Review the HL7 C-CDA on FHIR IG, which defines FHIR Composition profiles that mirror C-CDA document types (CCD, Discharge Summary, Progress Note, etc.) and provides mappings between C-CDA sections/entries and FHIR resource types.
Understand the mapping pattern: each C-CDA section (identified by LOINC section code) maps to a Composition.section with the same LOINC code, and the C-CDA entries within that section map to FHIR resources (e.g., Problem Section entries map to Condition resources, Medications Section entries map to MedicationStatement or MedicationRequest resources).
For translating C-CDA to FHIR: parse the C-CDA XML to extract section content and entries, map entries to FHIR resources using the IG's mapping tables, and assemble a FHIR document Bundle with a Composition resource and all mapped resources.
For translating FHIR to C-CDA: take the FHIR Composition and its referenced resources, apply the reverse mapping, and generate C-CDA XML with the correct templateIds, section codes, and entry structures.
Recognize that some C-CDA content (narrative text, complex clinical models) may not have direct FHIR equivalents, and some FHIR resources may not map cleanly to C-CDA entries — plan for lossy translation in edge cases.
Validate translated documents against both the source format's constraints and the target format's profile (C-CDA Schematron or FHIR validator) to confirm translation fidelity.
Known gotchas
C-CDA to FHIR translation is not lossless — narrative-only sections in C-CDA have no structured FHIR equivalent, and some coded entry nuances may not survive translation; always document known data loss points.
The C-CDA on FHIR IG is a mapping guide and document profile, not an automated translation specification — actual translation logic must be implemented and tested against real-world C-CDA documents, which vary widely in conformance.
Template IDs in C-CDA (CDA R2, C-CDA R2.1) must be carefully mapped to the correct FHIR profile; incorrect template ID mapping will result in resources that pass generic FHIR validation but fail clinical data interpretation.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp