Skip to content

Commit ef8a064

Browse files
feat: Roche Cedex BioHT - Added support for mg/L (#1028)
Co-authored-by: Nathan Stender <nathan.stender@benchling.com>
1 parent ac47580 commit ef8a064

3 files changed

Lines changed: 327 additions & 2 deletions

File tree

src/allotropy/parsers/roche_cedex_bioht/roche_cedex_bioht_structure.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,27 @@ def create(data: SeriesData) -> RawMeasurement:
6464
if BELOW_TEST_RANGE in error
6565
else data.get(float, "concentration value", NaN)
6666
)
67+
68+
value, unit = RawMeasurement._get_value_and_unit(
69+
concentration_value, data[str, "concentration unit"]
70+
)
71+
6772
return RawMeasurement(
6873
data[str, "analyte name"],
6974
data[str, "measurement time"],
70-
concentration_value,
71-
data[str, "concentration unit"],
75+
value,
76+
unit,
7277
error or None,
7378
)
7479

80+
@staticmethod
81+
def _get_value_and_unit(value: JsonFloat, unit: str) -> tuple[JsonFloat, str]:
82+
if isinstance(value, int | float):
83+
if unit == "mg/L":
84+
return value / 1000, "g/L"
85+
86+
return value, unit
87+
7588

