From 492ca7bc22a9314960a2de10d7239922e610c2b0 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Wed, 15 Jan 2025 21:40:52 -0800 Subject: [PATCH 1/5] refactor: move ground wire information into its own procedures --- src/aind_data_schema/core/procedures.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/aind_data_schema/core/procedures.py b/src/aind_data_schema/core/procedures.py index 54f2c280e..9b8039334 100644 --- a/src/aind_data_schema/core/procedures.py +++ b/src/aind_data_schema/core/procedures.py @@ -361,18 +361,26 @@ class Headframe(DataModel): well_type: Optional[str] = Field(default=None, title="Well type") +class GroundWireImplant(DataModel): + """Ground wire implant procedure""" + + procedure_type: Literal["Ground wire implant"] = "Ground wire implant" + ground_electrode_location: MouseAnatomicalStructure.ONE_OF = Field(..., title="Location of ground electrode") + + ground_wire_hole: Optional[int] = Field(default=None, title="Ground wire hole") + ground_wire_material: Optional[GroundWireMaterial] = Field(default=None, title="Ground wire material") + ground_wire_diameter: Optional[Decimal] = Field(default=None, title="Ground wire diameter") + ground_wire_diameter_unit: Optional[SizeUnit] = Field(default=None, title="Ground wire diameter unit") + + class ProtectiveMaterialReplacement(DataModel): """Description of a protective material replacement procedure in preparation for ephys recording""" - procedure_type: Literal["Ground wire"] = "Ground wire" + procedure_type: Literal["Protective material"] = "Protective material" protocol_id: str = Field(..., title="Protocol ID", description="DOI for protocols.io") protective_material: ProtectiveMaterial = Field( ..., title="Protective material", description="New material being applied" ) - ground_wire_hole: Optional[int] = Field(default=None, title="Ground wire hole") - ground_wire_material: Optional[GroundWireMaterial] = Field(default=None, title="Ground wire material") - ground_wire_diameter: Optional[Decimal] = Field(default=None, title="Ground wire diameter") - ground_wire_diameter_unit: Optional[SizeUnit] = Field(default=None, title="Ground wire diameter unit") well_part_number: Optional[str] = Field(default=None, title="Well part number") well_type: Optional[str] = Field(default=None, title="Well type") From 39abb47a588b343e4681b06433e96d064a4c7947 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Wed, 15 Jan 2025 21:59:02 -0800 Subject: [PATCH 2/5] fix: removing ground_electrode_location from MyomatrixThread --- src/aind_data_schema/core/procedures.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aind_data_schema/core/procedures.py b/src/aind_data_schema/core/procedures.py index 9b8039334..72a32ec1b 100644 --- a/src/aind_data_schema/core/procedures.py +++ b/src/aind_data_schema/core/procedures.py @@ -631,7 +631,9 @@ class MyomatrixContact(DataModel): class MyomatrixThread(DataModel): """Description of a thread of a myomatrix array""" - ground_electrode_location: MouseAnatomicalStructure.BODY_PARTS = Field(..., title="Location of ground electrode") + ground_electrode: bool = Field( + ..., title="Connected to a ground electrode", description="Ground electrode implant is in a separate procedure" + ) contacts: List[MyomatrixContact] = Field(..., title="Contacts") From 1197acb2e7f4ba332c09d655bad1cbcb87054249 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Thu, 23 Jan 2025 14:19:51 -0800 Subject: [PATCH 3/5] refactor: add description for hole and embed in Myomatrix procedure --- src/aind_data_schema/core/procedures.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/aind_data_schema/core/procedures.py b/src/aind_data_schema/core/procedures.py index 72a32ec1b..11fe43727 100644 --- a/src/aind_data_schema/core/procedures.py +++ b/src/aind_data_schema/core/procedures.py @@ -367,7 +367,9 @@ class GroundWireImplant(DataModel): procedure_type: Literal["Ground wire implant"] = "Ground wire implant" ground_electrode_location: MouseAnatomicalStructure.ONE_OF = Field(..., title="Location of ground electrode") - ground_wire_hole: Optional[int] = Field(default=None, title="Ground wire hole") + ground_wire_hole: Optional[int] = Field( + default=None, title="Ground wire hole", description="For SHIELD implants, the hole number for the ground wire" + ) ground_wire_material: Optional[GroundWireMaterial] = Field(default=None, title="Ground wire material") ground_wire_diameter: Optional[Decimal] = Field(default=None, title="Ground wire diameter") ground_wire_diameter_unit: Optional[SizeUnit] = Field(default=None, title="Ground wire diameter unit") @@ -630,10 +632,6 @@ class MyomatrixContact(DataModel): class MyomatrixThread(DataModel): """Description of a thread of a myomatrix array""" - - ground_electrode: bool = Field( - ..., title="Connected to a ground electrode", description="Ground electrode implant is in a separate procedure" - ) contacts: List[MyomatrixContact] = Field(..., title="Contacts") @@ -641,6 +639,7 @@ class MyomatrixInsertion(DataModel): """Description of a Myomatrix array insertion for EMG""" procedure_type: Literal["Myomatrix_Insertion"] = "Myomatrix_Insertion" + ground_electrode: GroundWireImplant = Field(..., title="Ground electrode") protocol_id: str = Field(..., title="Protocol ID", description="DOI for protocols.io") myomatrix_array: MyomatrixArray = Field(..., title="Myomatrix array") threads: List[MyomatrixThread] = Field(..., title="Array threads") From c6546989780017a175a4b2b5edff989060d5e81e Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Thu, 23 Jan 2025 14:20:36 -0800 Subject: [PATCH 4/5] feat: deprecate ProtectiveMaterialReplacement --- src/aind_data_schema/core/procedures.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/aind_data_schema/core/procedures.py b/src/aind_data_schema/core/procedures.py index 11fe43727..ffec6784a 100644 --- a/src/aind_data_schema/core/procedures.py +++ b/src/aind_data_schema/core/procedures.py @@ -375,18 +375,6 @@ class GroundWireImplant(DataModel): ground_wire_diameter_unit: Optional[SizeUnit] = Field(default=None, title="Ground wire diameter unit") -class ProtectiveMaterialReplacement(DataModel): - """Description of a protective material replacement procedure in preparation for ephys recording""" - - procedure_type: Literal["Protective material"] = "Protective material" - protocol_id: str = Field(..., title="Protocol ID", description="DOI for protocols.io") - protective_material: ProtectiveMaterial = Field( - ..., title="Protective material", description="New material being applied" - ) - well_part_number: Optional[str] = Field(default=None, title="Well part number") - well_type: Optional[str] = Field(default=None, title="Well type") - - class TarsVirusIdentifiers(DataModel): """TARS data for a viral prep""" From 43e27d1bae01c3140306f25d1a51d9c660478e4e Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Thu, 23 Jan 2025 14:21:24 -0800 Subject: [PATCH 5/5] chore: remove reference to deprecated procedure --- src/aind_data_schema/core/procedures.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/aind_data_schema/core/procedures.py b/src/aind_data_schema/core/procedures.py index ffec6784a..6c6a7717f 100644 --- a/src/aind_data_schema/core/procedures.py +++ b/src/aind_data_schema/core/procedures.py @@ -686,7 +686,6 @@ class Surgery(DataModel): NanojectInjection, OtherSubjectProcedure, Perfusion, - ProtectiveMaterialReplacement, RetroOrbitalInjection, SampleCollection, ],