CDA: Consume Document

Introduction

This example shows how to use the builtin xml.parse{} function to parse and consume a CDA document.

Note: The reason we are using XML functions to parse the CDA document is because CDA documents are simply large XML documents.

If you have any questions please contact us at support@interfaceware.com.

Using the Code [top]

  • Import the CDA: Consume Document channel from the Builtin: Iguana Protocols repository
  • Experiment with the code to find out how it works
  • Then add the local module to your Translator project
  • Copy the require statement from the channel and add it at the top of your script
    Note: This local module uses require to return a single function
  • Adapt the code to your own requirements
  • Use xml.parse{} to parse a CDA
    Note: The example code uses a sample CDA you will need to change this for a production system
  • Use ProcessProblems() to extract the list of problems from the CDA structured body

This is the github code for the main module:

How it works [top]

  • The code uses the builtin xml.parse{} function to parse the CDA into an XML node tree
    Note: Using XML functions to parse CDA documents works because CDA documents are simply XML documents, albeit large and complex ones
  • The code uses ProcessProblems() to extract the list of problems from the CDA body
    • The ProcessProblems() function requires a structuredBody parameter
    • ProcessProblems() is a local function stored in the local module problems.lua

More information [top]