Skip to main content

$literal

$literal(resourceTypeOrQuery?, params?, options?) -> string
Compact type signature<s-o?o?:s>

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

Execution
AsyncCan run in parallel

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

Documentation

Requires a configured FHIR server base URL.

$literal(resourceTypeOrQuery, params?, options?) performs a single-match FHIR search and returns the matching resource as a literal relative reference string (ResourceType/id). Use $resourceId() when you only need the logical id, or $resolve() when you need the full resource.

Supported argument forms

  • $literal("Patient", {"identifier": identifiers.memberId}) - search by value only
  • $literal("Patient", {"identifier": "http://fhir.acme.health/identifier/member-id|" & identifiers.memberId}) - search by system & value
  • $literal("Patient?identifier=http://fhir.acme.health/identifier/member-id|" & identifiers.memberId) - use query string

Supported options

The third optional options argument supports the following attributes:

  • asPost: send the search to the FHIR _search endpoint using POST (see GET and POST variants for FHIR search). Default is false (uses GET)
  • noCache: bypass cached responses for this request. This forces a fresh interaction even if the request is already cached.

Error behavior

$literal() requires exactly one match. It throws if the search returns no match or multiple matches.

Examples

Input

This example uses the full patient-summary example input. The expression reads the non-FHIR identifiers.memberId source field and combines it with a fixed FHIR identifier system in the search expression.

Example input

JSON
{
"patientId": "pat-0001",
"name": {
"given": "Avery",
"family": "Reed",
"display": "Avery Reed"
},
"birthDate": "1990-06-12",
"sex": "female",
"primaryCareTeam": {
"organization": "ExampleCare",
"facility": "ExampleCare Clinic",
"practitioner": {
"practitionerId": "prac-4001",
"display": "Jordan Kim"
}
},
"identifiers": {
"memberId": "mbr-3001",
"recordNumber": "rec-5001"
},
"tags": [
"demo",
"fictional"
],
"_xmlTagName": "patientSummary"
}

Expression

$literal("Patient", {"identifier": "http://fhir.acme.health/identifier/member-id|" & identifiers.memberId})

This search must resolve to exactly one matching resource.

Result

"Patient/pat-0001"