Customize the CDA header template
Though our template contains the common header attributes and elements required by most CDAs, it may not match your exact requirements. Don’t panic! It is really easy to customize the template to meet your needs.
Our header template is implemented using table called
CdaSchema. This table resides in our CDA API’s ‘cda’ module:
Depending on your requirements, you may need to add/remove elements or change the content. We are going to cover three scenarios, but there are many other possibilities for customization. Don’t be afraid to get creative!
Basic Scenario: Static Content Changes
If the header is the same for all your CDA documents but different from our supplied template, simply make a single “static” change.
For example, our template comes with two ‘templateID’ elements. You may only need one ‘templateID’ element with different value for the root attribute. Simply open up ‘cda’ module and make the content change:
What if you actually need additional ‘templateID’ elements? Simply copy and paste to create extra ones.
Another common fix? The last two elements (‘setId’ and ‘versionNumber’) are optional. If you do not need them in your CDA documents, simply delete them from the template
Advanced Scenario: Dynamic Content Changes
You may need different headers for different CDA documents. Here are a couple of approaches that you can use to fix this problem:
- Create several templates (for example,
CdaSchema2etc.). Apply some programming logic in your main script that will choose the appropriate one.
- Strip down our template, then simply append the fields you need in your main script’s FillHeader() function.For example, here is a minimal version of our header template:Here is the modified
FillHeader()code to accompany it:
- If you would like to use try this approach, then please use the “Dynamic Minimal CDA” on our CDA Templates page which contains the code shown above.
Create a completely new template
You could take a different approach and include all (or most of) the elements and attributes you need in your template. This way the structure of your CDA is very clearly defined, and all you need to do is plug in the data. This approach is different from what we did in this tutorial, but it could be an approach that suits your needs.
What do we suggest?
It seems likely that a simple static change to the template will be enough to meet most requirements. However, because our approach is flexible, we are confident that any requirements (or change in requirements) can easily be met.