Skip to content

refactor: only allow wrapped NonSurgeryInjections in Procedures.subject_procedures#1802

Merged
dbirman merged 6 commits intodevfrom
1801-injections-have-no-date-we-need-a-wrapper-class-in-procedures
Apr 23, 2026
Merged

refactor: only allow wrapped NonSurgeryInjections in Procedures.subject_procedures#1802
dbirman merged 6 commits intodevfrom
1801-injections-have-no-date-we-need-a-wrapper-class-in-procedures

Conversation

@dbirman
Copy link
Copy Markdown
Member

@dbirman dbirman commented Apr 16, 2026

This PR fixes an oversight we had in the Procedures.subject_procedures where we were allowing raw Injection objects. These don't have a start_date field since typically they show up inside a Surgery object. This PR creates a new wrapper NonSurgeryInjection that adds a required start_date, ethics_review_id, and notes.

Alternative
We could also remove Injection from the top-level and only allow Surgery objects, that would avoid adding a new wrapper class to the schema.

@dbirman dbirman linked an issue Apr 16, 2026 that may be closed by this pull request
@dbirman dbirman requested a review from saskiad April 16, 2026 18:15
Comment thread src/aind_data_schema/components/subject_procedures.py
Comment thread src/aind_data_schema/components/subject_procedures.py Outdated
Comment thread src/aind_data_schema/components/subject_procedures.py Outdated
Copy link
Copy Markdown
Collaborator

@saskiad saskiad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's discuss this one

@dbirman dbirman requested a review from saskiad April 22, 2026 22:09
@dbirman dbirman changed the title refactor: only allow InjectionProcedures in Procedures.subject_procedures refactor: only allow wrapped NonSurgeryInjections in Procedures.subject_procedures Apr 23, 2026
@dbirman dbirman added this pull request to the merge queue Apr 23, 2026
Merged via the queue into dev with commit ecf4b9e Apr 23, 2026
6 checks passed
@dbirman dbirman deleted the 1801-injections-have-no-date-we-need-a-wrapper-class-in-procedures branch April 23, 2026 00:53
dbirman added a commit that referenced this pull request May 6, 2026
* Allow specimen_id to be a list (#1770)

* Allow specimen_id to be a list

* Removed nonetype test

* Fixed specimen names in test

* Updated specimen_id description to clarify expectation during in-vivo sessions

* Spread args over multi lines to avoid lint fail

* docs: rebuild docs (#1771)

* docs: minor fixes to acquisition.md

* docs: remove bad directives and links

* docs: improve description for AcquisitionSubjectDetails (#1772)

* docs: improve description for AcquisitionSubjectDetails

* docs: rebuild docs

* fix: throw warnings when users include multiple identically named devices in the Instrument (#1773)

* fix: allow both planar and regular sectioning in sectioning procedures (#1777)

* fix: allow NHPSubject as subject_details option (#1778)

* docs: auto-build docs on opening PR (#1760)

* docs: auto-build docs on opening PR

* update docs [skip actions]

* docs: update contribution.md

* update docs [skip actions]

* chore: remove all unnecessary graphviz dependencies

* update docs [skip actions]

* update docs [skip actions]

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Handle lists of specimen IDs in procedures validator (#1783)

* Handle lists of specimen IDs in procedures validator

* Fix to properly handle individual str as well as lists of str

* refactor: simplifying code a tiny bit

---------

Co-authored-by: Dan Birman <danbirman@gmail.com>

* Add ticket linking workflow (#1785)

* Barseq blackbox acquisition (#1781)

* First pass at minimal blackbox acquisition. Has file that generates acquisition for two subjects, plus json outputs

* Added reference to output files

* Added specimen IDs to barseq acquisitions

* Removed readme file

* Updating examples/barseq_acquisition.py docstring

* Cleaned up comments in examples/barseq_acquisition.py

* Set timestamps to pacific with offset

* Changed experimenters to 'Barseq team'

* Removed references to local paths, removed duplicate jsons

* Added ExternalDataStream, made instrument optional, added test, updated example barseq

* Updated example json outputs for barseq subjects

* update docs [skip actions]

* Linting fixes

* Used DiscriminatedList

* Clean up stream adding logic

* Simplify barseq acquisition example

* Removed jsons

* clean up test and import properly

* Add ExternalDataStream support to Metadata validators and test that no instrument warning is raised for external acquisitions.

* Wording updates as suggested by Dan

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* 1792 quality control validator has a bug at line 307 where it fails to check metrics before doing metrics0 (#1793)

* fix: validator would trigger on empty metrics

* fix: do this upfront by bypassing the validator, adds a test

* chore: delete CHANGELOG.md (#1799)

* chore: delete CHANGELOG.md

* update docs [skip actions]

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* refactor: replace root calls to logging with module-level loggers (#1800)

* fix: issue with actions being skipped unnecessarily

* refactor: replace root logger with local loggers

* test: fixes to logger patches

* docs: improve docstring (#1748)

* docs: improve docstring

* docs: update specimen ID

* docs: clarify suffix

* docs: better writing

* update docs

* fix: bad merge

* update docs

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* refactor: only allow wrapped NonSurgeryInjections in Procedures.subject_procedures (#1802)

* refactor: only allow Injections in Procedures.subject_procedures when wrapped with an InjectionProcedure

* chore: add ethics_review_id/protocol_id

* fix: only allow Injection, BrainInjection requires a full CS from Surgery

* update docs [skip actions]

* refactor: NonSurgicalInjection

* update docs

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Add missing `tzdata` dependency (#1811)

* Add git hash to Code model (#1813)

* Add git hash to Code model

* update docs

* Increase hash length upper bound

* Change property name and emit warning if hash and version are not defined

* Refactor type alias

* update docs

* Break lines

* Update tests to reflect longer hashes

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* feat: add barseq instrument (#1685)

* feat: add barseq instrument

* refactor: SlapPlane -> Slap2Plane

* Revert "refactor: SlapPlane -> Slap2Plane"

This reverts commit 6f193b8.

* chore: lint

* refactor: fix serialization code in example

* fix: fix issues blocking build

* chore: fix write function for instrument example

* fix: specimen_ids validator correctly flattens lists (#1763)

* feat: working on procedures_sectioning example

* feat: continuing to develop chunk sections

* chore: embed slide regions in python code

* chore: lint

* chore: docstrings

* chore: lint

* chore: remove full sectioning file

---------

Co-authored-by: Doug Ollerenshaw <doug.ollerenshaw@alleninstitute.org>

* chore: bump version

* bump schema version [skip actions]

* chore: bump metadata

* bump schema version [skip actions]

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Doug Ollerenshaw <doug.ollerenshaw@alleninstitute.org>
Co-authored-by: gouwens <ngouwens@gmail.com>
Co-authored-by: Bruno Cruz <7049351+bruno-f-cruz@users.noreply.github.com>
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 this pull request may close these issues.

Injections have no date, we need a wrapper class in Procedures

2 participants