Skip to main content
Glama
FhirPathDisplay.tsx1.04 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { evalFhirPath } from '@medplum/core'; import type { Resource } from '@medplum/fhirtypes'; import type { JSX } from 'react'; import { ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay'; export interface FhirPathDisplayProps { readonly resource: Resource; readonly path: string; readonly propertyType: string; } export function FhirPathDisplay(props: FhirPathDisplayProps): JSX.Element | null { let value; try { value = evalFhirPath(props.path, props.resource); } catch (err) { console.warn('FhirPathDisplay:', err); return null; } if (value.length > 1) { throw new Error( `Component "path" for "FhirPathDisplay" must resolve to a single element. \ Received ${value.length} elements \ [${JSON.stringify(value, null, 2)}]` ); } return <ResourcePropertyDisplay value={value[0] || ''} propertyType={props.propertyType} />; }

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