---
title: Clinic workflow and FHIR records in the EHR example
sidebar_label: Clinic workflow
description: Follow the EHR example's patient intake, Practitioner authorization, FHIR reads and writes, Signals view, and synthetic relay boundaries.
---

# Clinic workflow and FHIR records

The EHR separates synthetic demo state from records returned by an Ovok sandbox. Sandbox requests use the signed-in Practitioner and remain subject to project AccessPolicies; a UI stage or care-team assignment does not grant backend access.

## Trace the implementation

1. [`src/App.tsx`](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/src/App.tsx) coordinates the clinic workbench, selected Patient, and demo or sandbox mode.
2. [`src/lib/ovokClient.ts`](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/src/lib/ovokClient.ts) lazily creates the `@ovok/core` client using the configured sandbox URL and tenant code.
3. [`src/lib/fhir.ts`](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/src/lib/fhir.ts) maps the example's inputs to FHIR `Patient`, `CareTeam`, `CarePlan`, and `DeviceUseStatement` resources.
4. [`src/components/PatientRegistrationDialog.tsx`](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/src/components/PatientRegistrationDialog.tsx) collects registration details; [`src/components/PatientChart.tsx`](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/src/components/PatientChart.tsx) presents records accessible for the selected Patient.
5. [`src/components/SignalsSetup.tsx`](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/src/components/SignalsSetup.tsx) exposes read-only Signals settings and open alerts.

## Sandbox records

The app searches accessible Patients and their demographics, patient-scoped Observations, QuestionnaireResponses, CareTeams, CarePlans, DeviceUseStatements, and Consent status where available. Sandbox registration first checks for an accessible Patient with the submitted email, then creates a FHIR `Patient` and separately requests an invitation. The two writes are not atomic.

Sandbox actions can create a `CareTeam`, an active CHF RPM `CarePlan`, and a `DeviceUseStatement` linking an accessible FHIR `Device` to the Patient. Creating one of these records does not grant access to the Patient or confirm that a device is available. Follow the [sandbox setup guide](/example-rpm-app/ehr/sandbox-setup) and the official [FHIR R4 reference](/api/fhir/r4) before adapting these operations.

Signals is read-only in this app. It does not change project settings, acknowledge alerts, calculate risk scores, or recommend treatment. The EHR does not implement human messaging, subscriptions, or WebSocket updates.

## Synthetic demo and local relay

The demo workbench uses synthetic fixtures and session-only actions. In development, [`vite.config.ts`](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/vite.config.ts) exposes an in-memory relay for synthetic ECG, weight, and questionnaire readings shared with the companion examples. [`src/lib/demoRelay.ts`](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/src/lib/demoRelay.ts) validates relay payloads. The relay resets with the dev server, has no database or Ovok connection, and is absent from production builds; it is not a sandbox fallback or a realtime platform feature.

## Current boundaries

- The registration form does not collect legally binding signatures or create a Consent record. Consent status is read-only.
- Intake questionnaire answers and clinical Conditions, allergies, medications, appointments, and task queues are not persisted as complete workflows.
- Device assignment in sandbox does not implement inventory, compatibility checks, shipping, delivery, returns, or replacement.
- Demo kit names and patient records are synthetic. The EHR is not for clinical use and is not certified medical software.

See the repository's [capability matrix](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/docs/capability-matrix.md), [FHIR resource mapping](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/docs/fhir-resource-mapping.md), and [capability-gap report](https://github.com/Ovok-Dev/rpm-ehr-example-app/blob/dev/docs/capability-gaps.md) for additional detail.
