<< Click to Display Table of Contents >> Navigation: Designing Templates > Template HTML > HL7 Tag Shorthand > Embedded Binary Data |
For HL7 messages which contain embedded binary data (like Adobe PDF reports, Images etc) you can use your HL7 Template to extract that data and link to it by using a special HTML tag in your Template Source Code the <hl7encapsulated... /> tag.
Example: <hl7encapsulated segment="OBX" field="5" prompt="Click HERE" />
Embedded binary data in an HL7 message is predominantly found in OBX segments (Field #5) and is typically for messages of type ORU (Observation Report Unsolicited). There is only one other field in the standard for HL7 version 2.5.1 which also contains binary data and this is in the CER segment (Field #6). For this discussion we will be looking at the example snippet below and breaking it down.
OBX|1|ED|Adobe PDF|1|DiagnosticReport^PDF^^Base64^JVBERi0xLjQKJcfsj....etc..etc|
First of all note field #2 of the OBX segment which has a value of ED (Encapsulated Data). Since the OBX segment can contain many different types of data Field #2 of the segment contains the HL7 Data Type which describes what will be contained in field #5 (the Result Data). So the snippet above is telling us that this OBX segment will contain Encapsulated Data in field #5. The ED Data Type is defined this way in the HL7 standard:
Data Type: ED - Encapsulated data (5 Components) •Component 1 source application •Component 2 type of data •Component 3 data subtype •Component 4 encoding •Component 5 data
So to break down field #5 of the example snippet above it looks like this:
•Component 1 source application = Diagnostic Report •Component 2 type of data = PDF •Component 3 data subtype = {Blank} •Component 4 encoding = Base64 •Component 5 data = JVBERi0xLjQKJcfsj....etc..etc
For your HL7 Templates using the <hl7encapsulated... /> tag whichever HL7 field you choose the HL7 Data Type for that field MUST be ED. The encoding MUST be Base64 and the encoded value MUST be in component #5 as shown above.
|
The tag is constructed similarly to a standard HTML link tag (<a href="somesite.com">Click Here</a>) with some very important exceptions.
Example: <hl7encapsulated segment="OBX" field="5" prompt="Click HERE" />
Your hl7encapsulated tags must be closed and contain no "inner text" just like horizontal rules <hr /> and line breaks <br />.
This is wrong: <hl7encapsulated segment="OBX" field="5" prompt="Click HERE">Any other HTML Code</hl7encapsulated>
This is correct: <hl7encapsulated segment="OBX" field="5" prompt="Click HERE" />
Required Tag Attributes Processed by the HL7 Template Publisher
•"segment". Required. Must be the 3 character segment name. If not present a validation error occurs. •"field". Required. Must be a positive integer indicating which HL7 field number within the HL7 segment identified in the "segment" attribute contains Encapsulated Data. •"prompt". Required. This will be the value used as the inner text of the final HTML link created by your Template Publisher. In the example above the "prompt" is 'Click HERE'. The final published document would have a link which looked like this <a href="renderedfilename">Click HERE</a>.
Optional Tag Attributes Processed by the HL7 Template Publisher
•"alt". Optional. If present will be used as the alt value in the final link. If not present the alt value is left empty. Example: <hl7encapsulated segment="OBX" field="5" alt="Diagnostic Report" prompt="Click HERE" />
•"target". Optional. If present will be used as the target value in the final link (example _blank, _top, etc.). If not present the target value is left empty and will be handled however your browser handles that situation. Example: <hl7encapsulated segment="OBX" field="5" target="_blank" prompt="Click HERE" />
•"extension". Optional. By default the Template Publisher will use the value in component #2 of the Encapsulated Data as the file extension when extracting files. If component #2 is empty or does not contain the appropriate value then you use the "extension" attribute to override this behavior. If used then the value MUST be valid to use as a file extension. See the example below: HL7 Value: OBX|1|ED|Some Data|1|DiagnosticReport^Adobe PDF^^Base64^JVBERi0xLjQKJcfsj....etc..etc| NOTE that value in component #2 of the Encapsulated Data in the HL7 value above is Adobe PDF. This is NOT the correct value to use as a file extension so I can override the behavior by using the "extension" attribute like so: Example: <hl7encapsulated segment="OBX" field="5" target="_blank" prompt="Click HERE" extension="pdf"/> |
In the Examples and Tutorials Template Library which installs with the UltraPort HL7 Notepad there is a template named Embedded Binary Data. The HTML source code below is a snippet from that template.
$$HL7SECTION segment="OBR" childsegments="OBX"$$
When published (or previewed in the Template Editor) the rendered HTML for the section using the <hl7encapsulated> tag looks like this in a web-browser:
![]() Example of Rendered HTML
|
Using Your HL7 Document Template to JUST Extract Binary Data
In the "Advanced" tab of the Publisher Settings there is an option to have your template ONLY extract binary data from HL7 messages when you publish documents.
IF this option is checked then your HL7 document template will ONLY extract embedded data files in the source HL7 message (identified with your <hl7encapsulated...> tag) when it is PUBLISHED. The Template HTML is NOT created in the Publish folder.
HINT: When using your template this way you CAN still use the "Extract Metadata" options and it WILL export your metadata xml as well as any embedded binary files.
See the Advanced Publisher Settings for additional information.