Skip to content

Commit

Permalink
feat: implant part mapping (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
mekhlakapoor authored Apr 4, 2024
1 parent 8b085f3 commit 149ced3
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/aind_metadata_service/sharepoint/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ def _merge_two_responses(
)
else:
left_procedures: List[Procedures] = left_model_response.aind_models
right_procedures: List[Procedures] = (
right_model_response.aind_models
)
right_procedures: List[
Procedures
] = right_model_response.aind_models
procedures = self._merge_procedures(
left_procedures=left_procedures,
right_procedures=right_procedures,
Expand Down
26 changes: 3 additions & 23 deletions src/aind_metadata_service/sharepoint/nsb2023/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -1983,29 +1983,7 @@ def aind_implant_id_coverslip_type(self) -> Optional[Any]:
return (
None
if self._nsb.implant_id_coverslip_type is None
else {
self._nsb.implant_id_coverslip_type.SELECT: None,
self._nsb.implant_id_coverslip_type.N_2001: None,
self._nsb.implant_id_coverslip_type.N_2002: None,
self._nsb.implant_id_coverslip_type.N_2004: None,
self._nsb.implant_id_coverslip_type.N_2005: None,
self._nsb.implant_id_coverslip_type.N_2006: None,
self._nsb.implant_id_coverslip_type.N_2007: None,
self._nsb.implant_id_coverslip_type.N_2008: None,
self._nsb.implant_id_coverslip_type.N_2009: None,
self._nsb.implant_id_coverslip_type.N_2010: None,
self._nsb.implant_id_coverslip_type.N_2011: None,
self._nsb.implant_id_coverslip_type.N_3001: None,
self._nsb.implant_id_coverslip_type.N_3002: None,
self._nsb.implant_id_coverslip_type.N_3003: None,
self._nsb.implant_id_coverslip_type.N_3004: None,
self._nsb.implant_id_coverslip_type.N_3004_25_PURALUBESYSTANE: None,
self._nsb.implant_id_coverslip_type.N_3005: None,
self._nsb.implant_id_coverslip_type.WHC_2_P_CURVED_GLASS_WITH: None,
self._nsb.implant_id_coverslip_type.N_3MM_STACKED_COVERSLIP: None,
self._nsb.implant_id_coverslip_type.N_5MM_STACKED_COVERSLIP: None,
self._nsb.implant_id_coverslip_type.N_5MM_STACKED_COVERSLIP_W: None,
}.get(self._nsb.implant_id_coverslip_type, None)
else self._nsb.implant_id_coverslip_type
)

@property
Expand Down Expand Up @@ -3627,6 +3605,7 @@ def get_procedure(self) -> List[Surgery]:
cran_during = self.aind_craniotomy_perform_d
cran_during_info = self.surgery_during_info(cran_during)
bregma_to_lambda_distance = self.aind_breg2_lamb
implant_part_number = self.aind_implant_id_coverslip_type
if craniotomy_type == CraniotomyType.FIVE_MM:
craniotomy_coordinates_reference = (
CoordinateReferenceLocation.LAMBDA
Expand All @@ -3647,6 +3626,7 @@ def get_procedure(self) -> List[Surgery]:
craniotomy_coordinates_reference=(
craniotomy_coordinates_reference
),
implant_part_number=implant_part_number,
)
headpost_info = HeadPostInfo.from_hp_and_hp_type(
hp=self.aind_headpost, hp_type=self.aind_headpost_type
Expand Down
8 changes: 4 additions & 4 deletions src/aind_metadata_service/smartsheet/protocols/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def _get_protocol_list(
"""
rows_associated_with_protocol_name: List[ProtocolInformation] = []
for row in self.model.rows:
opt_protocol: Optional[ProtocolInformation] = (
self._map_row_to_protocol(
row=row, input_protocol_name=protocol_name
)
opt_protocol: Optional[
ProtocolInformation
] = self._map_row_to_protocol(
row=row, input_protocol_name=protocol_name
)
if opt_protocol is not None:
rows_associated_with_protocol_name.append(opt_protocol)
Expand Down
6 changes: 3 additions & 3 deletions src/aind_metadata_service/tars/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ def integrate_injection_materials(
new_material.titer = (
injection_material.titer
)
procedure.injection_materials[idx] = (
new_material
)
procedure.injection_materials[
idx
] = new_material
elif (
tars_response.status_code
== StatusCodes.NO_DATA_FOUND.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"craniotomy_coordinates_unit": "millimeter",
"bregma_to_lambda_unit": "millimeter",
"craniotomy_size_unit": "millimeter",
"implant_part_number": null,
"implant_part_number": "3mm stacked coverslip",
"dura_removed": null,
"protective_material": null,
"recovery_time_unit": "minute"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"craniotomy_coordinates_unit": "millimeter",
"bregma_to_lambda_unit": "millimeter",
"craniotomy_size_unit": "millimeter",
"implant_part_number": null,
"implant_part_number": "2006",
"dura_removed": null,
"protective_material": null,
"recovery_time_unit": "minute"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"craniotomy_coordinates_unit": "millimeter",
"bregma_to_lambda_unit": "millimeter",
"craniotomy_size_unit": "millimeter",
"implant_part_number": null,
"implant_part_number": "5mm stacked coverslip",
"dura_removed": null,
"protective_material": null,
"recovery_time_unit": "minute"
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/sharepoint/nsb2023/raw/list_item22.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"Headpost": "Visual Ctx",
"HeadpostType": "Mesoscope",
"CraniotomyType": "5mm",
"ImplantIDCoverslipType": "5mm stacked coverslip",
"ImplantIDCoverslipType": "2006",
"Burr_x0020_hole_x0020_1": null,
"Inj1VirusStrain_rt": "Select...",
"Burr1_x0020_Virus_x0020_Biosafte": null,
Expand Down

0 comments on commit 149ced3

Please sign in to comment.