fix: Handle dilutions, replicate measurements, and mmol/l unit in Roche Cedex Bio HT#1244
Merged
Merged
Conversation
…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>
stephenworlow
approved these changes
Jul 23, 2026
nathan-stender
added a commit
that referenced
this pull request
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A V6/V7 Roche Cedex Bio HT export failed to parse. Three distinct issues surfaced, each fixed here:
Dilutions treated as duplicates. The same analyte can be measured at multiple dilutions within one sample (e.g. IgG human undiluted
3.933and at1/5→6.174, a minute apart). The dilution factor lived in the previously-discardedcol8. It's now nameddilution factor, threaded throughRawMeasurement, 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.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.17then15.43~43 min later). Instead of raisingDuplicate 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.Lowercase
mmol/lunit. A handful of rows report the unit asmmol/l; it's now normalized tommol/LviaUNIT_CONVERSIONS.Changes
constants.py: renamecol8→dilution factorinDATA_HEADER_V6_V7; addmmol/l→mmol/LtoUNIT_CONVERSIONS.roche_cedex_bioht_structure.py: adddilution_factortoRawMeasurement, include it in the grouping key and custom info; split on duplicate instead of raising (removes now-unusedAllotropyParserError).test_create_measurements_same_analyte_different_dilutionand reworked the duplicate test to assert the split behavior.roche_cedex_bioht_v7_dilution_and_replicates.txt(+ expected JSON) covering all three cases.Testing
roche_cedex_biohttests pass;hatch run lint(ruff, black, mypy) clean.🤖 Generated with Claude Code