Skip to content

fix(hts): bundle UCUM ucum-essence.xml instead of relying on THO#176

Merged
smunini merged 1 commit into
mainfrom
fix/hts-bundle-ucum
Jun 17, 2026
Merged

fix(hts): bundle UCUM ucum-essence.xml instead of relying on THO#176
smunini merged 1 commit into
mainfrom
fix/hts-bundle-ucum

Conversation

@smunini

@smunini smunini commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Problem

The deployed HTS (hts.heliossoftware.com) has no UCUM code system: $lookup/$validate-code against http://unitsofmeasure.org return not-found. The bundle download script claimed UCUM was "bundled in THO," but the HL7 THO tarball ships only the UCUM ValueSets (ucum-units, ucum-common) and a NamingSystem — it never defines the UCUM CodeSystem. So importing THO alone leaves http://unitsofmeasure.org with zero concepts.

Fix

  • crates/hts/scripts/download-bundled-terminologies.sh: replace the no-op "bundled in THO" UCUM step with an actual fetch of the canonical ucum-essence.xml (pinned UCUM_VERSION=v2.2), and correct the misleading comment.
  • Check in the resulting crates/hts/terminology-data/ucum-essence-v2.2.xml (82 KB, well under GitHub's 100 MB limit). The filename keeps ucum/essence so HTS bootstrap auto-detects ImportFormat::Ucum.

Verification

  • Download URL returns 200; correct namespace http://unitsofmeasure.org/ucum-essence, 24 prefixes / 7 base-units / 305 units.
  • bash -n passes on the script.
  • Real dry-run through the hts binary:
    [ucum] dry-run — 336 codes parsed (version 2.2), no DB writes
    Import complete: 1 CodeSystems, 336 concepts
    

Once this lands and HTS redeploys, http://unitsofmeasure.org will resolve and UCUM unit $lookup/$validate-code will work.

Note

Unrelated to the NDC gap (also currently missing on the server) — that is already fixed by 0788575 and just needs the redeploy. UCUM was a separate gap in the bundle.

The HL7 THO tarball ships only the UCUM ValueSets (ucum-units, ucum-common)
and a NamingSystem — it does not define the UCUM CodeSystem. As a result
http://unitsofmeasure.org had zero concepts loaded, so $lookup and
$validate-code against UCUM units returned not-found.

Replace the no-op 'bundled in THO' UCUM step in the download script with an
actual fetch of the canonical ucum-essence.xml (pinned UCUM_VERSION=v2.2),
and check in the resulting ucum-essence-v2.2.xml. The filename keeps
'ucum'/'essence' so HTS bootstrap auto-detects ImportFormat::Ucum.

Verified via 'hts import --dry-run': 336 codes parsed (24 prefixes,
7 base-units, 305 units), 1 CodeSystem.
@claude

claude Bot commented Jun 17, 2026

Copy link
Copy Markdown

Code review

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

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@smunini smunini merged commit a6e844d into main Jun 17, 2026
19 checks passed
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