@cosyte/terminology
@cosyte/terminology is our terminology engine for US healthcare code systems. It answers the FHIR
terminology questions ($translate, $lookup, $validate-code and $expand), validates UCUM units,
applies the ICD-9-CM and ICD-10-CM GEMs and the SNOMED CT to ICD-10-CM map, and navigates the RxNorm
drug graph, over code systems, value sets and maps you supply. It runs in your Node.js process, with
no terminology server and no runtime dependencies.
import { resolveSystem, isUnknownSystem } from "@cosyte/terminology";
const system = resolveSystem("2.16.840.1.113883.6.1");
isUnknownSystem(system) ? "unknown" : system.url; // => "http://loinc.org"
Who it is for
Developers who already hold codes (off an HL7 v2 message, a C-CDA document or a FHIR resource) and need to answer questions about them in code: which system is this, what does this code mean, is it allowed in this field, what is it in the other classification, what is in this drug. It is built for the case where a wrong answer is worse than no answer.
What it will not do
- Guess. An unknown system, an unmapped code, a value set it cannot fully evaluate and an
RXCUIthat is not in your release each come back as a typed result, never as a plausible answer. The engine model explains why. - Run a map backwards. A directional map is read only in the direction its author wrote it.
- Convert magnitudes. UCUM support is recognition and comparison of units, never
mg/dLtommol/L. - Ship a code-system release. SNOMED CT, CPT, LOINC, UMLS and RxNorm releases, the CMS GEM files, the SNOMED CT to ICD-10-CM refset and VSAC value sets are yours to supply, under the terms their stewards set.
- Parse a wire format. It reads FHIR resources and the standard release files; the HL7 v2, C-CDA and FHIR parsers are separate packages.
The package is not content-free: it bundles the UCUM unit table, the code-system identities, the
SNOMED CT concepts the complex-map resolver names, and RxNorm's relationship and term-type names
(RELA, RELA_INVERSE, TERM_TYPES).
What is bundled lists each, with its copyright.
Status
The 0.1 line, published on npm. Below 1.0.0 a breaking change ships in a new minor version, never
a patch, and the changelog says what broke. The diagnostic and fatal codes are part of that
contract: renaming or removing one is a breaking change.
Where to go next
- Installation, then the quickstart for a first result.
- The tutorial, check a lab result, walks one coded result through every layer.
- The how-to guides, one task each: resolve a code system, translate a code, load a code system, look up a code, expand a value set, check value set membership, validate UCUM units, map with the GEMs, map SNOMED CT to ICD-10-CM, navigate the RxNorm graph, find RxNorm concepts, and handle errors and warnings.
- The API reference, generated from the source, covers every export.