Repository navigation
Give SexType/SpeciesType built from IRIs a name; allow dandischema 0.15.x - #1949
Open
yarikoptic-gitmate wants to merge 3 commits into
Open
yarikoptic-gitmate wants to merge 3 commits into
yarikoptic-gitmate wants to merge 3 commits into
Conversation
dandi/dandi-schema#444 makes `name` required for `BaseType` subclasses (and `Contributor`). Two code paths here could produce nameless records, which would no longer validate: - `extract_sex` with a sex given as an IRI produced `SexType(identifier=<iri>, name=None)`. It now maps the two PATO IRIs this function itself emits back to "Male"/"Female", and otherwise uses the IRI itself as the name. It also no longer lowercases the IRI (`PATO_0000384` became `pato_0000384`). - `extract_species` for an NCBITaxon IRI not in `species_map` produced `SpeciesType(name=None)` when the ontology lookup failed or found no label. It now falls back to the IRI itself as the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NdN9xPzPo1AzsnEMuU8UQs
So that the release with dandi/dandi-schema#444 (required `name` for `Contributor` and `BaseType`, schema 0.8.1) can be installed; dandischema keeps 0.8.0 as an allowed migration target, so downgrades for older Archive servers keep working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NdN9xPzPo1AzsnEMuU8UQs
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1949 +/- ##
==========================================
+ Coverage 90.77% 90.93% +0.16%
==========================================
Files 92 92
Lines 14130 14149 +19
==========================================
+ Hits 12826 12867 +41
+ Misses 1304 1282 -22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepares dandi-cli for dandi/dandi-schema#444. That PR makes
namerequired (and non-empty) forContributorand for everyBaseTypesubclass (SexType,SpeciesType, …), with schema version 0.8.1.Changes
extract_sex(dandi/metadata/util.py)subject.sexis an IRI, this producedSexType(identifier=<iri>, name=None), which would no longer validate (as noted in the review of #444).http://purl.obolibrary.org/obo/PATO_0000384used to become.../pato_0000384.extract_speciesspecies_map, the name came from an ontology lookup and wasNonewhen the lookup failed (ConnectionError) or found no label.Pin:
dandischema < 0.15.0→< 0.16.0, so that the release carrying #444 can be installed.migrate()target, so the downgrades this client relies on for older Archive servers still work.Tests
@pytest.mark.ai_generated):test_extract_sex: letter codes, the PATO IRIs, and an unknown IRI.test_species_unknown_iri_lookup_fails: the ontology lookup is monkeypatched to raiseConnectionError.dandi/tests/test_metadata.pypasses against dandischema from Simplify release workflow #444's head (166 passed, 1 skipped) and against current dandischemamaster(-k "sex or species": 46 passed).Related: dandi/dandi-schema#442, dandi/dandi-schema#444.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NdN9xPzPo1AzsnEMuU8UQs
Generated by Claude Code