Skip to content

fix: Handle dilutions, replicate measurements, and mmol/l unit in Roche Cedex Bio HT#1244

Merged
nathan-stender merged 2 commits into
mainfrom
fix-cedex-bioht-dilution-replicates
Jul 23, 2026
Merged

fix: Handle dilutions, replicate measurements, and mmol/l unit in Roche Cedex Bio HT#1244
nathan-stender merged 2 commits into
mainfrom
fix-cedex-bioht-dilution-replicates

Conversation

@nathan-stender

Copy link
Copy Markdown
Collaborator

Summary

A V6/V7 Roche Cedex Bio HT export failed to parse. Three distinct issues surfaced, each fixed here:

  1. Dilutions treated as duplicates. The same analyte can be measured at multiple dilutions within one sample (e.g. IgG human undiluted 3.933 and at 1/56.174, a minute apart). The dilution factor lived in the previously-discarded col8. It's now named dilution factor, threaded through RawMeasurement, and included in the analyte grouping key so the two measurements no longer collide. The factor is also preserved in the analyte custom information document.

  2. Genuine replicate measurements raised an error. The same analyte can be re-measured (a second round) inside the 1-hour grouping window (e.g. glucose 15.17 then 15.43 ~43 min later). Instead of raising Duplicate measurement, we now split the later measurement into a new group keyed by its own time — realizing the improvement the previous code's comment explicitly anticipated.

  3. Lowercase mmol/l unit. A handful of rows report the unit as mmol/l; it's now normalized to mmol/L via UNIT_CONVERSIONS.

Changes

  • constants.py: rename col8dilution factor in DATA_HEADER_V6_V7; add mmol/lmmol/L to UNIT_CONVERSIONS.
  • roche_cedex_bioht_structure.py: add dilution_factor to RawMeasurement, include it in the grouping key and custom info; split on duplicate instead of raising (removes now-unused AllotropyParserError).
  • Updated affected unit tests; added test_create_measurements_same_analyte_different_dilution and reworked the duplicate test to assert the split behavior.
  • Added trimmed regression file roche_cedex_bioht_v7_dilution_and_replicates.txt (+ expected JSON) covering all three cases.

Testing

  • Full 2.4MB source export now parses (5864 groups).
  • All 22 roche_cedex_bioht tests pass; hatch run lint (ruff, black, mypy) clean.

🤖 Generated with Claude Code

…he Cedex Bio HT

A V6/V7 Cedex Bio HT export failed to parse for three reasons:

- The same analyte can be measured at multiple dilutions within a sample.
  The dilution factor (previously the discarded "col8") is now named and
  included in the analyte grouping key, so an undiluted and a diluted
  measurement are no longer treated as a duplicate. The factor is also
  preserved in the analyte custom information document.
- The same analyte can be genuinely re-measured (a second round) inside the
  1-hour grouping window. Instead of raising "Duplicate measurement", we now
  split the second measurement into a new group keyed by its own time,
  realizing the improvement anticipated by the previous code's comment.
- Some rows report the unit as lowercase "mmol/l"; it is now normalized to
  "mmol/L" via UNIT_CONVERSIONS.

Adds a trimmed regression test file covering all three cases.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nathan-stender
nathan-stender requested review from a team and slopez-b as code owners July 23, 2026 18:21
@nathan-stender
nathan-stender requested a review from tamargrey July 23, 2026 18:21
@nathan-stender
nathan-stender merged commit 1b963ec into main Jul 23, 2026
9 checks passed
@nathan-stender
nathan-stender deleted the fix-cedex-bioht-dilution-replicates branch July 23, 2026 20:31
nathan-stender added a commit that referenced this pull request Jul 24, 2026
### Fixed

- Support EnVision calculated formulas without a name prefix (#1246)
- Handle dilutions, replicate measurements, and mmol/l unit in Roche
Cedex Bio HT (#1244)
- Handle multiple spaces in Raw Data line for BMG MARS parser (#1243)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants