[FIX] sync curation extraction#1248
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for tracking curation stub UUIDs on studyset-study associations, enabling better synchronization between curation and extraction workflows. The changes allow the system to maintain a stable mapping between curated stubs and their corresponding study versions, even when studies are updated or re-ingested.
Key changes:
- Added
curation_stub_uuidcolumn to thestudyset_studiesassociation table with appropriate indexing and uniqueness constraints - Updated schema serialization/deserialization to handle stub UUID mappings in studyset payloads
- Modified frontend helper functions to preserve stub-to-study mappings when syncing curation data to extraction studysets
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| store/backend/neurostore/models/data.py | Adds curation_stub_uuid column to StudysetStudy model with relationship configurations |
| store/backend/migrations/versions/8e3f3d8a9b5b_add_curation_stub_uuid.py | Database migration to add the new column, index, and unique constraint |
| store/backend/neurostore/schemas/data.py | Updates schema serialization to capture and normalize stub UUID mappings |
| store/backend/neurostore/resources/data.py | Implements logic to update stub mappings when creating/updating studysets |
| store/backend/neurostore/resources/base.py | Refines permission checks for nested record updates |
| store/backend/neurostore/tests/api/test_studysets.py | Adds test coverage for stub UUID capture and persistence |
| store/scripts/backfill_curation_stub_uuid.py | Provides a backfill script for existing data |
| compose/neurosynth-frontend/src/helpers/Extraction.helpers.tsx | Adds mapStubsToStudysetPayload function to maintain stub-to-study mappings |
| compose/neurosynth-frontend/src/helpers/Extraction.helpers.spec.ts | Unit tests for the new helper function |
| compose/neurosynth-frontend/src/pages/Project/components/MoveToExtractionDialog.tsx | Updates to use new stub mapping helper |
| compose/neurosynth-frontend/src/pages/Extraction/components/ExtractionOutOfSync.tsx | Updates sync logic to preserve stub mappings |
| cypress/e2e/workflows/ingestion/Ingestion.cy.tsx | Minor test fixture path corrections |
|
dependent on: |
There was a problem hiding this comment.
Pushed minor changes removing an unused function argument.
Overall it looks good and it works on my end.
We just need to merge in and rebuild the typescript SDKs to add the curation_stub_map property in the studyset update object
I tested:
- creating and then ingesting two stubs without doi/pmid/pmcid creates two separate studies/base studies. Previous annotations are retained.
- creating and then ingesting two stubs with the same doi/pmid/pmcid creates two separate studies/base studies. Previous annotations are retained.
|
looking at the implementation, I do not want curation_stub_map to be a part of the public api, just adds more opportunities for there being 2 sources of truth. |
| const queryClient = useQueryClient(); | ||
| return useMutation<AxiosResponse<StudysetReturn>, AxiosError, StudysetRequest, unknown>( | ||
| (studyset) => API.NeurostoreServices.StudySetsService.studysetsPost(studyset), | ||
| (studyset) => API.NeurostoreServices.StudySetsService.studysetsPost(undefined, undefined, undefined, studyset), |
There was a problem hiding this comment.
Three undefined parameters suggest the API signature may have changed. Consider using named parameters or an options object to make the call site more maintainable and less error-prone.
| (studyset) => API.NeurostoreServices.StudySetsService.studysetsPost(undefined, undefined, undefined, studyset), | |
| (studyset) => API.NeurostoreServices.StudySetsService.studysetsPost({ studyset }), |
|
I'll merge this by EOD! |
no worries! i was actually wondering why we had the two sources of truth ( |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
e9a5cdc to
a4a063c
Compare
closes #1247
honestly a long standing issue that nick has brought up before, this make the alignment between stubs and studies within studysets direct so people do not lose their annotations (and sometimes analyses) when they update their meta-analyses. (updating meta-analyses is something we want to support, if we want to do "living meta-analyses").