Skip to content

Commit

Permalink
inj vol and depth as lists (#156)
Browse files Browse the repository at this point in the history
* inj vol and depth as lists

* removes print statement
  • Loading branch information
mekhlakapoor authored Nov 29, 2023
1 parent e8d5ae8 commit 048c1b9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 28 deletions.
40 changes: 24 additions & 16 deletions src/aind_metadata_service/sharepoint/nsb2019/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ def aind_date_range_start(self) -> Optional[datetime]:
return self._nsb.date_range_start

@property
def aind_dv2nd_inj(self) -> Optional[float]:
def aind_dv2nd_inj(self) -> Optional[List[float]]:
"""Maps dv2nd_inj to aind model"""
return self._parse_dv_str(self._nsb.dv2nd_inj)
dv = self._parse_dv_str(self._nsb.dv2nd_inj)
return None if dv is None else [dv]

@property
def aind_editor_id(self) -> Optional[int]:
Expand All @@ -334,19 +335,21 @@ def aind_fiber_implant1(self) -> Optional[bool]:
return self._nsb.fiber_implant1

@property
def aind_fiber_implant1_dv(self) -> Optional[float]:
def aind_fiber_implant1_dv(self) -> Optional[List[float]]:
"""Maps fiber_implant1_dv to aind model"""
return self._parse_dv_str(self._nsb.fiber_implant1_dv)
dv = self._parse_dv_str(self._nsb.fiber_implant1_dv)
return None if dv is None else [dv]

@property
def aind_fiber_implant2(self) -> Optional[bool]:
"""Maps fiber_implant2 to aind model"""
return self._nsb.fiber_implant2

@property
def aind_fiber_implant2_dv(self) -> Optional[float]:
def aind_fiber_implant2_dv(self) -> Optional[List[float]]:
"""Maps fiber_implant2_dv to aind model"""
return self._parse_dv_str(self._nsb.fiber_implant2_dv)
dv = self._parse_dv_str(self._nsb.fiber_implant2_dv)
return None if dv is None else [dv]

@property
def aind_field30(self) -> Optional[str]:
Expand Down Expand Up @@ -713,9 +716,10 @@ def aind_inj1_virus_strain_rt(self) -> Optional[str]:
return self._parse_virus_strain_str(self._nsb.inj1_virus_strain_rt)

@property
def aind_inj1_vol(self) -> Optional[str]:
def aind_inj1_vol(self) -> Optional[List[float]]:
"""Maps inj1_vol to aind model"""
return self._parse_inj_vol_str(self._nsb.inj1_vol)
vol = self._parse_inj_vol_str(self._nsb.inj1_vol)
return None if vol is None else [vol]

@property
def aind_inj1angle0(self) -> Optional[float]:
Expand All @@ -735,9 +739,10 @@ def aind_inj1angle0(self) -> Optional[float]:
)

@property
def aind_inj1volperdepth(self) -> Optional[float]:
def aind_inj1volperdepth(self) -> Optional[List[float]]:
"""Maps inj1volperdepth to aind model"""
return self._parse_inj_vol_str(self._nsb.inj1volperdepth)
volperdepth = self._parse_inj_vol_str(self._nsb.inj1volperdepth)
return None if volperdepth is None else [volperdepth]

@property
def aind_inj2_alternating_time(self) -> Optional[float]:
Expand Down Expand Up @@ -797,9 +802,10 @@ def aind_inj2_virus_strain_rt(self) -> Optional[str]:
return self._parse_virus_strain_str(self._nsb.inj2_virus_strain_rt)

@property
def aind_inj2_vol(self) -> Optional[float]:
def aind_inj2_vol(self) -> Optional[List[float]]:
"""Maps inj2_vol to aind model"""
return self._parse_inj_vol_str(self._nsb.inj2_vol)
vol = self._parse_inj_vol_str(self._nsb.inj2_vol)
return None if vol is None else [vol]

@property
def aind_inj2angle0(self) -> Optional[float]:
Expand All @@ -819,9 +825,10 @@ def aind_inj2angle0(self) -> Optional[float]:
)

@property
def aind_inj2volperdepth(self) -> Optional[float]:
def aind_inj2volperdepth(self) -> Optional[List[float]]:
"""Maps inj2volperdepth to aind model"""
return self._parse_inj_vol_str(self._nsb.inj2volperdepth)
volperdepth = self._parse_inj_vol_str(self._nsb.inj2volperdepth)
return None if volperdepth is None else [volperdepth]

@property
def aind_ionto_number_hpinj(self) -> Optional[str]:
Expand Down Expand Up @@ -1201,9 +1208,10 @@ def aind_virus_a_p(self) -> Optional[float]:
return self._parse_ap_str(self._nsb.virus_a_p)

@property
def aind_virus_d_v(self) -> Optional[float]:
def aind_virus_d_v(self) -> Optional[List[float]]:
"""Maps virus_d_v to aind model"""
return self._parse_dv_str(self._nsb.virus_d_v)
dv = self._parse_dv_str(self._nsb.virus_d_v)
return None if dv is None else [dv]

