# HL7 message reference

Canonical page: https://docs.ovok.com/guides/connect-your-ehr/message-reference

Ovok sends each Observation created in your project, and matched by the connection, as an IHE PCD-01 `ORU^R01` message (HL7 v2.6).

## Example [#example]

```text title="ORU^R01"
MSH|^~\&|OVOK||||20261111191600+0000||ORU^R01^ORU_R01|<Observation id>|P|2.6|||AL|NE||UNICODE UTF-8|||IHE_PCD_001^IHE PCD^1.3.6.1.4.1.19376.1.6.1.1.1^ISO
PID|1||MRN-9^^^KIS^MR||Muster^Erika||19500307|F
OBR|1||<Observation id>^OVOK|182777000^monitoring of patient^SNOMED-CT|||20261111191530+0000
OBX|1|NM|8867-4^Heart rate^LN|1.0.0.1|72|/min^beats/minute^UCUM|||||F|||20261111191530+0000
```

| Segment | Carries |
| --- | --- |
| `MSH` | Sender, time, message type, control id, profile |
| `PID` | The patient and the MRN in the hospital's system |
| `OBR` | The Observation id and the time of the reading |
| `OBX` | One numeric value, with code, unit, result status and time |

## What is sent [#what-is-sent]

- One `OBX` per numeric value: the Observation's own and each component's. A blood-pressure panel sends systolic and diastolic, not the panel.
- `OBX-3` is the MDC code when there is one, then LOINC, then SNOMED CT.
- Units are UCUM when the quantity carries a UCUM code.
- Times are UTC to the second, with `+0000`.
- `OBX-11` maps the Observation status: final `F`, preliminary `P`, amended or corrected `C`, registered `I`, cancelled `X`, entered in error `W`, otherwise `R`.

## What is skipped [#what-is-skipped]

Nothing is sent, and nothing is retried, when:

| Case | Fix |
| --- | --- |
| The patient has no identifier in the hospital's system | Add the MRN, then [resend](#resend-after-a-long-outage). |
| The Observation has no numeric value coded in MDC, LOINC or SNOMED CT | Fix the coding where the reading is produced, or narrow the connection's `criteria`. |

## Acknowledgements [#acknowledgements]

Ovok waits up to 10 seconds for the hospital's acknowledgement in `MSA-1`.

| Answer | Meaning |
| --- | --- |
| `AA`, `CA` | Accepted. The delivery is complete. |
| `AE`, `AR`, `CE`, `CR` | Rejected. The same refusal comes back on a retry, so fix the mapping with the hospital's analyst. |
| No answer in 10 seconds | The agent is offline or the receiver is slow. Ovok retries. |

## Retries [#retries]

A delivery that is not accepted is retried with backoff for about 34 minutes. After that the reading is not sent again by itself.

`MSH-10` is the Observation id. A retry after a lost acknowledgement carries the same control id, so the hospital can drop a repeated one.

## Resend after a long outage [#resend-after-a-long-outage]

Resend each missed Observation to the one connection, as a create:

```bash title="resend.sh"
curl --request POST "https://api.sandbox.ovok.com/fhir/R4/Observation/${OBSERVATION_ID}/\$resend" \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{"interaction":"create","subscription":"<connection id>"}'
```

See [Resend a resource](/primitives/resend-resource).

## See also [#see-also]

- [Connect over HL7 v2](/guides/connect-your-ehr/connect-over-hl7)
- [Troubleshooting HL7 connections](/guides/connect-your-ehr/troubleshooting)
