Skip to main content

$inValueSet

$inValueSet(value?, url, sourcePackage?) -> object
Compact type signature<x-so?:o>

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

Checks whether a code or Coding-like object belongs to a ValueSet and returns a membership result object.

This helper requires the relevant ValueSet to be available in the configured FHIR package context. It does not return a bare boolean. Successful membership returns { status: "member", concept: ... }, an absent code returns { status: "not-member" }, and unresolved lookups return { status: "unknown", reason: ... } when membership cannot be determined unambiguously. sourcePackage only narrows package resolution; ValueSet lookup stays package-based.

When value is a primitive code, membership is evaluated by code value. When value is a Coding-like object, the supplied system and code are evaluated together.

Examples

Check a proprietary status by ValueSet id (requires matching FHIR package content)

Input

This example uses the EncounterStatus ValueSet 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

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

Because the input is a primitive status code, this lookup matches by code value and returns the resolved concept from the ValueSet.

Result

{
"status": "member",
"concept": {
"system": "http://hl7.org/fhir/encounter-status",
"code": "finished",
"display": "Finished"
}
}

Check a Coding by ValueSet name (requires matching FHIR package content)

Input

This example uses the v2.0487 ValueSet from FHIR R4.

Example input

JSON
{
"resourceType": "Specimen",
"id": "spec-0001",
"status": "available",
"subject": {
"reference": "Patient/pat-0001",
"display": "Avery Reed"
},
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0487",
"code": "SER",
"display": "Serum"
}
],
"text": "Serum specimen"
}
}

Expression

$inValueSet(type.coding[0], "v2.0487")

Here the input already carries both system and code, so membership is evaluated as a Coding lookup.

Result

{
"status": "member",
"concept": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0487",
"code": "SER",
"display": "Serum"
}
}