Skip to content

fix(fhirpath): pass new upstream quantity ordering cases - #2251

Merged
smunini merged 1 commit into
mainfrom
fix/fhirpath-upstream-quantity-ordering
Oct 27, 2026
Merged

smunini merged 1 commit into
mainfrom
fix/fhirpath-upstream-quantity-ordering

Conversation

@smunini

@smunini smunini commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

The "Test FHIRPath" gate went red on every PR (e.g. #2248, run). The cause is FHIR/fhir-test-cases 7da4308 (2026-10-19), which added 13 cases on ordering quantities with different units. 4 of them failed:

  • testLessThan29 1 year < 2 months
  • testLessOrEqual28 1 year <= 2 days
  • testGreaterThan28 1 year > 1 'a'
  • testGreaterThan29 1 year > 2 months

6 more were SKIPPED because evaluation raised errors (1 'kg' < 2 'm' and the unit-text Parameters.parameter[n].value cases).

Changes

  • ucum::is_calendar_year_or_month_unorderable: comparing a calendar year/month with any other unit gives empty, because calendar years and months have no fixed length. year vs years still compares as the same unit. Durations of a week or less still order, so the existing 6 days < 1 week cases still pass.
  • compare_inequality: units that are not commensurable now give empty instead of a TypeError, which matches =.
  • compare_inequality: typed FHIR Quantity elements (Quantity, Age, Duration, ...) are compared as System.Quantity via fhir_quantity_from_object. A quantity with only a unit label now compares with a coded one that has the same unit.
  • The 13 new cases are added to the local r4/r5 test corpora, along with the parameters-quantity-unit-text.json input.

Testing

  • All 13 new cases pass in r4_tests and r5_tests.
  • cargo test -p helios-fhirpath --features R4,R5: all test binaries pass.
  • cargo clippy -p helios-fhirpath --features R4,R5 --all-targets with the CI flags: clean.

FHIR/fhir-test-cases 7da4308 (2026-10-19) added 13 cases for ordering
quantities with different units, and the "Test FHIRPath" gate went red
with 4 undeclared failures plus 6 cases skipped on evaluation errors.

- A calendar year/month compared with any other unit (`1 year < 2 months`,
  `1 year <= 2 days`, `1 year > 1 'a'`) is empty: calendar years and
  months have no fixed length. The singular and plural keyword are the
  same unit, and durations of a week or less still order.
- Quantities whose units are not commensurable (`1 'kg' < 2 'm'`) order
  to empty instead of raising a type error, matching `=`.
- FHIR Quantity elements order as System.Quantity, so a unit-text-only
  quantity compares with a coded one of the same unit.

Vendor the new cases and parameters-quantity-unit-text input into the
local r4/r5 corpora.
@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@smunini
smunini merged commit 60ff8f4 into main Oct 27, 2026
10 checks passed
@smunini
smunini deleted the fix/fhirpath-upstream-quantity-ordering branch October 27, 2026 18:49
@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

1 participant