Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def _get_reagent_data(
) in [
"Reagents, Externally Manufactured",
"Reagents, Internally Produced",
"Reagents, Internal",
"Reagents, External",
]:
n_reagent_lot_number = self.get_attr_or_none(
record, "cntn_cf_lotNumber"
)
n_reagent_name = self.get_attr_or_none(
record, "cntn_cf_fk_catalogNumberReagents", "displayValue"
)
n_reagent_name = self.get_attr_or_none(record, "cntn_barCode")
n_reagent_source = self.get_attr_or_none(
record, "cntn_fk_source", "displayValue"
)
Expand Down Expand Up @@ -167,6 +167,7 @@ def _parse_graph(

histology_data_list = []
for node in root_nodes:
subject_and_specimen_ids = []
histology_data = SlimsHistologyData()
washes = []
experiment_run_created_on_ts = self.get_attr_or_none(
Expand Down Expand Up @@ -197,6 +198,7 @@ def _parse_graph(
"Wash 3",
"Wash 4",
"Refractive Index Matching Wash",
"Refractive Index Matching Wash 2",
"Primary Antibody Wash",
"Secondary Antibody Wash",
"MBS Wash",
Expand Down Expand Up @@ -226,13 +228,22 @@ def _parse_graph(
n_subject_id, n_specimen_id = self._get_specimen_data(
g=g, exp_run_step_content=exp_run_step_child
)
if n_subject_id is not None:
histology_data.subject_id = n_subject_id
if n_specimen_id is not None:
histology_data.specimen_id = n_specimen_id
subject_and_specimen_ids.append(
(n_subject_id, n_specimen_id)
)
histology_data.washes = washes
if subject_id is None or subject_id == histology_data.subject_id:
histology_data_list.append(histology_data)
for n_ids in subject_and_specimen_ids:
n_subject_id = n_ids[0]
n_specimen_id = n_ids[1]
if subject_id is None or subject_id == n_subject_id:
subject_histology_data = histology_data.model_copy(
deep=True,
update={
"subject_id": n_subject_id,
"specimen_id": n_specimen_id,
},
)
histology_data_list.append(subject_histology_data)
return histology_data_list

def _get_graph(
Expand Down
26 changes: 18 additions & 8 deletions aind-slims-service-server/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ def test_histology_data():
specimen_id="BRN00000002",
subject_id="754372",
protocol_id=(
'<a href="https://www.protocols.io/edit/'
'refractive-index-matching-ethyl-cinnamate-cukpwuvn" '
'target="_blank" '
'rel="nofollow noopener noreferrer">'
'<a href="https://www.protocols.io/edit'
'/refractive-index-matching-ethyl-cinnamate-cukpwuvn"'
' target="_blank"'
' rel="nofollow noopener noreferrer">'
"Refractive Index Matching - Ethyl Cinnamate</a>"
),
protocol_name=(
Expand All @@ -282,20 +282,30 @@ def test_histology_data():
wash_name="Refractive Index Matching Wash",
wash_type="Refractive Index Matching",
start_time=datetime(
2025, 1, 24, 18, 40, 0, tzinfo=timezone.utc
2025, 1, 24, 18, 40, tzinfo=timezone.utc
),
end_time=datetime(
2025, 1, 27, 18, 40, 0, tzinfo=timezone.utc
2025, 1, 27, 18, 40, tzinfo=timezone.utc
),
modified_by="PersonM",
reagents=[
HistologyReagentData(
name="112372-100G",
name="rgntEX00000020",
source=None,
lot_number="stbk5149",
)
],
)
mass=None,
),
HistologyWashData(
wash_name="Refractive Index Matching Wash 2",
wash_type=None,
start_time=None,
end_time=None,
modified_by="PersonM",
reagents=[],
mass=None,
),
],
)
]
Expand Down