Appearance
HL7 Conformance Statement
1 Cover Page
- Product Name: DICOM7
- Vendor: Flux Inc.
- HL7 Standard: HL7 Version 2.x messaging over the Minimal Lower Layer Protocol (MLLP)
- Message versions:
- Outbound messages carry the version written in the message template. The default ORM template declares
2.3; the default ORU template declares2.5.1. - Inbound messages are not checked against a specific version.
- Acknowledgements from ORM2DICOM, ORU2DICOM and ORU2REPORT declare
2.3. Acknowledgements from HL72HL7 repeat the inbound MSH-12 value, or2.3when MSH-12 is empty.
- Outbound messages carry the version written in the message template. The default ORM template declares
© Flux Inc. All rights reserved.
2 Conformance Statement Overview
DICOM7 is a suite of six independent Windows services that connect DICOM systems with HL7 v2 systems. Each service has its own configuration, listener ports and cache. This page covers each service's HL7 behaviour. The DICOM side of the same services is covered in the DICOM Conformance Statement.
Table 2-1: HL7 messages per service
| Service | Message / Trigger Event | Role | Acknowledgement |
|---|---|---|---|
| DICOM2ORM | ORM^O01 (from template) | Sender | Response is read; see 5.4 |
| DICOM2ORU | ORU^R01 (from template) | Sender | Response is read and logged only; see 6.4 |
| ORM2DICOM | ORM (any trigger event) | Receiver | Original-mode ACK (AA / AE / AR) |
| ORU2DICOM | ORU^R01 (message type not checked) | Receiver | Original-mode ACK (AA / AE / AR) |
| ORU2REPORT | ORU^R01 (message type not checked) | Receiver | Original-mode ACK (AA / AE / AR) |
| HL72HL7 | Configured list, default ORM^O01 and ORU^R01 | Receiver and sender (forwarding) | Inbound: original-mode ACK after durable storage. Outbound: requires MSA-1 = AA and MSA-2 = outbound MSH-10 |
Table 2-2: Conversions
| Service | Input | Output |
|---|---|---|
| DICOM2ORM | Modality Worklist C-FIND results | HL7 ORM over MLLP |
| DICOM2ORU | DICOM C-STORE instances | HL7 ORU over MLLP |
| ORM2DICOM | HL7 ORM over MLLP | Modality Worklist entries served by C-FIND |
| ORU2DICOM | HL7 ORU over MLLP | Basic Text SR and, when present, Encapsulated PDF sent by C-STORE |
| ORU2REPORT | HL7 ORU over MLLP | PDF, PNG or HTML report files, or passthrough PDF attachments |
| HL72HL7 | HL7 v2 over MLLP | The same HL7 v2 messages forwarded over MLLP to configured destinations |
3 Table of Contents
- 1 Cover Page
- 2 Conformance Statement Overview
- 3 Table of Contents
- 4 Introduction
- 5 DICOM2ORM
- 6 DICOM2ORU
- 7 ORM2DICOM
- 8 ORU2DICOM
- 9 ORU2REPORT
- 10 HL72HL7
- 11 Transport
- 12 Character Sets and Encoding
- 13 Security
- 14 Known Limitations
4 Introduction
4.1 Scope
This page describes how the current DICOM7 services exchange HL7 v2 messages. It covers which messages each service sends and receives, which segments and fields it writes or reads, how it frames messages on the network, how it acknowledges messages and handles acknowledgements, how it rejects invalid input, and how it handles duplicates and retries.
Most of the HL7 content that DICOM2ORM and DICOM2ORU send comes from editable templates. The field tables in sections 5 and 6 describe the default templates that each service writes on first start. Sites that edit their templates will send different fields. See Templates.
4.2 Audience
This page is for interface analysts, integration engineers and system administrators who connect DICOM7 to a RIS, HIS, interface engine or reporting system. It assumes a working knowledge of HL7 v2 segments, fields, components and acknowledgement rules.
4.3 Remarks
This statement supports a first-level check of interoperability between DICOM7 and other HL7 v2 systems. It does not replace testing with the actual systems a site connects. Settings that change HL7 behaviour are listed in Configuration and on each service's page.
4.4 Field Notation
SEG-nis field n of segment SEG, for examplePID-3.SEG-n.cis component c of that field, for examplePV1-3.4.(gggg,eeee)is a DICOM attribute tag.#{gggg,eeee}is a DICOM tag placeholder in a DICOM2ORM or DICOM2ORU template.
4.5 Abbreviations
| Abbreviation | Definition |
|---|---|
| ACK | General acknowledgement message |
| AA / AE / AR | Application Accept / Application Error / Application Reject (MSA-1) |
| CA / CE / CR | Commit Accept / Commit Error / Commit Reject (enhanced mode MSA-1) |
| ED | Encapsulated Data (HL7 data type) |
| FS | File Separator, byte 0x1C |
| MLLP | Minimal Lower Layer Protocol |
| MSA | Message Acknowledgement segment |
| MSH | Message Header segment |
| MWL | Modality Worklist |
| SPS | Scheduled Procedure Step |
| SR | Structured Report |
| VT | Vertical Tab, byte 0x0B |
5 DICOM2ORM
DICOM2ORM queries a Modality Worklist SCP on a fixed interval, builds one ORM message for each worklist item it has not sent before, and sends it to a single HL7 receiver.
5.1 Supported Messages
| Message | Direction | Source |
|---|---|---|
| ORM^O01, version 2.3 (default template) | Outbound | ormTemplate.hl7 in the service data folder |
If no template exists on first start, the service writes the default template. If a template cannot be parsed, the service logs the error and exits.
5.2 Message Construction
For each worklist result, the service fills the template as follows.
- Special placeholders.
#{CurrentDateTime}becomes the current local time asyyyyMMddHHmmss.#{ScheduledDateTime}becomes Scheduled Procedure Step Start Date (0040,0002) followed by Start Time (0040,0003); if either is missing, it becomes the current time plus 24 hours.#{ScheduledProcedureStepID}becomes (0040,0009) from the first item of the Scheduled Procedure Step Sequence (0040,0100). - DICOM tag placeholders. Each
#{gggg,eeee}becomes the first value of that attribute. The service looks in the top-level dataset first, then in nested sequences, and uses the first match. Missing attributes become empty. Any|in a value is replaced with^. No other HL7 escaping is applied. - Header substitution at send time. In MSH, a literal
DICOM7in MSH-3 becomesHL7.SenderName. A literalRECEIVER_APPLICATIONis replaced withHL7.ReceiverNameonly when it is in MSH-4, andRECEIVER_FACILITYwithHL7.ReceiverFacilityonly when it is in MSH-5. The default template has these literals in MSH-5 and MSH-6, so they are sent unchanged. Write the receiving application and facility directly into MSH-5 and MSH-6 of the template. In other segments, any whole field holding one of the three literals is replaced.
Segments are separated by a carriage return (0x0D).
5.3 Default ORM Template Fields
Table 5-1: Default ORM^O01 content
| Field | Name | Value |
|---|---|---|
| MSH-3 | Sending Application | HL7.SenderName (default DICOM7) |
| MSH-4 | Sending Facility | Empty |
| MSH-5 | Receiving Application | RECEIVER_APPLICATION (sent as written; edit the template) |
| MSH-6 | Receiving Facility | RECEIVER_FACILITY (sent as written; edit the template) |
| MSH-7 | Date/Time of Message | Timestamp written when the default template file was created (see 14) |
| MSH-9 | Message Type | ORM^O01 |
| MSH-10 | Message Control ID | Study Instance UID (0020,000D) |
| MSH-11 | Processing ID | P |
| MSH-12 | Version ID | 2.3 |
| PID-1 | Set ID | 1 |
| PID-2 | Patient ID | Patient ID (0010,0020) |
| PID-3 | Patient Identifier List | Patient ID (0010,0020) |
| PID-5 | Patient Name | Patient's Name (0010,0010) |
| PID-7 | Date of Birth | Patient's Birth Date (0010,0030) |
| PID-8 | Sex | Patient's Sex (0010,0040) |
| PV1-1 | Set ID | 1 |
| PV1-2 | Patient Class | O |
| PV1-19 | Visit Number | Accession Number (0008,0050) |
| PV1-44 | Admit Date/Time | SPS Start Date (0040,0002) + SPS Start Time (0040,0003) |
| ORC-1 | Order Control | NW |
| ORC-2 | Placer Order Number | Accession Number (0008,0050) |
| ORC-3 | Filler Order Number | Study Instance UID (0020,000D) |
| ORC-4 | Order Status | SC |
| OBR-1 | Set ID | 1 |
| OBR-2 | Placer Order Number | Accession Number (0008,0050) |
| OBR-4 | Universal Service ID | Study Description (0008,1030) |
| OBR-6 | Requested Date/Time | SPS Start Date (0040,0002) + SPS Start Time (0040,0003) |
The worklist query requests Patient's Name, Patient ID, Birth Date, Sex, Study Instance UID, Accession Number, Referring Physician's Name, Study Description, Study Date, Study Time, Requested Procedure ID and Requested Procedure Description. Inside the Scheduled Procedure Step Sequence it requests Start Date, Start Time, Modality, Scheduled Station AE Title, Scheduled Performing Physician's Name, SPS Description, SPS ID, Scheduled Station Name and SPS Location. Templates can use any of these.
5.4 Acknowledgement Handling
DICOM2ORM decides whether a send succeeded as follows.
| Condition | Result |
|---|---|
| Connection not established within 5 seconds | Failed; queued for retry |
Response text contains the substring AA or ACK anywhere | Success |
| Response is empty (receiver closed without data) | Success, with a warning |
| No response within 5 seconds (read timeout) | Success, with a warning |
| Any other response | Failed; queued for retry |
The service does not parse the response as HL7. It does not check MSA-1 as a field and does not compare MSA-2 with the outbound MSH-10. A negative acknowledgement whose text contains ACK (for example in MSH-9) is therefore treated as a success.
5.5 Duplicates and Retries
- A worklist item is sent once per Study Instance UID. Once the item is sent, later query cycles skip it for as long as the item stays in the cache.
- Failed messages are saved to a retry queue. Before each query cycle the service resends queued messages older than
Retry.RetryIntervalMinutes. There is no limit on the number of attempts. - The query interval is set by
Query.IntervalSeconds(default 60).
6 DICOM2ORU
DICOM2ORU receives DICOM instances by C-STORE, builds one ORU message per SOP Instance, saves it to an outgoing folder and sends it to a single HL7 receiver.
6.1 Supported Messages
| Message | Direction | Source |
|---|---|---|
ORU^R01 (MSH-9 ORU^R01^ORU_R01), version 2.5.1 (default template) | Outbound | oruTemplate.hl7 in the service data folder |
Template loading works as in DICOM2ORM: the default is written on first start, and a template that cannot be parsed stops the service.
6.2 Message Construction
#{CurrentDateTime}becomes the current local time asyyyyMMddHHmmss.#{StudyDateTime}becomes Study Date (0008,0020) followed by Study Time (0008,0030), with the time normalised to six digits; if either is missing, it becomes the current time.- DICOM tag placeholders are resolved as in DICOM2ORM (5.2).
- The service then fills OBX-5 of the OBX segment whose OBX-3 is exactly
47045-0^Study report^LN:
| Received SOP Class | OBX-5 (ED) |
|---|---|
| Encapsulated PDF Storage | ^Application^PDF^Base64^<Base64 of Encapsulated Document (0042,0011)> |
| Secondary Capture Image Storage | ^AP^Octet-stream^Base64^<Base64 of the first frame's pixel data as stored> |
| Any other SOP Class | Unchanged from the template (data component empty) |
HL7.SenderName,HL7.ReceiverNameandHL7.ReceiverFacilityare not applied to ORU messages. MSH-3 to MSH-6 are sent exactly as written in the template.- Before sending, line endings are normalised to a carriage return, leading and trailing spaces are trimmed from each segment, and empty lines are removed.
6.3 Default ORU Template Fields
Table 6-1: Default ORU^R01 content
| Field | Name | Value |
|---|---|---|
| MSH-3 | Sending Application | DICOM7_DICOM2ORU |
| MSH-4 | Sending Facility | FLUXINC |
| MSH-5 | Receiving Application | FLUX^fluxinc.co^DNS |
| MSH-6 | Receiving Facility | fluxinc^2.16.840.1.113883.3.8873^ISO |
| MSH-7 | Date/Time of Message | Timestamp written when the default template file was created |
| MSH-9 | Message Type | ORU^R01^ORU_R01 |
| MSH-10 | Message Control ID | Study Instance UID (0020,000D) |
| MSH-11 | Processing ID | P |
| MSH-12 | Version ID | 2.5.1 |
| PID-1 | Set ID | 1 |
| PID-2 | Patient ID | Patient ID (0010,0020) |
| PID-3 | Patient Identifier List | Patient ID (0010,0020) |
| PID-5 | Patient Name | Patient's Name (0010,0010) |
| PID-7 | Date of Birth | Patient's Birth Date (0010,0030) |
| PID-8 | Sex | Patient's Sex (0010,0040) |
| PV1-1 | Set ID | 1 |
| PV1-2 | Patient Class | O |
| PV1-3 | Assigned Patient Location | Institution Name (0008,0080) |
| PV1-19 | Visit Number | Accession Number (0008,0050) |
| PV1-44 | Admit Date/Time | Current date/time |
| ORC-1 | Order Control | RE |
| ORC-2 | Placer Order Number | Accession Number (0008,0050) |
| ORC-3 | Filler Order Number | Study Instance UID (0020,000D) |
| ORC-4 | Order Status | CM |
| OBR-1 | Set ID | 1 |
| OBR-2 | Placer Order Number | Accession Number (0008,0050) |
| OBR-3 | Filler Order Number | Study Instance UID (0020,000D) |
| OBR-4 | Universal Service ID | Study Description (0008,1030) |
| OBR-7 | Observation Date/Time | Study Date (0008,0020) + Study Time (0008,0030) |
| OBR-8 | Observation End Date/Time | Current date/time |
| OBR-16 | Ordering Provider | Operators' Name (0008,1070) |
| OBR-25 | Result Status | F |
| OBX-1 | Set ID | 1 |
| OBX-2 | Value Type | ED |
| OBX-3 | Observation Identifier | 47045-0^Study report^LN |
| OBX-4 | Observation Sub-ID | 1 |
| OBX-5 | Observation Value | See 6.2 |
| OBX-11 | Observation Result Status | F |
6.4 Acknowledgement Handling
When HL7.WaitForAck is true (the default), the service reads one response of up to 4096 bytes after sending and writes it to the log. The response is not parsed or validated. MSA-1 and MSA-2 are not checked, so AE and AR acknowledgements are treated as successful delivery. WaitForAck controls only whether the service waits for and logs a response. It does not turn on acknowledgement validation.
| Condition | Result |
|---|---|
| Connection refused or failed | Failed; queued for retry |
| Error while writing, or while reading the response | Failed; queued for retry |
| Any response received, including AE or AR | Success |
| Receiver closes the connection without responding | Success |
WaitForAck: false | Success as soon as the message is written |
No read timeout applies while the service waits for a response. The connection attempt uses the operating system's default connect timeout.
6.5 Duplicates and Retries
- One ORU is generated per SOP Instance UID. If the same instance is received again after its ORU was generated, or while that ORU is waiting in the retry queue, the C-STORE is accepted and no new ORU is generated.
- Generated messages are sent from the outgoing folder once per processing cycle. The cycle repeats every
Retry.RetryIntervalMinutes(default 1). - Failed messages go to a retry queue and return to the outgoing folder after
Retry.RetryIntervalMinutes. There is no limit on the number of attempts. - A message file that cannot be read is moved to the
errorfolder.
7 ORM2DICOM
ORM2DICOM receives ORM messages, stores them, and serves them as Modality Worklist entries to DICOM modalities.
7.1 Supported Messages
| Message | Direction | Notes |
|---|---|---|
ORM, any trigger event (MSH-9 starts with ORM) | Inbound | Other message types receive AR |
| ACK | Outbound response | See 7.4 |
7.2 Message Validation
| Check | Outcome on failure |
|---|---|
First segment starts with MSH and contains at least nine fields, with MSH-9 not empty | AR, Invalid HL7 message format |
MSH-9 starts with ORM (case-insensitive) | AR, Unsupported message type <MSH-9> |
| Message can be parsed as HL7 v2 | AE |
| MSH segment present | AE |
| PID segment present | AE |
| Unexpected processing error | AR, with the error text |
Segments must be separated by carriage returns (0x0D). The service does not check MSH-11, MSH-12, ORC-1, or whether order or patient identifiers are present.
7.3 HL7 to Worklist Mapping
Each stored ORM becomes one worklist entry with the following attributes. The first occurrence of each segment is used.
Table 7-1: ORM to Modality Worklist mapping
| HL7 Source | DICOM Attribute | Notes |
|---|---|---|
| PID-3 | Patient ID (0010,0020) | Field value as received; truncated to 64 characters |
| PID-5 (XPN) | Patient's Name (0010,0010) | Components 1, 2, 3, 5 and 4 (family, given, middle, prefix, suffix) joined with ^; empty components are skipped; truncated to 64 characters |
| PID-7 | Patient's Birth Date (0010,0030) | Copied as received |
| PID-8 | Patient's Sex (0010,0040) | Copied as received |
| PID-11 | Patient's Address (0010,1040) | Only when present; truncated to 64 characters |
| PV1-3.4 | Institution Name (0008,0080) | Only when present |
| PV1-7 (XCN) | Scheduled Performing Physician's Name (0040,0006), in SPS Sequence | Components 2, 3, 4, 6, 5 joined with ^; empty components are skipped |
| PV1-8 (XCN) | Referring Physician's Name (0008,0090) | As PV1-7 |
| ORC-2.1 | Accession Number (0008,0050) | Truncated to 16 characters |
| ORC-12 (XCN) | Requesting Physician (0032,1032) | As PV1-7 |
| OBR-4 | Scheduled Procedure Step Description (0040,0007), in SPS Sequence | Entire field; truncated to 64 characters |
| OBR-7 | Scheduled Procedure Step Start Date (0040,0002), in SPS Sequence | First 8 characters, when at least 8 are present |
No other HL7 fields are used. Worklist matching and the DICOM attributes returned to modalities are described in the DICOM Conformance Statement.
7.4 Acknowledgement
ORM2DICOM sends one original-mode acknowledgement on the same connection for each received message.
Table 7-2: ACK content
| Field | Value |
|---|---|
| MSH-3 / MSH-4 | Inbound MSH-5 / MSH-6 |
| MSH-5 / MSH-6 | Inbound MSH-3 / MSH-4 |
| MSH-7 | Current local time, yyyyMMddHHmmss |
| MSH-9 | ACK |
| MSH-10 | ACK followed by the inbound MSH-10 |
| MSH-11 | P |
| MSH-12 | 2.3 |
| MSA-1 | AA, AE or AR |
| MSA-2 | Inbound MSH-10 (empty when the message has no usable MSH) |
| MSA-3 | Error text, for AE and AR only |
- AA is returned when the message was converted to a worklist entry. A failure to write the message to the cache is logged and does not change the code.
- AE is returned when the message cannot be converted (see 7.2). The message is not stored.
- AR is returned for a missing or unusable MSH, an unsupported message type, or an unexpected processing error.
- If the message has no usable MSH, MSH-3 to MSH-6 of the ACK are empty and MSH-10 is
ACKfollowed by a numeric timestamp. |characters in MSA-3 text are written as\|.- No ERR segment is sent. MSH-15 and MSH-16 are ignored, and enhanced-mode (commit) acknowledgements are not sent.
7.5 Order Lifecycle and Duplicates
- Each message's identity is a hash of its full text. A byte-identical resend is not stored again; it refreshes the existing entry's timestamp.
- A message that differs in any byte, for example a new MSH-7 or MSH-10, is stored as a separate worklist entry.
- ORC-1 is not used. Cancel, discontinue and change messages do not remove or update earlier entries; they are stored as additional entries.
- Entries are deleted
Order.ExpiryHours(default 72) after their last update. Cleanup runs at startup and everyCache.CleanupIntervalMinuteswhileCache.AutoCleanupis enabled. HL7.MaxORMsPerPatientis present in the configuration, but the current release does not apply it.
8 ORU2DICOM
ORU2DICOM receives ORU messages, converts each one to a DICOM Basic Text SR and, when the message carries an embedded PDF, an Encapsulated PDF. It sends them to one DICOM destination by C-STORE.
8.1 Supported Messages
| Message | Direction | Notes |
|---|---|---|
| ORU^R01 | Inbound | MSH-9 is not checked. Any message that can be parsed is processed as a result |
| ACK | Outbound response | See 8.4 |
8.2 HL7 Fields Read
The first occurrence of each segment is used.
Table 8-1: ORU to DICOM mapping (both generated objects)
| HL7 Source | DICOM Attribute | Notes |
|---|---|---|
| PID-3.1, else PID-2.1, else PID-2.2 (first repetition) | Patient ID (0010,0020) | If all are empty, the message identity is used |
| PID-5 (XPN) | Patient's Name (0010,0010) | Components 1, 2, 3, 5, 4 joined with ^; empty components skipped; UNKNOWN if empty |
| PID-7 | Patient's Birth Date (0010,0030) | First 8 characters, when at least 8 are present |
| PID-8 | Patient's Sex (0010,0040) | |
| PID-11 | Patient's Address (0010,1040) | Entire field |
| PV1-3.4 | Institution Name (0008,0080) | |
| PV1-8 (XCN) | Referring Physician's Name (0008,0090) | Components 2, 3, 4, 6, 5 |
| OBR-16 (XCN), else PV1-7 (XCN) | Performing Physician's Name (0008,1050) | |
| OBR-3.1, else OBR-2.1 | Accession Number (0008,0050) | Truncated to 16 characters |
| OBR-2.1 | Study ID (0020,0010) | Truncated to 16 characters |
| OBR-4.2 (first repetition) | Study Description (0008,1030), Series Description (0008,103E) | Falls back to Dicom.DefaultStudyDescription |
| OBR-7 | Study, Content Date/Time | Parsed as an HL7 date/time; the current time if absent or unparseable |
| OBR-3.1, else OBR-2.1, else MSH-10 | Study Instance UID (0020,000D) | The first value that, with all characters other than digits and . removed, is a valid UID of at most 64 characters. Otherwise a UID is derived from the message identity |
| — | Series and SOP Instance UIDs | Derived deterministically from the message identity, so a retry produces the same UIDs |
Table 8-2: Additional SR content
| HL7 Source | DICOM Content |
|---|---|
| PV1-7 (XCN) | Scheduled Performing Physician's Name, in SPS Sequence |
| OBR-7 (first 8 characters) | SPS Start Date, in SPS Sequence |
| OBR-4 (entire field) | SPS Description, in SPS Sequence |
| All OBX segments | TEXT content item ORU_SUMMARY (scheme 99FLUX): one numbered line per OBX with a non-empty OBX-5, in the form label: value units (ref range) [status]. The label is OBX-3.2 or OBX-3.1, units are OBX-6.1, the range is OBX-7, the status is OBX-11 |
| Whole message | TEXT content item ORU_RAW containing the received message, when it is shorter than 32,000 characters |
Embedded PDF detection. The service uses the first OBX that meets all of the following:
- OBX-2 is
ED. - OBX-5.4 is
Base64orB64. - OBX-5.5 contains data.
- OBX-5.3 or OBX-5.2 contains
pdf(case-insensitive). - The data decodes as Base64.
Document Title is taken from OBX-3.2, else OBX-3.1, else the default study description.
8.3 Processing and Validation
| Condition | Processing status | MSA-1 |
|---|---|---|
| Message cannot be parsed | Failure | AE, Unable to parse ORU message |
| Conversion to DICOM fails (including an invalid embedded PDF) | Failure; message moved to error | AE |
| Already processed (see 8.5) | Already processed | AA |
| Every generated object accepted by the DICOM destination | Success | AA |
| DICOM send fails | Deferred; queued for retry | HL7.DeferredAckCode (default AA) |
| Unexpected error | — | AE, with the error text |
The acknowledgement is sent after the first DICOM send attempt finishes, so the time to acknowledge includes the DICOM transfer. With the default DeferredAckCode: AA, an AA means the message was stored and will be delivered or retried. It does not confirm that the DICOM destination accepted it.
8.4 Acknowledgement
The ACK has the same layout as ORM2DICOM's (Table 7-2): swapped MSH-3 to MSH-6, MSH-9 ACK, MSH-10 ACK followed by the inbound MSH-10, MSH-12 2.3, MSA-2 equal to the inbound MSH-10, and MSA-3 for AE and AR only. HL7.SenderName, HL7.ReceiverName and HL7.ReceiverFacility are not used in ACKs.
8.5 Duplicates and Retries
- Message identity is MSH-10 with every character other than letters, digits,
_and-removed. If that leaves nothing, the identity is a hash of the message text. - A message whose identity has already been processed successfully receives AA and is not converted again, even if its content differs.
- Deferred messages are retried every
Retry.RetryIntervalMinutes(default 2) up toRetry.MaxAttempts(default 10). After that they are moved to theerrorfolder. A value of 0 means unlimited retries.
9 ORU2REPORT
ORU2REPORT receives ORU messages and produces report files in an output folder. It can render a report from an HTML template, pass through a PDF carried in or referenced by the message, or both.
9.1 Supported Messages
| Message | Direction | Notes |
|---|---|---|
| ORU^R01 | Inbound | MSH-9 is not checked. Any message that can be parsed is processed |
| ACK | Outbound response | Same layout as ORU2DICOM (8.4) |
9.2 HL7 Fields Read
Report templates and output file names use tokens. Named tokens come from these fields:
Table 9-1: Named report tokens
| Token | HL7 Source |
|---|---|
MessageControlId | MSH-10 |
SendingApplication | MSH-3 |
SendingFacility, FacilityIdentifier | MSH-4 |
ReceivingApplication | MSH-5 |
ReceivingFacility | MSH-6 |
PatientId | PID-3.1, else PID-2.1, else PID-2.2 (first repetition) |
PatientName, PatientNameDisplay | PID-5 |
DateOfBirth | PID-7 |
Gender | PID-8 |
AccessionNumber | OBR-3.1, else OBR-2.1 |
PlacerOrderNumber | OBR-2.1 |
ProcedureCode | OBR-4.1 (first repetition) |
ProcedureDescription, StudyDescription | OBR-4.2 (first repetition) |
ProcedureDescriptionShort | First three characters of OBR-4.2; empty if it starts with *** |
ObservationDateTime, ExamDate, ExamDateDisplay | OBR-7 |
ResultStatus | OBR-25 |
OrderingPhysician | OBR-16, else ORC-12 |
ReportText | OBX-5 of every OBX, one per line |
ObservationSummary | Summary of every OBX, as in ORU2DICOM's ORU_SUMMARY |
UUID | Message identity |
Any field can also be addressed directly by path, for example {PV1-19}, {OBR-7}, {PID-3.1}, {OBX[2]-5} or {OBX[*]-5} (all occurrences). In ReportText and ObservationSummary, <br> tags in OBX-5 become line breaks and HTML entities are decoded. Token filters and formats are described in Templates.
PDF attachments. When Report.SourceMode is Attachment, Auto or Both, the service looks for a PDF in one of two forms:
- Embedded: found as in ORU2DICOM (8.2).
- Referenced: the first OBX where OBX-2 is one of
Report.Attachment.ReferenceValueTypes(defaultRP,ST) and OBX-3.1 or OBX-3.2 matchesReferenceObservationIdentifiers. If no identifiers are configured, OBX-5 must containpdf. The OBX-5 value is used as a file path, afterPathMappingsare applied.
9.3 Processing and Acknowledgement
| Condition | Processing status | MSA-1 |
|---|---|---|
| Message cannot be parsed | Failure | AE, Unable to parse ORU message |
| Already processed | Already processed | AA |
| Output written | Success | AA |
| Rendering or output fails, or a referenced file is not yet readable | Deferred; queued for retry | HL7.DeferredAckCode (default AA) |
No PDF attachment found or delivered in Attachment or Both mode, with DeferOnMissing: false | Failure; message moved to error | AE |
| Unexpected error | — | AE, with the error text |
The acknowledgement is sent after the first processing attempt finishes, so rendering time adds to the time to acknowledge. Duplicate identity and retry limits work as in ORU2DICOM (8.5).
10 HL72HL7
Availability
This section describes HL72HL7 2.5.2. HL7.ControlIdReuse, the content hash in message identity, Cache.ReceiptRetentionDays, and ordered delivery (Ordered) are unreleased and not in 2.5.1. In 2.5.1, a message that reuses a stored identity with different content receives AE, receipts are kept indefinitely, and destinations are not delivered strictly in arrival order. See HL72HL7.
HL72HL7 is a store-and-forward HL7 broker. It accepts configured message types, writes each message durably to disk before acknowledging it, and forwards it to the destinations whose rules match.
10.1 Supported Messages
| Message | Direction | Notes |
|---|---|---|
Types in AcceptedMessageTypes (default ORM^O01, ORU^R01) | Inbound | Matched on MSH-9.1 and MSH-9.2; MSH-9.3 is ignored |
| The same messages | Outbound, per destination | Byte-for-byte as received, unless the destination defines transforms or correlation |
| ACK | Outbound response to the sender; inbound response from each destination | See 10.4 and 10.7 |
In CaptureOnly mode (the shipped default), messages are stored and acknowledged but not forwarded. In RouteAndDeliver mode, stored messages are forwarded.
10.2 Inbound Validation
| Check | MSA-1 on failure |
|---|---|
MLLP frame starts with VT as the first byte, ends with FS followed by CR, and is no larger than HL7.MaxMessageBytes | AR, Invalid MLLP frame; the connection is then closed |
Payload is at least 10 bytes and starts with MSH | AR |
| MSH-1 is a printable ASCII character; MSH-2 has at least four ASCII characters; all five delimiters are distinct | AR |
| MSH has at least 10 fields; MSH-9 has a type and a trigger event; MSH-10 is not blank | AR |
| MSH-3, MSH-4, MSH-5, MSH-6, MSH-9, MSH-10, MSH-12 and MSH-18 contain printable ASCII only | AR |
Every segment is non-empty, has a three-character name of A–Z or 0–9, and is followed by the MSH-1 separator | AR |
| No VT, FS, NUL or line-feed (0x0A) bytes inside the message (segments must end with CR only) | AR |
MSH-9 type and trigger are in AcceptedMessageTypes | AR, Message type is not accepted: <type> |
| Message was durably written to the spool | AE, Unable to commit message to durable storage |
| MSH-10 identity conflict (see 10.5) | AE |
Segment content beyond MSH is not otherwise validated.
10.3 Message Identity
A message's identity is built from MSH-9 (type and trigger), MSH-3, MSH-4 and MSH-10. When HL7.ControlIdReuse is Accept (the default), a hash of the exact message bytes is included as well.
10.4 Inbound Acknowledgement
The ACK is sent only after the message is written to disk with write-through.
Table 10-1: HL72HL7 ACK content
| Field | Value |
|---|---|
| MSH-1 / MSH-2 | | / ^~\& |
| MSH-3 / MSH-4 | Inbound MSH-5 / MSH-6 |
| MSH-5 / MSH-6 | Inbound MSH-3 / MSH-4 |
| MSH-7 | Current UTC time, yyyyMMddHHmmss |
| MSH-9 | ACK^<inbound trigger event>, or ACK^U01 if the header could not be read |
| MSH-10 | ACK followed by a numeric timestamp |
| MSH-11 | P |
| MSH-12 | Inbound MSH-12, or 2.3 |
| MSA-1 | AA, AE or AR |
| MSA-2 | Inbound MSH-10 (empty if the header could not be read) |
| MSA-3 | Error text for AE and AR. |, CR and LF are replaced with spaces, and the text is limited to 200 characters |
- AA: the message was stored, or is an exact duplicate of a stored message.
- AE: storage failed, or an identity conflict occurred. The sender may retry.
- AR: the frame or header is invalid, or the message type is not accepted.
No ERR segment is sent. MSH-15 and MSH-16 are ignored, and enhanced-mode acknowledgements are not sent.
10.5 Duplicates and Control ID Reuse
- A resend whose bytes exactly match a stored message receives AA and is not forwarded again. Receipts of completed messages are kept for
Cache.ReceiptRetentionDays(default 365), so a late resend is still recognised after the completed record has been cleaned up. HL7.ControlIdReuse: Accept(default): a message that reuses an earlier MSH-10 with different content is stored as a new message.HL7.ControlIdReuse: Reject: such a message receives AE, and a copy is kept in the quarantine folder.
10.6 Outbound Delivery
- Routing. A destination receives a message when MSH-9 matches one of its
MessageTypes, everyMatchrule passes (case-insensitive value list or regular expression on a field selector such asPV1-3.4), and, whenDeliverMessagesReceivedAfterUtcis set, the message arrived after that time. A message that matches no destination stays in the active spool. - Transforms. A destination can copy or set fields (
SEG-norSEG-n.c), optionally Base64-encode the value as UTF-8, and create a missing segment after a named segment. MSH-1, MSH-2, MSH-9, MSH-10 and MSH-12 cannot be targets. If the result no longer parses as a valid header, or MSH-10 has changed, the transform is refused and retried. - Correlation. A destination can copy fields from an earlier stored message of a
Fromtype whoseCandidateFieldequals the outbound message'sField. Only messages received betweenLookbackHoursbefore andHoldMinutesafter this message are considered. Candidates that would copy identical values count as one match. Candidates that disagree are never chosen between. While there is no single match, the message is held, then forwarded without enrichment afterHoldMinutes. A message whose key field is empty is forwarded without enrichment immediately. A target field that the message already fills keeps its own value. The stored original is never modified. - Ordering. With
Ordered: true(default), each destination receives messages in arrival order. While an earlier message waits for a retry, later messages to that destination wait behind it. Messages held for correlation do not block others. - Connections. Each attempt opens a new TCP connection, sends one frame (VT, message, FS, CR), reads one ACK frame and closes the connection. Connect and ACK timeouts are
Retry.ConnectTimeoutSeconds(default 5) andRetry.AckTimeoutSeconds(default 10). - Schedule. The delivery cycle runs every
Retry.IntervalSeconds(default 30). After a failed attempt, the next attempt for that destination waitsIntervalSeconds × 2^(attempts−1), up toRetry.MaxIntervalSeconds(default 900). Retries continue with no attempt limit until the message is accepted or rejected with a terminal code. - A message is complete when every matching destination has accepted it. It moves to the
rejectedfolder when every destination has either accepted it or returned a terminal rejection.
10.7 Outbound Acknowledgement Validation
Table 10-2: Destination response handling
| Destination response | Result |
|---|---|
Bytes before VT, an FS not followed by CR, or a frame larger than Retry.MaxAckBytes | Retryable failure |
Connection closed before a complete ACK, or no ACK within AckTimeoutSeconds | Retryable failure. The attempt is marked as possibly delivered |
| ACK contains bytes other than printable ASCII, CR or LF | Retryable failure |
ACK does not start with MSH, or has no MSA segment | Retryable failure |
MSA-1 is exactly AA and MSA-2 equals the outbound MSH-10 | Accepted |
MSA-1 is AA but MSA-2 does not match | Retryable failure |
MSA-1 is in Retry.TerminalAckCodes (default AR, CR) and MSA-2 matches | Terminal rejection; not retried for this destination |
Any other MSA-1, including AE, CA and CE | Retryable failure |
Only the first MSA segment is evaluated. CA (commit accept) is not treated as acceptance. AA and CA cannot be configured as terminal codes. If a destination rejects a message after an earlier attempt went unanswered, the rejection is logged as a likely duplicate of a copy that was already delivered.
11 Transport
All services use MLLP over plain TCP: a start byte VT (0x0B), the HL7 message, then FS (0x1C) and CR (0x0D).
Table 11-1: Transport behaviour per service
| Behaviour | DICOM2ORM | DICOM2ORU | ORM2DICOM / ORU2DICOM / ORU2REPORT | HL72HL7 |
|---|---|---|---|---|
| Role | Client | Client | Listener | Listener (inbound), client (outbound) |
| Default port | Sends to HL7.ReceiverPort (7777) | Sends to HL7.ReceiverPort (7777) | HL7.ListenPort: 7777 / 7777 / 7778 | HL7.ListenPort 7777; destination ports per destination |
| Bind address | — | — | HL7.ListenIP. 0.0.0.0 listens on loopback and each IPv4 address of the host | HL7.ListenIP. 0.0.0.0 listens on all IPv4 interfaces |
| Connections | New connection per message | New connection per message | Several messages per connection; no connection limit | Persistent inbound connections; at most HL7.MaxConnections (default 32), extra connections closed. New outbound connection per message |
| Inbound framing | — | — | Bytes before VT are ignored; the message ends at FS; the trailing CR is not required | Strict: VT must be first, FS must be followed by CR; several frames received together are each processed and acknowledged in order |
| Size limit | — | — | None | HL7.MaxMessageBytes (default 64 MiB) |
| Timeouts | Connect 5 s; response read 5 s | No explicit connect or read timeout | Read and write 30 s; a connection with no data for 30 s is closed | Partial frame HL7.ClientTimeoutSeconds (30 s); idle HL7.IdleConnectionTimeoutSeconds (300 s); outbound per Retry settings |
| Response read | One read of up to 4096 bytes | One read of up to 4096 bytes | — | Full MLLP frame up to Retry.MaxAckBytes |
ORM2DICOM, ORU2DICOM and ORU2REPORT process at most one message for each block of data received. Senders should wait for each ACK before sending the next message, which is the normal original-mode MLLP pattern.
12 Character Sets and Encoding
| Service | Reading | Writing |
|---|---|---|
| DICOM2ORM, DICOM2ORU | — | Messages are encoded as UTF-8. The default templates do not set MSH-18 |
| ORM2DICOM, ORU2DICOM, ORU2REPORT | Inbound bytes are decoded as UTF-8. MSH-18 is not consulted | ACKs are encoded as UTF-8. ORU2DICOM writes DICOM objects with Specific Character Set ISO_IR 192 (UTF-8) |
| HL72HL7 | Messages are stored and forwarded as the exact received bytes. MSH-18 is used only to decode a message for routing rules, transforms and correlation. When MSH-18 is empty, HL7.DefaultCharacterSet (default Windows-1252) is used | Forwarded messages keep their original bytes. Transformed messages are re-encoded in the same character set. ACKs are encoded as UTF-8; their header values are ASCII |
Table 12-1: MSH-18 values that HL72HL7 can decode
MSH-18 or DefaultCharacterSet value | Encoding |
|---|---|
ASCII, ISO IR6 | US-ASCII |
8859/1, ISO-8859-1, ISO IR100 | ISO 8859-1 |
UTF-8, UNICODE UTF-8 | UTF-8 |
Windows-1252, CP1252 | Windows-1252 |
HL72HL7 decodes strictly: a byte that is invalid for the declared character set causes an error rather than being replaced. A message whose MSH-18 is not in Table 12-1 is still captured and acknowledged, but it cannot be decoded for field routing, transforms or correlation.
13 Security
- HL7 traffic is not encrypted; no service supports TLS for MLLP. Use network-level protection, such as a VPN or a restricted network segment, where required.
- No service authenticates HL7 peers or filters them by address. Access is limited only by the configured bind address and by host or network firewalls.
- HL72HL7 limits concurrent inbound connections and message size, and closes stalled or idle connections.
14 Known Limitations
These are observed behaviours of the current release.
- DICOM2ORM success detection. Any response that contains
AAorACKanywhere in its text, an empty response, and a read timeout are all treated as successful delivery. MSA-1 and MSA-2 are not evaluated. - DICOM2ORU does not validate acknowledgements. The response is only read and logged.
WaitForAck: truemeans waiting for a response, not checking it, and no read timeout applies while waiting. - DICOM2ORU header settings.
HL7.SenderName,HL7.ReceiverNameandHL7.ReceiverFacilitydo not affect ORU messages. Set MSH-3 to MSH-6 in the template instead. - DICOM2ORM receiver settings.
HL7.ReceiverNameandHL7.ReceiverFacilityonly replace placeholders in MSH-4 and MSH-5, not MSH-5 and MSH-6 where the default template has them. Set MSH-5 and MSH-6 in the template instead (see 5.2). - Default template MSH-7. The default templates contain a fixed MSH-7 timestamp from the time the template file was created. To stamp each message with its send time, put
#{CurrentDateTime}in MSH-7. - Default template MSH-10. The default templates use the Study Instance UID as MSH-10. All ORU messages for instances of the same study therefore share one MSH-10.
- Escaping. Values substituted from DICOM have
|replaced with^. No other HL7 escape sequences are applied, so values that contain^,~,\or&are sent unescaped. - ORM2DICOM order control. ORC-1 is ignored. Cancellations and changes do not update earlier worklist entries, and every message that differs by even one byte creates a new entry.
HL7.MaxORMsPerPatientis not applied. - ORU2DICOM and ORU2REPORT message type. MSH-9 is not checked. Any message that can be parsed is processed as a result.
- ORU2DICOM and ORU2REPORT identity. Duplicates are detected by MSH-10 alone. After a message has been processed, a different message with the same MSH-10 receives AA and is not processed.
- Deferred acknowledgement. By default, ORU2DICOM and ORU2REPORT return AA when processing is deferred for retry. AA means the message was stored, not that it reached its final destination. Set
HL7.DeferredAckCodeto change this. - Character sets on receiving services. ORM2DICOM, ORU2DICOM and ORU2REPORT decode all input as UTF-8 regardless of MSH-18. Characters sent in another 8-bit encoding may not be decoded correctly.
- One message per data block. ORM2DICOM, ORU2DICOM and ORU2REPORT process at most one message for each block of data received. A sender that sends several messages without waiting for each ACK may have later messages processed late or not at all.
- Acknowledgement modes. Only original-mode acknowledgements are produced; MSH-15 and MSH-16 are ignored. ACKs carry error text in MSA-3 and contain no ERR segment. HL72HL7 does not accept
CAfrom a destination as successful delivery. - ACK header format. ORM2DICOM, ORU2DICOM and ORU2REPORT send MSH-9 as
ACKwithout a trigger event and MSH-12 as2.3, whatever version the inbound message declares.|in MSA-3 is written as\|, not\F\. - Transport security. MLLP traffic is not encrypted (see 13).