Convert CDA XML to a FHIR JSON Bundle
You can use this API endpoint to convert CDA documents to FHIR format programmatically. Here is an example using curl.
curl -X POST https://hdu.cdcmeta.com/cda2fhir/api/ -F "cda_file=@path_to_your_cda_file.xml"
The API response contains JSON. It contains a FHIR JSON Bundle or an error message in case of failure.
{"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"fullUrl": "urn:uuid:e8b66b6b-b5ee-1fa4-15de-840ff3ce5da8",
"resource": {
"resourceType": "Composition",
"id": "e8b66b6b-b5ee-1fa4-15de-840ff3ce5da8",
"identifier": {
"use": "official",
"value": "2.16.840.1.113883.9.9.9.9.9"
},
"status": "final",
"type": {
"coding": [
{
"code": "55751-2",
"display": "Public Health Case Report",
"system": "http://loinc.org"
}
]
},
"date": "2020-11-07T09:44:21-05:00",
"title": "Initial Public Health Case Report",
"confidentiality": "N",
"attester": [
{
"party": {
"reference": "Practitioner/"
}
}
],
"section": [
{
"title": "Plan of Treatment",
"text": {
"status": "generated",
"div": "Plan of Treatment"
},
"code": {
"coding": [
{
"code": "18776-5",
"display": "Plan of Treatment",
"system": "http://loinc.org"
}
]
},
"mode": "snapshot"
},
{
"title": "Encounters",
...
{"error": "Failed to render FHIR",
"message": "RenderingError",
"cause": "filter 'format_as_date_time': unexpected error: Malformed HL7 datetime 2020111501000, on line 48"
}