7689
def create_measurements(data: pd.DataFrame) -> dict[str, dict[str, RawMeasurement]]:
7790
measurements = sorted(
Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
{
2+
"$asm.manifest": "http://purl.allotrope.org/manifests/solution-analyzer/REC/2024/09/solution-analyzer.manifest",
3+
"solution analyzer aggregate document": {
4+
"solution analyzer document": [
5+
{
6+
"measurement aggregate document": {
7+
"measurement document": [
8+
{
9+
"device control aggregate document": {
10+
"device control document": [
11+
{
12+
"device type": "solution-analyzer"
13+
}
14+
]
15+
},
16+
"measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_0",
17+
"measurement time": "2023-09-15T16:55:51+00:00",
18+
"sample document": {
19+
"sample identifier": "SMPL1"
20+
},
21+
"absorbance": {
22+
"value": 6.32,
23+
"unit": "mAU"
24+
}
25+
},
26+
{
27+
"device control aggregate document": {
28+
"device control document": [
29+
{
30+
"device type": "solution-analyzer"
31+
}
32+
]
33+
},
34+
"measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_1",
35+
"measurement time": "2023-09-15T16:55:51+00:00",
36+
"sample document": {
37+
"sample identifier": "SMPL1"
38+
},
39+
"analyte aggregate document": {
40+
"analyte document": [
41+
{
42+
"analyte name": "ammonia",
43+
"molar concentration": {
44+
"value": 1.846,
45+
"unit": "mmol/L"
46+
}
47+
},
48+
{
49+
"analyte name": "glutamine",
50+
"molar concentration": {
51+
"value": 2.45,
52+
"unit": "mmol/L"
53+
}
54+
},
55+
{
56+
"analyte name": "lactate",
57+
"mass concentration": {
58+
"value": 2e-05,
59+
"unit": "g/L"
60+
}
61+
},
62+
{
63+
"analyte name": "ldh",
64+
"molar concentration": {
65+
"value": 1.471103,
66+
"unit": "mmol/L"
67+
}
68+
},
69+
{
70+
"analyte name": "total protein",
71+
"mass concentration": {
72+
"value": 0.0046,
73+
"unit": "g/L"
74+
}
75+
}
76+
]
77+
}
78+
}
79+
],
80+
"data processing time": "2023-09-17T13:04:06+00:00"
81+
},
82+
"analyst": "ADMIN"
83+
},
84+
{
85+
"measurement aggregate document": {
86+
"measurement document": [
87+
{
88+
"device control aggregate document": {
89+
"device control document": [
90+
{
91+
"device type": "solution-analyzer"
92+
}
93+
]
94+
},
95+
"measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_2",
96+
"measurement time": "2023-09-15T16:56:58+00:00",
97+
"sample document": {
98+
"sample identifier": "SMPL2"
99+
},
100+
"analyte aggregate document": {
101+
"analyte document": [
102+
{
103+
"analyte name": "ammonia",
104+
"molar concentration": {
105+
"value": 1.87,
106+
"unit": "mmol/L"
107+
}
108+
},
109+
{
110+
"analyte name": "glutamine",
111+
"molar concentration": {
112+
"value": 2.4,
113+
"unit": "mmol/L"
114+
}
115+
},
116+
{
117+
"analyte name": "total protein",
118+
"mass concentration": {
119+
"value": 0.0047,
120+
"unit": "g/L"
121+
}
122+
}
123+
]
124+
}
125+
}
126+
],
127+
"data processing time": "2023-09-17T13:04:06+00:00"
128+
},
129+
"analyst": "ADMIN"
130+
},
131+
{
132+
"measurement aggregate document": {
133+
"measurement document": [
134+
{
135+
"device control aggregate document": {
136+
"device control document": [
137+
{
138+
"device type": "solution-analyzer"
139+
}
140+
]
141+
},
142+
"measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_3",
143+
"measurement time": "2023-09-15T16:58:34+00:00",
144+
"sample document": {
145+
"sample identifier": "SMPL3"
146+
},
147+
"absorbance": {
148+
"value": 6.71,
149+
"unit": "mAU"
150+
}
151+
},
152+
{
153+
"device control aggregate document": {
154+
"device control document": [
155+
{
156+
"device type": "solution-analyzer"
157+
}
158+
]
159+
},
160+
"measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_4",
161+
"measurement time": "2023-09-15T16:58:34+00:00",
162+
"sample document": {
163+
"sample identifier": "SMPL3"
164+
},
165+
"analyte aggregate document": {
166+
"analyte document": [
167+
{
168+
"analyte name": "ammonia",
169+
"molar concentration": {
170+
"value": 1.817,
171+
"unit": "mmol/L"
172+
}
173+
},
174+
{
175+
"analyte name": "glutamine",
176+
"molar concentration": {
177+
"value": 2.43,
178+
"unit": "mmol/L"
179+
}
180+
},
181+
{
182+
"analyte name": "total protein",
183+
"mass concentration": {
184+
"value": 4.8,
185+
"unit": "g/L"
186+
}
187+
}
188+
]
189+
}
190+
}
191+
],
192+
"data processing time": "2023-09-17T13:04:06+00:00"
193+
},
194+
"analyst": "ADMIN"
195+
},
196+
{
197+
"measurement aggregate document": {
198+
"measurement document": [
199+
{
200+
"device control aggregate document": {
201+
"device control document": [
202+
{
203+
"device type": "solution-analyzer"
204+
}
205+
]
206+
},
207+
"measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_5",
208+
"measurement time": "2023-09-16T10:12:10+00:00",
209+
"sample document": {
210+
"sample identifier": "SMPL4"
211+
},
212+
"absorbance": {
213+
"value": 4.09,
214+
"unit": "mAU"
215+
}
216+
},
217+
{
218+
"device control aggregate document": {
219+
"device control document": [
220+
{
221+
"device type": "solution-analyzer"
222+
}
223+
]
224+
},
225+
"measurement identifier": "ROCHE_CEDEX_BIOHT_TEST_ID_6",
226+
"measurement time": "2023-09-16T10:12:10+00:00",
227+
"sample document": {
228+
"sample identifier": "SMPL4"
229+
},
230+
"analyte aggregate document": {
231+
"analyte document": [
232+
{
233+
"analyte name": "ammonia",
234+
"molar concentration": {
235+
"value": 3.788,
236+
"unit": "mmol/L"
237+
}
238+
},
239+
{
240+
"analyte name": "glutamine",
241+
"molar concentration": {
242+
"value": 2.07,
243+
"unit": "mmol/L"
244+
}
245+
},
246+
{
247+
"analyte name": "lactate",
248+
"mass concentration": {
249+
"value": 0.00189,
250+
"unit": "g/L"
251+
}
252+
},
253+
{
254+
"analyte name": "ldh",
255+
"molar concentration": {
256+
"value": 5.591828,
257+
"unit": "mmol/L"
258+
}
259+
}
260+
]
261+
}
262+
}
263+
],
264+
"data processing time": "2023-09-17T13:04:06+00:00"
265+
},
266+
"analyst": "ADMIN"
267+
}
268+
],
269+
"data system document": {
270+
"ASM file identifier": "roche_cedex_bioht_example_with_mg_L.json",
271+
"data system instance identifier": "N/A",
272+
"file name": "roche_cedex_bioht_example_with_mg_L.txt",
273+
"UNC path": "tests/parsers/roche_cedex_bioht/testdata/roche_cedex_bioht_example_with_mg_L.txt",
274+
"ASM converter name": "allotropy_roche_cedex_bioht",
275+
"ASM converter version": "0.1.97",
276+
"software name": "CEDEX BIO HT",
277+
"software version": "6.0.0.1905 (1905)"
278+
},
279+
"device system document": {
280+
"device identifier": "N/A",
281+
"equipment serial number": "123456",
282+
"model number": "CEDEX BIO HT"
283+
}
284+
}
285+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
0 2023-09-17 13:04:06 #ARC-FILE# 1.1a 2021-05-01 2023-09-17 CEDEX BIO HT 123456 6.0.0.1905 (1905) ADMIN
2+
40 2023-09-15 16:55:51 SMPL1 SAM GLN2B mmol/L 2.45 0.17138 R
3+
40 2023-09-15 16:55:53 SMPL1 SAM ODB OD 6.32 1.05394 R
4+
40 2023-09-15 16:56:18 SMPL1 SAM LDH2B U/L 88.09 0.00728 R
5+
40 2023-09-15 16:56:26 SMPL1 SAM NH3B mmol/L 1.846 0.05333 R
6+
40 2023-09-15 16:56:37 SMPL1 SAM LAC2B mg/L 0.02 0.01567 R
7+
40 2023-09-15 16:56:48 SMPL1 SAM TP2LB mg/L 4.6 0.14883 R
8+
40 2023-09-15 16:56:58 SMPL2 SAM GLN2B mmol/L 2.40 0.16787 R
9+
40 2023-09-15 16:57:09 SMPL2 SAM ODB OD < TEST RNG 6.71 1.11766 R
10+
40 2023-09-15 16:57:19 SMPL2 SAM LDH2B U/L < TEST RNG < 20.00 0.00060 R
11+
40 2023-09-15 16:57:30 SMPL2 SAM NH3B mmol/L 1.870 0.05408 R
12+
40 2023-09-15 16:57:41 SMPL2 SAM LAC2B mg/L < TEST RNG < 0.00 0.00310 R
13+
40 2023-09-15 16:57:51 SMPL2 SAM TP2B mg/L < TEST RNG < 4.0 0.03322 R
14+
40 2023-09-15 16:58:02 SMPL2 SAM TP2D mg/L < TEST RNG < 40.0 0.02653 R
15+
40 2023-09-15 16:58:23 SMPL2 SAM TP2LB mg/L 4.7 0.15217 R
16+
40 2023-09-15 16:58:34 SMPL3 SAM GLN2B mmol/L 2.43 0.17049 R
17+
40 2023-09-15 16:58:45 SMPL3 SAM ODB OD 6.71 1.11813 R
18+
40 2023-09-15 16:58:55 SMPL3 SAM LDH2B U/L < TEST RNG < 20.00 0.00076 R
19+
40 2023-09-15 16:59:06 SMPL3 SAM NH3B mmol/L 1.817 0.05242 R
20+
40 2023-09-15 16:59:16 SMPL3 SAM LAC2B mg/L < TEST RNG < 0.00 0.00329 R
21+
40 2023-09-15 16:59:38 SMPL3 SAM TP2D mg/L < TEST RNG < 40.0 0.02702 R
22+
40 2023-09-15 17:00:52 SMPL3 SAM TP2LB g/L 4.8 0.15436 R
23+
40 2023-09-16 10:12:10 SMPL4 SAM GLN2B mmol/L 2.07 0.14503 R
24+
40 2023-09-16 10:12:12 SMPL4 SAM ODB OD 4.09 0.68160 R
25+
40 2023-09-16 10:13:29 SMPL4 SAM LDH2B U/L 334.84 0.02665 R
26+
40 2023-09-16 10:13:37 SMPL4 SAM NH3B mmol/L 3.788 0.11415 R
27+
40 2023-09-16 10:22:55 SMPL4 SAM LAC2B mg/L v 1.89 0.15187 R

0 commit comments

Comments
 (0)