---
title: "ixml"
slug: "ixml"
updated: 2025-11-19T00:04:47Z
published: 2025-11-19T00:04:47Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.imat.io/llms.txt
> Use this file to discover all available pages before exploring further.

# IXML

## Table of Classes

| Main POJOs | Secondary POJOs |
| --- | --- |
| [Allergy](/docs/ixml#Allergy) | [Plan](/docs/ixml#Plan) | [Address](/docs/ixml#Address) | [Header](/docs/ixml#Header) | [POJO](/docs/ixml#Pojo) |
| [AllergyObservation](/docs/ixml#AllergyObservation) | [Base64](/docs/ixml#Base64) | [Author](/docs/ixml#Author) | [Authenticator](/docs/ixml#Authenticator) | [CommonPojo](/docs/ixml#CommonPojo) |
| [Encounter](/docs/ixml#Encounter) | [EncompassingEncounter](/docs/ixml#EncompassingEncounter) | [EffectiveTime](/docs/ixml#EffectiveTime) | [CustodianInfo](/docs/ixml#CustodianInfo) | [AdminPojo](/docs/ixml#AdminPojo) |
| [FunctionalStatus](/docs/ixml#FunctionalStatus) |  | [High](/docs/ixml#High) | [HParticipant](/docs/ixml#HParticipant) |  |
| [AssessmentScale](/docs/ixml#AssessmentScale) | Care Plan POJOs | [Low](/docs/ixml#Low) | [HieInfo](/docs/ixml#HieInfo) |  |
| [ScaleSupporting](/docs/ixml#ScaleSupporting) | [Goal](/docs/ixml#Goal) | [Ethnicity](/docs/ixml#Ethnicity) | [NextOfKin](/docs/ixml#NextOfKin) |  |
| [SelfCare](/docs/ixml#SelfCare) | [HealthConcern](/docs/ixml#HealthConcern) | [Gender](/docs/ixml#Sex) | [Patient](/docs/ixml#Patient) |  |
| [StatusObservation](/docs/ixml#StatusObservation) | [Intervention](/docs/ixml#Intervention) | [HtmlTableFormat](/docs/ixml#HtmlTableFormat) | [Id](/docs/ixml#Id) |  |
| [Immunization](/docs/ixml#Immunization) |  | [Column](/docs/ixml#Column) | [Recipient](/docs/ixml#Recipient) |  |
| [Medication](/docs/ixml#Medication) |  | [Language](/docs/ixml#Language) | [DocumentationOf](/docs/ixml#DocumentationOf) |  |
| [Payer](/docs/ixml#Payer) |  | [MaritalStatus](/docs/ixml#MaritalStatus) |  |  |
| [Problem](/docs/ixml#Problem) |  | [Organization](/docs/ixml#Organization) |  |  |
| [Procedure](/docs/ixml#Procedure) |  | [Participant](/docs/ixml#Participant) |  |  |
| [ResultPanel](/docs/ixml#ResultPanel) |  | [Performer](/docs/ixml#Performer) |  |  |
| [Result](/docs/ixml#Result) |  | [Person](/docs/ixml#Person) |  |  |
| [SocialHistories](/docs/ixml#SocialHistories) |  | [Race](/docs/ixml#Race) |  |  |
| [Caregiver](/docs/ixml#Caregiver) |  | [Religion](/docs/ixml#Religion) |  |  |
| [CultureAndReligion](/docs/ixml#CultureAndReligion) |  | [Sex](/docs/ixml#Sex) |  |  |
| [HomeEnvironment](/docs/ixml#HomeEnvironment) |  | [Status](/docs/ixml#Status) |  |  |
| [Pregnancy](/docs/ixml#Pregnancy) |  | [Telecom](/docs/ixml#Telecom) |  |  |
| [SmokingStatus](/docs/ixml#SmokingStatus) |  | [Translation](/docs/ixml#Translation) |  |  |
| [SocialHistory](/docs/ixml#SocialHistory) |  |  |  |  |
| [TobaccoUse](/docs/ixml#TobaccoUse) |  |  |  |  |
| [VitalSignGroup](/docs/ixml#VitalSignGroup) |  |  |  |  |
| [VitalSign](/docs/ixml#VitalSign) |  |  |  |  |

Intermediate XML is used in the process of creating CCDs. It's what *mdht-restlet* needs to generate on-demand CCDs, QRDA I, QRDA III, and FHIR records.

For further information, see the documentation for [QRDA I](/v1/docs/ixml-qrda-1) and [QRDA III](/v1/docs/ixml-qrda-iii).

## Documents (Implementation Guide)

These were used primarily in creating the POJOs and populating the CCD using MDHT APIs.

| Title | ***HL7 Implementation Guide for CDA® Release 2: Consolidated CDA Templates for Clinical Notes (US Realm) Draft Standard for Trial Use Release 2.1 Draft Standard for Trial Use August 2015 Volume 2—Templates and Supporting Material*** |
| --- | --- |
| Filename | ***CDAR2_IG_CCDA_CLINNOTES_R1_DSTU2.1_2015AUG_Vol2_Templates_and_Supporting_Material.pdf***, 906 pages |

## Implementation

See implementation details for sections, data types, etc. on each (major) POJO which indicates its relevant sections in the Implementation Guide.

## Examples

The example tends to include the use of *Base-level*, *Common,* and *Admin POJO* fields as relevant. That these are "spared" from being explicitly included in the definition on the left (because they're inherited) is probably the most confusing aspect of the Java definitions. This is why the examples have been put there.

## Document Types

*Generate*the following document types with *mdht-restlet*, as specified in the **<samp>Header</samp>** <samp>&lt;doctype&gt;</samp> field:

1. CCDA
2. QRDA I
3. QRDA III
4. Care Plan
5. Unstructured

## Base-level POJOs

Note:Nothing in this group, neither POJO nor instance variable name, is ever seen in the IXML. These are for internal use only and appear here for informational purposes only. Similarly for **<samp>CommonPojo</samp>** and **<samp>AdminPojo</samp>**.

```
abstract class Pojo
{                             // internal-use only
  String       ____;          // name of the XML element causing this POJO to be created
  String       name;          // may or may not be identical to '____'; sometimes this is name in a significant way
  int          lineNumber;    // used to report errors in catalina.out
  DocumentType doctype;       // one of "CCDA", "QRDA I", "QRDA III", "Care Plan" or "Unstructured"
  String       vendor;        // name soliciting this generated document
  Integer      conformance;   // conformance year of the document
  boolean      validate;      // can turn off validation using <validate flag="false" /> (deprecated)
  String[]     required;      // validation: list of fields/children (by name) that must be present
  String[]     optional;      // validation: list of fields/children (by name) that are optional
  String[]     notes;         // validation: list of notes or suggestions
}

class Unknown extends Pojo    // applied to any IXML element that is not understood, at least temporarily
{                             // internal-use only
  String                elementname;
  Map< String, String > attributes;
  String                content;
}
```

#### Conformance

See field, <samp>conformance</samp>, above. For instance, conformance to chronologically advancing implementation guides from *CDAR2_IG_CCDA_CLINNOTES_R1_DSTU2.1_2015AUG_Vol2_<big>&nbsp;<strong>2019JUN&nbsp;</strong></big>with_errata.pdf* to *CDAR2_IG_CCDA_CLINNOTES_R1_DSTU2.1_2015AUG_Vol2_<big>&nbsp;<strong>2022SEP&nbsp;</strong></big>with_errata.pdf*is done by injecting (e.g.) `&lt;conformance&gt;2022&lt;/conformance&gt;` into the IXML header (after <samp>&lt;doctype&gt;</samp> is a good place). For CCDAs, this went into effect in *mdht-restlet##3.5.0*.

#### List of base-level POJOs

The POJOs below are used mostly as subordinates to other POJOs. **Base64** is used to create instances of *Unstructured Document (V2)*. This POJO results in the creation of a *text* element inside a *nonXMLBody* and optionally involves compression.

| Source Code | IXML Sample |
| --- | --- |
| <samp>Address</samp> |
| ``` class Address extends Pojo { String use; List< String > line; String city; String state; String zipcode; String country; } ``` | ``` <address use="WP"> <line>5242 Broadway Avenue</line> <line>#538</line> <city>New York</city> <state>NY</state> <zipcode>10001</zipcode> <country>US</country> </address> ``` |
| <samp>Authenticator</samp> |
| ``` class Authenticator extends Pojo { String time; String signaturecode; String signaturetext; } ``` | ``` <authenticator time="20220506093201" signaturecode="blah" signaturetext="blahblah" /> ``` |
| <samp>Base64</samp> |
| ``` class Base64 extends Pojo { String mediatype; String compression; // e.g.: "DF" } ``` | ``` <base64 mediatype="application/pdf"> TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu== </base64> ``` |
| <samp>Patient</samp> |
| ``` class Patient extends Pojo { String facilityoid; String mrn; List< Id > id; String firstname; String lastname; List< String > middlename; String birthdate; Sex gender; Race race; Ethnicity ethnicity; Language language; MaritalStatus maritalstatus; Religion religion; Telecom telecom; Address address; } ``` | ``` <header> <patient> <facilityoid>2.16.840.1.113883.3.6452</facilityoid> <mrn>665892</mrn> <id root="801.295.9626" extension="1955-01-18" /> <id root="2.81.55.1034.16.22" extension="1996-09-11" /> <firstname>Herman</firstname> <lastname>Munster</lastname> <birthdate>18561031000000+0000</birthdate> <gender code="M" codesystem="2.16.840.1.113883.5.1" codesystemname="AdministrativeGender" displayname="Male" /> <race code="2106-4" codesystem="2.16.840.1.113883.6.238" codesystemname="Race & Ethnicity - CDC" displayname="Green" /> <ethnicity code="2186-5" codesystem="2.16.840.1.113883.6.238" codesystemname="Race & Ethnicity - CDC" displayname="Not Hispanic or Latino" /> <language code="eng" codesystem="2.16.840.1.113883.5.60" codesystemname="LanguageAbilityMode" displayname="Expressed spoken" proficiency="Good" preference="true" /> <maritalstatus code="M" codesystem="2.16.840.1.113883.5.2" codesystemname="MaritalStatusCode" displayname="Married" /> <religion code="1013" codesystem="2.16.840.1.113883.5.1076" codesystemname="HL7 Religious Affiliation" displayname="Christian (non-Catholic, non-specific)" /> <address use="HP"> <line>1313 Mockingbird Lane</line> <city>Mockingbird Heights</city> <state>CA</state> <zipcode>90210</zipcode> <country>US</country> </address> </patient> </header> ``` |
| <samp>CustodianInfo</samp> |
| ``` class CustodianInfo extends Pojo { String oid; String name; Telecom telecom; Address address; } ``` | ``` <header> <custodianinfo> <oid>2.16.840.1.113883.3.6452</oid> <name>IMAT Solutions</name> <telecom use="WP">+1.844-772-6258</telecom> <address use="WP"> <line>565 East Technology Avenue</line> <line>3300</line> <city>Orem</city> <state>UT</state> <zipcode>84097</zipcode> <country>US</country> </address> </custodianinfo> </header> ``` |

It is often the case that the IMAT Solutions search engine knows about authors loosely associated with a patient's care without knowing which authors are associated with which concept (problem, procedure, vital sign, etc.). Such authors as are known may be placed in this POJO and will be generated in the CCD's <samp>&lt;documentationOf ... /&gt;</samp> section at the bottom of the header.

| Source Code | IXML Sample |
| --- | --- |
| <samp>DocumentationOf</samp> |
| ``` class DocumentationOf extends Pojo { List< Author > authors; } ``` | ``` <documentationOf> <authors> <author ... /> <author ... /> . . . <author ... /> </authors> </documentationOf> ``` |
| <samp>EffectiveTime</samp> |
| ``` class EffectiveTime extends Pojo { Low low; High high; } ``` |  |
| <samp>Header</samp> |
| ``` class Header extends Pojo { DocumentType doctype; String vendor; String codename; String title; String informationrecipientid; Patient patient; HieInfo hieinfo; CustodianInfo custodianinfo; HParticipant participant; List< NextOfKin > nextofkin; } ``` | ``` <header> <doctype>CCDA</doctype> <vendor>Dogpatch Mule 'n' Maternity</vendor> <!-- optional --> <conformance>2023</conformance> <!-- optional --> <codename>Continuity of Care Document</codename> <title>Continuity of Care Document</title> <patient ... /> <hieinfo ... /> <custodianinfo ... /> <hparticipant ... /> <!-- immature as yet --> <kin> <nextofken 1 ... /> <nextofken 2 ... /> <nextofken n ... /> </kin> </header> ``` |
| ``` enum DocumentType { UNKNOWN, CCDA, QRDA_I, QRDA_III } ``` |  |
| <samp>HieInfo</samp> |
| ``` class HieInfo extends Pojo { String oid; String name; String telecom; Address address; } ``` | ``` <header> <hieinfo> <name>Bronx RHIO</name> <telecom use="WP">tel:+1(718)708-6630</telecom> <oid>2.16.840.1.113883.3.371</oid> <address> <line>1776 Eastchester Road</line> <city>Bronx</city> <state>NY</state> <zipcode>10461</zipcode> <country>US</country> </address> </hieinfo> </header> ``` |
| <samp>High</samp> |
| ``` class High extends Pojo { String root; String extension; } ``` |  |
| <samp>Id</samp> |
| ``` class Id extends Pojo { String root; String extension; } ``` | ``` <header> <patient> <!-- see this in example for Patient --> ... <id root="801.295.9626" extension="1955-01-18" /> ... </patient> </header> ``` |
| <samp>Low</samp> |
| ``` class Low extends Pojo { String value; } ``` |  |
| <samp>NextOfKin</samp> |
| ``` class NextOfKin extends Pojo { String firstname; String lastname; List< String > middlename; String birthdate; Sex gender; Race race; Ethnicity ethnicity; Address address; } ``` | ``` <header> <kin> <nextofkin> <firstname>Jack</firstname> <middlename>the</middlename> <middlename>infamous</middlename> <lastname>Ripper</lastname> <birthdate>18600131</birthdate> <gender code="M" codesystem="2.16.840.1.113883.5.1" codesystemname="AdministrativeGender" displayname="Male" /> <race code="2106-4" codesystem="2.16.840.1.113883.6.238" codesystemname="Race & Ethnicity - CDC" displayname="Green" /> <ethnicity code="2186-5" codesystem="2.16.840.1.113883.6.238" codesystemname="Race & Ethnicity - CDC" displayname="Not Hispanic or Latino" /> <address use="HP"> <!-- Scotland Yard wants to know! --> <line>Highstreet, 10</line> <city>Chelsea</city> <state>Greater London</state> <zipcode>SW10 0AB</zipcode> <country>UK</country> </address> </nextofkin> </kin> </header> ``` |
| <samp>Organization</samp> |
| ``` class Organization extends Pojo { String name; String facilityoid;* Telecom telecom; Address address; } ``` *Warning: In times past, this field was <samp>id</samp>. This confuses the SAX parser by failing to parse and subsume constructs like vital signs under larger collections. Hence, some data sections go missing. | ``` <organization> <name>Westinghouse Corporation</name> <!-- facility name --> <facilityoid>2.4.87.932456.10.20.3</facilityoid> <telecom use="WP">+1617.232.0891</telecom> <address use="WP"> <line>35 Medicine Avenue</line> <city>Westinghouse</city> <state>MA</state> <zipcode>02136</zipcode> <country>US</country> </address> <organization> ``` |
| <samp>HParticipant</samp> |
| ``` class HParticipant extends Pojo { String typecode; String classcode; String certificationnumber; Organization organization; Person person; Address address; // (deprecated) } ``` | ``` <header> <hparticipant> <typecode>VRF</typecode> <classcode>ASSIGNED</classcode> <certificationnumber>123456</certificationnumber> <organization ... /> </hparticipant> <!-- and/or --> <hparticipant> <typecode>IND</typecode> <classcode>GUAR</classcode> <certificationnumber>123456</certificationnumber> <person ... /> </hparticipant> </header> ``` |
| <samp>Person</samp> |
| ``` class Person extends Pojo { String family; String given; List < String > givens; String prefix; String suffix; String npi; Telecom telecom; Address address; } ``` | ``` <person> <family>Lewis</family> <first>Clive</first> <middle>Staples</middle> <middle>Jack</middle> <prefix>Prof.</prefix> <telecom use="HP">+44 01865 22 3333</telecom> <address use="HP"> <line>The Kilns</line> <city>Oxford</city> <zipcode>OX1 1AF</zipcode> <country>UK</country> </address> </person> ``` |
| <samp>Recipient</samp> |
| ``` class Recipient extends Pojo { boolean intended; Person person; Organization organization; } ``` | ``` <recipient intended="true"> <person ... /> <organization ... /> <recipient> ``` Used for <samp>&lt;informationRecipient ... /&gt;</samp> |
| <samp>Telecom</samp> |
| ``` class Telecom extends Pojo { String use; String number; } ``` | ``` <telecom use="HP"> <number>+33 9 75.76.65.71</number> </telecom> ``` |

## Common (evolved) POJOs

<samp>CommonPojo</samp> doesn't appear in the IXML, but its instance variables appear—used as attributes on XML elements. Most <samp>CommonPojo</samp>s directly represent sections; some are helpers used to enhance others by composition (as opposed to inheritance).

| <samp>CommonPojo</samp> |
| --- |
| ``` class CommonPojo extends Pojo { // internal-use only String classcode; // attribute for CDA section, e.g.: OBS String moodcode; // attribute for CDA section, e.g.: EVN String typecode; // "2.16.840.1.113883.1.11.19601" (more often, "REFR", "SPRT", etc.) String startdate; // "2017-05-02 12:21:36", "20180101000000", etc. or "" or leave field out String enddate; // "2017-05-02 18:23:01", "20180201000000", etc. or "" or leave field out String code; // "2670", "142496001", etc. String codesystem; // "2.16.840.1.113883.6.88" String codesystemname; // "RxNorm", "SNOMED", "LOINC", etc. String displayname; // some formal or informal name, etc. String statuscode; // "completed" or "active" } ``` |

**<samp>CommonPojo</samp>** features many fields that are used in POJOs that subclass it.

- **<samp>classcode</samp>**, **<samp>moodcode</samp>** and **<samp>typecode</samp>** are used in situations where the boilerplate cannot know and so IXML must say which.
- **<samp>startdate</samp>** serves in **<samp>effectivetime</samp>** for **<samp>low</samp>** and also in those situations where it's the only time and there is no **<samp>enddate</samp>** (or **<samp>high</samp>**) semantically.
- **<samp>code</samp>**, **<samp>codesystem</samp>**, **<samp>codesystemname</samp>** and **<samp>displayname</samp>** are a set of four crucially important codes used to generate MDHT <samp>CD</samp> or <samp>CE</samp>codes in the CCD construct:

```
<code code="" codeSystem="" codeSystemName="" displayName="" />
```
- Some POJOs, like **<samp>Problem</samp>**(and others), must populate value codes with similar sets (to the four explain just above) in the CCD construct:

```
<value code="" codeSystem="" codeSystemName="" displayName="" xsi:type="CD" />
```

So it is that these POJOs must offer **<samp>valuecode</samp>**, **<samp>valuecodesystem</samp>**, **<samp>valuecodesystemname</samp>** and **<samp>valuedisplayname</samp>** in order to reduce confusion as to what construct they'll be used for. In the cases where a complete set of the four is not offered, the missing ones are guaranteed boilerplated.
- **<samp>statuscode</samp>**is used to supply the value in the construct:

```
<statusCode code="completed|active" />
```

Even if this value is established by boilerplate, it usually can be overridden.
- Note that any attribute may be passed to an IXML element. If unrecognized, for example, it's an old, deprecated one, it will simply be ignored without any effect upon what's generated in the CCD.

## The <samp>HtmlTableFormat</samp> POJO

This tailors the human-readable (HTML table) section generated in the CCDA for each principal section (such as Allergies, Encounters, Immunizations, Medications, Problems, Procedures, etc.). This element is usefully applied to any <samp>CommonPojo</samp> (listed further below) that's expected to provide a human-readable (HTML table) in the generated CCDA. Multiple or none of these definitions appear below the header and above the individual concept lists and their definitions.

| Source Code | IXML Sample |
| --- | --- |
| <samp>HtmlTableFormat</samp> |
| ``` class HtmlTableFormat { String sectionname; List< Column > columns; } ``` | ``` <human-readable-formats> <htmltableformat sectionname="encounter"> <column name="date/time" source="author:time" empty="(no date)" /> <column name="facility" source="author:organization:name" /> <column name="facilityoid" source="author:organization:facilityoid" /> <column name="description" source="author:displayname" /> </htmltableformat> <htmltableformat sectionname="procedure"> <column name="date" source="startdate" /> <column name="description" source="displayname" /> <column name="facility" source="author:organization:name" /> </htmltableformat>\n" ... </human-readable-formats> ``` |
| <samp>Column</samp> |
| ``` class Column { String name; // header name for the column (free form: you may name this anything you wish) String source; // IXML CommonPojo member providing the resource String empty; // what to default to in case of missing resource } ``` |  |

Failure to express attribute <samp>empty</samp> will cause default "(unknown)" to be substituted for data when the cell data/value is null or empty.

The <samp>CommonPojo</samp>s that are candidates for this treatment are as follows. In the documented examples of some of these, you may find a small example of a column or two based on which you can fully define them. Failure to define an HTML table format override for a section will mean that the original, IMAT Solutions' default columns are used including the data implied (i.e.: what IMAT Solutions used to supply before creating this flexibility feature).

| <big>CCDAs</big> |
| --- |
| [**<samp>Allergy</samp>**](/docs/ixml#Allergy) | (<samp>sectioname="allergy"</samp>) |
| [**<samp>Encounter</samp>**](/docs/ixml#Encounter) | (<samp>sectioname="encounter"</samp>) |
| [**<samp>FunctionalStatus</samp>**](/docs/ixml#FunctionalStatus) | (<samp>sectioname="functional status"</samp>) |
| [**<samp>Immunization</samp>**](/docs/ixml#Immunization) | (<samp>sectioname="immunization"</samp>) |
| [**<samp>Medication</samp>**](/docs/ixml#Medication) | (<samp>sectioname="medication"</samp>) |
| [**<samp>Payer</samp>**](/docs/ixml#Payer) | (<samp>sectioname="payer"</samp>) |
| [**<samp>Problem</samp>**](/docs/ixml#Problem) | (<samp>sectioname="problem"</samp>) |
| [**<samp>Procedure</samp>**](/docs/ixml#Procesure) | (<samp>sectioname="procedure"</samp>) |
| [**<samp>Result</samp>**](/docs/ixml#Result) | (<samp>sectioname="result"</samp>) |
| [**<samp>SocialHistory</samp>**](/docs/ixml#SocialHistory) | (<samp>sectioname="social history"</samp>) |
| [**<samp>SmokingStatus</samp>**](/docs/ixml#SmokingStatus) | (<samp>sectioname="smoking status"</samp>) |
| [**<samp>VitalSign</samp>**](/docs/ixml#VitalSign) | (<samp>sectioname="vital sign"</samp>) |
| <big>Care Plans</big> |
| [**<samp>Goal</samp>**](/docs/ixml#Goal) | (<samp>sectioname="goal"</samp>) |
| [**<samp>HealthConcern</samp>**](/docs/ixml#HealthConcern) | (<samp>sectioname="health concern"</samp>) |
| [**<samp>Intervention</samp>**](/docs/ixml#Intervention) | (<samp>sectioname="intervention"</samp>) |
| <big>QRDA</big> |
| No sections in QRDA I or III participate in explicit human-readable generation. |

In the IXML examples below, where there is a <samp>&lt;htmltableformat</samp>, it is usually the description of the IMAT Solutions default figuring in the explanation above. This means a) that you don't have to do anything (add <samp>&lt;htmltableformat</samp>) to get that behavior, but b) the default given serves as a good place to start when you do wish to deviate from the default and build your own.

#### How to know which fieldnames of the POJO can serve as data sources

Not all instance variables (fields) are candidates for this feature. Written Java, obviously there is strict delineation between data and code. Consequently, we predict what you will want to use and annotate POJO fieldnames in this rather light, background color that are eligible. If you wish to consume data from a field that isn't thus marked, please contact us.

When consuming fields from a list (or array) of subordinate elements of a POJO (a frequent example would be [**Translation**](/docs/ixml#Translation)), only the first (or zeroeth) element will be used. In an allergy instrumented thus:

```
<htmltableformat sectionname="allergy">
  ...
  <column name="type" source="allergyobservation:type" empty="(unknown type)" />
</htmltableformat>
```

Only the <samp>type</samp> of the first [**<samp>AllergyObservation</samp>**](/docs/ixml#AllergyObservation) will be considered no matter how many additional observations may exist.

#### Special framework extensions

##### Name-builder macro

Taking an example from [**Result**](/docs/ixml#Result) for the formation of the *primary-care physician*'s name, it's possible to dictate how that happens using a special syntax. Here's the example:

```
  <column name="author" source="author:person:name:prefix+given+middle+family" />
```

The way this works is to

1. end the <samp>source</samp> syntax string with an element (<samp>name</samp>) that doesn't exist in the named POJO (<samp>Person</samp>), but that is descriptive of the result (though it doesn't matter—it's for documentary value).
2. A final colon is added, then...
3. elements by names that do exist for the POJO are added—separated by plus signs (<samp>+</samp>); these are used to source and format the individual fields they suggest.

##### OR'd sources

Taking an example from [**Encounter**](/docs/ixml#Encounter) for the source of <samp>date</samp>, this value comes from the [**Problem**](/docs/ixml#Problem) if there is one. However, as not all [**Encounter**](/docs/ixml#Encounter)s have subordinate [**Problem**](/docs/ixml#Problem)s, the date can come from the [**Encounter**](/docs/ixml#Encounter)'s <samp>startdate</samp> or <samp>enddate</samp> (not really in an encounter—it's just an example to illustrate <samp>OR</samp>) field thus:

```
<htmltableformat sectionname="encounter">
  ...
  <column name="date" source="problem:startdate|enddate" empty="(no date)" />
</htmltableformat>
```

##### [**AllergyObservation**](/docs/ixml#AllergyObservation) syntax enhancements

There is a syntactic mechanism in the [**<samp>HtmlTableFormat</samp>**](/docs/ixml#HtmlTableFormat) specification by which fields in the [**<samp>AllergyObservation</samp>**](/docs/ixml#AllergyObservation) can contribute to the human-readable (HTML table) for [**<samp>Allergies</samp>**](/docs/ixml#Allergy).

For example, an HR specification for [**<samp>Allergies</samp>**](/docs/ixml#Allergy) in IXML might look like this:

```
<htmltableformat sectionname="allergy">
  <column name="date"        source="startdate"                                       empty="(date unknown)" />
  <column name="description" source="displayname"                                     empty="(no description)" />
  <column name="facility"    source="author:organization:name"                        empty="(facility unknown)" />
  <!-- the discriminant to match is understood to be in field 'type' of an allergyobservation: -->
  <column name="reaction"    source="allergyobservation:valuedisplayname[reaction]" empty="(no reaction)" />
  <column name="severity"    source="allergyobservation:valuedisplayname[severity]" empty="(no severity)" />
</htmltableformat>
```

The CCD output looks like this (highlighted lines correspond to the highlighted lines of the IXML specification above):

```
<title>Allergies and Intolerances</title>
<text>
  <table>
    <thead>
      <tr>
        <th> date </th>
        <th> description </th>
        <th> facility </th>
        <th>  reaction </th>
        <th>  severity </th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td> 2020-01-01 </td>
        <td> orange juice </td>
        <td> CharterCare </td>
        <td>  Swelling </td>
        <td>  Severe </td>
      </tr>
    </tbody>
  </table>
</text>
```

The more obscure details of this lie in *mdht-restlet* code running the list of [**<samp>AllergyObservation</samp>**](/docs/ixml#AllergyObservation)s to pick the observation whose <samp>type</samp> matches the current specification's bracketed expression. There are two in the specification:

```
<column name="reaction" source="allergyobservation:valuedisplayname[ reaction]" />
<column name="severity" source="allergyobservation:valuedisplayname[ severity]" />
```

As we do not require that this list just happen to be in the same order as the specification's columns (i.e.: "reaction" first, then "severity"), we have to match the <samp>type</samp> to ensure we get the correct valuedisplayname as the data for the corresponding column. So, the mysterious detail of this implementation (for the IXML writer) would be that field <samp>type</samp> is implicitly involved. Hence, the comment in the documented specification sample.

Here we add the allergy observations as coded in the IXML which should help to remove this mystery. I purposely expressed them out of order for the purpose of demonstrating that the implementation is sensitive enough not to require it.

```
<allergyobservation type="severity"
                    valuecode="24484000"
                    valuecodesystem="2.16.840.1.113883.6.96"
                    valuecodesystemname="SNOMED"
                    valuedisplayname=" Severe" />
<allergyobservation type="reaction"
                    valuecode="65124004"
                    valuecodesystem="2.16.840.1.113883.6.96"
                    valuecodesystemname="SNOMED"
                    valuedisplayname=" Swelling" />
```

## The <samp>Author</samp>, <samp>Participant</samp>, and <samp>Performer</samp> POJOs

Is a mere <samp>Pojo</samp>, but it's mostly consumed by other POJOs. Note that not every field in <samp>Person</samp> and <samp>Organization</samp> is required; in fact, most are not. For example, <samp>Person</samp> offers a telecom and address, but even if present, these will never be used (in <samp>Author</samp>). Similarly, <samp>Organization</samp> offers fields that will not be used in this context.

All authors furnished to any concept section are collected into a list, duplicates are dropped, then the whole list is added to the <samp>&lt;documentationOf ... &gt;</samp> section near the end of the header in the generated CCD.

| Author | IXML Sample |
| --- | --- |
| ``` class Author extends Pojo { String time; String code; String codesystem; String codesystemname; String displayname; Telecom telecom; Address address; Person person; // PCP and NPI Organization organization; // facility name and OID } ``` | ``` <author time="202112090900+0000" code="163W00000X" codesystem="2.16.840.1.113883.5.53" codesystemname="Health Care Provider Taxonomy" displayname="Physician"> <telecom>818 290-9233</telecom> <!-- optional (encouraged) --> <address> <!-- optional; used if present --> <line>32089 Rodeo Drive</line> <city>Beverly Hills</city> <state>CA</state> <zipcode>90210</zipcode> <country>US</country> </address> <person> <family>Seymore</family> <!-- optional (encouraged)* --> <given>Jane</given> <!-- optional (encouraged)* --> <middle>J.</middle> <!-- optional* --> <suffix>MD</suffix> <!-- optional (encouraged)* --> <npi>665892</npi> <!-- required for NPI --> <!-- any other fields from Person are ignored --> </person> <!-- *used to create PCP if present --> <organization> <name>Beverly Hills Clinic</name> <!-- required facility name --> <facilityoid>2.16.840.1.113883.19.42</facilityoid> <!-- required facility OID --> <!-- any other fields added to Organization are ignored --> </organization> </author> <htmltableformat> <!-- human-readability (column) examples --> <column name="npi" source="author:person:npi" empty="(unidentified)" /> <column name="facility name" source="author:organization:name" empty="(unknown)" /> <column name="facility oid" source="author:organization:facilityoid" empty="(unknown)" /> </htmltableformat> ``` |

**<samp>CommonPojo</samp>**'s <samp>facilityname</samp>, <samp>facilityoid</samp>, <samp>pcp</samp> (primary-care physician) and <samp>npi</samp> (National Provider Identifier) used to be fields shared in common (to all POJOs subclassing <samp>CommonPojo</samp>). One or more of these were often passed as attribute values. This no longer serves any purpose; this practice has been deprecated. The proper source of this information is in the **<samp>Author</samp>** associated with the POJO in question (if expressed):

| fieldname | present, expected source |
| --- | --- |
| <samp>facilityname</samp> | From **<samp>Organization</samp>** → <samp>name</samp> |
| <samp>facilityoid</samp> | From **<samp>Organization</samp>** → <samp>facilityoid</samp> |
| <samp>pcp</samp> | From **<samp>Person</samp>** → <samp>family</samp>, <samp>given</samp>, <samp>suffix</samp> |
| <samp>npi</samp> | From **<samp>Person</samp>** → <samp>npi</samp> |

In generating CCDAs, **<samp>Author</samp>** is consumed by the following subclasses of <samp>CommonPojo</samp>:

1. [**<samp>Allergy</samp>**](/docs/ixml#Allergy)
2. [**<samp>SelfCare</samp>**](/docs/ixml#SelfCare) ( **<samp>FunctionalStatus</samp>**)
3. [**<samp>StatusObservation</samp>**](/docs/ixml#StatusObservation) ( **<samp>FunctionalStatus</samp>**)
4. [**<samp>Immunization</samp>**](/docs/ixml#Immunization)
5. [**<samp>Medication</samp>**](/docs/ixml#Medication)
6. [**<samp>Problem</samp>**](/docs/ixml#Problem)
7. [**<samp>Procedure</samp>**](/docs/ixml#Procedure)
8. [**<samp>ResultPanel</samp>**](/docs/ixml#ResultPanel)
9. [**<samp>SocialHistory</samp>**](/docs/ixml#SocialHistory) ( **<samp>SocialHistories</samp>**)
10. [**<samp>SmokingStatus</samp>**](/docs/ixml#SmokingStatus) ( **<samp>SocialHistories</samp>**)
11. [**<samp>VitalSignGroup</samp>**](/docs/ixml#VitalSignGroup)
12. [**<samp>VitalSign</samp>**](/docs/ixml#VitalSign)

But, these do not accommodate any **<samp>Author</samp>**:

1. [**<samp>Encounter</samp>**](/docs/ixml#Encounter) (has a list of [**<samp>Problem</samp>**](/docs/ixml#Problem)s each of which accommodates [**<samp>Author</samp>**](/docs/ixml#Author))
2. [**<samp>FunctionalStatus</samp>**](/docs/ixml#FunctionalStatus) (⅔ of subsections accommodate [**<samp>Author</samp>**](/docs/ixml#Author))
3. [**<samp>Payer</samp>**](/docs/ixml#Payer) (immature, not really used presently, may change)
4. [**<samp>Result</samp>**](/docs/ixml#Result) (parent [**<samp>ResultPanel</samp>**](/docs/ixml#ResultPanel) accommodates the [**<samp>Author</samp>**](/docs/ixml#Author) for all **<samp>Result</samp>**s)

## <samp>Participant</samp>

<samp>Participant</samp> is not ubiquitous; it's currently only supported by [***Encounter***](/docs/ixml#Encounter).

| Participant | IXML Sample |
| --- | --- |
| ``` class Participant extends Pojo { String name; // of Service Delivery Location String code; String codesystem; String codesystemname; String displayname; Telecom telecom; Address address; } ``` | ``` <participant code="163W00000X" codesystem="2.16.840.1.113883.5.53" <!-- boilerplated from code --> codesystemname="Health Care Provider Taxonomy" <!-- ibid --> displayname="Physician" <!-- ibid --> name="Catskills Health Clinic"> <!-- playing entity --> <telecom>818 290-9233</telecom> <address> <line>32089 Rodeo Drive</line> <city>Beverly Hills</city> <state>CA</state> <zipcode>90210</zipcode> <country>US</country> </address> </participant> ``` |

Service Delivery Location

## <samp>Performer</samp>

<samp>Performer</samp> is very similar to [***Author***](/docs/ixml#Author). It is not ubiquitous; it's currently only supported by [***Encounter***](/docs/ixml#Encounter).

| Performer | IXML Sample |
| --- | --- |
| ``` class Performer extends Pojo { String code; String codesystem; String codesystemname; String displayname; String functioncode; String functioncodesystem; String functioncodesystemname; String functiondisplayname; String originaltext; Telecom telecom; Address address; } ``` | ``` <performer code="163W00000X" codesystem="2.16.840.1.113883.5.53" codesystemname="Health Care Provider Taxonomy" displayname="Physician" functioncode="PCP" functioncodesystem="2.16.840.1.113883.5.88" functioncodesystemname="ParticipationFunction" functiondisplayname="Primary Care Provider" originaltext="This is a test of the Emergency Broadcast System."> <telecom>818 290-9233</telecom> <address> <line>32089 Rodeo Drive</line> <city>Beverly Hills</city> <state>CA</state> <zipcode>90210</zipcode> <country>US</country> </address> <person> <family>Seymore</family> <given>Jane</given> <middle>J.</middle> <!-- optional* --> <suffix>MD</suffix> <!-- optional (encouraged)* --> <npi>665892</npi> <!-- required for NPI --> <telecom ... /> <address ... /> </person> <organization> <name>Beverly Hills Clinic</name> <!-- required facility name --> <facilityoid>2.16.840.1.113883.19.42</facilityoid> <!-- required facility OID --> <telecom ... /> <address ... /> </organization> </performer> ``` |

## Other consumed POJOs

These only serve in subordinate roles to principal POJOs.

These translations correspond to *translation* noted in the [*Implementation Guide*](/v1/docs/ixml#documents-implementation-guide) as generated under <samp>&lt;code&gt;</samp> constructs. In general, if any of these tetracodes is missing, you're inviting trouble. In some cases, absence will cause "subtranslations" to occur or the translation will be constructed with null or missing values.

| Translation | IXML Sample |
| --- | --- |
| ``` class Translation extends Pojo { String code; String codesystem; String codesystemname; String displayname; } ``` | ``` <!-- for handling non-SNOMED setCode() in act, observation, etc. --> <translation code="345678" codesystem="2.4.6.8.10.12" codesystemname="This isn't a code system" displayname="This is a translation of a code system" /> ``` |

## Principal POJOs

Usually atop [**<samp>CommonPojo</samp>**s](/docs/ixml#CommonPojo), these are used to build the CCDA section by section.

**Important note:**  All these [<samp>CommonPojo</samp>](/docs/ixml#CommonPojo) subclasses offer not only the fields explicitly documented, but also all the fields in superclass [<samp>CommonPojo</samp>](/docs/ixml#CommonPojo) such as (especially) <samp>code</samp>, <samp>codesystem</samp>, etc. These fields are crucially relevant.

| Source Code | IXML Sample |
| --- | --- |
| Allergy |
| ``` class Allergy extends CommonPojo { Author author; String observationstatuscode; Author observationauthor; List< AllergyObservation > allergyobservation; } ``` | ``` <allergies> <allergy startdate="201212250900" code="1000082" codesystem="2.16.840.1.113883.6.88" codesystemname="RxNorm" displayname="Christmas candy" statuscode="active" observationstatuscode="completed" displayname="Christmas candy"> <author ... /> <observationauthor time="202112090900+0000" code="163W00000X" codesystem="2.16.840.1.113883.5.53" codesystemname="Health Care Provider Taxonomy" displayname="Physician"> <telecom>818 290-9233<telecom> <!-- works like any ordinary author --> ... </observationauthor> <allergyobservation ... /> </allergy> </allergies> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="allergy"> <column name="date" source="startdate" /> <column name="description" source="displayname" /> <column name="facility" source="author:organization:name" /> <!-- the discriminant to match is understood to be in field 'type' of an allergyobservation: --> <column name="reaction" source="allergyobservation:valuedisplayname[reaction]" empty="(no reaction)" /> <column name="severity" source="allergyobservation:valuedisplayname[severity]" empty="(no severity)" /> </htmltableformat> </htmltableformats> ``` |
| Allergies and Intolerances Section (V3) Allergy Concern Act (V3) Allergy—Intolerance Observation (V2) |  |
| AllergyObservation |
| ``` class AllergyObservation extends CommonPojo { String type; ("reaction" or "severity") String valuecode; String valuecodesystem; String valuecodesystemname; String valuedisplayname; } ``` | ``` <allergies> <allergy ...> <allergyobservation type="severity" valuecode="24484000" valuecodesystem="2.16.840.1.113883.6.96" valuecodesystemname="SNOMED" valuedisplayname="Severe" /> <allergyobservation type="reaction" valuecode="65124004" valuecodesystem="2.16.840.1.113883.6.96" valuecodesystemname="SNOMED" valuedisplayname="Swelling" /> </allergy> </allergies> ``` |
| Reaction Observation (V2) Severity Observation (V2) |
| EncompassingEncounter |
| ``` class EncmpassingEncounter extends CommonPojo { String root; String extension; String facilityroot; } ``` | ``` <encompassingencounter root="2.16.840.1.113883.19" extension="9937012" facilityroot="2.16.540.1.113883.19.2" /> ``` |
| Encounter |
| ``` class Encounter extends CommonPojo { List< Translation > translation; List< Problem > problems; Performer performer; Participant participant; } ``` | ``` <encounters> <encounter startdate="20120528" code="99213" codesystemname="CPT-4" codesystem="2.16.840.1.113883.6.12" displayname="Office outpatient visit 15 minutes"> <translation ... /> <performer ... /> <participant ... /> <problems> <problem 1 ... /> <problem 2 ... /> <problem n ... /> </problems> </encounter> </encounters> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="encounter"> <column name="type" source="displayname" /> <column name="date" source="problem:startdate" empty="(no date)" /> <column name="description" source="problem:valuedisplayname" /> <!-- description requires a problem --> <column name="facility" source="problem:author:organization:name" /> <!-- facility name requires a problem --> </htmltableformat> </htmltableformats> ``` |
| Encounters Section (V3) Encounter Activity (V3) Encounter Diagnosis (V3) Problem Observation (V3) |  |
| FunctionalStatus |
| ``` class FunctionalStatus extends CommonPojo { List< StatusObservation > statusobservation; List< AssessmentScale > assessmentscale; List< SelfCare > selfcare; } ``` | ``` <functionalstatusdetails> <functionalstatus> <statusobservation startdate="20130309" code="129035000" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED CT" displayname="Mental status" /> <statusobservation startdate="20130311" code="129035000" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED CT" displayname="independent with dressing"> <author ... /> </statusobservation> <assessmentscale startdate="20120214" code="54614-3" codesystem="2.16.840.1.113883.6.1" codesystemname="LOINC" displayname="Brief Interview for Mental Status" value="7"> <scalesupporting code="248240001" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED" displayname="motor response" value="3" /> </assessmentscale> <selfcare startdate="20130311" code="46482-6" codesystem="2.16.840.1.113883.6.1" codesystemname="LOINC" displayname="Transferring" valuecode="371153006" valuecodesystem="2.16.840.1.113883.6.96" valuecodesystemname="SNOMED CT" valuedisplayname="Independent"> <author ... /> </selfcare> </functionalstatus> </functionalstatusdetails> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="functional status"> <column name="date" source="startdate" /> <column name="author" source="author:person:family" /> <!-- need system to forumulate suffix given family --> <column name="value" source="value" /> </htmltableformat> </htmltableformats> ``` |
| **Functional Status Section:** Functional Status Observation (V2) Assessment Scale Observation Assessment Scale Supporting Observation Self-care Activities |  |
| StatusObservation |
| ``` class StatusObservation extends CommonPojo { Author author; } ``` | ``` <functionalstatus> <statusobservation startdate="20130309" code="129035000" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED CT" displayname="Mental status" /> <statusobservation startdate="20130311" code="129035000" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED CT" displayname="independent with dressing"> <author ... /> </statusobservation> <functionalstatus> ``` |
| AssessmentScale |
| ``` class AssessmentScale extends CommonPojo { String value; ScaleSupporting scalesupporting; } ``` | ``` <functionalstatusdetails> <functionalstatus> <statusobservation ... > <author ... /> </statusobservation> <assessmentscale startdate="20120214" code="54614-3" codesystem="2.16.840.1.113883.6.1" codesystemname="LOINC" value="7" displayname="Brief Interview for Mental Status" value="7"> <scalesupporting code="248240001" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED" displayname="motor response" value="3" /> </assessmentscale> <selfcare ... > <author ... /> </selfcare> </functionalstatus> </functionalstatusdetails> ``` |
| ScaleSupporting |
| ``` class ScaleSupporting extends CommonPojo { String value; } ``` | ``` <functionalstatusdetails> <functionalstatus> <assessmentscale startdate="20120214" code="54614-3" codesystem="2.16.840.1.113883.6.1" codesystemname="LOINC" value="7" displayname="Brief Interview for Mental Status"> <scalesupporting code="248240001" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED" displayname="motor response" value="3" /> </assessmentscale> </functionalstatus> </functionalstatusdetails> ``` |
| SelfCare |
| ``` class SelfCare extends CommonPojo { String valuecode; String valuecodesystem; String valuecodesystemname; String valuedisplayname; Author author; } ``` | ``` <functionalstatusdetails> <functionalstatus> <statusobservation ... > <author ... /> </statusobservation> <assessmentscale ... /> <scalesupporting ... /> </assessmentscale> <selfcare startdate="20130311" code="46482-6" codesystem="2.16.840.1.113883.6.1" codesystemname="LOINC" displayname="Transferring" valuecode="371153006" valuecodesystem="2.16.840.1.113883.6.96" valuecodesystemname="SNOMED CT" valuedisplayname="Independent"> <author ... /> </selfcare> </functionalstatus> </functionalstatusdetails> ``` |
| Goal |
| ``` class Goal extends CommonPojo { String value; String unit; Author author; } ``` | ``` <goal startdate="20220511141903" enddate="20220515151903" code="59408-5" codesystem="2.16.840.1.113883.6.1" codesystemname="LOINC" displayname="Oxygen saturation in Arterial blood by Pulse oximetry" value="92" unit="%"> <author time="201308011235-0800" code="163W00000X" codesystem="2.16.840.1.113883.19.42" codesystemname="Health Care Provider Taxonomy" displayname="Beverly Hills Clinic"> <telecom>818 290-9233</telecom> <address> <line>32089 Rodeo Drive</line> <city>Beverly Hills</city> <state>CA</state> <zipcode>90210</zipcode> <country>US</country> </address> <person> <family>Seymore</family> <given>Jane</given> <middle>J.</middle> <suffix>MD</suffix> <npi>665892</npi> </person> </author> </goal> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="goal"> <column name="dates" source="startdate"/> <column name="documents" source="displayname"/> </htmltableformat> </htmltableformats> ``` |
| Goals Section Goal Observation Identifier |  |
| HealthConcern |
| ``` class HealthConcern extends CommonPojo { Author author; } ``` | ``` <healthconcerns> <healthconcern startdate="20220511141903" enddate="20220515151903"> <author time="201308011235-0800" code="163W00000X" codesystem="2.16.840.1.113883.19.42" codesystemname="Health Care Provider Taxonomy" displayname="Beverly Hills Clinic"> <telecom>818 290-9233</telecom> <address> <line>32089 Rodeo Drive</line> <city>Beverly Hills</city> <state>CA</state> <zipcode>90210</zipcode> <country>US</country> </address> <person> <family>Seymore</family> <given>Jane</given> <middle>J.</middle> <suffix>MD</suffix> <npi>665892</npi> </person> </author> </healthconcern> </healthconcerns> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="health concern"> <column name="date" source="startdate" /> <column name="description" source="displayname" /> </htmltableformats> </htmltableformats> ``` |
| Heath Concerns Section (V2) Health Status Observation (V2) Health Concern Act (V2) |
| Immunization |
| ``` class Immunization extends CommonPojo { boolean negation; // false (default) String value; String unit; List< Translation > translation; Author author; } ``` | ``` <immunizations> <immunization negation="false" startdate="20201007000000+0000" enddate="20201007000000+0000" value="7.0" <!-- for dose quantity --> unit="mg/DL" code="106" codesystem="2.16.840.1.113883.12.292" codesystemname="CVX" displayname="diphtheria"> <translation code="345678" codesystem="2.4.6.8.10.12" codesystemname="This isn't a code system" displayname="This is a translation of a code system" /> <author time="201308011235-0800" code="163W00000X" codesystem="2.16.840.1.113883.19.42" codesystemname="Health Care Provider Taxonomy" displayname="Beverly Hills Clinic"> <telecom>818 290-9233</telecom> <address> <line>32089 Rodeo Drive</line> <city>Beverly Hills</city> <state>CA</state> <zipcode>90210</zipcode> <country>US</country> </address> <person> <family>Seymore</family> <given>Jane</given> <middle>J.</middle> <suffix>MD</suffix> <npi>665892</npi> </person> </author> </immunization> </immunizations> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="immunization"> <column name="date" source="startdate" /> <column name="description" source="displayname" /> <column name="facility" source="author:organization:name" /> </htmltableformats> </htmltableformats> ``` |
| Immunization Section (V3) Immunization Activity (V3) Immunization Medication Information (V2) |  |
| Intervention |
| ``` class Intervention extends CommonPojo { String order; //one of "Intervention Act (V2)" (default), //"Planned Intervention Act (V2)"or //"Handoff Communication Participants" String moodcode; //one of "APT", "ARQ", "INT","PRMS", "PRP" or "RQO" List< Author > author; List< HParticipant > hparticipant; } ``` | ``` <intervention startdate="20220511141903" enddate="20220515151903" order="Planned Intervention Act (V2)" moodcode="APT"> <author time="201308011235-0800" code="163W00000X" codesystem="2.16.840.1.113883.19.42" codesystemname="Health Care Provider Taxonomy" displayname="Beverly Hills Clinic"> <telecom>818 290-9233</telecom> <address> <line>32089 Rodeo Drive</line> <city>Beverly Hills</city> <state>CA</state> <zipcode>90210</zipcode> <country>US</country> </address> <person> <family>Seymore</family> <given>Jane</given> <middle>J.</middle> <suffix>MD</suffix> <npi>665892</npi> </person> </author> </intervention> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="intervention"> <column name="date" source="startdate" /> <column name="description" source="valuedisplayname" /> <column name="facility" source="author:organization:name" /> </htmltableformat> </htmltableformats> ``` |
| Interventions Section (V3) Intervention Act (V2) Planned Intervention Act (V2) Handoff Communication Participants |  |
| Medication |
| ``` class Medication extends CommonPojo { String value; String repeatnumber; String approachsitecode; String approachsitecodesystem; String approachsitecodesystemname; String approachsitedisplayname; String ratequantity; String ratequantityunits; String maxdosequantitynumerator; String maxdosequantitydenominator; String administrationunitcode; String administrationunitcodesystem; String administrationunitcodesystemname; String administrationunitdisplayname; String materialcode; String materialcodesystem; String materialcodesystemname; String materialdisplayname; String routecode; String routecodesystem; String routecodesystemname; String routedisplayname; Immunization immunization; List< Translation > translation; Author author; } ``` | ``` <medications> <medication startdate="20200706000000+0000" enddate="20200706000000+0000" code="198473" codesystem="2.16.840.1.113883.6.88" codesystemname="RXNORM" displayname="Aspirin 600 MG Rectal Suppository" . . . /> <immunization ... /> <!-- (when medication is an immunization) --> <translation ... /> <author ... /> </medication> </medications> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="medication"> <column name="date" source="startdate" /> <column name="description" source="displayname" /> <column name="facility" source="author:organization:name" /> </htmltableformats> </htmltableformats> ``` |
| Medications Section (V2) Medication Activity (V2) Medication Information (V2) |  |
| Payer |
| ``` class Payer extends CommonPojo { String translationcode; String translationdisplayname; } ``` | ``` <payers> <payer startdate="20210411" enddate="20210411" statuscode="completed" code="12" codesystem="2.16.840.1.113883.6.255.1336" codesystemname="Insurance Type Code (x12N-1336)" displayname="Medicare Secondary Working" translationcode="2" translationdisplayname="Medicare" organizationname="Transylvanian Emigres Health"> <person> <family>Munster</family> <given>Lily</given> <given>Dracula</given> <prefix>Mrs.</prefix> </person> <telecom use="HP">+400745-443 444</telecom> <address use="HP"> <line>Str. Maslinului nr. 16A</line> <city>Bucharest</city> <state>Bucharest</state> <country>RO</country> </address> </payer> </payers> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="payer"> </htmltableformat> </htmltableformats> ``` |
| Payers Section (V3) Coverage Activity (V3) Policy Activity (V3) |  |
| Plan |
| ``` class Plan extends CommonPojo { Author author; } ``` | ``` <assessments> <plan startdate="20210411" enddate="20210411" statuscode="completed" code="12" codesystem="2.16.840.1.113883.6.255.1336" codesystemname="Insurance Type Code (x12N-1336)" displayname="Medicare Secondary Working" /> <author ... /> </plan> </assessments> ``` |
| Assessment and Plan Section (V2) Planned Act (V2) —as yet never generated |  |
| Problem |
| ``` class Problem extends CommonPojo { String translationcode; String translationcodesystem; String translationcodesystemname; String translationdisplayname; String valuecode; String valuecodesystem; String valuecodesystemname; String valuedisplayname; List< Translation > translation; Author author; } ``` | ``` <problems> <problem startdate="20120222" <!-- SHALL --> enddate="" <!-- MAY --> <!-- this goes into Problem Observation (V3) --> code="99645-9" codesystem="2.16.840.1.113883.6.90" codesystemname="SNOMED" <!-- must be SNOMED --> displayname="Acquired absence of unspecified breast and nipple" translationcode="Z90.10" <!-- translation of above to non-SNOMED --> translationcodesystem="2.16.840.1.113883.6.90" translationcodesystemname="ICD10" translationdisplayname="Acquired absence of unspecified breast and nipple" valuecode="Z90.10" valuecodesystem="2.16.840.1.113883.6.90" valuecodesystemname="ICD10" valuedisplayname="Acquired absence of unspecified breast and nipple"> <translation code="345678" <!-- used for <value ... /> above --> codesystem="2.4.6.8.10.12" codesystemname="This isn't a code system" displayname="This is a translation of a code system" /> <author ... /> </problem> </problems> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="problem"> <column name="date" source="startdate" /> <column name="description" source="valuedisplayname" /> <column name="facility" source="author:organization:name" /> </htmltableformat> </htmltableformats> ``` |
| Problem Section (V3) Problem Concern Act (V3) Problem Concern Act (V3) Problem Observation (V3) |  |
| Procedure |
| ``` class Procedure extends CommonPojo { String value; String units; String targetsitecode; // (SHOULD, probably missing) String targetsitecodesystem; String targetsitecodesystemname; String targetsitedisplayname; String activity; // "observation" (default), // "procedure" or "act" Author author; } ``` | ``` <procedures> <procedure startdate="19771006000000+0000" enddate="19771006000000+0000" code="37894004" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED" displayname="Evaluation and management of new patient (procedure)" targetsitecode="28273000" targetsitecodesystem="2.16.840.1.113883.6.96" targetsitecodesystemname="SNOMED CT" targetsitedisplayname="bile duct" activity="observation"> <author ... /> </procedure> </procedures> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="procedure"> <column name="date" source="startdate" /> <column name="description" source="displayname" /> <column name="facility" source="author:organization:name" /> </htmltableformat> </htmltableformats> ``` |
| Procedures Section (V2) Procedure Activity Observation (V2) Procedure Activity Procedure (V2) Procedure Activity Act (V2) |  |
| ResultPanel |
| ``` class ResultPanel extends CommonPojo { String classcode; (default is BATTERY) Author author; List< Result > result; } ``` | ``` <resultpanels> <resultpanel startdate="20171108" enddate="20171108" code="70161-5" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayname="Chlamydia trachomatis"> <author time="201308011235-0800" code="163W00000X" codesystem="88" codesystemname="Health Care Provider Taxonomy" displayname="Dogpatch Mule 'n' Maternity"> <telecom>615 349-7777</telecom> <address> <line>Main Street</line> <city>Dogpatch</city> <state>TN</state> <zipcode>37026</zipcode> <country>US</country> </address> <person> <family>Mamie</family> <given>Yokum</given> <suffix>MD</suffix> <npi>1234</npi> </person> </author> <result 1 ... /> <result 2 ... /> <result n ... /> </resultpanel> </resultpanels> ``` |
| (See [**Result**](/docs/ixml#Result).) |  |
| Result |
| ``` class Result extends CommonPojo { String value; String unit; String interpretationcode; String interpretationcodesystem; String observationlowvalue; String observationhighvalue; String observationunit; String observationtext; List< Translation > translation; } ``` | ``` <resultpanels> <resultpanel ... > <author ... /> <result startdate="20200203000000+0000" code="_31777-6" codesystem="2.16.840.1.113883.6.1" codesystemname="LOINC" displayname="Chlamydia trachomatis Ag Presence in Unspecified specimen" interpretationcode="Jiminy Cricket" interpretationcodesystem="1.2.3.4.5.6" value="8" unit="mg" observationlowvalue="1" observationhighvalue="2.9" observationunit="%" observationtext="Fun, fun, fun, 'til Daddy takes the T-bird away!" /> </resultpanel> </resultpanels> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="result"> <column name="lab" source="displayname" /> <column name="date" source="startdate" /> <column name="author" source="author:person:name:prefix+given+middle+family" /> <column name="facility" source="author:organization:name" /> <column name="value" source="value" /> <column name="unit" source="unit" /> <column name="interpretation" source="interpretationcode" /> </htmltableformat> </htmltableformats> ``` |
| Results Section (V3) Result Organizer (V3) Result Observation (V3) | Note: despite <samp>&lt;htmltableformat ... /&gt;</samp> or not, each result panel leads to the generation in the human-readable (HTML) section of row banners. These make use of <samp>ResultPanel.displayname</samp> and are notaffected by anything put into the [flexible human-readable mechanism](/docs/ixml#html-format). |
| SocialHistories |
| ``` class SocialHistories extends CommonPojo { List< SocialHistory > socialhistories; List< SmokingStatus > smokingstatus; List< Pregnancy > pregnancies; List< TobaccoUse > tobaccouses; List< Caregiver > caregivers; List< CultureAndReligion > culturesandreligions; List< HomeEnvironment > homeenvironments; } ``` | ``` <socialhistories> <socialhistory ... /> <smokingstatus ... /> <!-- not yet supported: --> <pregnancy ... /> <tobaccouse ... /> <caregiver ... /> <cultureandreligion ... /> <homeenvironment ... /> </socialhistories> ``` |
| (See [**SocialHistory**](/docs/ixml#SocialHistory).) |  |
| SocialHistory |
| ``` class SocialHistory extends CommonPojo { String value; List< Translation > translation; Author author; } ``` | ``` <socialhistories> <!-- codesystem and codesystemname are boilerplated if forgotten --> <socialhistory startdate="20180110" enddate="20210531" value="1" <!-- optional, but SHOULD --> code="102487004" codesystem="2.16.840.1.113883.6.96" <!-- (boilerplated) --> codesystemname="SNOMED_CT" <!-- (boilerplated) --> displayname="Environmental risk factor"> <!-- (HTML table cell) --> <translation ... /> <author ... /> </socialhistory> </socialhistories> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="social history"> <column name="date" source="startdate" /> <column name="description" source="displayname" /> <column name="facility" source="author:organization:name" /> </htmltableformat> </htmltableformats> ``` |
| Social History Section (V3) Social History Observation (V3) |  |
| SmokingStatus |
| ``` Class SmokingStatus extends CommonPojo { String valuecode; String valuecodesystem; String valuecodesystemname; String valuedisplayname; List< Translation > translation; Author author; } ``` | ``` <socialhistories> <!-- code, codesystem, etc. are boilerplated --> <!-- valuecode is not boilerplated --> <!-- valuecode and valuecodesystem are smoking status current observations --> <!-- valuecodesystem and valuecodesystemname are boilerplated if forgotten --> <smokingstatus startdate="20130311" enddate="20200104" code="81229-7" // (boilerplated) codesystem="LA26103-4" // (boilerplated) codesystemname="LOINC" // (boilerplated) displayname="Former smoker" // (boilerplated) valuecode="449868002" valuecodesystem="2.16.840.1.113883.6.96" // (boilerplated) valuecodesystemname="SNOMED CT" // (boilerplated) valuedisplayname="Heavy tobacco smoker"> // (HTML table cell) <author ... /> </smokingstatus> </socialhistories> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="smoking status"> <column name="date" source="startdate" /> <column name="description" source="valuedisplayname" /> <column name="facility" source="author:organization:name" /> </htmltableformat> </htmltableformats> ``` |
| Smoking Status—Meaningful Use (V2) |  |
| VitalSignGroup |
| ``` class VitalSignGroup extends CommonPojo { Author author; List< VitalSign > vitalsign; } ``` | ``` <vitalsigngroups> <vitalsigngroup startdate="20171108" enddate="20171108" <!-- code, codesystem, codesystemname and displayname are boilerplated --> > <author ... /> <vital 1 ... /> <vital 2 ... /> <vital n ... /> </vitalsigngroup> </vitalsigngroups> ``` |
| (See [**VitalSign**](/docs/ixml#VitalSign).) |  |
| VitalSign |
| ``` Class VitalSign extends CommonPojo { String value; String units; List< Translation > translation; Author author; } ``` | ``` <vitalsigngroups> <vitalsigngroup startdate="20171108" enddate="20171108" <!-- code, codesystem, codesystemname and valuecodedisplayname are boilerplated --> > <author ... /> <vital startdate="20180803" enddate="20180803" code="46680005" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED CT" displayname="BP diastolic" statuscode="completed" value="80" <!-- must be convertible to floating-point --> units="mm[Hg]"> <translation code="74728-7" codesystem="2.16.840.1.113883.6.1" codesystemname="LOINC" displayname="BP diastolic" /> <author ... /> </vital> </vitalsigngroup> </vitalsigngroups> <!-- legacy format (still supported) --> <vitals> <vital startdate="20180803" enddate="20180803" code="46680005" codesystem="2.16.840.1.113883.6.96" codesystemname="SNOMED CT" displayname="BP diastolic" statuscode="completed" value="80" <!-- must be convertible to floating-point --> units="mm[Hg]"> </vital> </vitals> <htmltableformats> <!-- human-readability example --> <htmltableformat sectionname="vital sign"> <column name="date" source="startdate" /> <column name="measurement" source="displayname" /> <column name="value" source="value" /> <column name="units" source="units" /> </htmltableformat> </htmltableformats> ``` |
| Vital Signs Section (V3) Vital Signs Organizer (V3) Vital Sign Observation (V2) |  |

## Specialized POJOs

<samp>AdminPojo</samp> doesn't appear in the IXML, but its instance variable, <samp>count</samp>, appears as an attribute on XML elements.

These are also referred to as *administrative* or *demographic POJOs*. In the pop-up examples there are multiple, optional forms. The preferred form comes first; the others typically demonstrate backward support for earlier versions of *mdht-restlet*. Earlier forms probably work, but are not guaranteed always to work.

If any of these are construed inaccurately, i.e.: invalid code (here <samp>9999-9</samp> which is not a valid race code and "white"), code system, code system name, etc., the result will be incorporated in a translation:

```
<raceCode nullFlavor="UNK">
  <translation code="9999-9"
               codeSystem="2.16.840.1.113883.6.238"
               codeSystemName="Race & Ethnicity - CDC"
               displayName="white" />
</raceCode>
```

This means that it's possible to substitute non-standard, private or proprietary codes in a way that will nevertheless validate.

| Source Code | IXML Sample |
| --- | --- |
| AdminPojo |
| ``` class AdminPojo extendsCommonPojo { } ``` | // internal-use only |
| Ethnicity |
| ``` class Ethnicity extends AdminPojo { } ``` | ``` <!-- recommended --> <ethnicity code="2135-2" codesystem="2.16.840.1.113883.6.238" codesystemname="Race & Ethnicity - CDC Ethnicity group" displayname="Hispanic or Latino" /> <!-- deprecated --> <ethnicity>2135-2</ethnicity> ``` |
| Language |
| ``` class Language extends AdminPojo { } ``` | ``` <!-- recommended --> <language code="frn" codesystem="2.16.840.1.113883.6.121" codesystemname="Language" displayname="French" /> <!-- deprecated --> <language>eng</language> ``` |
| MaritalStatus |
| ``` class MaritalStatus extends AdminPojo { } ``` | ``` <!-- recommended --> <maritalstatus code="M" codesystem="2.16.840.1.113883.5.2" codesystemname="MaritalStatusCode" displayname="Married" /> <!-- deprecated --> <maritalstatus>S</maritalstatus> <!-- deprecated --> <maritalstatus>Widowed</maritalstatus> ``` |
| Race |
| ``` class Race extends AdminPojo { } ``` | ``` <!-- recommended --> <race code="1002-5" codesystem="2.16.840.1.113883.6.238" codesystemname="Race & Ethnicity - CDC" displayname="American Indian or Alaska Native" /> <!-- deprecated --> <race>1002-5</race> <!-- deprecated --> <race>white</race> ``` |
| Religion |
| ``` class Religion extends AdminPojo { } ``` | ``` <!-- recommended --> <religion code="1027" codesystem="2.16.840.1.113883.5.1076" codesystemname="HL7 Religious Affiliation" displayname="Latter Day Saints" /> <!-- deprecated --> <religion>1027</religion> <!-- deprecated --> <religion>Catholic</religion> ``` |
| Sex |
| ``` class Sex extends AdminPojo { } ``` | ``` <!-- recommended --> <sex code="M" codesystem="2.16.840.1.113883.5.1" codesystemname="HL7AdministrativeGenderCode" displayname="Male" /> <!-- deprecated --> <gender>Female</gender> <!-- deprecated --> <gender>Unknown</gender> ``` |

## Appendix: IXML format templates

## POJO Theory

In Java, a *POJO* is a "plain, old Java object," elsewhere also called *a bean*. Each XML element in the IXML is rendered in *mdht-restlet*'s data structures as:

- a POJO 1, 2, 3
- implied collection of POJOs (but doesn't render as anything itself), 4
- nothing (because ignored).5

1 all IXML identifiers are lower-case; there is no mixed-case. 2 all POJOs in Java are classnames and are in **bold**, camelback case here, but as IXML elements they are lower-case (e.g.: <samp>EffectiveTime</samp> → <samp>&lt;effectivetime&gt;</samp>). 3 in the POJOs below, instance variable names (or fields) refer either to attributes or subelements in IXML; again, no mixed case. 4 an example of this would be <samp>&lt;encounters&gt;</samp> in the IXML below:

```
<encounters>
  <encounter ... />
  <encounter ... />
  <encounter ... />
</encounters>
```

5 <samp>&lt;cdadoc&gt;</samp> is an example of this.

As pointed out in the notes above, in the names of POJOs, you should recognize principal IXML element names. In the instance variable names or fields of each of these POJOs you should recognize either IXML attributes for those elements or subelements or, in some cases, element content text according to this example:

```
< element-name  attribute-name="attribute-value">
  < subelement-name />
   element content text
</element-name>
```

POJOs, as Java objects, may inherit from other POJOs. So it is the case that many POJOs, like <samp>Allergy</samp>, which appears to have few defined fields (instance variables) of its own, in fact have all those of <samp>CommonPojo</samp>, to wit, <samp>startdate</samp>, <samp>enddate</samp>, <samp>code</samp>, <samp>codesystem</samp>, ... <samp>codesystemname</samp>. <samp>Encounter</samp>, for CCDAs, has all of <samp>CommonPojo</samp> plus <samp>problems</samp> and others still.

Base class <samp>Pojo</samp> defines instance variables <samp>doctype</samp>, <samp>vendor</samp>, <samp>name</samp>, <samp>conformance</samp>, etc. These have no significance in the subclassing POJO. For example, for <samp>Measure</samp>, <samp>____</samp> is not the name of the measure (but only "measure" because from <samp>measure</samp>). The name of the measure must be stored in <samp>name</samp>. This is documented here because it's a point of confusion.

Sometimes, what's an attribute and what's a subelement is described by a comment.

Minor inconsistencies caused by this implementation being done first in May 2018 by two persons, both of which left the company, carried on by another, then, at the return of one of the originals, more work was done. Finally, standardization was undertaken (ironically by the two who left the company, then came back), but there are still a few awkward inconsistencies. These may be highlighted erratically here and there.

Here are some sample "railroad tracks" for IXMLs.

## Methodology

This documentation is primarily a reference guide or grammar and not a method. It has many uses for reference (mostly), but it is also the only aid to IXML composition. Here are some suggestions for bridging the gap.

- The examples on this page are not always kept perfectly up to date, but they are more practically useful than the POJO definitions. They are the closest thing to a method.
- Remember, when using the POJO definitions as your guide, that there are semantics that are rarely apparent, such as:
  - Some, but rarely all of the fields of the resource's superclass ([**<samp>CommonPojo</samp>**](/docs/ixml#CommonPojo), [**<samp>AdminPojo</samp>**](/docs/ixml#AdminPojo)) pertain to the resource you are composing.
  - However, if you supply unheeded attributes in your resource, they will likely be ignored and not hurt anything.
  - Fields consumed by one resource (e.g.: [**<samp>Problem</samp>**](/docs/ixml#Problem)) may not always be used for exactly the same semantic purpose in another (e.g.: [**<samp>Allergy</samp>**](/docs/ixml#Allergy)). Attributes <samp>code</samp>, <samp>codesystem</samp>, etc. are usually for the <samp>&lt;code ... /&gt;</samp> near the top of any generated resource, but not always. Sometimes they may (perplexingly) apply to another such as <samp>&lt;value ... /&gt;</samp>.

#### Definitions

- A *resource* is a major POJO such as <samp>Allergy</samp>, <samp>Medication</samp>, <samp>VitalSign</samp>, etc.
- Resources are generated as *entries* in CCDA based on information a corresponding IXML element which becomes a POJO in *mdht-restlet*.
- Entries are collected together in a *section*. Most often, POJO names directly evoke section names ( <samp>Allergy</samp>—*Allergies & Intolerances*, <samp>Problem</samp>—*Problems*, etc.).
- Sections are subordinate to semantically insignificant *components*.
- The MDHT library is called to generate syntagms and outputs CDA (CCDA, QRDA, etc.).

#### Creating a section

In IXML, a section being one or more entries each represented by an IXML element, these elements are groups together using an element usually given a name in the plural, e.g.:

```
<allergies>
  <allergy 1 .../>
  <allergy 2 .../>
  <allergy 3 .../>
</allergies>
```

The plurals are arbitrary; they only need to match (i.e.: legal XML). Hence, the above could be:

```
<sneezes>
  <allergy 1 .../>
  <allergy 2 .../>
  <allergy 3 .../>
</sneezes>
```

As plural element names are unknown to *mdht-restlet* and are discarded except for their value in grouping significant POJOs into a section, any attributes or content text are discarded.

In short, these section elements are collectors that wrap the entries. If you have no entries (for example, if you have no problems to emit), then you do not need to generate an empty section, but it will not cause *mdht-restlet* to fail:

```
<allergies />
```

or:

```
<allergies>
</allergies>
```

#### Creating an entry

This is the significant part of building IXML.

For each instance of a resource, such as (these were the supported sections as of *mdht-restlet##3.2.2*):

1. an allergy,
2. an encounter,
3. a functional status,
4. an immunization,
5. a medication,
6. a payer,
7. a problem,
8. a procedure,
9. a (lab) result,
10. a social history or
11. a vital sign,

There will be a corresponding element with attributes and usually subelements each with more attributes and often their own subelements. This hierarchy should be accurately documented in the lists of <samp>CommonPojo</samp>s above.

In (lab) results, there is the additional complexity that results are grouped into one or more result panels. The numbering used here is only to convey understanding; there is no numbering element or attribute in the XML of the IXML document:

```
<results>
  <resultpanel 1 .../>
    <result 1.1 .../>
    <result 1.2 .../>
    <result 1.3 .../>
  </resultpanel>
  <resultpanel 2 .../>
    <result 2.1 .../>
  </resultpanel>
</results>
```

A similar thing happens for vital signs: they are grouped into one or more vital groups (the *Implementation Guide* doesn't speak of "vital sign panels"). Vital-sign groups should be united by <samp>startdate</samp>, but can be assembled according to any criteria. If <samp>&lt;vitalsigngroup&gt;</samp> is used in IXML, then no attempt will be made to impose that defined groups be assembled by date. Each group defined will result in a CDA *Organizer* that subsumes all of the vital signs defined below it. In the following example, two organizers carrying three (and two) vital signs will be seen in CDA output.

Vital-sign groups should include an author (SHOULD); individual vital signs themselves should include an author (SHOULD). Missing author definitions are tolerated, however.

```
<vitalsigngroups>
  <vitalsigngroup 1 .../>
    <vital 1.1 .../>
    <vital 1.2 .../>
    <vital 1.3 .../>
  </vitalsigngroup>
  <vitalsigngroup 2 .../>
    <vital 2.1 .../>
  </vitalsigngroup>
</vitalsigngroups>
```

The following legacy format is still tolerated. The result is that the vitals will be sorted, then grouped, according to <samp>startdate</samp> under a CDA *organizer*.

Also, in this case, the CDA *Organizer* will not carry any author (SHOULD) since there's no IXML element to define one. Individual vital signs can carry an author if defined (SHOULD).

```
<vitals>
  <vital 1 .../>
  <vital 2 .../>
  <vital 3 .../>
</vitals>
```

#### Creating a proper entry

In order to create an entry, you must

1. generate the proper element name (from the numbered list above),
2. generate the attributes required for that resource,
3. generate the subelements required or optional for that resource,
4. generate the attributes and subelements incumbant upon each of those subelements.

#### Creating the header

The header has its own required content which differs between CCDA, QRDA and other CDA types. This will not be discussed here. The resources to expect in a CCDA header include most of which are elements rather than attributes on elements):

- <samp>codename</samp>
- <samp>title</samp>
- <samp>informationrecipiantid</samp>
- <samp>patient</samp> (has subelements; cannot have plurality)
- <samp>hieinfo</samp> (has subelements)
- <samp>nextofkin</samp> (has subelements; suggested name of plural collector is "kin")
- <samp>hparticipant</samp> (has subelements)
- <samp>custodianinfo</samp> (has subelements; plural is "custodians")

Some elements are crucial and, if missing, the IXML will fault. Not all plurality (or collections) is supported in all headers. Passing additional kin, participantsder , custodians, etc. may not result in date being put into the CCDA. Please contact us with observations or complaints about this.

## Execution

An example of how CCDA documents are generated (QRDA I).

1. The JUnit test or Tomcat servlet code passes the IXML input as a stream to a SAX parser.
2. <samp>ParseIncoming.parse( InputStream inputStream )</samp> invokes SAX parsing.
3. <samp>IncomingDataHandler</samp>, this is the SAX parser user code, calls...
4. ...various <samp>IncomingDataHandler.<em>method</em>()</samp>s until, having reached the IXML document's end...
5. ...<samp>IncomingDataHandler.endDocument()</samp> winds up the parsing, then calls for MDHT generators.
6. Depending on the type of document being generated, CCDA, QRDA I or QRDA III, a generator is called.
7. <samp>Generate.generateDocument()</samp> refines the POJOs, then calls generators on all parsed POJOs thus:
8. Bottles up the (MDHT-generated) document and returns it as a <samp>String</samp> to the bottom of the SAX parser  
handler, <samp>endDocument()</samp>, thence to the bottom of the SAX parser and finally to the invoking code in  
(JUnit test or Tomcat servlet).

## When "(unknown)" is unexpected

This typically happens in human-readable (HTML) tables and is the result of failing to set tetracode fields <samp>code</samp>, <samp>codesystem</samp>, <samp>codesystemname</samp>, but in particular, <samp>displayname</samp> (many examples, most concept sections).

Another way for this to happen is to be missing a <samp>value</samp> or <samp>unit</samp> (see, for example, [**<samp>VitalSign</samp>**](/docs/ixml#VitalSign)).

Less clear might be to have failed to provide fields inside more complex structures such as a facility name (in [**<samp>Author</samp>**](/docs/ixml#Author) → [**<samp>Organization</samp>**](/docs/ixml#Organization) → name).

If you leave constructs such as authors and organizations out (unexpressed, null or otherwise unpopulated in IXML), you must expect this sort of thing to happen.

## <value value="<*N*" ... />

You may preserve the attribute value <samp>value="&lt;60"</samp> of a [**<samp>Result</samp>**](/docs/ixml#Result), or other section types in CCD, as expressed:

```
      <result startdate="20230115"
              code="17636008"
              codesystem="2.4.68.10.1214.16"
              codesystemname="SNOMED"
              displayname="Specimen collection"
              value="&lt;60" unit="mg" />
```

But, the [*Implementation Guide*](/v1/docs/ixml#documents-implementation-guide) and validators do not tolerate any value in that field other than a floating point. The solution you'll see to preserve an annotation (<samp>&lt;, &gt;, ˜</samp>, etc.) involves generating a (legal) translation construct, but respecting the CCDA standard in the value itself where the annotation is dropped as illegal:

```
  <value unit="mg" value="60.0" xsi:type="PQ">
    <translation>
      <originalText>&lt;60</originalText>
    </translation>
  </value>
```

## Troubleshooting

When the CCDA or Care Plan produced has problems, consider the following.

1. Adhere to the strict and exact spelling of identfiers described in this document.
2. Exact case of POJO names. All POJO names, fieldnames, attribute names, etc. are in lower- not upper or camelback case and without underscores or hyphens.
3. Changing or old identifier names. There isn't much of this, but the exact naming may conflict.
4. In times past, the [**Organization**](/docs/ixml#Organization) id field has been <samp>facility</samp>, <samp>oid</samp>, <samp>id</samp>, etc.. Getting this particular fieldname wrong confuses the SAX parser and constructs like [**VitalSign**](/docs/ixml#VitalSign) and others that include an author plus organization may go missing under parent collections (like [**VitalSignGroup**](/docs/ixml#VitalSignGroup)). The identifier <samp>id</samp> only occurs legally inside the [**Patient**](/docs/ixml#Patient) (as a list of zero or more [**Id**](/docs/ixml#Id)s).
5. Note that id-conceptual fields exist as various POJO fields:
  1. <samp>id</samp> in [**Patient**](/docs/ixml#Patient)
  2. <samp>oid</samp> in [**CustodianInfo**](/docs/ixml#CustodianInfo) and in [**HieInfo**](/docs/ixml#HieInfo)
  3. <samp>facilityoid</samp> in [**Patient**](/docs/ixml#Patient) and in [**Organization**](/docs/ixml#Organization)

## Logging

Logged output is generated in the log file, */opt/tomcat/logs/catalina.out*, which is managed entirely by Tomcat though it's possible to affect what's generated by *mdht-restlet* through modifying ***logback.xml***, a file on the path

*/opt/tomcat/webapps/mdht-restlet##M.m.r-b/WEB-INF/classes/logback.xml*.

...where *M* refers to the major version number, *m* to the minor version number, *r* to the revision level and *b* to the build number of *mdht-restlet*.

Edit this file and change (maybe add because usually missing) the following section. In particular, ensure that the <samp>level</samp> is set to <samp>TRACE</samp>. The normal value for <samp>level</samp> is <samp>INFO</samp> which keeps the log as only informative.

```
  <logger name="com.imatsolutions.mdht" level="TRACE" additivity="false">
    <appender-ref ref="CONSOLE" />
  </logger>
```

Normally, this is what's in *logback.xml*:

```
  <logger name="com.imatsolutions" level="INFO" additivity="false">
    <appender-ref ref="CONSOLE" />
  </logger>
```

To shut any logging except for errors off, removing roughly 35 lines for each CCD generated from the log, do this:

```
  <logger name="com.imatsolutions" level="ERROR" additivity="false">
    <appender-ref ref="CONSOLE" />
  </logger>
```

Above, <samp>name</samp> is the Java package path. Knowing the package name makes it possible to constrain the output to just what you want to see happen, but, in order to know what you're tailoring, you would have to understand what code is in what package. This is hard to do and, from time to time, the package paths below *com.imatsolutions* change depending on design refactoring. I would suggest not attempting to second-guess this, but use the example(s) above.

Note that any time you modify *logback.xml*, the effect will almost certainly be nil untill you bounce Tomcat:

```
# systemctl restart tomcat
```

When doing deep, ugly debugging, do one of these:

##### Debugging the MDHT generation

```
  <logger name="com.imatsolutions.mdht" level="TRACE" additivity="false">
    <appender-ref ref="CONSOLE" />
  </logger>
```

##### Debugging the SAX parser (very ugly—more interesting to IXML writers)

```
  <logger name="com.imatsolutions.sax" level="TRACE" additivity="false">
    <appender-ref ref="CONSOLE" />
  </logger>
```

### Logging examples

...processing *gold-standard.ixml* at one point:

```
126  [main] WARN  c.i.s.ParseIncoming.parse:115 - Warnings of IXML and other problems arising during SAX parsing and POJO construction:
155  [main] WARN  c.i.p.c.Address.perform:122 - 'NW 092 3C' is not a US zipcode, line 540
155  [main] WARN  c.i.p.c.Address.perform:138 - Country 'UK' is not US, Canada or Mexico, line 541
157  [main] INFO  c.i.s.ParseIncoming.parse:120 - Back from SAX parser...
1103 [main] INFO  c.i.m.Generate.generateDocument:196 - Document generating for MPID 1694505
1106 [main] INFO  c.i.m.Generate.generateDocument:227 - Vendor requesting document is IMAT Solutions
1118 [main] INFO  c.i.m.c.GenerateCcda.generate:111 -    Generating CCDA document (at 20220325174120+0000)
1118 [main] INFO  c.i.m.c.GenerateCcda.generate:116 -    Expected POJOs in play:
                                                           ...Next of kin        4
                                                           ...Custodian info     1
                                                           ...Allergies          1
                                                           ...Encounters         1
                                                           ...Functional Status  1
                                                           ...Immunizations      1
                                                           ...Medications        1
                                                           ...Problems           1
                                                           ...Procedures         1
                                                           ...Result Panels      1
                                                           ...Results            1
                                                           ...Social Histories   1
                                                           ...Vital Sign groups  3
                                                           ...Vital Signs        4
1119 [main] INFO  c.i.m.c.GenerateCcda.generate:120 -      ...for 1 HIE info
1119 [main] INFO  c.i.m.c.GenerateCcda.generate:121 -      ...for 1 Custodian info
1119 [main] INFO  c.i.m.c.GenerateCcda.generate:122 -      ...for 4 Next of kin
1119 [main] INFO  c.i.m.c.GenerateCcda.generate:126 -      ...for 7 Authors (and potential HParticipants)
1161 [main] INFO  c.i.m.c.GenerateCcda.generate:143 -      ...for 1 Allergy or Intolerance
1193 [main] INFO  c.i.m.c.GenerateCcda.generate:150 -      ...for 1 Encounter
1201 [main] INFO  c.i.m.c.GenerateCcda.generate:157 -      ...for 1 Functional Status
1206 [main] INFO  c.i.m.c.GenerateCcda.generate:164 -      ...for 1 Immunization
1217 [main] INFO  c.i.m.c.GenerateCcda.generate:171 -      ...for 1 Medication
1225 [main] INFO  c.i.m.c.GenerateCcda.generate:185 -      ...for 1 Problem
1232 [main] INFO  c.i.m.c.GenerateCcda.generate:192 -      ...for 1 Procedure
1239 [main] INFO  c.i.m.c.GenerateCcda.generate:199 -      ...for 1 Result panel/Lab (1 result)
1253 [main] INFO  c.i.m.c.GenerateCcda.generate:206 -      ...for 1 Social Histories
1258 [main] INFO  c.i.m.c.GenerateCcda.generate:215 -      ...for 3 Vital Sign groups (4 vital signs)
2957 [main] INFO  c.i.m.Generate.generateDocument:260 -          Time spent validating: 1692
```

If */opt/tomcat/webapps/mdht-restlet##M.m.r-b/WEB-INF/classes/logback.xml* is amended to mandate <samp>TRACE</samp>-level logging, for example,

```
  <logger name="com.imatsolutions.mdht" level="TRACE" additivity="false">
    <appender-ref ref="CONSOLE" />
  </logger>
```

...then you might see something like the following extra statements describing the building and folding of authors in lists.

```
130  [main] WARN  c.i.s.ParseIncoming.parse:115 - Warnings of IXML and other problems arising during SAX parsing and POJO construction:
158  [main] INFO  c.i.s.ParseIncoming.parse:120 - Back from SAX parser...
1228 [main] INFO  c.i.m.Generate.generateDocument:196 - Document generating for MPID 1694505
1232 [main] INFO  c.i.m.Generate.generateDocument:227 - Vendor requesting document is IMAT Solutions
1248 [main]  TRACE c.i.m.c.AuthorsAndPerformers.outputAuthorList:229 - Authors:

     1: npi: 4028-19-4233398, family:  Seymore,    given:  Jane,      middle:  J., facilityoid:  2.16.840.1.113883.5.53, name:                             Allergist
     2: npi:      43-89-hike, family:  of Cleves,  given:  Anne,      middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
     3: npi:                , family:  of Cleves,  given:  Anne,      middle:    , facilityoid:                     568, name:                Good Health Laboratory
     4: npi: 4028-19-4233398, family:  Seymore,    given:  Jane,      middle:  J., facilityoid:  2.16.840.1.113883.5.53, name:                                Doctor
     5: npi:          665892, family:  Parr,       given:  Catherine, middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
     6: npi:          665892, family:  Parr,       given:  Catherine, middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
     7: npi:          665892, family:  Parr,       given:  Catherine, middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
     8: npi:          665892, family:  Parr,       given:  Catherine, middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
     9: npi:          665892, family:  Parr,       given:  Catherine, middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
    10: npi:      9999999999, family:  Boleyn,     given:  Anne,      middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
    11: npi: 4028-19-4233398, family:  Seymore,    given:  Jane,      middle:  J., facilityoid:  2.16.840.1.113883.5.53, name:                                Doctor

1249 [main]  TRACE c.i.m.c.AuthorsAndPerformers.outputAuthorList:229 - Deduplicated authors:

    1: npi: 4028-19-4233398, family:  Seymore,    given:  Jane,      middle:  J., facilityoid:  2.16.840.1.113883.5.53, name:                             Allergist
    2: npi:      43-89-hike, family:  of Cleves,  given:  Anne,      middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
    3: npi:                , family:  of Cleves,  given:  Anne,      middle:    , facilityoid:                     568, name:                Good Health Laboratory
    4: npi: 4028-19-4233398, family:  Seymore,    given:  Jane,      middle:  J., facilityoid:  2.16.840.1.113883.5.53, name:                                Doctor
    5: npi:          665892, family:  Parr,       given:  Catherine, middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
    6: npi:      9999999999, family:  Boleyn,     given:  Anne,      middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse

1249 [main]  TRACE c.i.m.c.AuthorsAndPerformers.outputAuthorList:229 - Sorted authors:

    1: npi:                , family:  of Cleves,  given:  Anne,      middle:    , facilityoid:                     568, name:                Good Health Laboratory
    2: npi: 4028-19-4233398, family:  Seymore,    given:  Jane,      middle:  J., facilityoid:  2.16.840.1.113883.5.53, name:                             Allergist
    3: npi: 4028-19-4233398, family:  Seymore,    given:  Jane,      middle:  J., facilityoid:  2.16.840.1.113883.5.53, name:                                Doctor
    4: npi:      43-89-hike, family:  of Cleves,  given:  Anne,      middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
    5: npi:          665892, family:  Parr,       given:  Catherine, middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse
    6: npi:      9999999999, family:  Boleyn,     given:  Anne,      middle:    , facilityoid:  2.16.840.1.113883.5.53, name:                      Registered Nurse

1249 [main] INFO  c.i.m.c.GenerateCcda.generate:111 -    Generating CCDA document (at 20220405200214+0000)
1250 [main] INFO  c.i.m.c.GenerateCcda.generate:116 -    Expected POJOs in play:
                                                           ...Next of kin        4
                                                           ...Custodian info     1
                                                           ...Allergies          1
                                                           ...Encounters         1
                                                           ...Functional Status  1
                                                           ...Immunizations      1
                                                           ...Medications        1
                                                           ...Problems           1
                                                           ...Procedures         1
                                                           ...Result Panels      1
                                                           ...Results            1
                                                           ...Social Histories   1
                                                           ...Vital Sign groups  3
                                                           ...Vital Signs        4
1250 [main] INFO  c.i.m.c.GenerateCcda.generate:120 -      ...for 1 HIE info
1250 [main] INFO  c.i.m.c.GenerateCcda.generate:121 -      ...for 1 Custodian info
1250 [main] INFO  c.i.m.c.GenerateCcda.generate:122 -      ...for 4 Next of kin
1250 [main] INFO  c.i.m.c.GenerateCcda.generate:126 -      ...for 6 Authors (and potential HParticipants)
1299 [main]  TRACE c.i.m.c.PopulateDocumentationOf.author:109 -      (no NPI): of Cleves, Anne, 568, Good Health Laboratory...
1301 [main] WARN  c.i.m.c.PopulateDocumentationOf.populatePerformerFromAuthor:142 - No NPI code for performer from author.person, line:239
1301 [main]  TRACE c.i.m.c.PopulateDocumentationOf.author:109 -      4028-19-4233398: Seymore, Jane, MD, 2.16.840.1.113883.5.53, Allergist...
1302 [main]  TRACE c.i.m.c.PopulateDocumentationOf.author:109 -      4028-19-4233398: Seymore, Jane, MD, 2.16.840.1.113883.5.53, Doctor...
1302 [main]  TRACE c.i.m.c.PopulateDocumentationOf.author:109 -      43-89-hike: of Cleves, Anne, MD, 2.16.840.1.113883.5.53, Registered Nurse...
1303 [main]  TRACE c.i.m.c.PopulateDocumentationOf.author:109 -      665892: Parr, Catherine, BSN, 2.16.840.1.113883.5.53, Registered Nurse...
1303 [main]  TRACE c.i.m.c.PopulateDocumentationOf.author:109 -      9999999999: Boleyn, Anne, PhD, 2.16.840.1.113883.5.53, Registered Nurse...
1303 [main] INFO  c.i.m.c.GenerateCcda.generate:143 -      ...for 1 Allergy or Intolerance
1338 [main] INFO  c.i.m.c.GenerateCcda.generate:150 -      ...for 1 Encounter
1348 [main] INFO  c.i.m.c.GenerateCcda.generate:157 -      ...for 1 Functional Status
1351 [main]  TRACE c.i.m.c.PopulateFunctionalStatus.status:160 -     Functional Status Observation 1...
1351 [main]  TRACE c.i.m.c.PopulateFunctionalStatus.status:160 -     Functional Status Observation 2...
1352 [main]  TRACE c.i.m.c.PopulateFunctionalStatus.status:160 -     Assessment Scale 1...
1352 [main]  TRACE c.i.m.c.PopulateFunctionalStatus.status:160 -     Self-care Activity 1...
1355 [main] INFO  c.i.m.c.GenerateCcda.generate:164 -      ...for 1 Immunization
1376 [main] INFO  c.i.m.c.GenerateCcda.generate:171 -      ...for 1 Medication
1383 [main] INFO  c.i.m.c.GenerateCcda.generate:185 -      ...for 1 Problem
1390 [main] INFO  c.i.m.c.GenerateCcda.generate:192 -      ...for 1 Procedure
1396 [main] INFO  c.i.m.c.GenerateCcda.generate:199 -      ...for 1 Result panel/Lab (1 result)
1400 [main]  TRACE c.i.m.c.PopulateResultPanels.panel:119 -          Chlamydia trachomatis...
1402 [main]  TRACE c.i.m.c.PopulateResultPanels.populateResultOrganizerV3:156 -     Result 1
1410 [main] INFO  c.i.m.c.GenerateCcda.generate:206 -      ...for 1 Social Histories
1415 [main] INFO  c.i.m.c.GenerateCcda.generate:215 -      ...for 3 Vital Sign groups (4 vital signs)
1418 [main]  TRACE c.i.m.c.PopulateVitalSigns.group:190 -            Vital Sign group 1...
1420 [main]  TRACE c.i.m.c.PopulateVitalSigns.group:190 -            Vital Sign group 2...
1420 [main]  TRACE c.i.m.c.PopulateVitalSigns.group:190 -            Vital Sign group 3...
3131 [main] INFO  c.i.m.Generate.generateDocument:269 - Document generated; elapsed time: 00:00:00:01:1903
```

#### *Care Plan (V2)* logging example

```
131  [main] WARN  c.i.s.ParseIncoming.parse:115 - Warnings of IXML and other problems arising during SAX parsing and POJO construction:
150  [main] INFO  c.i.s.ParseIncoming.parse:120 - Back from SAX parser...
1102 [main] INFO  c.i.m.Generate.generateDocument:196 - Document generating for MPID 1694505
1104 [main] INFO  c.i.m.Generate.generateDocument:227 - Vendor requesting document is IMAT Solutions
1263 [main] INFO  c.i.m.c.GenerateCarePlan.generate:73 -   Generating Care Plan (V2) (at 20220513182356+0000)
1267 [main] INFO  c.i.m.c.GenerateCarePlan.generate:78 -   Expected POJOs in play (and count):
                                                                  ...HParticipants              2
                                                                  ...Performers                1
                                                                  ...Recipients                1
                                                                  ...Authenticator             1
                                                                  ...EncompassingEncounter     1
                                                                  ...Health Concerns           1
                                                                  ...Goals                     1
                                                                  ...Interventions             1
1337 [main] INFO  c.i.m.c.GenerateCarePlan.validateHeader:171 - Header information found:
1337 [main] INFO  c.i.m.c.GenerateCarePlan.validateHeader:180 -   HParticipant information found
1337 [main] INFO  c.i.m.c.GenerateCarePlan.validateHeader:185 -   Performers information found
1337 [main] INFO  c.i.m.c.GenerateCarePlan.validateHeader:190 -   Recipient information found
1337 [main] INFO  c.i.m.c.GenerateCarePlan.validateHeader:195 -   Authenticator information found
1338 [main] INFO  c.i.m.c.GenerateCarePlan.validateHeader:200 -   ComponentOf/encompassingEncounter information found
1376 [main] INFO  c.i.m.Generate.generateDocument:269 - Document generated; elapsed time: 00:00:00:00:273
```

## The <samp>curl</samp> command line

These are tailored to a) confirming that *mdht-restlet* is up and b) sending an IXML to it to generate a CCD—pretty much all *mdht-restlet* is able to do.

1. Basic <samp>GET</samp> retrieves HTML. You can do this in a browser. It tells you that *mdht-restlet*is live.

```
$ curl http://localhost:8080/mdht-restlet
```
2. Basic <samp>GET</samp> requesting plain text. It tells you that *mdht-restlet*is live.

```
$ curl http://localhost:8080/mdht-restlet         -H "Accept: text/plain"
```
3. Command to <samp>POST</samp> a file in the payload as a request. It posts IXML from a file in the local filesystem to *mdht-restlet* and the generated CCD comes back on <samp>stdout</samp>.

```
$ curl http://localhost:8080/mdht-restlet -X POST -H 'Content-Type: application/xml' --data "@sample.ixml"
```

Plain Old Java Object. It is an ordinary Java object, not bound by any special restriction other than those forced by the Java Language Specification and not requiring any classpath. POJOs are used for increasing the readability and re-usability of a program.

--https://www.geeksforgeeks.org/pojo-vs-java-beans/#
