Skip to main content

code_systems

Canonical code-system identifiers, shared across EHR backends.

Coding.system is compared by exact string equality wherever criteria are matched (see _matching_coding in bitfount.steps.criteria_matching.codes) — there is no normalisation step. A criterion pinned to a code_system therefore only matches entries whose querier emitted that same string, so every backend has to agree on one spelling per system or the same criterion silently fails against one of them.

These URIs are the agreed spelling. FHIR R4 servers emit them natively, so a FHIR-backed querier gets them for free by passing Coding.system through; a non-FHIR backend (NextGen Enterprise, whose JSON carries no system URI at all) maps its own fields onto them instead.

NextGenPatientQuerier.get_patient_conditions and get_patient_allergies both emit ICD_10_SYSTEM_IDENTIFIER (rather than the short form "icd10"), so a criterion pinned to a code_system matches the same condition or allergy from either NextGen or a FHIR R4 server.

Module​

Global variables​

  • CCD_ACUITY_CODE : Final[str] - The code, under CCD_ACUITY_SYSTEM, that marks a CCD-sourced reading.
  • CCD_ACUITY_SYSTEM : Final[str] - Bitfount-minted system marking a visual acuity read from a C-CDA document.

    A reading parsed from a CCD carries this coding last. A criterion or reader that wants only CCD-sourced readings matches on it, and another provider's LOINC 28631-0 is never mistaken for one.

  • CDA_CODE_SYSTEM_NAMES : Final[Mapping[str, str]] - C-CDA codeSystemName to canonical URI, for a code with no known OID.

    Keys are upper case with spaces, hyphens and underscores removed, so SNOMED CT and SNOMED-CT both read as SNOMEDCT.

  • CDA_CODE_SYSTEM_OIDS : Final[Mapping[str, str]] - HL7 OID to canonical URI, for the codeSystem of a C-CDA code.

    A CDA document names a code's system by OID, where FHIR uses a URI. An OID not listed here is kept as the coding's system as written.

  • CODE_SYSTEM_TO_IDENTIFIER : dict[str, str] - Short name to canonical URI, for callers that accept a short name.

    Used to build FHIR system|code search parameters, and to resolve a short-form code_system supplied in task config. Not applied to codings a querier emits — those carry the URI directly.

  • IDENTIFIER_TO_CODE_SYSTEM : Final[Mapping[str, str]] - Canonical URI to short name: CODE_SYSTEM_TO_IDENTIFIER inverted.
  • NDC_SYSTEM_IDENTIFIER : Final[str] - FDA National Drug Code.

    A code identifies one package of one product from one labeler, so a drug has many, and they churn: a product relisted under a new labeler gets new ones and the old codes leave the FDA directory (NextGen's FDB catalogue still carries some of those). Prefer RXNORM_SYSTEM_IDENTIFIER, whose concept for a given drug and strength is stable, and treat NDC as a last resort for an entry carrying nothing else.

    NextGen emits the 11-digit normalised form without hyphens (00378718505); the FDA directory publishes hyphenated segments (0378-7185-05). Codes are passed through as the source gives them — the original segmentation cannot be recovered from an 11-digit string — so a consumer comparing across the two forms must normalise first.

  • VISUAL_ACUITY_STUDY_CODE : Final[str] - LOINC "Visual acuity study", which the CCD parser reads as an acuity.

    A generic code: it names neither the eye nor whether the reading was best-corrected. Seen on the acuity readings of one Nextech site's CCDs; other sites may use another code, or none.