From 721131ea6806e8dea76fabfa709cf623212435c5 Mon Sep 17 00:00:00 2001 From: james-leinas Date: Mon, 8 Dec 2025 15:23:36 -0800 Subject: [PATCH] update adapter for v7.0 support --- .../parsers/roche_cedex_bioht/constants.py | 2 +- .../roche_cedex_bioht_reader.py | 6 +- .../roche_cedex_bioht_v7_example_01.json | 839 ++++++++++++++++++ .../roche_cedex_bioht_v7_example_01.txt | 21 + 4 files changed, 864 insertions(+), 4 deletions(-) create mode 100644 tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_v7_example_01.json create mode 100644 tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_v7_example_01.txt diff --git a/src/allotropy/parsers/roche_cedex_bioht/constants.py b/src/allotropy/parsers/roche_cedex_bioht/constants.py index 0be3d6463..e2046f4bc 100644 --- a/src/allotropy/parsers/roche_cedex_bioht/constants.py +++ b/src/allotropy/parsers/roche_cedex_bioht/constants.py @@ -42,7 +42,7 @@ "analyst", ] -DATA_HEADER_V6 = [ +DATA_HEADER_V6_V7 = [ "row type", "measurement time", "sample identifier", diff --git a/src/allotropy/parsers/roche_cedex_bioht/roche_cedex_bioht_reader.py b/src/allotropy/parsers/roche_cedex_bioht/roche_cedex_bioht_reader.py index da13c60d5..9f1819cba 100644 --- a/src/allotropy/parsers/roche_cedex_bioht/roche_cedex_bioht_reader.py +++ b/src/allotropy/parsers/roche_cedex_bioht/roche_cedex_bioht_reader.py @@ -8,7 +8,7 @@ from allotropy.parsers.roche_cedex_bioht.constants import ( ANALYTES_LOOKUP, DATA_HEADER_V5, - DATA_HEADER_V6, + DATA_HEADER_V6_V7, DETECTION_KIT_LOOKUP, DETECTION_KIT_RANGE_LOOKUP, INFO_HEADER, @@ -47,8 +47,8 @@ def read_samples_data(self, contents: IOType) -> pd.DataFrame: software_version = self.title_data[str, "software version"] if software_version.startswith("5"): data_header = DATA_HEADER_V5 - elif software_version.startswith("6"): - data_header = DATA_HEADER_V6 + elif software_version.startswith("6") or software_version.startswith("7"): + data_header = DATA_HEADER_V6_V7 else: msg = f"Unsupported software version: {software_version}" raise ValueError(msg) diff --git a/tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_v7_example_01.json b/tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_v7_example_01.json new file mode 100644 index 000000000..bd9c947e2 --- /dev/null +++ b/tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_v7_example_01.json @@ -0,0 +1,839 @@ +{ + "$asm.manifest": "http://purl.allotrope.org/manifests/solution-analyzer/REC/2024/09/solution-analyzer.manifest", + "solution analyzer aggregate document": { + "solution analyzer document": [ + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_0", + "measurement time": "2025-11-20T14:21:53+00:00", + "sample document": { + "sample identifier": "SAMPLE1" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "glutamine", + "molar concentration": { + "value": 0.241, + "unit": "mmol/L" + }, + "custom information document": { + "analyte code": "GLN2B", + "detection kit": "Standard", + "detection kit range": "0.1 - 10.26 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_1", + "measurement time": "2025-11-20T14:25:05+00:00", + "sample document": { + "sample identifier": "SAMPLE10" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "ammonia", + "mass concentration": { + "value": 0.13622900000000002, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "NH3B", + "detection kit": "Standard", + "detection kit range": " 0.278 - 13.89 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_2", + "measurement time": "2025-11-20T14:25:16+00:00", + "sample document": { + "sample identifier": "SAMPLE11" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "phosphate", + "mass concentration": { + "value": 0.6627000000000001, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "PHO2B", + "detection kit": "Standard", + "detection kit range": "0.1 - 8.37 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_3", + "measurement time": "2025-11-20T14:25:26+00:00", + "sample document": { + "sample identifier": "SAMPLE12" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "pyruvate", + "mass concentration": { + "value": 0.029335, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "PYRB", + "detection kit": "Standard", + "detection kit range": "0.2 - 8 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_4", + "measurement time": "2025-11-20T14:25:37+00:00", + "sample document": { + "sample identifier": "SAMPLE13" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "potassium", + "molar concentration": { + "value": 10.62, + "unit": "mmol/L" + }, + "custom information document": { + "analyte code": "KB", + "detection kit": "Standard", + "detection kit range": "2 - 28 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_5", + "measurement time": "2025-11-20T14:25:47+00:00", + "sample document": { + "sample identifier": "SAMPLE14" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "iron", + "mass concentration": { + "value": 0.08548, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "FE2D", + "detection kit": "High with Pre - Dilution", + "detection kit range": "0.009 - 1.79 mmol/L ", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_6", + "measurement time": "2025-11-20T14:26:09+00:00", + "sample document": { + "sample identifier": "SAMPLE15" + }, + "error aggregate document": { + "error document": [ + { + "error": "< 4.00", + "error feature": "total protein - Standard" + } + ] + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "total protein", + "mass concentration": { + "value": -0.0, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "TP2B", + "detection kit": "Standard", + "detection kit range": "4 - 120 g/L", + "flag": "< 4.00", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_7", + "measurement time": "2025-11-20T14:26:20+00:00", + "sample document": { + "sample identifier": "SAMPLE16" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "glycerol", + "mass concentration": { + "value": 0.0287, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "GLYB", + "detection kit": "Low", + "detection kit range": "0.1 - 10 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_8", + "measurement time": "2025-11-20T14:26:30+00:00", + "sample document": { + "sample identifier": "SAMPLE17" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "calcium", + "mass concentration": { + "value": 0.01319, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "CA2B", + "detection kit": "Standard", + "detection kit range": "0.2 - 5 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_9", + "measurement time": "2025-11-20T14:26:41+00:00", + "sample document": { + "sample identifier": "SAMPLE18" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "magnesium", + "mass concentration": { + "value": 0.03137, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "MG2B", + "detection kit": "Standard", + "detection kit range": "0.1 - 2.5 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_10", + "measurement time": "2025-11-20T14:31:42+00:00", + "sample document": { + "sample identifier": "SAMPLE19" + }, + "error aggregate document": { + "error document": [ + { + "error": "unknown", + "error feature": "asparagine - Low" + } + ] + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "asparagine", + "mass concentration": { + "value": -0.0, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "ASNLB", + "detection kit": "Low", + "detection kit range": "0.1 - 1 mmol/L", + "flag": "unknown", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_11", + "measurement time": "2025-11-20T14:23:11+00:00", + "sample document": { + "sample identifier": "SAMPLE2" + }, + "error aggregate document": { + "error document": [ + { + "error": "< 10.04", + "error feature": "acetate - Standard" + } + ] + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "acetate", + "mass concentration": { + "value": -0.0, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "AC2B", + "detection kit": "Standard", + "detection kit range": "0.25 - 38.9 mmol/L", + "flag": "< 10.04", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_12", + "measurement time": "2025-11-20T14:36:07+00:00", + "sample document": { + "sample identifier": "SAMPLE20" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "ldh", + "molar concentration": { + "value": 46.963573, + "unit": "mmol/L" + }, + "custom information document": { + "analyte code": "LDH2B", + "detection kit": "Standard", + "detection kit range": "20 - 1000 U/L", + "flag": "verification", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_13", + "measurement time": "2025-11-20T14:23:29+00:00", + "sample document": { + "sample identifier": "SAMPLE3" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "aspartate", + "mass concentration": { + "value": 0.434, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "ASPB", + "detection kit": "Standard", + "detection kit range": "0.1 - 9 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_14", + "measurement time": "2025-11-20T14:23:40+00:00", + "sample document": { + "sample identifier": "SAMPLE4" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "glucose", + "mass concentration": { + "value": 3.303, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "GLC3B", + "detection kit": "Standard", + "detection kit range": "0.111 - 41.63 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_15", + "measurement time": "2025-11-20T14:23:51+00:00", + "sample document": { + "sample identifier": "SAMPLE5" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "glutamate", + "molar concentration": { + "value": 3.37, + "unit": "mmol/L" + }, + "custom information document": { + "analyte code": "GLU2B", + "detection kit": "Standard", + "detection kit range": "0.099 - 10.2 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_16", + "measurement time": "2025-11-20T14:24:01+00:00", + "sample document": { + "sample identifier": "SAMPLE6" + }, + "error aggregate document": { + "error document": [ + { + "error": "< 80", + "error feature": "IgG human - Standard" + } + ] + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "IgG human", + "mass concentration": { + "value": -0.0, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "IGGHB", + "detection kit": "Standard", + "detection kit range": "0.000533 - 0.01067 mmol/L", + "flag": "< 80", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_17", + "measurement time": "2025-11-20T14:24:13+00:00", + "sample document": { + "sample identifier": "SAMPLE7" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "lactate", + "mass concentration": { + "value": 1.014, + "unit": "g/L" + }, + "custom information document": { + "analyte code": "LAC2B", + "detection kit": "Standard", + "detection kit range": "0.0444 - 15.55 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_18", + "measurement time": "2025-11-20T14:24:33+00:00", + "sample document": { + "sample identifier": "SAMPLE8" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "ldh", + "molar concentration": { + "value": 45.743471, + "unit": "mmol/L" + }, + "custom information document": { + "analyte code": "LDH2D", + "detection kit": "High with Pre - Dilution", + "detection kit range": "200 - 10000 U/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + }, + { + "measurement aggregate document": { + "measurement document": [ + { + "device control aggregate document": { + "device control document": [ + { + "device type": "solution-analyzer" + } + ] + }, + "measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_19", + "measurement time": "2025-11-20T14:24:54+00:00", + "sample document": { + "sample identifier": "SAMPLE9" + }, + "analyte aggregate document": { + "analyte document": [ + { + "analyte name": "sodium", + "molar concentration": { + "value": 104.3, + "unit": "mmol/L" + }, + "custom information document": { + "analyte code": "NAB", + "detection kit": "Standard", + "detection kit range": "50 - 275 mmol/L", + "record type": "40" + } + } + ] + } + } + ], + "data processing time": "2025-11-20T14:51:33+00:00" + }, + "analyst": "admin" + } + ], + "data system document": { + "ASM file identifier": "roche_cedex_bioht_v7_example_01.json", + "data system instance identifier": "N/A", + "file name": "roche_cedex_bioht_v7_example_01.txt", + "UNC path": "tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_v7_example_01.txt", + "ASM converter name": "allotropy_roche_cedex_bioht", + "ASM converter version": "0.1.111", + "software name": "CEDEX BIO HT", + "software version": "7.0.0.2410 (2410)" + }, + "device system document": { + "device identifier": "N/A", + "equipment serial number": "600086", + "model number": "CEDEX BIO HT" + } + } +} diff --git a/tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_v7_example_01.txt b/tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_v7_example_01.txt new file mode 100644 index 000000000..1400c654e --- /dev/null +++ b/tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_v7_example_01.txt @@ -0,0 +1,21 @@ +0 2025-11-20 14:51:33 #ARC-FILE# 1.1a 2025-11-20 2025-11-20 CEDEX BIO HT 600086 7.0.0.2410 (2410) admin +40 2025-11-20 14:21:53 SAMPLE1 SAM GLN2B mmol/L 0.241 0.01568 R +40 2025-11-20 14:23:11 SAMPLE2 SAM AC2B mg/L < TEST RNG < 10.04 0.00462 R +40 2025-11-20 14:23:29 SAMPLE3 SAM ASPB g/L 0.434 0.26964 R +40 2025-11-20 14:23:40 SAMPLE4 SAM GLC3B g/L 3.303 0.54259 R +40 2025-11-20 14:23:51 SAMPLE5 SAM GLU2B mmol/L 3.37 0.22482 R +40 2025-11-20 14:24:01 SAMPLE6 SAM IGGHB mg/L < TEST RNG < 80 0.00193 R +40 2025-11-20 14:24:13 SAMPLE7 SAM LAC2B g/L 1.014 0.79162 R +40 2025-11-20 14:24:33 SAMPLE8 SAM LDH2D U/L 2739.13 0.01997 R +40 2025-11-20 14:24:54 SAMPLE9 SAM NAB mmol/L 104.3 0.17794 R +40 2025-11-20 14:25:05 SAMPLE10 SAM NH3B mg/L 136.229 0.28925 R +40 2025-11-20 14:25:16 SAMPLE11 SAM PHO2B mg/L 662.70 0.87608 R +40 2025-11-20 14:25:26 SAMPLE12 SAM PYRB mg/L 29.335 0.02394 R +40 2025-11-20 14:25:37 SAMPLE13 SAM KB mmol/L 10.62 0.10378 R +40 2025-11-20 14:25:47 SAMPLE14 SAM FE2D mg/L 85.48 0.09319 R +40 2025-11-20 14:26:09 SAMPLE15 SAM TP2B g/L < TEST RNG < 4.00 0.02903 R +40 2025-11-20 14:26:20 SAMPLE16 SAM GLYB mg/L 28.70 0.01895 R +40 2025-11-20 14:26:30 SAMPLE17 SAM CA2B mg/L 13.19 0.01969 R +40 2025-11-20 14:26:41 SAMPLE18 SAM MG2B mg/L 31.37 -0.0202 R +40 2025-11-20 14:31:42 SAMPLE19 SAM ASNLB g/L > TEST RNG > 0.264 0.16674 R +40 2025-11-20 14:36:07 SAMPLE20 SAM LDH2B U/L v 2812.19 0.02007 R \ No newline at end of file