HL7 Templates
HL7 Templates
HeartLab HL7 Templates allow administrators to customize the HL7 message structure generated by HeartLab for downstream systems such as:
- Electronic Medical Records (EMR)
- Practice Management Systems (PMS)
- Integration engines
- External clinical systems
Templates use dynamic variables to automatically insert:
- Patient information
- Study details
- Report content
- PDF report data
into HL7 messages generated by HeartLab.
Applies to
- Users with Integrations: HL7 permissions (typically Administrators)
Before You Begin
HL7 templates are typically configured with assistance from:
- Your IT team
- EMR vendor
- Integration provider
- HeartLab representative
You may require:
- HL7 message specifications
- Receiving application requirements
- Facility identifiers
- Custom segment formatting rules
Create an HL7 Template
- Navigate to Settings > Integrations > HL7 Templates
- Select Create HL7 Template
- Enter a template name.
- Select Create Template
HL7 Template Content
The Content editor contains the HL7 message structure generated by HeartLab.
Default example:
MSH|^~\&|HeartLab|HeartLab|RECEIVING_APP|RECEIVING_FACILITY|{{ message.timestamp | date }}||ORU^R01|{{ message.id }}|P|2.5|||||UNICODE UTF-8
PID|1||{{ patient.id }}||{{ patient.name | person_name }}||{{ patient.birthdate | date }}|{{ patient.sex }}
OBR|1|||{{ study.accessionNumber }}^{{ study.type }}^L|||{{ study.date | date }}
OBX|1|ED|REPORT^Diagnostic Report^L||{{ report.pdf }}||||||F
Dynamic Variables
Templates use dynamic variables wrapped in:
{{ variable }}
These variables are automatically replaced with study data when the HL7 message is generated.
Examples include:
| Variable | Description |
|---|---|
{{ patient.id }} | Patient identifier |
{{ patient.name }} | Patient name |
{{ patient.birthdate }} | Patient date of birth |
{{ patient.sex }} | Patient sex |
{{ study.accessionNumber }} | Study accession number |
{{ study.type }} | Study type |
{{ study.date }} | Study date |
{{ report.pdf }} | Encoded report PDF |
{{ message.timestamp }} | Message timestamp |
{{ message.id }} | Unique message ID |
Example Output
The Example Output section displays a rendered preview of the generated HL7 message using example data.
This can be used to:
- Validate HL7 formatting
- Verify variable replacement
- Confirm segment structure
- Review message output before deployment
Downloading HL7 Output
Select HL7 Download to export the generated HL7 example output for:
- Testing
- Validation
- EMR onboarding
- Integration troubleshooting
Best Practices
- Keep a backup of working templates before making changes
- Validate template changes with your receiving system
- Test changes in a non-production environment where possible
- Confirm receiving systems support the configured HL7 version and message structure
Troubleshooting
Common causes of HL7 formatting issues include:
- Invalid HL7 segment structure
- Incorrect separator characters
- Unsupported receiving system requirements
- Invalid or incomplete template variables
- Incorrect encoding expectations
If generated HL7 output is rejected:
- Review the Example Output section
- Verify all required segments exist
- Confirm formatting requirements with the receiving system
- Compare output against vendor-provided HL7 specifications
- Contact your HeartLab representative for assistance if required