Skip to main content

$resolve

$resolve(resourceTypeOrRef?, params?, options?) -> object
Compact type signature<s-o?o?:o>

If resourceTypeOrRef 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.

$resolve(resourceTypeOrRef, params?, options?) returns one FHIR resource.

Pass a literal relative reference such as Patient/123 to read that resource directly. Pass a conditional reference search query to perform a search that must resolve to exactly one matching resource.

Supported argument forms

Literal reference resolution

  • $resolve('Patient/123')

Conditional reference resolution

  • $resolve("Patient?identifier=http://fhir.acme.health/identifier/member-id|mbr-3001")
  • $resolve("Patient", {"identifier": "http://fhir.acme.health/identifier/member-id|" & identifiers.memberId})

Supported options

  • 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

When used as a search helper, $resolve() throws if the search returns no match or more than one match. When used with a literal relative reference, it throws if the referenced resource cannot be read.

Examples

Resolve a literal relative reference

Input

Example input

JSON
{
"resourceType": "Patient",
"id": "pat-0001",
"gender": "female",
"identifier": [
{
"system": "urn:examplecare:member-id",
"value": "mbr-3001"
}
],
"name": [
{
"use": "official",
"family": "Reed",
"given": [
"Avery"
]
}
],
"managingOrganization": {
"reference": "Organization/org-0001",
"display": "ExampleCare Clinic"
}
}

Expression

$resolve(managingOrganization.reference)

The result below shows a representative resolved resource. Actual resource content depends on the configured FHIR server.

Result

{
"resourceType": "Organization",
"id": "org-0001"
}

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

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

This search must resolve to exactly one matching resource.

Result

{
"resourceType": "Patient",
"id": "pat-0001"
}