# Connect to your EHR

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

Connect your project to a hospital's EHR or clinical information system (CIS), so readings and results reach the system clinicians already use.

The path depends on what the hospital system speaks.

| The hospital system | Path | Start here |
| --- | --- | --- |
| A FHIR-native EHR | Use the FHIR R4 API directly. | [FHIR-native EHRs](#fhir-native-ehrs) |
| An HL7 v2 system, which is most hospital CIS | Make an Ovok HL7 connection. | [Connect over HL7 v2](/guides/connect-your-ehr/connect-over-hl7) |

## FHIR-native EHRs [#fhir-native-ehrs]

A FHIR-native EHR needs no connection object. It calls the same FHIR R4 API as your own apps.

| Task | How | Page |
| --- | --- | --- |
| Sign in | Create an [admin application](/applications#admin) and exchange its id and secret for a token with `client_credentials` at `POST /oauth2/token`. | [Authenticate](/signals/standalone/get-started#authenticate-and-get-a-session-token) |
| Pull what changed | Search with `_lastUpdated=gt<timestamp>`. | [Queries and pagination](/graphql/queries-and-pagination) |
| Pull everything | Start a bulk `$export`: NDJSON files, with `_since` for increments. | [Export system data](/primitives/export-system-data) |
| Receive changes | Create a `Subscription` with a `rest-hook` channel. Each delivery is signed in `X-Signature`. | [Subscription](/api/fhir/r4/subscription) |
| Write into Ovok | Put the hospital's MRN in `Patient.identifier` and use a conditional create, so a patient is never created twice. | [Patient](/api/fhir/r4/patient) |

## HL7 v2 hospital systems [#hl7-v2-hospital-systems]

Most hospital CIS take HL7 v2 over MLLP, often behind an interface engine. An Ovok HL7 connection sends each new Observation as an HL7 v2 `ORU^R01` message in the IHE PCD-01 profile.

- Codes: IEEE 11073 MDC, LOINC or SNOMED CT. Units: UCUM.
- A small HL7 agent runs inside the hospital network and opens an outbound connection to Ovok. The hospital opens no inbound port.
- A connection is one form in the Console or one API call. No code per hospital.

## Pages in this guide [#pages-in-this-guide]

1. [Connect over HL7 v2](/guides/connect-your-ehr/connect-over-hl7): make the connection, install the agent, test and go live.
2. [HL7 message reference](/guides/connect-your-ehr/message-reference): what is sent, what is skipped, acknowledgements, retries and resends.
3. [Troubleshooting HL7 connections](/guides/connect-your-ehr/troubleshooting): the usual failures and what to do.

## See also [#see-also]

- [Applications](/applications)
- [Access policies](/access-policies)
- [Resend a resource](/primitives/resend-resource)
