Function: loadConceptMap()
loadConceptMap(
json):ConceptMap
Load an untrusted FHIR R4 ConceptMap JSON value into an immutable ConceptMap.
Accepts the standard resource shape: a top-level object with resourceType: "ConceptMap" and an
optional group[]. source[x]/target[x] scopes are read from either the Uri or Canonical
variant. The result is deep-frozen. Anything structurally unusable throws a
TerminologyError carrying FATAL_CODES.TERM_CONCEPTMAP_MALFORMED.
Parameters
json
unknown
The untrusted resource (typically JSON.parse output - hence unknown).
Returns
The immutable, validated ConceptMap.
Throws
TERM_CONCEPTMAP_MALFORMED when the resource is not a usable ConceptMap.
Example
import { loadConceptMap } from "@cosyte/terminology";
const map = loadConceptMap({
resourceType: "ConceptMap",
url: "http://example.org/cm/gender",
group: [
{
source: "http://hl7.org/fhir/administrative-gender",
target: "http://terminology.hl7.org/CodeSystem/v2-0001",
element: [{ code: "male", target: [{ code: "M", equivalence: "equivalent" }] }],
},
],
});
map.group.length; // => 1