Skip to main content

$translateCode

$translateCode(value?, url, packageFilter?) -> value
Compact type signature<x-so?:x>

If value is omitted, the current context value is used.

Execution
AsyncCan run in parallel

This helper performs terminology work asynchronously. Independent calls can start together when they wait on terminology resolution. See Parallelism And Async Evaluation and Async And Concurrency.

Source: FUME

Documentation

Translates a code or Coding-like value through a ConceptMap and returns only the mapped code values.

This helper requires the relevant ConceptMap to be available through the configured environment. A single target is returned as a string, multiple targets are returned as an array of strings, and unmapped lookups return undefined. The optional packageFilter argument narrows ConceptMap resolution when more than one package could satisfy the lookup and skips server ConceptMap resolution.

Examples

Translate a proprietary status by ConceptMap id (requires a configured FHIR server or matching package content)

Input

This example uses the EncounterStatusCanonicalMap ConceptMap from FHIR R4.

Example input

JSON
[
{
"encounterId": "enc-1001",
"patientId": "pat-0001",
"status": "finished",
"class": "outpatient",
"type": "primary-care",
"reason": "routine follow-up",
"facility": "ExampleCare Clinic",
"practitionerId": "prac-4001",
"start": "2026-02-14T09:30:00Z",
"end": "2026-02-14T10:05:00Z"
},
{
"encounterId": "enc-1002",
"patientId": "pat-0001",
"status": "finished",
"class": "outpatient",
"type": "imaging",
"reason": "headache evaluation",
"facility": "ExampleCare Imaging",
"practitionerId": "prac-4002",
"start": "2026-03-01T15:10:00Z",
"end": "2026-03-01T15:45:00Z"
},
{
"encounterId": "enc-1003",
"patientId": "pat-0001",
"status": "in-progress",
"class": "virtual",
"type": "care-coordination",
"reason": "medication questions",
"facility": "ExampleCare Clinic",
"practitionerId": "prac-4003",
"start": "2026-03-10T11:20:00Z",
"end": ""
},
{
"encounterId": "enc-1004",
"patientId": "pat-0001",
"status": "planned",
"class": "outpatient",
"type": "lab",
"reason": "fasting labs",
"facility": "ExampleCare Clinic",
"practitionerId": "prac-4001",
"start": "2026-03-20T08:00:00Z",
"end": ""
}
]

Expression

$translateCode($[0].status, "sc-encounter-status")

The helper returns only the mapped code value, even when the lookup is driven by a larger payload.

Result

"complete"