Skip to main content
Glama
derived.ts1.5 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { SearchParameter } from '@medplum/fhirtypes'; import { DotAtom, FhirPathAtom, SymbolAtom } from '../fhirpath/atoms'; /** * Derives an "identifier" search parameter from a reference search parameter. * * FHIR references can have an "identifier" property. * * Any FHIR reference search parameter can be used to search for resources with an identifier. * * However, the FHIR specification does not define an "identifier" search parameter for every resource type. * * This function derives an "identifier" search parameter from a reference search parameter. * @param inputParam - The original reference search parameter. * @returns The derived "identifier" search parameter. */ export function deriveIdentifierSearchParameter(inputParam: SearchParameter): SearchParameter { return { resourceType: 'SearchParameter', code: inputParam.code + ':identifier', base: inputParam.base, type: 'token', expression: `(${inputParam.expression}).identifier`, } as SearchParameter; } export function getInnerDerivedIdentifierExpression(expression: string): string | undefined { return expression.match(/^\((.+)\)\.identifier$/)?.[1]; } export function getParsedDerivedIdentifierExpression(originalExpression: string, atom: FhirPathAtom): FhirPathAtom { return new FhirPathAtom(originalExpression, new DotAtom(atom, new SymbolAtom('identifier'))); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server