$resourceId
$resourceId(resourceTypeOrQuery?, params?, options?) -> string<s-o?o?:s>If resourceTypeOrQuery is omitted, the current context value is used.
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.
$resourceId(resourceTypeOrQuery, params?, options?) performs a single-match FHIR search and returns only the matching resource's logical id value. Use $resolve() when you need the full resource, or $literal() when you need a ResourceType/id literal reference.
Supported argument forms
- Structured query form:
$resourceId("Patient", {"identifier": "http://fhir.acme.health/identifier/member-id|" & identifiers.memberId}) - String query from:
$resourceId("Patient?identifier=http://fhir.acme.health/identifier/member-id|" & identifiers.memberId)
Supported options
asPost: send the search to the FHIR_searchendpoint using POST (see GET and POST variants for FHIR search). Default isfalse(uses GET)noCache: bypass cached responses for this request. This forces a fresh interaction even if the request is already cached.
Error behavior
$resourceId() requires exactly one match. It throws if the search returns no match or multiple matches.
Examples
Extract a logical id from a conditional search
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
{
"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
$resourceId("Patient", {"identifier": "http://fhir.acme.health/identifier/member-id|" & identifiers.memberId})
This search must resolve to exactly one matching resource.
Result
"pat-0001"