# Epic

> Measure Epic appointments booked, completed, and missed in Ours Privacy from a scheduled report export into Reverse ETL, and match each booking to the website visit that led to it.

Source: https://docs.oursprivacy.com/docs/epic

Use this page to measure Epic appointments in Ours Privacy from a scheduled report: bookings, completed visits, and no-shows, each credited to the campaign and website visit that led to it. Your Epic team schedules a daily report, and [Reverse ETL](https://docs.oursprivacy.com/docs/reverse-etl) imports it.

A report export is one of two ways to bring Epic activity into Ours Privacy. The other is a FHIR or HL7 interface connection; see [Choose an EHR or PMS Connection Path](https://docs.oursprivacy.com/docs/ehr-connection-paths) to compare them.

---

## Before you start

- **Someone who can build and schedule a report in Epic.** Usually your Epic analyst or reporting team.
- **An identifier on every row.** The visitor ID passed on your booking links (see below), an email address, or your own patient ID sent as an external ID. Include more than one when you have them.
- **The outcomes you want to measure,** such as booked, completed, cancelled, or no-show appointments.
- **The [Web SDK](https://docs.oursprivacy.com/docs/web-sdk-javascript) or [Tag Manager](https://docs.oursprivacy.com/docs/tag-manager/installation) on your website,** so the visit and the campaign that drove it are recorded before the patient books.

---

## Setup

1. **Build the report.** Ask your Epic team for a report with one row per appointment: an appointment ID, the status (booked, completed, cancelled, no-show), the time of the status change, the department or service line, and the identifiers above. Leave out clinical detail the measurement does not need.
2. **Pass the visitor ID on your booking links.** When patients book through MyChart from your site, add the visitor ID to each MyChart booking link's `linksource` value, and ask your Epic team to include `linksource` as a column in the report. Ask them to confirm your MyChart links accept it. This links each booking to the exact web visit, with no email match needed.

   ```javascript
   // Run after the Web SDK loads. Match the selector to your MyChart booking links.
   document.querySelectorAll('a[href*="mychart"]').forEach((link) => {
     const url = new URL(link.href);
     url.searchParams.set('linksource', ours.getVisitorId());
     link.href = url.toString();
   });
   ```

   You can run the same code as a Custom HTML tag in [Tag Manager](https://docs.oursprivacy.com/docs/tag-manager). If you already use `linksource` for another value, agree with your Epic team on which one the report needs.

3. **Schedule the export.** Have Epic save the report as a CSV file once a day to an SFTP server Ours Privacy hosts for you, or to your own SFTP server or S3 bucket. See [Connecting Reverse ETL Sources](https://docs.oursprivacy.com/docs/connecting-sources) for what each option needs.
4. **Set up the import with the Ours Privacy team.** Contact your account representative. The team configures the Reverse ETL source and writes the transform that turns each row into an event, previewing it against a sample file before the first run.
5. **Check the events.** After the first file arrives, open [Recent Events](https://docs.oursprivacy.com/docs/tracking-and-debugging-events) and confirm the appointment events appear on the right visitors.

---

## Example events

Each report row becomes a [standard healthcare event](https://docs.oursprivacy.com/docs/standard-healthcare-events), such as `appointment_booked` or `appointment_completed`, dated to when the status changed rather than when the file arrived.

Use the same appointment ID on every event so booking, attendance, and no-shows stay one journey. Before forwarding any of these to a destination, add them to its [event allow list](https://docs.oursprivacy.com/docs/allow-listing-events).

---

## Next Steps

- **[Reverse ETL](https://docs.oursprivacy.com/docs/reverse-etl):** how scheduled imports, transforms, and approvals work.
- **[Choose an EHR or PMS Connection Path](https://docs.oursprivacy.com/docs/ehr-connection-paths):** compare a report export with a FHIR or HL7 interface and the other paths.
- **[Standard Healthcare Events](https://docs.oursprivacy.com/docs/standard-healthcare-events):** event names and properties for the patient journey.
- **[Visitor Identity and Matching](https://docs.oursprivacy.com/docs/visitor-identity-and-matching):** how the visitor ID, email, and external ID connect a report row to website activity.
- **[EHR and PMS Support Matrix](https://docs.oursprivacy.com/docs/ehr-support-matrix):** paths for other systems.

For setup help, contact [support@oursprivacy.com](mailto:support@oursprivacy.com).
