Skip to content
Recipes

C-CDA documents to FHIR

Parse a C-CDA document and write the patient, problems, medications, allergies, procedures and results to a FHIR R4 server.

On this page

Healthcare organizations exchange summaries of care as C-CDA documents. This recipe reads one C-CDA document, converts it to FHIR R4 and writes the result to a FHIR server, so the data in the document becomes queryable resources.

Source and destination

The workflow takes the document XML, converts it to a FHIR document Bundle with the CDA adapter, and writes its resources to Medplum as one transaction.

flowchart LR
    A[C-CDA XML] --> B[CDA to FHIR]
    B -->|transaction Bundle| C[Medplum]
  • Source: C-CDA (or plain CDA) XML. The template takes it from a manual run, as { "content": "<ClinicalDocument>…" }. Other sources, such as a webhook or an SFTP folder, are not part of the template: whatever comes before the CDA step must hand it the XML as content. A file pickup or SFTP pickup trigger already does: each run's input carries the file's text as content.
  • Destination: the Medplum server in the Compose stack. The template is tested against Medplum only. A fhir-rest step POSTs a transaction Bundle it is given, but the template's output wraps the Bundle for Medplum's import-bundle, so writing to another FHIR R4 server means changing that output too.
  • Result: a Composition, the Patient, the author as a Practitioner, and Conditions, MedicationStatements, AllergyIntolerances, Procedures and Observations from the document's sections.

What it uses

  • Template C-CDA → FHIR Patient Sync (ccda-to-fhir-patient-sync). See the Workflow catalog.
  • Adapter cda, action cda-to-fhir. Its parse-cda action returns the parsed document as JSON instead.
  • Adapter medplum, action import-bundle.
  • The CDA parse transform, to work with the parsed document in a transform step.

Status

Available on this release. The template builds the whole flow; create it with Workflows → Templates and run it with a synthetic document for TESTPATIENT.

Know the limits before you go live:

  • The parser reads the patient, author, sections and their entries. It does not validate the document against the C-CDA templates.
  • Generating a C-CDA document from FHIR is not part of this recipe.

Reference