Diagnostic and fatal codes
An outcome the engine cannot answer positively carries one of these codes; the one exception is
resolveSystem's unknown result (see TERM_SYSTEM_UNRECOGNIZED). The
codes are part of the public contract: renaming or removing one is a breaking change. Branch on the
code, never on a message. Each code is the same string as its key in DIAGNOSTIC_CODES or
FATAL_CODES.
- Diagnostic codes are returned, never thrown: on a typed result, on a concept's status, on an
expansion's diagnostics, or on a loaded model's
warnings. - Fatal codes are thrown, on a
TerminologyError, when a source cannot be used at all.
Handle errors and warnings shows how to handle each kind.
Diagnostic codes
TERM_TRANSLATE_UNMAPPED
- From:
translate, on aTranslateUnmappedresult (unmapped: true). - Means: the map has no target for the source code, or every target it declares is a
non-mapping (
unmatchedordisjoint). Any fallback the map declares is reported onmode, never applied. See translate a code.
TERM_SYSTEM_UNRECOGNIZED
- From: none in this release. The code names the outcome of
resolveSystemnot recognizing an identifier, but that result is{ unknown: true, input }with nocodefield. - Means: use it as the name for that outcome in your own records; test for the outcome itself with
isUnknownSystem. See resolve a code system.
TERM_RRF_MALFORMED_ROW
- From:
loadCodeSystemwithformat: "rrf", onwarnings. - Means: a row had too few columns to reach a configured column, or no code. The row was skipped.
TERM_CSV_MALFORMED
- From:
loadCodeSystemwithformat: "csv", onwarnings. - Means: a row had too few fields to reach a configured column, or a quoted field was still open at the end of the file. The row was skipped.
TERM_FIXED_WIDTH_MALFORMED
- From:
loadCodeSystemwithformat: "fixed-width", onwarnings. - Means: a line was too short to reach the code field, or its code field was blank. The line was skipped.
TERM_FHIR_CONCEPT_MALFORMED
- From:
loadCodeSystemwithformat: "fhir", onwarnings, withline0. - Means: a concept in the resource was not an object or had no
code. The concept was skipped; the rest of the resource loaded.
TERM_CODE_UNKNOWN
- From:
lookup, on aLookupUnknownresult (found: false), andvalidateCode, whenvalidisfalse. - Means: the code is not in the release you loaded. See look up a code.
TERM_CONCEPT_DEPRECATED
- From: a concept's
status.code, onlookup,validateCodeand the loaded concept. - Means: the release marks the concept deprecated: a LOINC-style
DEPRECATEDstatus, a FHIRinactiveordeprecatedproperty, or a FHIRstatusproperty other thanactive. The code is still found and valid; it is not current.
TERM_CONCEPT_HEADER_NOT_BILLABLE
- From: a concept's
status.code, when a fixed-width file's billable flag marks a header. - Means: the code is a classification header, such as an ICD-10-CM category, and not valid on a claim. It is still found and valid as a code.
TERM_VALUESET_CANNOT_EXPAND
- From:
expandandvalidateCodeInValueSet, ondiagnostics; and on aValueSetMemberUndeterminedresult (undetermined: true). - Means: a part of the value set could not be computed: a code system or referenced value set
you did not pass, a
regexorgeneralizesfilter, a component whose pinned version the release does not confirm, an active-only compose with no release to check activity against, or, for a membership check, a pre-computed expansion that is not whole and does not list the code. The expansion is a lower bound; the membership check is undetermined. See complete, incomplete and undetermined answers.
TERM_VALUESET_EXPANSION_TRUNCATED
- From:
expand, ondiagnostics, withpathexpansion.validateCodeInValueSetreports the same case asTERM_VALUESET_CANNOT_EXPAND, for a code the expansion does not list. - Means: the value set's pre-computed expansion is not whole: its
totalis larger than its entries, it is flagged too costly, or it is marked unclosed. Thedetailsays which.
TERM_VALUESET_ENUMERATED_CODE_UNDEFINED
- From:
expand, ondiagnostics, once per component. - Means: a component lists a code the release you passed for its system does not define, so the
code was left out. The answer stays
complete: true, andvalidateCodeInValueSetdecides that code is not a member.
TERM_UCUM_INVALID
- From:
validateUcum, whenvalidisfalse. - Means: the string is not a valid case-sensitive UCUM unit: it does not parse, or it names an atom the UCUM table does not have. See validate UCUM units.
TERM_CROSSWALK_NO_MAP
- From:
applyGem, on aCrosswalkNoMapresult; andapplyComplexMap, on a group withoutcome: "no-map". - Means: the source is in the map and the steward says it has no target: a GEM
NoDxorNoPCSrow, or a complex-map row in category447638001or with no target.
TERM_CROSSWALK_UNMAPPED
- From:
applyGemandapplyComplexMap, on aCrosswalkUnmappedresult. - Means: the source code is not in the map you loaded at all.
TERM_CROSSWALK_CONTEXT_REQUIRED
- From:
applyComplexMap, on a group withoutcome: "context-required". - Means: the group's rules need an age or a gender you did not pass, or contain a rule the engine cannot read, or none of them held. The group's rows come back so you can see what it needs. See map SNOMED CT to ICD-10-CM.
TERM_GEM_MALFORMED_ROW
- From:
loadGems, onwarnings. - Means: a line did not have three whitespace-separated fields, or its flags were not five digits. The line was skipped.
TERM_COMPLEX_MAP_MALFORMED_ROW
- From:
loadComplexMapwithformat: "rf2", onwarnings. - Means: a row had no concept id, map group or map priority. The row was skipped.
TERM_RXNORM_MALFORMED_ROW
- From:
loadRxNormGraph, onwarnings, with thefileit was in. - Means: a row of
RXNCONSO,RXNRELorRXNSAThad too few columns, or anRXNORMconcept row had noRXCUI, or an NDC row had noRXCUIor NDC. The row was skipped.
TERM_RXNORM_UNTYPED_CONCEPT
- From:
loadRxNormGraph, onwarnings, with the line of the concept's first atom. - Means: none of the concept's
RXNORMatoms has a term type that can type it: every one is a synonym type (PSN,SY,TMSY) or one the engine does not model. The concept was left out of the graph. See how the RxNorm graph is read.
TERM_RXNORM_UNKNOWN_RXCUI
- From: the RxNorm navigation calls (
ingredientsOf,consistsOf,genericFor,brandsFor,doseFormsOf,relatedByRela), on aRxNormUnknownresult (found: false). - Means: the
RXCUIyou asked about is not in the release you loaded.
TERM_RXNORM_NDC_UNMAPPED
- From:
resolveNdc, on anNdcUnmappedresult (resolved: false). - Means: the NDC, as written, is not in the
RXNSATyou loaded.
Fatal codes
TERM_CONCEPTMAP_MALFORMED
- From:
loadConceptMap, thrown. - Means: the resource is not a usable FHIR R4
ConceptMap: not an object, the wrongresourceType, a group, element or target that is not an object, a target with noequivalenceor one R4 does not define, or agroup.unmappedwith no validmode. The message gives the path.
TERM_CODESYSTEM_MALFORMED
- From:
loadCodeSystemand the readers behind it, thrown. - Means: the source cannot be used: a FHIR resource whose
resourceTypeis notCodeSystem, a CSV file with no header row or without a configured column (the message names the column's role), or an RRF or fixed-width property entry that is not an object.
TERM_VALUESET_MALFORMED
- From:
loadValueSet, thrown. - Means: the resource is not a usable FHIR R4
ValueSet: the wrongresourceType, or a compose or expansion whose required shape is broken (a component that is not an object or names neither asystemnor avalueSet, a listed concept or expansion entry with nocode, a filter missing itsproperty,oporvalue, a non-booleaninactive). An unsupported filter operator is not fatal: it isTERM_VALUESET_CANNOT_EXPANDwhen the value set is used.
TERM_CROSSWALK_MALFORMED
- From:
loadComplexMapwithformat: "rf2", thrown. - Means: the refset has no header row, or its header lacks
referencedComponentId,mapGroupormapPriority. Loading a GEM file never throws.
TERM_MAP_NOT_INVERTIBLE
- From:
invertGem, thrown, always. - Means: a GEM map was asked to run backwards. Load the file for the other direction instead; the message names it. See how the crosswalk resolvers read a map.