HL7 v2 Test Messages: 65 Validated Synthetic Samples
This pack gives you 65 synthetic HL7 v2 messages for integration testing: 40 clean messages that parse with zero validator issues, and 25 invalid messages, each paired with a manifest naming the exact rule id it must trigger. Every file is invented test data, not real patient data, and is verified by the same parser that powers our HL7 v2 Toolkit for JetBrains IDEs.
What is in the HL7 v2 test message pack?
The pack is 111 files in total: 40 clean messages, 25 invalid messages, 40 golden JSON outputs, 3 performance batches, plus the manifest, readme and a machine-readable expected-rules table. Here is the full breakdown.
| Folder | Files | What it is |
|---|---|---|
| clean/ | 40 | Well-formed messages, 0 validator problems. ADT (A01/A03/A08), ORU^R01 multi-OBX, ORM^O01, SIU^S12, MDM^T02, ACK - in HL7 v2.3 and v2.5.1. |
| invalid/ | 25 | One or more deliberate defects per file, each with a declared rule id (see error catalogue below). |
| golden/ | 40 | Expected parse output (JSON) for every clean message, for diffing your own parser. |
| perf/ | 3 | Large batch files: 500, 2,000 and 5,000 messages for throughput testing. |
| INDEX.md, README.md | 2 | Full manifest and the synthetic-data policy, licence and usage notes. |
The 25 invalid messages cover a documented catalogue of defects, so you can prove your validator raises the right rule and nothing else:
| Rule id | Files | Example defect |
|---|---|---|
| hl7.header.missing | 2 | No MSH, or MSH not first segment |
| hl7.required.missing | 5 | Empty PID-3, PID-5, MSH-9, MSH-10, OBR-4 |
| hl7.type.obx5 | 3 | OBX-5 content does not match the type declared in OBX-2 |
| hl7.type.nm | 3 | Non-numeric value in an NM field |
| hl7.type.dt / hl7.type.ts | 4 | Malformed date or timestamp |
| hl7.segment.unknown | 2 | Unknown segment tag (XYZ, QWX) |
| hl7.length.exceeded | 2 | Field over the published maximum length |
| hl7.table.unknown | 2 | Code outside its HL7 table (PID-8 sex "Q") |
| mixed | 2 | Two or three independent defects in one file |
Are these real patient data?
No. Every message in the pack is synthetic by policy. Production HL7 messages are protected health information, so you cannot legally drop them into a test suite or a shared repository. Public samples from the internet are unvalidated and are sometimes copied from real records. These files are invented from scratch: fictional patient names, TEST-prefixed MRNs and visit ids, 555 phone numbers, and a trailing banner segment on every message declaring the data synthetic.
Three free HL7 samples
Here are three clean messages from the pack, verbatim, so you can see the shape and the synthetic banner before buying. The full pack adds 37 more clean messages plus the 25 invalid ones.
ACK^A01 (HL7 v2.5.1)
MSH|^~\&|TESTLIS|TESTFAC|TESTRCV|TESTRCVFAC|20260115103000||ACK^A01|TESTACK000|P|2.5.1
MSA|AA|TESTA01000
ZBN|SYNTHETIC conformance data - NOT real patient data. Not for clinical or production use.
ADT^A01 admit (HL7 v2.3)
MSH|^~\&|TESTADT|TESTLAB|TESTRCV|TESTRCVFAC|20260115103000||ADT^A01|TESTA01003|P|2.3
EVN|A01|20260115103000
PID|1||999MRN0004^^^H^MR||TESTPERSONA^CHARLIETEST^M||19991231|F|||104 TEST ST^^Anytown^ZZ^00000-9004||555-0104
PV1|1|I|ICU^01^A||||||||||||||||TEST-VISIT-03
ZBN|SYNTHETIC conformance data - NOT real patient data. Not for clinical or production use.
ADT^A03 discharge (HL7 v2.3)
MSH|^~\&|TESTRIS|TESTCLINIC|TESTRCV|TESTRCVFAC|20260115103000||ADT^A03|TESTA03002|P|2.3
EVN|A03|20260115103000
PID|1||999MRN0009^^^H^MR||TESTSUBJECT^BRAVOTEST^M||19450808|M|||109 TEST ST^^Anytown^ZZ^00000-9009||555-0109
PV1|1|O|ICU^01^A||||||||||||||||TEST-VISIT-02
ZBN|SYNTHETIC conformance data - NOT real patient data. Not for clinical or production use.
How do the invalid messages help?
Each invalid message isolates one defect (a few "mixed" files carry two or three) and the manifest tells you the exact rule id and message fragment your validator should raise. That turns a vague "does my parser catch errors" into a pass/fail acceptance suite: load the file, assert the reported rule matches the manifest, fail the build if it does not. The same messages were used to validate the parser engine behind our HL7 v2 Toolkit plugin for JetBrains IDEs.
FAQ
Are these real patient data?
No. Every message is synthetic by policy: fictional names, TEST-prefixed identifiers, 555 phone numbers, invented MRNs, and a banner segment on every file declaring it synthetic. There is no real protected health information anywhere in the pack, so it is safe to commit to a shared repository or CI pipeline.
Will the clean messages pass my HL7 validator?
The 40 clean messages are built to produce zero problems from a conformant HL7 v2 parser, and are checked against the engine that powers our HL7 v2 Toolkit. If your validator flags one, it is usually a stricter or non-standard local rule, and the golden JSON output for each file shows the expected parse so you can see exactly where the difference is.
Which HL7 versions and message types are covered?
HL7 v2.3 and v2.5.1, detected from MSH-12. Message types include ADT (A01 admit, A03 discharge, A08 update), ORU^R01 lab results with multiple OBX segments, ORM^O01 orders, SIU^S12 scheduling, MDM^T02 documents, and ACK acknowledgements.
Can I redistribute the files?
The licence is single-team commercial use with no redistribution. Your team can use the messages across internal projects, CI and test suites. Reselling or publishing the files, or bundling them into a distributed product, is not permitted.