From 18fa5f4ef4aa60f7a0cad629a3068bb3755c9382 Mon Sep 17 00:00:00 2001 From: Felipe Narvaez Date: Wed, 3 Sep 2025 12:29:25 -0500 Subject: [PATCH 1/4] Novobio flex2 use SeriesData.get_unread --- .../novabio_flex2/novabio_flex2_structure.py | 4 + .../SampleResults2022-06-28_142558.json | 47 ++- ...mpleResultsDEVICE1232021-02-18_104838.json | 272 ++++++++++++++++-- ...leResultsT123456789C2020-01-01_162647.json | 87 +++++- 4 files changed, 382 insertions(+), 28 deletions(-) diff --git a/src/allotropy/parsers/novabio_flex2/novabio_flex2_structure.py b/src/allotropy/parsers/novabio_flex2/novabio_flex2_structure.py index 87d362ef82..5de41a7d4d 100644 --- a/src/allotropy/parsers/novabio_flex2/novabio_flex2_structure.py +++ b/src/allotropy/parsers/novabio_flex2/novabio_flex2_structure.py @@ -78,6 +78,7 @@ class Sample: viable_cell_count: float | None = None cell_type_processing_method: str | None = None cell_density_dilution_factor: float | None = None + custom_info: dict[str, Any] | None = None @classmethod def create(cls, units: SeriesData, data: SeriesData) -> Sample: @@ -122,6 +123,7 @@ def create(cls, units: SeriesData, data: SeriesData) -> Sample: if cell_density_dilution else None, cell_density_dilution_factor=try_float_or_none(str(cell_density_dilution)), + custom_info={**data.get_unread(), **units.get_unread()}, ) @@ -178,6 +180,7 @@ def parse_data( return SeriesData(), sample_data first_row = sample_data[0] + first_row.get_unread() date_time_regex = r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}" if re.match(date_time_regex, first_row[str, "Date & Time"]) is None: return SampleData.parse_units(first_row), sample_data[1:] @@ -198,6 +201,7 @@ def _create_measurement(sample: Sample, **kwargs: Any) -> Measurement: sample_identifier=sample.identifier, description=sample.sample_type, batch_identifier=sample.batch_identifier, + custom_info=sample.custom_info, **kwargs, ) diff --git a/tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.json b/tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.json index 781801b557..67c59678b0 100644 --- a/tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.json +++ b/tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.json @@ -19,7 +19,20 @@ "sample document": { "sample identifier": "SMPL_1234", "batch identifier": "BATCH_123", - "description": "Spent Media" + "description": "Spent Media", + "custom information document": { + "Sparging O2%": 20.9, + "Cell Type": "Workhog", + "Sample Time": "24-6-2022 14:34:52", + "pH / Gas Flow Time": 3.65, + "Vessel ID": "3L Bioreactor", + "PCO2 @ Temp": 46.8, + "Vessel Pressure (psi)": 0.0, + "Chemistry Dilution Ratio": "1:1", + "Chemistry Flow Time": 6.67, + "pH @ Temp": 7.4, + "PO2 @ Temp": 191.6 + } }, "analyte aggregate document": { "analyte document": [ @@ -103,7 +116,20 @@ "sample document": { "sample identifier": "SMPL_1234", "batch identifier": "BATCH_123", - "description": "Spent Media" + "description": "Spent Media", + "custom information document": { + "Sparging O2%": 20.9, + "Cell Type": "Workhog", + "Sample Time": "24-6-2022 14:34:52", + "pH / Gas Flow Time": 3.65, + "Vessel ID": "3L Bioreactor", + "PCO2 @ Temp": 46.8, + "Vessel Pressure (psi)": 0.0, + "Chemistry Dilution Ratio": "1:1", + "Chemistry Flow Time": 6.67, + "pH @ Temp": 7.4, + "PO2 @ Temp": 191.6 + } }, "pO2": { "value": 191.6, @@ -136,7 +162,20 @@ "sample document": { "sample identifier": "SMPL_1234", "batch identifier": "BATCH_123", - "description": "Spent Media" + "description": "Spent Media", + "custom information document": { + "Sparging O2%": 20.9, + "Cell Type": "Workhog", + "Sample Time": "24-6-2022 14:34:52", + "pH / Gas Flow Time": 3.65, + "Vessel ID": "3L Bioreactor", + "PCO2 @ Temp": 46.8, + "Vessel Pressure (psi)": 0.0, + "Chemistry Dilution Ratio": "1:1", + "Chemistry Flow Time": 6.67, + "pH @ Temp": 7.4, + "PO2 @ Temp": 191.6 + } }, "pH": { "value": 7.4, @@ -159,7 +198,7 @@ "file name": "SampleResults2022-06-28_142558.csv", "UNC path": "tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.csv", "ASM converter name": "allotropy_novabio_flex2", - "ASM converter version": "0.1.79", + "ASM converter version": "0.1.104", "software name": "NovaBio Flex" }, "device system document": { diff --git a/tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.json b/tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.json index 2a6d6258f7..ac388eec5f 100644 --- a/tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.json +++ b/tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.json @@ -233,7 +233,23 @@ "measurement time": "2021-02-18T10:33:17+00:00", "sample document": { "sample identifier": "SAMPLE 0002", - "description": "Default" + "description": "Default", + "custom information document": { + "pH / Gas Flow Time": 4.0, + "Operator": "Unither", + "Cell Density Flow": 5.4, + "PO2 @ Temp": 211.9, + "pH @ Temp": 7.262, + "Sample Time": "2/18/2021 10:33:17 AM", + "Vessel Pressure (psi)": 0.0, + "Cell Inspection Type": "StandardCHO", + "Valid Images": 47.0, + "Chemistry Flow Time": 7.57, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 14.5, + "Pre-Dilution Multiplier": 1.0 + } }, "analyte aggregate document": { "analyte document": [ @@ -316,7 +332,23 @@ "measurement time": "2021-02-18T10:33:17+00:00", "sample document": { "sample identifier": "SAMPLE 0002", - "description": "Default" + "description": "Default", + "custom information document": { + "pH / Gas Flow Time": 4.0, + "Operator": "Unither", + "Cell Density Flow": 5.4, + "PO2 @ Temp": 211.9, + "pH @ Temp": 7.262, + "Sample Time": "2/18/2021 10:33:17 AM", + "Vessel Pressure (psi)": 0.0, + "Cell Inspection Type": "StandardCHO", + "Valid Images": 47.0, + "Chemistry Flow Time": 7.57, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 14.5, + "Pre-Dilution Multiplier": 1.0 + } }, "processed data aggregate document": { "processed data document": [ @@ -364,7 +396,23 @@ "measurement time": "2021-02-18T10:33:17+00:00", "sample document": { "sample identifier": "SAMPLE 0002", - "description": "Default" + "description": "Default", + "custom information document": { + "pH / Gas Flow Time": 4.0, + "Operator": "Unither", + "Cell Density Flow": 5.4, + "PO2 @ Temp": 211.9, + "pH @ Temp": 7.262, + "Sample Time": "2/18/2021 10:33:17 AM", + "Vessel Pressure (psi)": 0.0, + "Cell Inspection Type": "StandardCHO", + "Valid Images": 47.0, + "Chemistry Flow Time": 7.57, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 14.5, + "Pre-Dilution Multiplier": 1.0 + } }, "pO2": { "value": 211.9, @@ -396,7 +444,23 @@ "measurement time": "2021-02-18T10:33:17+00:00", "sample document": { "sample identifier": "SAMPLE 0002", - "description": "Default" + "description": "Default", + "custom information document": { + "pH / Gas Flow Time": 4.0, + "Operator": "Unither", + "Cell Density Flow": 5.4, + "PO2 @ Temp": 211.9, + "pH @ Temp": 7.262, + "Sample Time": "2/18/2021 10:33:17 AM", + "Vessel Pressure (psi)": 0.0, + "Cell Inspection Type": "StandardCHO", + "Valid Images": 47.0, + "Chemistry Flow Time": 7.57, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 14.5, + "Pre-Dilution Multiplier": 1.0 + } }, "osmolality": { "value": 303.0, @@ -416,7 +480,23 @@ "measurement time": "2021-02-18T10:33:17+00:00", "sample document": { "sample identifier": "SAMPLE 0002", - "description": "Default" + "description": "Default", + "custom information document": { + "pH / Gas Flow Time": 4.0, + "Operator": "Unither", + "Cell Density Flow": 5.4, + "PO2 @ Temp": 211.9, + "pH @ Temp": 7.262, + "Sample Time": "2/18/2021 10:33:17 AM", + "Vessel Pressure (psi)": 0.0, + "Cell Inspection Type": "StandardCHO", + "Valid Images": 47.0, + "Chemistry Flow Time": 7.57, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 14.5, + "Pre-Dilution Multiplier": 1.0 + } }, "pH": { "value": 7.262, @@ -448,7 +528,20 @@ "measurement time": "2021-02-18T10:38:33+00:00", "sample document": { "sample identifier": "SAMPLE 0003", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 3.88, + "Operator": "Unither", + "PO2 @ Temp": 182.0, + "pH @ Temp": 7.288, + "Sample Time": "2/18/2021 10:38:33 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.78, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 13.8, + "Pre-Dilution Multiplier": 1.0 + } }, "analyte aggregate document": { "analyte document": [ @@ -531,7 +624,20 @@ "measurement time": "2021-02-18T10:38:33+00:00", "sample document": { "sample identifier": "SAMPLE 0003", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 3.88, + "Operator": "Unither", + "PO2 @ Temp": 182.0, + "pH @ Temp": 7.288, + "Sample Time": "2/18/2021 10:38:33 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.78, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 13.8, + "Pre-Dilution Multiplier": 1.0 + } }, "pO2": { "value": 182.0, @@ -563,7 +669,20 @@ "measurement time": "2021-02-18T10:38:33+00:00", "sample document": { "sample identifier": "SAMPLE 0003", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 3.88, + "Operator": "Unither", + "PO2 @ Temp": 182.0, + "pH @ Temp": 7.288, + "Sample Time": "2/18/2021 10:38:33 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.78, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 13.8, + "Pre-Dilution Multiplier": 1.0 + } }, "pH": { "value": 7.288, @@ -595,7 +714,20 @@ "measurement time": "2021-02-18T10:41:08+00:00", "sample document": { "sample identifier": "SAMPLE 0004", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 3.83, + "Operator": "Unither", + "PO2 @ Temp": 154.6, + "pH @ Temp": 7.215, + "Sample Time": "2/18/2021 10:41:08 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.72, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 17.9, + "Pre-Dilution Multiplier": 1.0 + } }, "analyte aggregate document": { "analyte document": [ @@ -678,7 +810,20 @@ "measurement time": "2021-02-18T10:41:08+00:00", "sample document": { "sample identifier": "SAMPLE 0004", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 3.83, + "Operator": "Unither", + "PO2 @ Temp": 154.6, + "pH @ Temp": 7.215, + "Sample Time": "2/18/2021 10:41:08 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.72, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 17.9, + "Pre-Dilution Multiplier": 1.0 + } }, "pO2": { "value": 154.6, @@ -710,7 +855,20 @@ "measurement time": "2021-02-18T10:41:08+00:00", "sample document": { "sample identifier": "SAMPLE 0004", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 3.83, + "Operator": "Unither", + "PO2 @ Temp": 154.6, + "pH @ Temp": 7.215, + "Sample Time": "2/18/2021 10:41:08 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.72, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 17.9, + "Pre-Dilution Multiplier": 1.0 + } }, "pH": { "value": 7.215, @@ -742,7 +900,20 @@ "measurement time": "2021-02-18T10:43:33+00:00", "sample document": { "sample identifier": "SAMPLE 0005", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 3.88, + "Operator": "Unither", + "PO2 @ Temp": 158.3, + "pH @ Temp": 7.252, + "Sample Time": "2/18/2021 10:43:33 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.5, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 15.1, + "Pre-Dilution Multiplier": 1.0 + } }, "analyte aggregate document": { "analyte document": [ @@ -825,7 +996,20 @@ "measurement time": "2021-02-18T10:43:33+00:00", "sample document": { "sample identifier": "SAMPLE 0005", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 3.88, + "Operator": "Unither", + "PO2 @ Temp": 158.3, + "pH @ Temp": 7.252, + "Sample Time": "2/18/2021 10:43:33 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.5, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 15.1, + "Pre-Dilution Multiplier": 1.0 + } }, "pO2": { "value": 158.3, @@ -857,7 +1041,20 @@ "measurement time": "2021-02-18T10:43:33+00:00", "sample document": { "sample identifier": "SAMPLE 0005", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 3.88, + "Operator": "Unither", + "PO2 @ Temp": 158.3, + "pH @ Temp": 7.252, + "Sample Time": "2/18/2021 10:43:33 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.5, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 15.1, + "Pre-Dilution Multiplier": 1.0 + } }, "pH": { "value": 7.252, @@ -889,7 +1086,20 @@ "measurement time": "2021-02-18T10:46:05+00:00", "sample document": { "sample identifier": "SAMPLE 0006", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 4.02, + "Operator": "Unither", + "PO2 @ Temp": 176.2, + "pH @ Temp": 7.278, + "Sample Time": "2/18/2021 10:46:05 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.73, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 10.1, + "Pre-Dilution Multiplier": 1.0 + } }, "analyte aggregate document": { "analyte document": [ @@ -972,7 +1182,20 @@ "measurement time": "2021-02-18T10:46:05+00:00", "sample document": { "sample identifier": "SAMPLE 0006", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 4.02, + "Operator": "Unither", + "PO2 @ Temp": 176.2, + "pH @ Temp": 7.278, + "Sample Time": "2/18/2021 10:46:05 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.73, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 10.1, + "Pre-Dilution Multiplier": 1.0 + } }, "pO2": { "value": 176.2, @@ -1004,7 +1227,20 @@ "measurement time": "2021-02-18T10:46:05+00:00", "sample document": { "sample identifier": "SAMPLE 0006", - "description": "Simple" + "description": "Simple", + "custom information document": { + "pH / Gas Flow Time": 4.02, + "Operator": "Unither", + "PO2 @ Temp": 176.2, + "pH @ Temp": 7.278, + "Sample Time": "2/18/2021 10:46:05 AM", + "Vessel Pressure (psi)": 0.0, + "Chemistry Flow Time": 7.73, + "Sparging O2%": 20.9, + "Chemistry Dilution Ratio": "1:1", + "PCO2 @ Temp": 10.1, + "Pre-Dilution Multiplier": 1.0 + } }, "pH": { "value": 7.278, @@ -1027,7 +1263,7 @@ "file name": "SampleResultsDEVICE1232021-02-18_104838.csv", "UNC path": "tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.csv", "ASM converter name": "allotropy_novabio_flex2", - "ASM converter version": "0.1.79", + "ASM converter version": "0.1.104", "software name": "NovaBio Flex" }, "device system document": { diff --git a/tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.json b/tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.json index cc262b164c..7befb7229e 100644 --- a/tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.json +++ b/tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.json @@ -19,7 +19,22 @@ "sample document": { "sample identifier": "Test1", "batch identifier": "1.0", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Flow Time": 1.0, + "Pre-Dilution Multiplier": 1.0, + "Cell Inspection Type": "StandardCHO", + "PCO2 @ Temp": "mmHg", + "Vessel Pressure (psi)": 1.0, + "PO2 @ Temp": "mmHg", + "Sparging O2%": 1.0, + "Chemistry Dilution Ratio": "1:01", + "pH / Gas Flow Time": 1.0, + "Vessel ID": 1.0, + "Sample Time": "1/1/2020 16:20", + "pH @ Temp": 1.0, + "Osm": "mOsm/kg" + } }, "analyte aggregate document": { "analyte document": [ @@ -103,7 +118,22 @@ "sample document": { "sample identifier": "Test1", "batch identifier": "1.0", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Flow Time": 1.0, + "Pre-Dilution Multiplier": 1.0, + "Cell Inspection Type": "StandardCHO", + "PCO2 @ Temp": "mmHg", + "Vessel Pressure (psi)": 1.0, + "PO2 @ Temp": "mmHg", + "Sparging O2%": 1.0, + "Chemistry Dilution Ratio": "1:01", + "pH / Gas Flow Time": 1.0, + "Vessel ID": 1.0, + "Sample Time": "1/1/2020 16:20", + "pH @ Temp": 1.0, + "Osm": "mOsm/kg" + } }, "processed data aggregate document": { "processed data document": [ @@ -145,7 +175,22 @@ "sample document": { "sample identifier": "Test1", "batch identifier": "1.0", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Flow Time": 1.0, + "Pre-Dilution Multiplier": 1.0, + "Cell Inspection Type": "StandardCHO", + "PCO2 @ Temp": "mmHg", + "Vessel Pressure (psi)": 1.0, + "PO2 @ Temp": "mmHg", + "Sparging O2%": 1.0, + "Chemistry Dilution Ratio": "1:01", + "pH / Gas Flow Time": 1.0, + "Vessel ID": 1.0, + "Sample Time": "1/1/2020 16:20", + "pH @ Temp": 1.0, + "Osm": "mOsm/kg" + } }, "pO2": { "value": 1.0, @@ -178,7 +223,22 @@ "sample document": { "sample identifier": "Test1", "batch identifier": "1.0", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Flow Time": 1.0, + "Pre-Dilution Multiplier": 1.0, + "Cell Inspection Type": "StandardCHO", + "PCO2 @ Temp": "mmHg", + "Vessel Pressure (psi)": 1.0, + "PO2 @ Temp": "mmHg", + "Sparging O2%": 1.0, + "Chemistry Dilution Ratio": "1:01", + "pH / Gas Flow Time": 1.0, + "Vessel ID": 1.0, + "Sample Time": "1/1/2020 16:20", + "pH @ Temp": 1.0, + "Osm": "mOsm/kg" + } }, "osmolality": { "value": 1.0, @@ -199,7 +259,22 @@ "sample document": { "sample identifier": "Test1", "batch identifier": "1.0", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Flow Time": 1.0, + "Pre-Dilution Multiplier": 1.0, + "Cell Inspection Type": "StandardCHO", + "PCO2 @ Temp": "mmHg", + "Vessel Pressure (psi)": 1.0, + "PO2 @ Temp": "mmHg", + "Sparging O2%": 1.0, + "Chemistry Dilution Ratio": "1:01", + "pH / Gas Flow Time": 1.0, + "Vessel ID": 1.0, + "Sample Time": "1/1/2020 16:20", + "pH @ Temp": 1.0, + "Osm": "mOsm/kg" + } }, "pH": { "value": 1.0, @@ -222,7 +297,7 @@ "file name": "SampleResultsT123456789C2020-01-01_162647.csv", "UNC path": "tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.csv", "ASM converter name": "allotropy_novabio_flex2", - "ASM converter version": "0.1.79", + "ASM converter version": "0.1.104", "software name": "NovaBio Flex" }, "device system document": { From 863a3ea7db2e090db5dc5f7c0e697329df069a78 Mon Sep 17 00:00:00 2001 From: Felipe Narvaez Date: Wed, 3 Sep 2025 12:43:31 -0500 Subject: [PATCH 2/4] added missing file --- .../benchling/_2024/_09/solution_analyzer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/allotropy/allotrope/schema_mappers/adm/solution_analyzer/benchling/_2024/_09/solution_analyzer.py b/src/allotropy/allotrope/schema_mappers/adm/solution_analyzer/benchling/_2024/_09/solution_analyzer.py index 6fbe824f4a..379ec7593d 100644 --- a/src/allotropy/allotrope/schema_mappers/adm/solution_analyzer/benchling/_2024/_09/solution_analyzer.py +++ b/src/allotropy/allotrope/schema_mappers/adm/solution_analyzer/benchling/_2024/_09/solution_analyzer.py @@ -125,6 +125,9 @@ class Measurement: # Errors errors: list[Error] | None = None + # Custom information + custom_info: dict[str, Any] | None = None + @dataclass(frozen=True) class MeasurementGroup: @@ -355,7 +358,7 @@ def _get_sample_document(self, measurement: Measurement) -> SampleDocument: batch_identifier=measurement.batch_identifier, description=measurement.description, ), - None, + measurement.custom_info, ) def _create_analyte_document(self, analyte: Analyte) -> AnalyteDocument: From b011b3f10967fd9705c884b1fbe840c4508793aa Mon Sep 17 00:00:00 2001 From: Felipe Narvaez Date: Fri, 5 Sep 2025 11:49:49 -0500 Subject: [PATCH 3/4] Added decorator to supress unused keys warning and fixed james comments --- .../benchling/_2024/_09/solution_analyzer.py | 3 +- .../novabio_flex2/novabio_flex2_structure.py | 26 +- src/allotropy/parsers/utils/warnings_tools.py | 21 + .../SampleResults2022-06-28_142558.json | 56 ++- ...mpleResultsDEVICE1232021-02-18_104838.json | 406 +++++++++--------- ...leResultsT123456789C2020-01-01_162647.json | 107 ++--- 6 files changed, 329 insertions(+), 290 deletions(-) create mode 100644 src/allotropy/parsers/utils/warnings_tools.py diff --git a/src/allotropy/allotrope/schema_mappers/adm/solution_analyzer/benchling/_2024/_09/solution_analyzer.py b/src/allotropy/allotrope/schema_mappers/adm/solution_analyzer/benchling/_2024/_09/solution_analyzer.py index 379ec7593d..51544e61cc 100644 --- a/src/allotropy/allotrope/schema_mappers/adm/solution_analyzer/benchling/_2024/_09/solution_analyzer.py +++ b/src/allotropy/allotrope/schema_mappers/adm/solution_analyzer/benchling/_2024/_09/solution_analyzer.py @@ -127,6 +127,7 @@ class Measurement: # Custom information custom_info: dict[str, Any] | None = None + device_control_custom_info: dict[str, Any] | None = None @dataclass(frozen=True) @@ -305,7 +306,7 @@ def _get_measurement_document_item( metadata.sample_volume_setting, ), ), - None, + measurement.device_control_custom_info, ), ] ), diff --git a/src/allotropy/parsers/novabio_flex2/novabio_flex2_structure.py b/src/allotropy/parsers/novabio_flex2/novabio_flex2_structure.py index 5de41a7d4d..927e4d4ad5 100644 --- a/src/allotropy/parsers/novabio_flex2/novabio_flex2_structure.py +++ b/src/allotropy/parsers/novabio_flex2/novabio_flex2_structure.py @@ -30,6 +30,7 @@ from allotropy.parsers.utils.pandas import SeriesData from allotropy.parsers.utils.uuids import random_uuid_str from allotropy.parsers.utils.values import try_float_or_none +from allotropy.parsers.utils.warnings_tools import suppress_unused_keys_warning @dataclass(frozen=True) @@ -79,6 +80,7 @@ class Sample: cell_type_processing_method: str | None = None cell_density_dilution_factor: float | None = None custom_info: dict[str, Any] | None = None + device_control_custom_info: dict[str, Any] | None = None @classmethod def create(cls, units: SeriesData, data: SeriesData) -> Sample: @@ -86,6 +88,17 @@ def create(cls, units: SeriesData, data: SeriesData) -> Sample: if cell_density_dilution: cell_density_dilution = cell_density_dilution.split(":")[0] + unused_keys = { + "Sample Time", + "PCO2 @ Temp", + "PO2 @ Temp", + "pH @ Temp", + "Operator", + "Osm", + } + data.mark_read(unused_keys) + units.mark_read(unused_keys) + return Sample( identifier=data[str, "Sample ID"], sample_type=data[str, "Sample Type"], @@ -123,6 +136,16 @@ def create(cls, units: SeriesData, data: SeriesData) -> Sample: if cell_density_dilution else None, cell_density_dilution_factor=try_float_or_none(str(cell_density_dilution)), + device_control_custom_info=data.get_custom_keys( + { + "Sparging O2%", + "pH / Gas Flow Time", + "Vessel Pressure (psi)", + "Chemistry Flow Time", + "Valid Images", + "Cell Density Flow", + } + ), custom_info={**data.get_unread(), **units.get_unread()}, ) @@ -167,6 +190,7 @@ def parse_units(units: SeriesData) -> SeriesData: return SeriesData(pd.Series(data)) @staticmethod + @suppress_unused_keys_warning def parse_data( raw_data: pd.DataFrame, ) -> tuple[SeriesData, list[SeriesData]]: @@ -180,7 +204,6 @@ def parse_data( return SeriesData(), sample_data first_row = sample_data[0] - first_row.get_unread() date_time_regex = r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}" if re.match(date_time_regex, first_row[str, "Date & Time"]) is None: return SampleData.parse_units(first_row), sample_data[1:] @@ -202,6 +225,7 @@ def _create_measurement(sample: Sample, **kwargs: Any) -> Measurement: description=sample.sample_type, batch_identifier=sample.batch_identifier, custom_info=sample.custom_info, + device_control_custom_info=sample.device_control_custom_info, **kwargs, ) diff --git a/src/allotropy/parsers/utils/warnings_tools.py b/src/allotropy/parsers/utils/warnings_tools.py new file mode 100644 index 0000000000..cf37d48e7b --- /dev/null +++ b/src/allotropy/parsers/utils/warnings_tools.py @@ -0,0 +1,21 @@ +from __future__ import annotations + +from collections.abc import Callable +import functools +import gc +import os +from typing import Any + + +def suppress_unused_keys_warning(func: Callable[..., Any]) -> Callable[..., Any]: + @functools.wraps(func) + def _wrapper(*args: Any, **kwargs: Any) -> Any: + previous_warn_unused_keys = os.environ.pop("WARN_UNUSED_KEYS", None) + try: + return func(*args, **kwargs) + finally: + gc.collect() + if previous_warn_unused_keys is not None: + os.environ["WARN_UNUSED_KEYS"] = previous_warn_unused_keys + + return _wrapper diff --git a/tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.json b/tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.json index 67c59678b0..2c77446542 100644 --- a/tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.json +++ b/tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.json @@ -10,7 +10,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "metabolite-detection" + "detection type": "metabolite-detection", + "custom information document": { + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "Chemistry Flow Time": 6.67, + "pH / Gas Flow Time": 3.65 + } } ] }, @@ -21,17 +27,9 @@ "batch identifier": "BATCH_123", "description": "Spent Media", "custom information document": { - "Sparging O2%": 20.9, - "Cell Type": "Workhog", - "Sample Time": "24-6-2022 14:34:52", - "pH / Gas Flow Time": 3.65, "Vessel ID": "3L Bioreactor", - "PCO2 @ Temp": 46.8, - "Vessel Pressure (psi)": 0.0, "Chemistry Dilution Ratio": "1:1", - "Chemistry Flow Time": 6.67, - "pH @ Temp": 7.4, - "PO2 @ Temp": 191.6 + "Cell Type": "Workhog" } }, "analyte aggregate document": { @@ -107,7 +105,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "blood-gas-detection" + "detection type": "blood-gas-detection", + "custom information document": { + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "Chemistry Flow Time": 6.67, + "pH / Gas Flow Time": 3.65 + } } ] }, @@ -118,17 +122,9 @@ "batch identifier": "BATCH_123", "description": "Spent Media", "custom information document": { - "Sparging O2%": 20.9, - "Cell Type": "Workhog", - "Sample Time": "24-6-2022 14:34:52", - "pH / Gas Flow Time": 3.65, "Vessel ID": "3L Bioreactor", - "PCO2 @ Temp": 46.8, - "Vessel Pressure (psi)": 0.0, "Chemistry Dilution Ratio": "1:1", - "Chemistry Flow Time": 6.67, - "pH @ Temp": 7.4, - "PO2 @ Temp": 191.6 + "Cell Type": "Workhog" } }, "pO2": { @@ -153,7 +149,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "ph-detection" + "detection type": "ph-detection", + "custom information document": { + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "Chemistry Flow Time": 6.67, + "pH / Gas Flow Time": 3.65 + } } ] }, @@ -164,17 +166,9 @@ "batch identifier": "BATCH_123", "description": "Spent Media", "custom information document": { - "Sparging O2%": 20.9, - "Cell Type": "Workhog", - "Sample Time": "24-6-2022 14:34:52", - "pH / Gas Flow Time": 3.65, "Vessel ID": "3L Bioreactor", - "PCO2 @ Temp": 46.8, - "Vessel Pressure (psi)": 0.0, "Chemistry Dilution Ratio": "1:1", - "Chemistry Flow Time": 6.67, - "pH @ Temp": 7.4, - "PO2 @ Temp": 191.6 + "Cell Type": "Workhog" } }, "pH": { @@ -198,7 +192,7 @@ "file name": "SampleResults2022-06-28_142558.csv", "UNC path": "tests/parsers/novabio_flex2/testdata/SampleResults2022-06-28_142558.csv", "ASM converter name": "allotropy_novabio_flex2", - "ASM converter version": "0.1.104", + "ASM converter version": "0.1.105", "software name": "NovaBio Flex" }, "device system document": { diff --git a/tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.json b/tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.json index ac388eec5f..5c290adae6 100644 --- a/tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.json +++ b/tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.json @@ -10,7 +10,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "metabolite-detection" + "detection type": "metabolite-detection", + "custom information document": { + "Chemistry Flow Time": 7.5, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.51, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.94 + } } ] }, @@ -18,7 +26,12 @@ "measurement time": "2021-02-18T10:28:04+00:00", "sample document": { "sample identifier": "SAMPLE 0001", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Dilution Ratio": "1:1", + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 + } }, "analyte aggregate document": { "analyte document": [ @@ -93,7 +106,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "cell-counting" + "detection type": "cell-counting", + "custom information document": { + "Chemistry Flow Time": 7.5, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.51, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.94 + } } ] }, @@ -101,7 +122,12 @@ "measurement time": "2021-02-18T10:28:04+00:00", "sample document": { "sample identifier": "SAMPLE 0001", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Dilution Ratio": "1:1", + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 + } }, "processed data aggregate document": { "processed data document": [ @@ -141,7 +167,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "blood-gas-detection" + "detection type": "blood-gas-detection", + "custom information document": { + "Chemistry Flow Time": 7.5, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.51, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.94 + } } ] }, @@ -149,7 +183,12 @@ "measurement time": "2021-02-18T10:28:04+00:00", "sample document": { "sample identifier": "SAMPLE 0001", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Dilution Ratio": "1:1", + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 + } }, "pO2": { "value": 197.1, @@ -173,7 +212,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "osmolality-detection" + "detection type": "osmolality-detection", + "custom information document": { + "Chemistry Flow Time": 7.5, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.51, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.94 + } } ] }, @@ -181,7 +228,12 @@ "measurement time": "2021-02-18T10:28:04+00:00", "sample document": { "sample identifier": "SAMPLE 0001", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Dilution Ratio": "1:1", + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 + } }, "osmolality": { "value": 300.0, @@ -193,7 +245,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "ph-detection" + "detection type": "ph-detection", + "custom information document": { + "Chemistry Flow Time": 7.5, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.51, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.94 + } } ] }, @@ -201,7 +261,12 @@ "measurement time": "2021-02-18T10:28:04+00:00", "sample document": { "sample identifier": "SAMPLE 0001", - "description": "Default" + "description": "Default", + "custom information document": { + "Chemistry Dilution Ratio": "1:1", + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 + } }, "pH": { "value": 7.34, @@ -225,7 +290,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "metabolite-detection" + "detection type": "metabolite-detection", + "custom information document": { + "Chemistry Flow Time": 7.57, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.4, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 4.0 + } } ] }, @@ -235,19 +308,8 @@ "sample identifier": "SAMPLE 0002", "description": "Default", "custom information document": { - "pH / Gas Flow Time": 4.0, - "Operator": "Unither", - "Cell Density Flow": 5.4, - "PO2 @ Temp": 211.9, - "pH @ Temp": 7.262, - "Sample Time": "2/18/2021 10:33:17 AM", - "Vessel Pressure (psi)": 0.0, - "Cell Inspection Type": "StandardCHO", - "Valid Images": 47.0, - "Chemistry Flow Time": 7.57, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 14.5, + "Cell Inspection Type": "StandardCHO", "Pre-Dilution Multiplier": 1.0 } }, @@ -324,7 +386,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "cell-counting" + "detection type": "cell-counting", + "custom information document": { + "Chemistry Flow Time": 7.57, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.4, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 4.0 + } } ] }, @@ -334,19 +404,8 @@ "sample identifier": "SAMPLE 0002", "description": "Default", "custom information document": { - "pH / Gas Flow Time": 4.0, - "Operator": "Unither", - "Cell Density Flow": 5.4, - "PO2 @ Temp": 211.9, - "pH @ Temp": 7.262, - "Sample Time": "2/18/2021 10:33:17 AM", - "Vessel Pressure (psi)": 0.0, - "Cell Inspection Type": "StandardCHO", - "Valid Images": 47.0, - "Chemistry Flow Time": 7.57, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 14.5, + "Cell Inspection Type": "StandardCHO", "Pre-Dilution Multiplier": 1.0 } }, @@ -388,7 +447,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "blood-gas-detection" + "detection type": "blood-gas-detection", + "custom information document": { + "Chemistry Flow Time": 7.57, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.4, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 4.0 + } } ] }, @@ -398,19 +465,8 @@ "sample identifier": "SAMPLE 0002", "description": "Default", "custom information document": { - "pH / Gas Flow Time": 4.0, - "Operator": "Unither", - "Cell Density Flow": 5.4, - "PO2 @ Temp": 211.9, - "pH @ Temp": 7.262, - "Sample Time": "2/18/2021 10:33:17 AM", - "Vessel Pressure (psi)": 0.0, - "Cell Inspection Type": "StandardCHO", - "Valid Images": 47.0, - "Chemistry Flow Time": 7.57, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 14.5, + "Cell Inspection Type": "StandardCHO", "Pre-Dilution Multiplier": 1.0 } }, @@ -436,7 +492,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "osmolality-detection" + "detection type": "osmolality-detection", + "custom information document": { + "Chemistry Flow Time": 7.57, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.4, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 4.0 + } } ] }, @@ -446,19 +510,8 @@ "sample identifier": "SAMPLE 0002", "description": "Default", "custom information document": { - "pH / Gas Flow Time": 4.0, - "Operator": "Unither", - "Cell Density Flow": 5.4, - "PO2 @ Temp": 211.9, - "pH @ Temp": 7.262, - "Sample Time": "2/18/2021 10:33:17 AM", - "Vessel Pressure (psi)": 0.0, - "Cell Inspection Type": "StandardCHO", - "Valid Images": 47.0, - "Chemistry Flow Time": 7.57, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 14.5, + "Cell Inspection Type": "StandardCHO", "Pre-Dilution Multiplier": 1.0 } }, @@ -472,7 +525,15 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "ph-detection" + "detection type": "ph-detection", + "custom information document": { + "Chemistry Flow Time": 7.57, + "Vessel Pressure (psi)": 0.0, + "Cell Density Flow": 5.4, + "Valid Images": 47.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 4.0 + } } ] }, @@ -482,19 +543,8 @@ "sample identifier": "SAMPLE 0002", "description": "Default", "custom information document": { - "pH / Gas Flow Time": 4.0, - "Operator": "Unither", - "Cell Density Flow": 5.4, - "PO2 @ Temp": 211.9, - "pH @ Temp": 7.262, - "Sample Time": "2/18/2021 10:33:17 AM", - "Vessel Pressure (psi)": 0.0, - "Cell Inspection Type": "StandardCHO", - "Valid Images": 47.0, - "Chemistry Flow Time": 7.57, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 14.5, + "Cell Inspection Type": "StandardCHO", "Pre-Dilution Multiplier": 1.0 } }, @@ -520,7 +570,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "metabolite-detection" + "detection type": "metabolite-detection", + "custom information document": { + "Chemistry Flow Time": 7.78, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.88 + } } ] }, @@ -530,16 +586,7 @@ "sample identifier": "SAMPLE 0003", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 3.88, - "Operator": "Unither", - "PO2 @ Temp": 182.0, - "pH @ Temp": 7.288, - "Sample Time": "2/18/2021 10:38:33 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.78, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 13.8, "Pre-Dilution Multiplier": 1.0 } }, @@ -616,7 +663,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "blood-gas-detection" + "detection type": "blood-gas-detection", + "custom information document": { + "Chemistry Flow Time": 7.78, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.88 + } } ] }, @@ -626,16 +679,7 @@ "sample identifier": "SAMPLE 0003", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 3.88, - "Operator": "Unither", - "PO2 @ Temp": 182.0, - "pH @ Temp": 7.288, - "Sample Time": "2/18/2021 10:38:33 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.78, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 13.8, "Pre-Dilution Multiplier": 1.0 } }, @@ -661,7 +705,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "ph-detection" + "detection type": "ph-detection", + "custom information document": { + "Chemistry Flow Time": 7.78, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.88 + } } ] }, @@ -671,16 +721,7 @@ "sample identifier": "SAMPLE 0003", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 3.88, - "Operator": "Unither", - "PO2 @ Temp": 182.0, - "pH @ Temp": 7.288, - "Sample Time": "2/18/2021 10:38:33 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.78, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 13.8, "Pre-Dilution Multiplier": 1.0 } }, @@ -706,7 +747,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "metabolite-detection" + "detection type": "metabolite-detection", + "custom information document": { + "Chemistry Flow Time": 7.72, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.83 + } } ] }, @@ -716,16 +763,7 @@ "sample identifier": "SAMPLE 0004", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 3.83, - "Operator": "Unither", - "PO2 @ Temp": 154.6, - "pH @ Temp": 7.215, - "Sample Time": "2/18/2021 10:41:08 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.72, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 17.9, "Pre-Dilution Multiplier": 1.0 } }, @@ -802,7 +840,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "blood-gas-detection" + "detection type": "blood-gas-detection", + "custom information document": { + "Chemistry Flow Time": 7.72, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.83 + } } ] }, @@ -812,16 +856,7 @@ "sample identifier": "SAMPLE 0004", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 3.83, - "Operator": "Unither", - "PO2 @ Temp": 154.6, - "pH @ Temp": 7.215, - "Sample Time": "2/18/2021 10:41:08 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.72, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 17.9, "Pre-Dilution Multiplier": 1.0 } }, @@ -847,7 +882,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "ph-detection" + "detection type": "ph-detection", + "custom information document": { + "Chemistry Flow Time": 7.72, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.83 + } } ] }, @@ -857,16 +898,7 @@ "sample identifier": "SAMPLE 0004", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 3.83, - "Operator": "Unither", - "PO2 @ Temp": 154.6, - "pH @ Temp": 7.215, - "Sample Time": "2/18/2021 10:41:08 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.72, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 17.9, "Pre-Dilution Multiplier": 1.0 } }, @@ -892,7 +924,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "metabolite-detection" + "detection type": "metabolite-detection", + "custom information document": { + "Chemistry Flow Time": 7.5, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.88 + } } ] }, @@ -902,16 +940,7 @@ "sample identifier": "SAMPLE 0005", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 3.88, - "Operator": "Unither", - "PO2 @ Temp": 158.3, - "pH @ Temp": 7.252, - "Sample Time": "2/18/2021 10:43:33 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.5, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 15.1, "Pre-Dilution Multiplier": 1.0 } }, @@ -988,7 +1017,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "blood-gas-detection" + "detection type": "blood-gas-detection", + "custom information document": { + "Chemistry Flow Time": 7.5, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.88 + } } ] }, @@ -998,16 +1033,7 @@ "sample identifier": "SAMPLE 0005", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 3.88, - "Operator": "Unither", - "PO2 @ Temp": 158.3, - "pH @ Temp": 7.252, - "Sample Time": "2/18/2021 10:43:33 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.5, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 15.1, "Pre-Dilution Multiplier": 1.0 } }, @@ -1033,7 +1059,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "ph-detection" + "detection type": "ph-detection", + "custom information document": { + "Chemistry Flow Time": 7.5, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 3.88 + } } ] }, @@ -1043,16 +1075,7 @@ "sample identifier": "SAMPLE 0005", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 3.88, - "Operator": "Unither", - "PO2 @ Temp": 158.3, - "pH @ Temp": 7.252, - "Sample Time": "2/18/2021 10:43:33 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.5, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 15.1, "Pre-Dilution Multiplier": 1.0 } }, @@ -1078,7 +1101,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "metabolite-detection" + "detection type": "metabolite-detection", + "custom information document": { + "Chemistry Flow Time": 7.73, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 4.02 + } } ] }, @@ -1088,16 +1117,7 @@ "sample identifier": "SAMPLE 0006", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 4.02, - "Operator": "Unither", - "PO2 @ Temp": 176.2, - "pH @ Temp": 7.278, - "Sample Time": "2/18/2021 10:46:05 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.73, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 10.1, "Pre-Dilution Multiplier": 1.0 } }, @@ -1174,7 +1194,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "blood-gas-detection" + "detection type": "blood-gas-detection", + "custom information document": { + "Chemistry Flow Time": 7.73, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 4.02 + } } ] }, @@ -1184,16 +1210,7 @@ "sample identifier": "SAMPLE 0006", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 4.02, - "Operator": "Unither", - "PO2 @ Temp": 176.2, - "pH @ Temp": 7.278, - "Sample Time": "2/18/2021 10:46:05 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.73, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 10.1, "Pre-Dilution Multiplier": 1.0 } }, @@ -1219,7 +1236,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "ph-detection" + "detection type": "ph-detection", + "custom information document": { + "Chemistry Flow Time": 7.73, + "Vessel Pressure (psi)": 0.0, + "Sparging O2%": 20.9, + "pH / Gas Flow Time": 4.02 + } } ] }, @@ -1229,16 +1252,7 @@ "sample identifier": "SAMPLE 0006", "description": "Simple", "custom information document": { - "pH / Gas Flow Time": 4.02, - "Operator": "Unither", - "PO2 @ Temp": 176.2, - "pH @ Temp": 7.278, - "Sample Time": "2/18/2021 10:46:05 AM", - "Vessel Pressure (psi)": 0.0, - "Chemistry Flow Time": 7.73, - "Sparging O2%": 20.9, "Chemistry Dilution Ratio": "1:1", - "PCO2 @ Temp": 10.1, "Pre-Dilution Multiplier": 1.0 } }, @@ -1263,7 +1277,7 @@ "file name": "SampleResultsDEVICE1232021-02-18_104838.csv", "UNC path": "tests/parsers/novabio_flex2/testdata/SampleResultsDEVICE1232021-02-18_104838.csv", "ASM converter name": "allotropy_novabio_flex2", - "ASM converter version": "0.1.104", + "ASM converter version": "0.1.105", "software name": "NovaBio Flex" }, "device system document": { diff --git a/tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.json b/tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.json index 7befb7229e..e2e4f954f6 100644 --- a/tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.json +++ b/tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.json @@ -10,7 +10,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "metabolite-detection" + "detection type": "metabolite-detection", + "custom information document": { + "Sparging O2%": 1.0, + "pH / Gas Flow Time": 1.0, + "Chemistry Flow Time": 1.0, + "Vessel Pressure (psi)": 1.0 + } } ] }, @@ -21,19 +27,10 @@ "batch identifier": "1.0", "description": "Default", "custom information document": { - "Chemistry Flow Time": 1.0, - "Pre-Dilution Multiplier": 1.0, - "Cell Inspection Type": "StandardCHO", - "PCO2 @ Temp": "mmHg", - "Vessel Pressure (psi)": 1.0, - "PO2 @ Temp": "mmHg", - "Sparging O2%": 1.0, "Chemistry Dilution Ratio": "1:01", - "pH / Gas Flow Time": 1.0, "Vessel ID": 1.0, - "Sample Time": "1/1/2020 16:20", - "pH @ Temp": 1.0, - "Osm": "mOsm/kg" + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 } }, "analyte aggregate document": { @@ -109,7 +106,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "cell-counting" + "detection type": "cell-counting", + "custom information document": { + "Sparging O2%": 1.0, + "pH / Gas Flow Time": 1.0, + "Chemistry Flow Time": 1.0, + "Vessel Pressure (psi)": 1.0 + } } ] }, @@ -120,19 +123,10 @@ "batch identifier": "1.0", "description": "Default", "custom information document": { - "Chemistry Flow Time": 1.0, - "Pre-Dilution Multiplier": 1.0, - "Cell Inspection Type": "StandardCHO", - "PCO2 @ Temp": "mmHg", - "Vessel Pressure (psi)": 1.0, - "PO2 @ Temp": "mmHg", - "Sparging O2%": 1.0, "Chemistry Dilution Ratio": "1:01", - "pH / Gas Flow Time": 1.0, "Vessel ID": 1.0, - "Sample Time": "1/1/2020 16:20", - "pH @ Temp": 1.0, - "Osm": "mOsm/kg" + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 } }, "processed data aggregate document": { @@ -166,7 +160,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "blood-gas-detection" + "detection type": "blood-gas-detection", + "custom information document": { + "Sparging O2%": 1.0, + "pH / Gas Flow Time": 1.0, + "Chemistry Flow Time": 1.0, + "Vessel Pressure (psi)": 1.0 + } } ] }, @@ -177,19 +177,10 @@ "batch identifier": "1.0", "description": "Default", "custom information document": { - "Chemistry Flow Time": 1.0, - "Pre-Dilution Multiplier": 1.0, - "Cell Inspection Type": "StandardCHO", - "PCO2 @ Temp": "mmHg", - "Vessel Pressure (psi)": 1.0, - "PO2 @ Temp": "mmHg", - "Sparging O2%": 1.0, "Chemistry Dilution Ratio": "1:01", - "pH / Gas Flow Time": 1.0, "Vessel ID": 1.0, - "Sample Time": "1/1/2020 16:20", - "pH @ Temp": 1.0, - "Osm": "mOsm/kg" + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 } }, "pO2": { @@ -214,7 +205,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "osmolality-detection" + "detection type": "osmolality-detection", + "custom information document": { + "Sparging O2%": 1.0, + "pH / Gas Flow Time": 1.0, + "Chemistry Flow Time": 1.0, + "Vessel Pressure (psi)": 1.0 + } } ] }, @@ -225,19 +222,10 @@ "batch identifier": "1.0", "description": "Default", "custom information document": { - "Chemistry Flow Time": 1.0, - "Pre-Dilution Multiplier": 1.0, - "Cell Inspection Type": "StandardCHO", - "PCO2 @ Temp": "mmHg", - "Vessel Pressure (psi)": 1.0, - "PO2 @ Temp": "mmHg", - "Sparging O2%": 1.0, "Chemistry Dilution Ratio": "1:01", - "pH / Gas Flow Time": 1.0, "Vessel ID": 1.0, - "Sample Time": "1/1/2020 16:20", - "pH @ Temp": 1.0, - "Osm": "mOsm/kg" + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 } }, "osmolality": { @@ -250,7 +238,13 @@ "device control document": [ { "device type": "solution-analyzer", - "detection type": "ph-detection" + "detection type": "ph-detection", + "custom information document": { + "Sparging O2%": 1.0, + "pH / Gas Flow Time": 1.0, + "Chemistry Flow Time": 1.0, + "Vessel Pressure (psi)": 1.0 + } } ] }, @@ -261,19 +255,10 @@ "batch identifier": "1.0", "description": "Default", "custom information document": { - "Chemistry Flow Time": 1.0, - "Pre-Dilution Multiplier": 1.0, - "Cell Inspection Type": "StandardCHO", - "PCO2 @ Temp": "mmHg", - "Vessel Pressure (psi)": 1.0, - "PO2 @ Temp": "mmHg", - "Sparging O2%": 1.0, "Chemistry Dilution Ratio": "1:01", - "pH / Gas Flow Time": 1.0, "Vessel ID": 1.0, - "Sample Time": "1/1/2020 16:20", - "pH @ Temp": 1.0, - "Osm": "mOsm/kg" + "Cell Inspection Type": "StandardCHO", + "Pre-Dilution Multiplier": 1.0 } }, "pH": { @@ -297,7 +282,7 @@ "file name": "SampleResultsT123456789C2020-01-01_162647.csv", "UNC path": "tests/parsers/novabio_flex2/testdata/SampleResultsT123456789C2020-01-01_162647.csv", "ASM converter name": "allotropy_novabio_flex2", - "ASM converter version": "0.1.104", + "ASM converter version": "0.1.105", "software name": "NovaBio Flex" }, "device system document": { From b4e89139cfc7b91d13301786966e98079e084290 Mon Sep 17 00:00:00 2001 From: Felipe Narvaez Date: Tue, 9 Sep 2025 13:00:50 -0500 Subject: [PATCH 4/4] added docstrig to suppress warnings decorator --- src/allotropy/parsers/utils/warnings_tools.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/allotropy/parsers/utils/warnings_tools.py b/src/allotropy/parsers/utils/warnings_tools.py index cf37d48e7b..03f4a3a8a9 100644 --- a/src/allotropy/parsers/utils/warnings_tools.py +++ b/src/allotropy/parsers/utils/warnings_tools.py @@ -8,6 +8,12 @@ def suppress_unused_keys_warning(func: Callable[..., Any]) -> Callable[..., Any]: + """ + Use when a class that warns for unread keys is created for a special one-off use that does not intend to read all keys, e.g. + to read a single value and return. + Not appropriate to use in the main use of the class where unread keys should be copied into custom data fields. + """ + @functools.wraps(func) def _wrapper(*args: Any, **kwargs: Any) -> Any: previous_warn_unused_keys = os.environ.pop("WARN_UNUSED_KEYS", None)