Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indistinct search_names #2712

Open
29 of 30 tasks
JoeCohen opened this issue Feb 10, 2025 · 3 comments · May be fixed by #2714
Open
29 of 30 tasks

Indistinct search_names #2712

JoeCohen opened this issue Feb 10, 2025 · 3 comments · May be fixed by #2714
Assignees

Comments

@JoeCohen
Copy link
Member

JoeCohen commented Feb 10, 2025

  1. Prevent creating a Name (or editing a Name to create) a search_name which is the identical to, or only trivially different from, an existing search_name. I.e., different at most only in: diacritical, punctuation, case.
  2. Possibly move some existing validators from app/models/name.rb to app/models/name/validation.rb.
  3. Fix (merge) existing examples in the live db.

Tasks

  • Validator preventing saving of indistinct Names
  • search_names for all fixtures, fixing any Failures
  • validate presence of search_name
  • fix any errors caused by above presence validators
  • remove temporary hack which ignored blank search_name
  • Fix any test issues caused by above removal.
  • review Rails Active Record Validations Guide
  • Can I move existing existing validators from app/models/name.rb to app/models/name/validation.rb.?
  • Make sure error message/flash are correct
  • Improve author ending test. See Comment below
  • add author content test: only alphabetical (including diacriticals), comma, period, open/close parens, ampersand
  • More author ending tests
  • Fix author ending message
  • Fix this: https://github.com/MushroomObserver/mushroom-observer/actions/runs/13315844899/job/37189513589
  • See if I can simplify form of existing Name validators
  • Improve Name create form instructions
    • omit author of protocol
    • omit publication
    • omit "in"
  • Make sure new validators prevent API from saving bad Names
  • Can I DRY API?
  • Deep Rubocop
  • Add suggested manual tests to PR
  • PR ready for review
  • Add questions/notes:
    • full author can include [];
    • advantage of doing validations in model;
    • translated message.
  • Request review
  • Optional: Fix (merge) existing examples in the live db.

See 2025-02-09 Slack message:

Kuhner vs. Kühner is real. (Not just a movie with Meryl Strœp.)
As of yesterday’s db backup, there were 6 homonyms whose search_name had an exact or near miss.
Lepiota rhacodioides - exact duplicates
Cortinarius amigochrous - Kuhner vs. Kühner
Entoloma prismatospermum - trailing comma
Lactarius subvernalis - trailing comma
Macrolepiota bonaerensis - trailing comma
Melanoleuca phaeopodia - trailing comma
I suggest:
Add validator(s) which prevent creating a Name (or editing a Name to create) exact matches or near misses for search_name.
After deploy, merge the listed homonyms
I think the validators should be before_save validators, rather than in #create or #edit. Else the API could create a bad Name. (This would also let us dry the API a bit.)
There also might be some validators in name.rb which could be moved to app/models/name/validation.rb.

@JoeCohen JoeCohen changed the title Trivially different search_names Indistinct search_names Feb 10, 2025
@JoeCohen JoeCohen self-assigned this Feb 10, 2025
@nimmolo
Copy link
Contributor

nimmolo commented Feb 10, 2025

I don't feel qualified to comment on anything nomenclature-related, but this feels right to me.

@mo-nathan
Copy link
Member

Thanks for doing all this work! Sounds reasonable to me. The trailing comma case is interesting. In my view, authors should only end in a letter or a period. There are a bunch of other cases of trailing commas as well as a few random ")"s, years, and alt spellings in square brackets. These just seem to create more chances for duplicates.

@JoeCohen
Copy link
Member Author

@mo-nathan: Thanks for the encouragement and the comment.

  • Re "doing all this work". I haven't done (or at least pushed) anything yet. The author ending stuff is old.
  • Looks like this approach leads into a rabbit hole. I don't know if it's high-enough priority to dig into.
    • I wrote a validator (and a test), but rails t gets 82 failures, 3 errors.
    • Off the top of my head, my guess is that the cause is incomplete fixtures (without search_name) and tests which save Names which are incomplete or otherwise problematic.
    • I will investigate further.
  • I agree with your comments about author ending. I'll have to clean up the db. (This stuff is the result of careless pasting from IF/MB.)

@JoeCohen JoeCohen linked a pull request Feb 11, 2025 that will close this issue
@JoeCohen JoeCohen linked a pull request Feb 11, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants