Repository navigation
fix: NovaBio Flex2 - do not emit measurements that have no measured value CUST-12697 - #1278
Open
ajcariaga16 wants to merge 1 commit into
Open
ajcariaga16 wants to merge 1 commit into
ajcariaga16 wants to merge 1 commit into
Conversation
…alue A detection measurement was emitted whenever any mapped property was set, including unit strings from the file's unit row and cell density dilution settings. Rows without cell counts then produced an empty cell-counting measurement that fails ASM schema validation (viability and viable cell density are required), aborting the whole file. Only emit a measurement when at least one measured value of its detection type is present; units, data processing settings and the pH measurement temperature alone do not count, and an empty analyte list counts as no value. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ajcariaga16
marked this pull request as ready for review
October 19, 2026 14:54
nathan-stender
approved these changes
Oct 20, 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
Converting a NovaBio BioProfile Flex2
SampleResultsCSV still fails schema validation after #1261 whenever a row has no cell counts but either (a) aCell Density Dilutionvalue, or (b) the file has a unit row, which sets the cell density / PO2 / PCO2 unit strings on every sample. Reported by a customer (CUST-12475, follow-up to the pH-only failure fixed in #1261).Root cause
_get_measurements()emitted a measurement for a detection type whenever any of its mapped properties was non-None:That includes
*_unitfields and the data processing fields (cell_type_processing_method,cell_density_dilution_factor), none of which are measured values. A chemistry-only row then produced a cell-counting measurement with no processed data (or only acell density dilution factor), and the cell-counting schema requiresviability (cell counter)andviable cell density (cell counter):An empty analyte list (
[]) was also counted as a value, producing a metabolite measurement with no analyte document.Fix
Add
MEASURED_PROPERTIES_BY_DETECTION_TYPElisting the measured-value properties of each detection type, and only emit a measurement when at least one of them is present. This generalizes the pH-only guard from #1261 (REQUIRED_PROPERTY_BY_DETECTION_TYPE), which it replaces: pH remains the only measured property ofph-detection, since vessel temperature is the temperature at which pH was measured rather than a measurand.Behavior for rows that do have measured values is unchanged. A row with partial cell counts (e.g. total density without viability) still fails validation as before; that is inconsistent data and dropping it silently seemed worse than a clear error.
Testing
SampleResultsT000000001C2026-01-01_120000.csv(anonymized, derived from the customer file) with a unit row and three rows: full cell counts, chemistry-only, and dilution-setting-only. Without the fix it fails with the error above; expected JSON generated with--overwrite.hatch run test_all.py3.10:pytest tests: 1538 passed.ruff,black --checkandmypyclean on the changed files.🤖 Generated with Claude Code