Last updated
Last updated
C-CDA / FHIR Converter provides bidirectional mapping for all data elements from the list. is also available.
In certain cases, such as regulatory requirements, legacy systems integration, or the need to support a specific workflow, it may be necessary to convert FHIR data to C-CDA format to seamlessly integrate systems.
A typical FHIR to C-CDA conversion process is usually divided into three main steps:
Gather required data in FHIR format: In this step, a number of GET requests are performed to retrieve the required data from the FHIR server or source systems.
Generate FHIR 'document' type Bundle: The gathered data is organized into a FHIR Document Bundle, with the FHIR Composition resource serving as the main document container.
Convert FHIR Document to C-CDA Document: In this step, the FHIR data is mapped and transformed into C-CDA structures, and divided into entries and sections according to the C-CDA document template requirements.
Aidbox simplifies this process by incorporating features such as document definitions, section narrative generators, and pseudo-code scripts to preprocess the document before the conversion.
In technical terms, to generate a C-CDA document from FHIR data, it is necessary to create a bundle containing a resource that specifies the top-level document attributes, including the title, document type, author, subject (patient), and a list of document sections. Each section must be described by type, title and the FHIR resources to be included. Once the FHIR Document bundle is composed, it can be submitted to the /ccda/v2/to-ccda endpoint for conversion to a C-CDA document.
Below are some details about each of these features.
To simplify the creation of Document bundles, Aidbox offers a feature called Document Definition, which enables the description of document contents using the FHIR Search API. The example below illustrates how to define a Document Definition:
Parameters interpolation is also supported. For example, in the Vitals Signs section of the sample above:
{{pid}}
will be replaced with the value passed in the query-string parameter pid
and this way vitals observations are scoped to the specific patient.
Another frequent use-case is date filtering. It can be easily added with two parameters: start-date
and end-date:
Multiple FHIR searches per section is also possible:
The best practice is to have Observation.code to be equal to section LOINC code for Observations containing section narratives. Narrative itself can be stored in either Observation.note[0].text
or Observation.value.string
.
Quite often it's needed to make ad-hoc changes here and there in the CDA document to meet specific requirements. For example, one may want to generate section narrative from section entries or discard all patient identifiers except for SSN. To make this possible, you can get FHIR Document populated by Document Definition via /ccda/prepare-doc
endpoint and then make modifications to it. When all modifications are in place, you can submit result to the /ccda/v2/to-cda
endpoint to generate the final CDA document. Consider the following pseudo-code which removes all patient idenfitiers from the Patient resource except for SSN:
Another pseudo-code example on how to populate section narrative from section entries:
C-CDA / FHIR module provides ready-to-use Document Definitions for most frequently used document types.
This endpoint accepts Document Definition in request body or docdef-id
and converts it into the FHIR Document bundle without applying C-CDA transformation. Resulting FHIR Document is returned. This endpoint is useful to debug Document Definition and check if all needed data is in place.
Endpoint uses query string to get values for Document Definition parameters. In the example below {{pid}}
param will be replaced with 42
from the query string.
You can pass predefined Document Definition ID indocdef-id
query-string parameter:
Endpoint returns a FHIR Document or OperationOutcome resource in case of error.
You may set the mode of resolving references inmode
query-string parameter, if you pass resolve-all
all unresolved references will be resolved independently of FHIR Search query un Document Definition.
You may also pass :resolve
instruction inside Document Definition. It will resolve references by path even if FHIR Search does not have such reference in search-params.
Behaves the same way as /ccda/prepare-doc
, but additionally applies C-CDA transformation, so you'll get C-CDA XML document in response.
Response:
Predefined Document Definition example:
Each resource attribute, such as :subject
, :author
, or :section/:entry
, is specified as a HTTP request that returns a single FHIR resource or multiple FHIR resources. The full power of the can be used to retrieve resources that meet specific criteria.
All the filtering logic is strictly described by the , so the date filtering in the example above .
To pick the right templateId
for a section, converter uses LOINC to OID mapping table which can be found on the . "Entries Required" / "Entries Optional" variation can be specified via FHIR extension. In the example below document contains two sections: and .
Along with structured entries, CDA section contains human-readable narrative describing section data. This narrative can be automatically generated from entries () or it can be retrieved from Observation resource. To retrieve narrative from Observation, provide corresponding request under the :text
key:
Additionally to this list, you can put your own predefined Document Definitions via .
These govern your access to and use of the Aidbox FHIR API module. By accessing or using the Aidbox FHIR API, the App Developer (“You”), agrees to be bound by .
continuity-of-care
CCD
pid
- Patient ID
start-date
end-date
This page describes how to populate C-CDA documents from FHIR data stored in Aidbox FHIR Server.