@property
def aind_virus_hemisphere(self) -> Optional[Side]:
Expand Down
8 changes: 4 additions & 4 deletions tests/resources/json_responses/combined.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"workstation_id": null,
"instrument_id": null,
"procedure_type": "Retro-orbital injection",
"injection_volume": 1.0,
"injection_volume": [1.0],
"injection_volume_unit": "microliter",
"injection_eye": "Left"
},
Expand Down Expand Up @@ -76,7 +76,7 @@
"instrument_id": null,
"injection_coordinate_ml": 1.0,
"injection_coordinate_ap": 1.0,
"injection_coordinate_depth": 1.0,
"injection_coordinate_depth": [1.0],
"injection_coordinate_unit": "millimeter",
"injection_coordinate_reference": "Bregma",
"bregma_to_lambda_distance": 4.1,
Expand All @@ -86,7 +86,7 @@
"targeted_structure": "VISp6",
"injection_hemisphere": null,
"procedure_type": "Nanoject injection",
"injection_volume": 1.0,
"injection_volume": [1.0],
"injection_volume_unit": "nanoliter"
},
{
Expand All @@ -113,7 +113,7 @@
"targeted_structure": "MOp",
"stereotactic_coordinate_ap": 1.0,
"stereotactic_coordinate_ml": 3.0,
"stereotactic_coordinate_dv": 2.0,
"stereotactic_coordinate_dv": [2.0],
"stereotactic_coordinate_unit": "millimeter",
"stereotactic_coordinate_reference": "Bregma",
"bregma_to_lambda_distance": 4.1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"ferrule_material": null,
"stereotactic_coordinate_ap": -1.6,
"stereotactic_coordinate_ml": -3.3,
"stereotactic_coordinate_dv": 4.2,
"stereotactic_coordinate_dv": [4.2],
"stereotactic_coordinate_unit": "millimeter",
"stereotactic_coordinate_reference": null,
"bregma_to_lambda_distance": 4.0,
Expand All @@ -32,7 +32,7 @@
"ferrule_material": null,
"stereotactic_coordinate_ap": -3.05,
"stereotactic_coordinate_ml": -0.6,
"stereotactic_coordinate_dv": 4.2,
"stereotactic_coordinate_dv": [4.2],
"stereotactic_coordinate_unit": "millimeter",
"stereotactic_coordinate_reference": null,
"bregma_to_lambda_distance": 4.0,
Expand Down Expand Up @@ -155,7 +155,7 @@
"instrument_id": null,
"injection_coordinate_ml": -0.6,
"injection_coordinate_ap": -3.05,
"injection_coordinate_depth": 4.3,
"injection_coordinate_depth": [4.3],
"injection_coordinate_unit": "millimeter",
"injection_coordinate_reference": null,
"bregma_to_lambda_distance": 4.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"ferrule_material": null,
"stereotactic_coordinate_ap": -1.6,
"stereotactic_coordinate_ml": -3.3,
"stereotactic_coordinate_dv": 4.2,
"stereotactic_coordinate_dv": [4.2],
"stereotactic_coordinate_unit": "millimeter",
"stereotactic_coordinate_reference": null,
"bregma_to_lambda_distance": 4.0,
Expand All @@ -32,7 +32,7 @@
"ferrule_material": null,
"stereotactic_coordinate_ap": -3.05,
"stereotactic_coordinate_ml": -0.6,
"stereotactic_coordinate_dv": 4.2,
"stereotactic_coordinate_dv": [4.2],
"stereotactic_coordinate_unit": "millimeter",
"stereotactic_coordinate_reference": null,
"bregma_to_lambda_distance": 4.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"ferrule_material": null,
"stereotactic_coordinate_ap": -1.6,
"stereotactic_coordinate_ml": -3.3,
"stereotactic_coordinate_dv": 4.2,
"stereotactic_coordinate_dv": [4.2],
"stereotactic_coordinate_unit": "millimeter",
"stereotactic_coordinate_reference": null,
"bregma_to_lambda_distance": 4.0,
Expand All @@ -32,7 +32,7 @@
"ferrule_material": null,
"stereotactic_coordinate_ap": -3.05,
"stereotactic_coordinate_ml": -0.6,
"stereotactic_coordinate_dv": 4.2,
"stereotactic_coordinate_dv": [4.2],
"stereotactic_coordinate_unit": "millimeter",
"stereotactic_coordinate_reference": null,
"bregma_to_lambda_distance": 4.0,
Expand Down Expand Up @@ -156,7 +156,7 @@
"instrument_id": null,
"injection_coordinate_ml": -0.6,
"injection_coordinate_ap": -3.05,
"injection_coordinate_depth": 4.3,
"injection_coordinate_depth": [4.3],
"injection_coordinate_unit": "millimeter",
"injection_coordinate_reference": null,
"bregma_to_lambda_distance": 4.0,
Expand Down

0 comments on commit 048c1b9

Please sign in to comment.