Skip to main content
Glama
ResourceForm.utils.ts1.2 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { InternalSchemaElement } from '@medplum/core'; import { capitalize, isEmpty } from '@medplum/core'; import type { StructureDefinition } from '@medplum/fhirtypes'; export function setPropertyValue( obj: any, key: string, propName: string, elementDefinition: InternalSchemaElement, value: any ): any { const types = elementDefinition.type; if (types.length > 1) { for (const type of types) { const compoundKey = key.replace('[x]', capitalize(type.code as string)); if (compoundKey in obj) { delete obj[compoundKey]; } } } if (isEmpty(value)) { obj[propName] = undefined; } else { obj[propName] = value; } return obj; } export type SupportedProfileStructureDefinition = StructureDefinition & { url: NonNullable<StructureDefinition['url']>; name: NonNullable<StructureDefinition['name']>; }; export function isSupportedProfileStructureDefinition( profile?: StructureDefinition ): profile is SupportedProfileStructureDefinition { return !!profile && !isEmpty(profile.url) && !isEmpty(profile.name); }

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