Problem
Reference age domains are currently encoded in several places: hard-coded checks in reference modules, age-grid constants, table contents, and hybrid-reference selection logic. These can drift. Issue #100 exposed one example in the UK Trisomy 21 BMI reference: the source and runtime tables end at 18.92 years, while code rejected ages above 18.82.
The canonical source collection is being developed in rcpch/growth-references. It is incomplete, but should ultimately supply the source data and applicability metadata from which runtime tables are generated.
Goal
Make accepted age domains data-driven for every reference, measurement, and sex while preserving clinically intentional boundaries and overlap precedence.
Raw first/last table coordinates alone are not always the clinical domain. WHO and UK-WHO tables contain overlap or source rows outside the interval owned by that segment, and hybrid references have policy-based boundary precedence. The model must therefore distinguish:
- observed table extent;
- clinically supported applicability interval;
- inclusive or exclusive endpoints;
- overlap ownership and precedence;
- measurement-specific and sex-specific availability;
- interpolation allowed only within a selected series, never extrapolation beyond it.
Proposed approach
- Inventory the observed minimum and maximum ages for every runtime LMS series by reference segment, measurement, and sex.
- Add explicit machine-readable applicability metadata alongside each canonical source reference in
rcpch/growth-references.
- Generate or validate runtime JSON and age-grid metadata from those canonical sources rather than manually copying independent literals.
- Centralise reference selection and domain validation around this metadata.
- Retain explicit policy for hybrid and overlapping references, including exact two-year and five-year ownership rules.
- Fail build-time validation when a declared applicability interval lies outside the available table extent or when generated runtime data drift from the canonical source.
Acceptance criteria
- No measurement-specific age boundary is duplicated as an unexplained literal in calculation code.
- Every reference/measurement/sex combination has a declared applicability interval and source provenance.
- Exact first and last accepted ages succeed;
math.nextafter() immediately outside each endpoint fails with a specific error.
- Interpolation is permitted only between available points in the selected series.
- Hybrid-reference overlap behavior remains explicitly tested and unchanged unless separately clinically approved.
- Runtime packaged tables can be reproducibly generated or verified against
rcpch/growth-references.
Related
- Immediate T21 BMI boundary correction: forthcoming PR for the confirmed 18.92-year endpoint.
rcpch/growth-references/trisomy21/UKReference/LMS_Downs.xlsx is the checked source for that correction.
- Existing WHO and UK-WHO exact-boundary tests provide a pattern for endpoint coverage.
Problem
Reference age domains are currently encoded in several places: hard-coded checks in reference modules, age-grid constants, table contents, and hybrid-reference selection logic. These can drift. Issue #100 exposed one example in the UK Trisomy 21 BMI reference: the source and runtime tables end at 18.92 years, while code rejected ages above 18.82.
The canonical source collection is being developed in
rcpch/growth-references. It is incomplete, but should ultimately supply the source data and applicability metadata from which runtime tables are generated.Goal
Make accepted age domains data-driven for every reference, measurement, and sex while preserving clinically intentional boundaries and overlap precedence.
Raw first/last table coordinates alone are not always the clinical domain. WHO and UK-WHO tables contain overlap or source rows outside the interval owned by that segment, and hybrid references have policy-based boundary precedence. The model must therefore distinguish:
Proposed approach
rcpch/growth-references.Acceptance criteria
math.nextafter()immediately outside each endpoint fails with a specific error.rcpch/growth-references.Related
rcpch/growth-references/trisomy21/UKReference/LMS_Downs.xlsxis the checked source for that correction.