-
Notifications
You must be signed in to change notification settings - Fork 1
Enable copying an existing species' taxonomy when creating new species, and add a taxonomy check #834
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
base: main
Are you sure you want to change the base?
Conversation
…dd duplicate check for species
…so added trim option to EditableTextField
…an be incertae sedis which has a space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables copying an existing species’ taxonomy when creating a new species and adds a client‐side taxonomy consistency check before saving. Key changes include validator enhancements, new taxonomy utilities, UI updates to the taxonomy tab, integration of the taxonomy check in the save flow, and extensive test updates.
- Added
checkTaxonomy
andconvertTaxonomyFields
to enforce and normalize taxonomy data. - Updated
WriteButton
andDetailView
to run taxonomy validation before write. - Enhanced
TaxonomyTab
with a “Copy existing taxonomy” button and trimming options in text fields. - Expanded E2E tests to cover taxonomy rules and trimming behavior.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
shared/validators/species.ts | Added species‐level validation rules for genus, species, order, family, and unique identifier. |
redux/speciesReducer.ts | Exported useLazyGetAllSpeciesQuery for taxonomy checks. |
components/Species/taxonomyFunctions.tsx | Introduced checkTaxonomy and convertTaxonomyFields . |
components/Species/Tabs/TaxonomyTab.tsx | Added copy button, trimming options, and updated classification layout. |
components/Species/SpeciesDetails.tsx | Passed new taxonomy prop to DetailView . |
components/Notification.tsx | Allowed multi‐line alert messages with whiteSpace: 'pre-line' . |
components/DetailView/common/editingComponents.tsx | Added trim option and onBlur trimming to EditableTextField . |
components/DetailView/common/SelectingTable.tsx | Added buttonTooltip prop; adjusted modal invocation. |
components/DetailView/common/EditingModal.tsx | Wrapped modal button in tooltip when provided. |
components/DetailView/components.tsx | Integrated taxonomy flag and utilities into save button logic. |
frontend/src/common.tsx | Defined smallSpeciesTableColumns for species selection. |
documentation/.../EditableTextField.md | Documented new trim option. |
cypress/e2e/species.cy.js | Extended tests for copying taxonomy and validation rules. |
Comments suppressed due to low confidence (3)
frontend/src/shared/validators/species.ts:4
- The function name
isEmptyUniqIdentifier
uses an inconsistent abbreviation (Uniq
). Rename toisEmptyUniqueIdentifier
for clarity and consistency.
const isEmptyUniqIdentifier = (unique_identifier: string) => {
frontend/src/common.tsx:144
- [nitpick] Header text capitalization is inconsistent (
'Taxon status'
). Consider changing to'Taxon Status'
or'Taxonomic Status'
to match title‐case style used elsewhere.
header: 'Taxon status',
frontend/src/components/DetailView/common/SelectingTable.tsx:72
- You’ve added
buttonTooltip
, but thedataCy
prop is no longer forwarded toEditingModal
, potentially breaking test selectors. PassdataCy
through to maintain thedata-cy
attribute on the button.
<EditingModal buttonText={buttonText} buttonTooltip={buttonTooltip}>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Select an existing species as the source to copy taxonomy from.
- there is +New button on the selection list which in this case is odd
- after selecting the species by pressing the + button, the window could be closed right away instead of pressing the Close button.
- I could create duplicates for Canis aureus, Canis lupus, Alopex lagopus for the first time, but not for the second time.
- the species should always be lower case, genus and others lower case with capital first letter (but see next)
- lower case: fam., gen., sp., indet., incertae sedis
- dot at the end: fam->fam., gen->gen., sp->sp., indet->indet.
- incertaesedis->incertae sedis
- NEW: while creating a new taxon, check also the existing synonyms for duplicates (Rhinoceros mercki is a synonym of Stephanorhinus kirchbergensis)
Create a new entry and set the Order or Family field to “Incertae sedis”
System should allow this entry, even if taxonomic parent fields are missing or unconstrained
- try adding genus New into Carnivora and set Family field to “Incertae sedis”
- I get Family Incertae sedis belongs to order Sparassodonta, not Carnivora.
NEW: Try to enter a new species (e.g., Crocuta yangula which is imagenary taxon), where the same subspecies name already exists as a species-level entry in the same genus (e.g., Crocuta crocuta yangula)
System should warn or block the entry, highlighting the duplicate at the species level in the same genus.
- I could add Crocuta yangula but did not enter it
… button from tables that do not need it
Thank you!
The other things you mentioned are still a work in progress. |
…tabase into copy-species-taxonomy
…tabase into copy-species-taxonomy
Indet without a dot has the taxonomy check. Indet should be --> indet. Copy species data from Eucladoceros/megaloceros giullii/savinii. The system allows saving a duplicate after the "informal species" is selected. |
|
When I edit a species that belongs to the family Nyanzapithecidae, I receive an error: "Family Nyanzapithecidae belongs to suborder Euprimates, not Hominoidea." If I edit the suborder to "Euprimates", I get an error "Family Nyanzapithecidae belongs to suborder Hominoidea, not Euprimates." This must be due to the database contents, which include Nyanzapithecidae that belong to both suborders, Euprimates and Hominoidea. This could be informed to the user with a message "This taxon has several entries for suborder [or order, family,...]: item1, item2" followed by |
The taxonomy check now notifies the user if the database contains multiple different parent values for the taxonomy field they are editing, and does not let them edit the entry. There are no tests for this at the moment, and the "continue with edit" button needs to be implemented later, possibly in another PR. |
Made another PR since I accidentally did some git magic with the previous one (#759).