A sample repo using Medplum and AI SDKs for document parsing to the FHIR medical standard.
This project uses npm for package management. The following packages are installed:
- @medplum/core
- @medplum/fhirtypes
- TypeScript
- OpenAI SDK
- Anthropic SDK
- Vercel AI SDK
- Langchain
To install dependencies:
npm install
Create a .env.local
by copying the .env.example file and assigning the appropriate environment variables.
This project is set up with TypeScript.
npm run create-sample-patient
- Runs a script that creates a sample patient.npm run document-agent
- Runs the document agent script that fetches and processes FHIR documents
documents/
- the PDF documentslib/
- Medplum libraryscripts/
- Utility scriptsdocument-agent.ts
- Script for fetching and processing FHIR documents
The document agent script right now only connects to the Medplum API. You are encouraged to use any LLM APIs/SDKs (we have included four of the most common). To run it:
First generate a patient, and take note of its ID:
npm run create-sample-patient
Then request the patient ID when running the document-agent script:
npm run document-agent