Skip to main content

core.parsexfhirquery

Home > @medplum/core > parseXFhirQuery

parseXFhirQuery() function

Parses an extended FHIR search criteria string (i.e. application/x-fhir-query).

Signature:

export declare function parseXFhirQuery(query: string, variables: Record<string, TypedValue>): SearchRequest;

Parameters

ParameterTypeDescription
querystringThe X-Fhir-Query string to parse
variablesRecord<string, TypedValue>Values to pass into embedded FHIRPath expressions

Returns:

SearchRequest

The parsed search request

Example

Evaluating a FHIRPath subexpression

const query = 'Patient?name={{ %patient.name }}';
const variables = { patient: { name: 'John Doe' } };
const request = parseXFhirQuery(query, variables);
console.log(request.filters[0].value); // "John Doe"