Skip to main content
Glama
PatientTimeline.tsx2.31 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { MedplumClient, ProfileResource } from '@medplum/core'; import { createReference } from '@medplum/core'; import type { Attachment, Patient, Reference, ResourceType } from '@medplum/fhirtypes'; import type { JSX } from 'react'; import { useCallback } from 'react'; import type { ResourceTimelineProps } from '../ResourceTimeline/ResourceTimeline'; import { ResourceTimeline } from '../ResourceTimeline/ResourceTimeline'; export interface PatientTimelineProps extends Pick<ResourceTimelineProps<Patient>, 'getMenu'> { readonly patient: Patient | Reference<Patient>; } export function PatientTimeline(props: PatientTimelineProps): JSX.Element { const { patient, ...rest } = props; const loadTimelineResources = useCallback((medplum: MedplumClient, resourceType: ResourceType, id: string) => { const ref = `${resourceType}/${id}`; const _count = 100; return Promise.allSettled([ medplum.readHistory('Patient', id), medplum.search('Communication', { subject: ref, _count }), medplum.search('Device', { patient: ref, _count }), medplum.search('DeviceRequest', { patient: ref, _count }), medplum.search('DiagnosticReport', { subject: ref, _count }), medplum.search('Media', { subject: ref, _count }), medplum.search('ServiceRequest', { subject: ref, _count }), medplum.search('Task', { subject: ref, _count }), ]); }, []); return ( <ResourceTimeline value={patient} loadTimelineResources={loadTimelineResources} createCommunication={(resource: Patient, sender: ProfileResource, text: string) => ({ resourceType: 'Communication', status: 'completed', subject: createReference(resource), sender: createReference(sender), sent: new Date().toISOString(), payload: [{ contentString: text }], })} createMedia={(resource: Patient, operator: ProfileResource, content: Attachment) => ({ resourceType: 'Media', status: 'completed', subject: createReference(resource), operator: createReference(operator), issued: new Date().toISOString(), content, })} {...rest} /> ); }

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