Add sameAs field to the Dandiset model`#364
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #364 +/- ##
==========================================
+ Coverage 97.89% 97.91% +0.01%
==========================================
Files 18 18
Lines 2379 2401 +22
==========================================
+ Hits 2329 2351 +22
Misses 50 50
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Defines a new sameAs field on the Dandiset model to represent DANDI URIs pointing to the same dandiset on other DANDI instances (per #358 / replaces #361).
Changes:
- Added
sameAs(optional list) to theDandisetmodel with JSON schema metadata. - Refactored existing publishing-metadata test to reuse a shared
base_dandiset_metadatafixture. - Added tests covering
sameAsbehavior for omitted/empty/valid/invalid inputs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
dandischema/models.py |
Adds the new sameAs field to the Dandiset schema. |
dandischema/tests/test_models.py |
Introduces a shared metadata fixture and adds coverage for sameAs validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
91e2e75 to
853efb6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
So that the metadata can be reused in different tests without modifications from a previous test
96d486c to
419313b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
yarikoptic
left a comment
There was a problem hiding this comment.
Looks good to me.
@satra -- wdyt about this sameAs approach where we for now reserve just ability to point to other dandi:// instances etc, but in principle could indeed then open to other URLs.
| json_schema_extra={"readOnly": True, "nskey": "schema"}, | ||
| ) | ||
|
|
||
| sameAs: Annotated[ |
There was a problem hiding this comment.
note: I thought we had merged
already... apparently not, so later we would need to add handling of sameAs as well there
|
and actually we can identify instances based on our detection in dandi-cli as well (not sure why first one did not return 'dandi' name BTW) so it doesn't have to be a |
|
actually more specifically -- that function: ❯ python -c 'from dandi.dandiarchive import parse_dandi_url; print(parse_dandi_url("dandi://dandi/001700"))'
DandisetURL(instance=DandiInstance(name='dandi', gui='https://dandiarchive.org', api='https://api.dandiarchive.org/api'), dandiset_id='001700', version_id=None)
❯ python -c 'from dandi.dandiarchive import parse_dandi_url; print(parse_dandi_url("https://dandiarchive.org/dandiset/001700"))'
DandisetURL(instance=DandiInstance(name='dandi', gui='https://dandiarchive.org', api='https://api.dandiarchive.org/api'), dandiset_id='001700', version_id=None)so we could point to any url dandi-cli understands and associate a |
| rf"^dandi://{UNVENDORED_ID_PATTERN}/\d{{6}}" | ||
| rf"(@(draft|{VERSION_NUM_PATTERN}))?(/\S+)?$" |
There was a problem hiding this comment.
the only comment i have is whether this should be a DANDI specific sameAs or anywhere. say someone puts the same dataset on zenodo, does that get to be added here? or in related resources?
There was a problem hiding this comment.
I would keep it constrained to just point to our instances, while coding tools defensively (could be anything), and indeed referring people to use related for extra resources. Although, we could potentially use sameAs to point to DataLad dandisets here... WDYT?
|
@satra lets proceed? |
…trings - SIMPLE_DOWNGRADES: "0.6.11" -> "0.7.0" (no 0.6.11 was ever released) - Add sameAs to downgrade fields (added on master via PR #364) - Include str in empty-value check so releaseNotes="" is treated as empty - Rewrite test to use DANDI_SCHEMA_VERSION and minimal metadata dict (0.6.11 was not in ALLOWED_INPUT_SCHEMAS, basic_publishmeta needed instance_name positional arg) - Add test coverage for sameAs downgrade (empty list, non-empty list) Co-Authored-By: Claude Code 2.1.63 / Claude Opus 4.6 <noreply@anthropic.com>
This PR closes #358 and replaces #361.
This PR defines the
sameAsfield in theDandisetmodel. It is a list of DANDI URLs of the Dandiset at other DANDI instances. It implements the solution proposed by #358 (comment).