This wiki has undergone a migration to Confluence found Here
<meta name="googlebot" content="noindex">

Self Displaying CDA

From HL7Wiki
Jump to navigation Jump to search

This project will describe how to embed a display stylesheet in a CDA document to make it possible to display in a web browser.

Project Scope Statement : #711 in Project Insight


See the Project Scope Statement Above

Who should read this specification

Browser developers and creators of CDA documents who wish these documents to be easily viewed in a web browser.


A Self Displaying CDA document that conforms to all the SHALL requirements of this guide SHALL include a <templateId root='TBD'/> element under the <ClinicalDocument> element.

<ClinicalDocument ... >
 <templateId root='TBD.1'/> 

A Self Displaying CDA document that conforms to all the SHALL requirements and SHOULD requirements of this guide SHOULD include a <templateId root='TBD.1'/> element under the <ClinicalDocument> element in addition to the previous <templateId> element.

<ClinicalDocument ... >
 <templateId root='TBD'/> 
 <templateId root='TBD.1'/> 

Stylesheet Processing Instruction

A self-displaying CDA document SHALL include an XML declaration. The XML declaration need not be for a specific XML version or character encoding.

The presense of an XML declaration is required to avoid putting the displaying browser in QUIRKS mode. This specification does not require a specific version of XML or character encoding to be used.

<?xml version='1.0' encoding='UTF-8'?>

A self-displaying CDA document SHALL include the following stylesheet processing instruction after the XML declaration and before the <ClinicalDocument> element of the CDA.

<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type='text/css' href='#css'?>
<ClinicalDocument ...>

? Should the href be fixed by this specification? Advantage : One way to handle it, and it can be simple, and selected to avoid confusion with other possible ID attributes. #css may not work. It might need to be less likely to have been used, like #hl7-org-cda-css. If not fixed by this specification, it should be recommended...

The first section of the CDA Document shall contain an <observationMedia> element containing a <value> element that SHALL contain the following content :

 <observationMedia classCode="OBS" moodCode="EVN">
  <value mediaType="text/css" representation="TXT" xml :id='css'>
      paragraph, addr, text { display : block; }
      ClinicalDocument { display : block; }
      #css             { display : none; }
      entry            { display : none; }
      name             { display : block; }
      section>text     { display : block; }
      table            { display : block; /* table; */border-spacing : 2px; }
      tr               { display : block; /* table-row;*/ vertical-align : inherit }
      thead            { display : block; /* table-header-group; */ vertical-align : middle  }
      tbody            { display : block; /* table-row-group; */ vertical-align : middle  }
      tfoot            { display : block; /* table-footer-group; */ vertical-align : middle  }
      col              { display : table-column; }
      colgroup         { display : table-column-group; }
      td               { display : inline-block; /* table-cell; */ vertical-align : inherit; }
      th               { display : inline-block; /* table-cell; */ font-weight : bolder; text-align : center; vertical-align : inherit }
      table>caption    { display : block; /* table-caption; */ text-align : center; }
      structuredBody   { margin : 8px; display : block; }
      ClinicalDocument>title { font-size : 2em; margin : .67em 0 }
      structuredBody>component>section>title { font-size : 1.5em; margin : .75em 0; }
      structuredBody>component>section>component>section>title { font-size : 1.17em; margin : .83em 0 }
      structuredBody>component>section>component>section>component>section title { margin : 1.12em 0 } 
      structuredBody>component>section>component>section>component>section>component>section>title { font-size : .83em; margin : 1.5em 0 }
      structuredBody>component>section>component>section>component>section>component>section>component>section>title { font-size : .75em; margin : 1.67em 0 }
      title           { padding-top : 10px; font-weight : bolder; display : block;  }
      addr            { font-style : italic }
      sub             { font-size : .83em; vertical-align : sub }
      sup             { font-size : .83em; vertical-align : super }

      list            { margin : 1.12em 0; margin-left : 40px;  display : block;  }
      list [listType="ordered"] { margin : 1.12em 0; margin-left : 40px;  display : block;  list-style-type : decimal; }
      list [listType="unordered"] { margin : 1.12em 0; margin-left : 40px;  display : block;  list-style-type : decimal; }
      item             { display : list-item; }
      list>list       { margin-top : 0; margin-bottom : 0 }
      br :before       { content : "\A"; white-space : pre-line }
      streetAddressLine :before, 
      city :before
      country :before  { content : "\A"; white-space : pre-line }
      center          { text-align : center }
       :link,  :visited { text-decoration : underline }
       :focus          { outline : thin dotted invert }

? What can be changed? Is it all fixed? What is extensible? How are things measured? Some thoughts : Measurements are based relative font sizes, so that fonts can size up/down for ease of reading.

Two choices for tables : 1. A Self-Displaying CDA document SHOULD NOT contain tables. 2. A Self-Displaying CDA document MAY contain tables. Tables SHOULD be aligned using monospaced font and padding characters. One of these is needed for broad browser support.

A Self-Displayinbg CDA SHALL NOT contain nested tables, or tables where columns or rows have been spanned. Due to limited support in browsers for XML tables, nested tables or tables with column or row-spanning will not be accurately displayed and could result in misinterpretation, with potential patient safety consequences.

A Self-Displaying CDA SHALL NOT use renderMultimedia elements. There is presently no way to indicate that renderMultimedia elements reference content that can be displayed using CSS. ? The above could be caveated by appending "that are required to be displayed to understand the content", but I don't think that works as guidance.

A Self-Displaying CDA SHOULD include a preface in the content attribute for the ClinicalDocument stylesheet that explains what the limitations are to the viewer of the document using that stylesheet.

A Self-Displaying CDA MAY use StyleCodes not defined by the CDA standard. If it does, these SHOULD be noted as limitations.