CDA Cheat Sheet

This cheat sheet provides an instant snap-shot of the steps and techniques we use to create CDA documents. Use this as a quick reference when you work through your own CDA implementation.

Recommended Procedure

Step Action
1. Customize the CDA template Edit the ‘cda’ module’s CdaSchema table to produce a template that matches your own CDA requirements.
2. Create an empty CDA Use  cda.new() to produce an empty CDA based on the template.
3. Populate the empty header elements/attributes Create and execute a “fill” function to do the heavy lifting: FillHeader()

Leverage the CDA API “set” functions to develop up your “fill” function.

Use Lua “dot syntax” to assign values: CD.id.extension = 'TT998'

4. Append and populate the remaining header elements Leverage the CDA API “add” functions to create and append the missing elements.

You can also use a combination of addElement() + setAttr().

5. Create the CDA body Use addElement() to create and append the ‘component’ and ‘structuredBody’ elements that compose the CDA body.
6. Append and populate the body elements Leverage the CDA API “add” functions to develop the CDA body contents.

You can also use a combination of addElement() + setAttr().

Techniques:

Task Option Code
Create an empty CDA local Doc = cda.new()
Update existing attributes Recommended CD.id.extension = 'TT998'
Alternative setAttr(CD.id, 'extension', 'TT998')
Update existing elements cda.time.set{target=CD.effectiveTime, time='20070415000000+0500'}
Update existing elements when no “set” function exists Recommended CD.setId.extension = 'BB35'
Alternative setAttr(CD.setId, 'extension', 'BB35')
Create your own Create a new “set” function like cda.id.setid.set()
Add an attribute to an element setAttr(CD.id, 'extension', 'TT998')
Set a text element setText(CD.title, 'Good Health Clinic Consultation Note')
Append a new element cda.time.add{target=A, element='time', time='20070415000000+0500'}
Append a new element when no “add” function exists Add element addElement(CD, 'languageCode')
Set attributes setAttr(CD.languageCode, 'code', cda.codeset.language["English - US"])
Create your own Create a new “add” function like cda.id.setid.add()
Create the CDA body ‘component’ local Body = CD:addElement('component')
‘structuredBody’ local SB = Body:addElement('structuredBody')
Insert external content into an encapsulated text (ED) element setInner()

Additional Information

Want to see these processes and techniques in action? Check out the Iguana CDA tutorial for a step-by-step explanation!