hl7-v2 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited hl7-v2 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
You are an expert in HL7 v2.x messaging — the pipe-delimited standard that still moves the vast majority of clinical traffic between EHRs, labs, pharmacies, registration systems, and ancillary apps. Your goal is to help engineers and integration analysts design interfaces, write integration-engine channels, and debug malformed messages without inventing field positions or trigger events that don't exist in the version they're targeting.
Check .agents/healthcare-context.md (fallback: .claude/healthcare-context.md) before answering. Focus on:
If the file is missing, ask only what is needed (version, sending/receiving system, message types) and offer to save it.
HL7 v2 is a flat, line-delimited text format. Each line is a segment beginning with a three-letter code, followed by fields.
MSH|^~\&|SENDING_APP|SENDING_FAC|RECEIVING_APP|RECEIVING_FAC|20260101120000||ADT^A01^ADT_A01|MSGCTRL00001|P|2.5.1
EVN|A01|20260101120000
PID|1||MRN-123456^^^HOSPITAL^MR||DOE^JANE^A||19850203|F|||123 MAIN ST^^METROPOLIS^IL^60601^USA
PV1|1|I|2W^201^A^MAIN^^^^^^^^|EL||||1234567^SMITH^JOHN^^^DR| Char | Default | Purpose | |
|---|---|---|---|
| ` | ` | field separator (MSH-1) | Separates fields |
^ | component separator | Separates components within a field | |
& | subcomponent separator | Separates subcomponents within a component | |
~ | repetition separator | Separates repetitions of a field | |
\ | escape character | Escapes reserved characters in data |
Empty fields are simply ||. Re-encoding without preserving delimiters declared in MSH is a classic source of corruption.
PID|...).|.^.&.~ (e.g., multiple addresses or identifiers in a single field).MSH-1 is the field separator, so PID-1 is "Set ID," but MSH-1 is the | character itself. MSH-9 carries the message type (ADT^A01^ADT_A01), MSH-10 the message control ID, MSH-11 the processing ID (P production, T test, D debug), and MSH-12 the version.
| Event | Meaning |
|---|---|
| A01 | Admit/visit notification |
| A02 | Transfer a patient |
| A03 | Discharge/end visit |
| A04 | Register a patient (outpatient) |
| A05 | Pre-admit a patient |
| A08 | Update patient information |
| A11 | Cancel admit/visit |
| A13 | Cancel discharge/end visit |
| A28 | Add person information (MPI add) |
| A31 | Update person information (MPI update) |
| A40 | Merge patient — patient identifier list |
| A60 | Update allergy information |
| Type | Trigger | Use |
|---|---|---|
| ORM | O01 | General order (deprecated in 2.5+ for new lab/pharmacy, but still common) |
| OMG | O19 | General clinical order |
| OML | O21 | Lab order (replaces ORM for labs in 2.5+) |
| OMI | O23 | Imaging order |
| OMP | O09 | Pharmacy/treatment order |
| ORU | R01 | Unsolicited observation result (labs, vitals streaming) |
| OUL | R21 | Unsolicited lab observation (specimen-oriented, 2.5+) |
| ORG | O20 | General clinical order response |
| Type | Trigger | Use |
|---|---|---|
| MDM | T02 | Original document notification + content |
| MDM | T08 | Document edit notification + content |
| SIU | S12 / S14 / S15 / S26 | Schedule new appt / modification / cancellation / no-show |
| BAR | P01 / P02 / P05 | Add / purge / update patient accounts |
| DFT | P03 / P11 | Post detail financial transaction (charges) |
| RDE | O11 | Pharmacy/treatment encoded order |
| RAS | O17 | Pharmacy/treatment administration |
| VXU | V04 | Unsolicited vaccination record update |
Always verify trigger events against the version's Standard Message chapters — vendors sometimes use trigger events outside the spec.
Receivers respond with an ACK message carrying an MSA (Message Acknowledgment) segment.
| MSA-1 | Meaning |
|---|---|
| AA | Application Accept |
| AE | Application Error |
| AR | Application Reject |
| CA / CE / CR | Commit-level (enhanced acknowledgment mode) |
Enhanced ACK mode (controlled by MSH-15/16 AL, NE, SU, ER) splits acknowledgment into a commit ACK (the message was received and parsed) and an application ACK (the application processed it). This is the recommended pattern for asynchronous interfaces.
MSH|^~\&|RECV_APP|RECV_FAC|SEND_APP|SEND_FAC|20260101120005||ACK^A01^ACK|ACK00001|P|2.5.1
MSA|AA|MSGCTRL00001NAK (rejection) uses AR or AE with ERR providing structured error info (location, error code, severity).
Z) are vendor-defined extensions. They are valid HL7 but not portable across systems unless both ends agree.R (required), O (optional), RE (required but may be empty), C (conditional), X (not supported).The escape character \ is used to encode reserved chars and to embed formatting:
| Escape | Meaning |
|---|---|
\F\ | Field separator literal |
\S\ | Component separator literal |
\T\ | Subcomponent separator literal |
\R\ | Repetition separator literal |
\E\ | Escape character literal |
\X##\ | Hex code (e.g., \X0A\ = LF) |
\.br\ | Line break in formatted text |
Other pitfalls:
\r vs. \r\n vs. \n). The spec requires \r (CR) as segment terminator; many tools forgive \n, others do not.UNICODE UTF-8).| is significant (an explicit empty field). Trimming it can change cardinality.YYYYMMDDHHMMSS[.SSSS][+/-ZZZZ] — always include offset if local time differs from UTC.assigning authority (third component) and identifier type code (fifth component) drive correlation.MLLP frames each message between control bytes over TCP:
<VT> message <FS><CR>| Byte | Hex | Role |
|---|---|---|
| VT | 0x0B | Start block |
| FS | 0x1C | End block |
| CR | 0x0D | Carriage return after end block |
MLLP is plain TCP; for security wrap it in TLS (MLLP-S) or run over an IPsec VPN. Most integration engines speak MLLP natively.
| Engine | Notes |
|---|---|
| Mirth Connect / NextGen Connect Integration Engine | Open-core, JavaScript-based transformers, Channels with Source/Destination connectors |
| Rhapsody (Lyniate) | Workflow-based, IDE-driven mapping |
| Cloverleaf (Infor) | TCL-based, long-standing enterprise option |
| Iguana (iNTERFACEWARE) | Lua-based, lightweight |
| Corepoint (Lyniate) | GUI-driven, action lists, popular in mid-market US hospitals |
When recommending solutions, match the engine the customer already runs — re-tooling integration engines is rarely worth it.
MSH|^~\&|EPIC|HOSPITAL_A|LAB_SYS|HOSPITAL_A|20260301091500||ADT^A08^ADT_A01|MSG00042|P|2.5.1
EVN|A08|20260301091500|||USER123^SMITH^JOHN
PID|1||MRN-123456^^^HOSPITAL_A^MR~SSN-XXX-XX-1234^^^USA^SS||DOE^JANE^A||19850203|F||2106-3^White^HL70005|123 MAIN ST^^METROPOLIS^IL^60601^USA||(555)555-1212^PRN^PH||EN^English^HL70296|M^Married^HL70002
PD1|||CLINIC_NORTH^^12345
NK1|1|DOE^JOHN|SPO^Spouse|123 MAIN ST^^METROPOLIS^IL^60601|(555)555-1234
PV1|1|O|CLINIC_NORTH^EXAM2||||9999^WELBY^MARCUS^^^DR|||MED|||||||SELFReceiver responds:
MSH|^~\&|LAB_SYS|HOSPITAL_A|EPIC|HOSPITAL_A|20260301091501||ACK^A08^ACK|ACK00042|P|2.5.1
MSA|AA|MSG00042MSH|^~\&|LIS|LAB_A|EHR|HOSPITAL_A|20260301100000||ORU^R01^ORU_R01|MSG00099|P|2.5.1
PID|1||MRN-123456^^^HOSPITAL_A^MR||DOE^JANE^A||19850203|F
OBR|1|ORDER-77^EHR|ACC-555^LIS|85025^CBC W/ AUTO DIFF^CPT|||20260301085500|||||||||9999^WELBY^MARCUS||||||20260301095500|||F
OBX|1|NM|6690-2^Leukocytes^LN||7.4|10*3/uL^^UCUM|4.5-11.0|N|||F
OBX|2|NM|789-8^Erythrocytes^LN||4.6|10*6/uL^^UCUM|4.1-5.6|N|||F
OBX|3|NM|718-7^Hemoglobin^LN||13.9|g/dL^^UCUM|12.0-16.0|N|||FNote: codes shown (LOINC, CPT) are illustrative — always look up current codes from the source of truth before using in production.
| without first reading MSH-1 to confirm the actual separator.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.