Skip to main content

EHR Ingestion Log

Route: /reports/ehr-ingestion File: src/reports/EhrIngestionLogPage.tsx

The EHR Ingestion Log gives admins a full audit trail of every FHIR resource received from an external EHR during sync. It shows what was received, whether it was stored successfully, how long it took, and the raw payload side-by-side with what was stored in ChartChat.


The page is structured as three levels. Breadcrumbs at the top let you navigate back.

Connections  →  Patient / Resource Type Summary  →  Individual Log Records

Level 1 — Connections

Lists all PatientEHRConnection resources across all patients. Each row represents one patient's connection to one EHR.

Summary chips (clickable filters):

ChipFilter
TotalAll connections
Activestatus = active
Token Expiredstatus = token_expired
InactiveAny other status

Clicking a chip filters the table to that status. Clicking again clears the filter.

Table columns:

ColumnDescription
PatientAvatar + full name + UUID
HospitalEHR provider name or hospital endpoint name
Statusactive (green) / token_expired (orange) / other (gray)
Last SyncTimestamp of the last completed sync

Search: Free-text search by patient name, hospital name, or status.

Sorting: All columns are sortable (asc/desc) by clicking the column header.

Pagination: 20 connections per page.

Data fetching: Streams all PatientEHRConnection resources via searchResourcePages with _count=50&_sort=-_lastUpdated. Hospital names for UUID-based ehrProvider values are resolved by looking up the corresponding Endpoint resource.

Clicking any row drills into Level 2 for that connection.


Level 2 — Resource Type Summary

Shows a breakdown of all EhrIngestionLog records for the selected connection, grouped by FHIR resource type.

Patient summary bar at the top shows:

  • Patient name + avatar
  • Connection status badge
  • Hospital name
  • Last sync timestamp
  • Stats: total sync runs, total resources ingested, total failed

Table columns:

ColumnDescription
Resource TypeFHIR resource type (e.g. Condition, Observation)
TotalTotal records ingested for this type
SyncedCount with status = success
FailedCount with status = failed — shown as red badge if > 0
Success RatePercentage, with a colour-coded progress bar (green ≥ 100%, orange ≥ 80%, red < 80%)
Last SyncedMost recent receivedAt timestamp for this type
View BundleOpens a modal showing all raw EHR payloads for this type as a FHIR Bundle

View Bundle modal: Assembles all ehrData.payload values for the resource type into a single FHIR Bundle (type: searchset) and displays it as formatted JSON. Includes a copy-to-clipboard button.

Data fetching: Streams all EhrIngestionLog records for the connection using the connection search parameter:

EhrIngestionLog?connection=PatientEHRConnection/{id}&_count=100&_sort=-_lastUpdated

Clicking a resource type row drills into Level 3.


Level 3 — Individual Log Records

Shows the paginated list of individual EhrIngestionLog entries for one resource type within the selected connection.

Table columns:

ColumnDescription
Received AtTimestamp when the resource arrived
Stored ResourceReference to the stored FHIR resource (e.g. Condition/abc-123) or if failed
DurationProcessing time in milliseconds
ErrorError message (first line, truncated) if ingestion failed

Pagination: 25 records per page.

Clicking any row opens the Detail Modal.


Detail Modal

Opens when clicking an individual log record at Level 3. Shows a complete side-by-side comparison:

Header metadata:

FieldDescription
PatientName or UUID
HospitalEHR name
Resource TypeFHIR type
Received AtTimestamp
DurationProcessing time in ms
Source EndpointFull EHR FHIR endpoint URL

Error block: Shown in red if outcome.error is present.

Raw vs Stored (side by side):

Left panelRight panel
Raw from EHR — ehrData.payload formatted as JSONStored in ChartChat — fetched live via medplum.readReference(storedResource)

The stored resource is fetched on-demand when the modal opens. If the ingestion failed, the right panel shows "No stored resource (ingestion failed)".


EhrIngestionLog FHIR Resource

Each row in the table corresponds to one EhrIngestionLog resource. See EHR Import — Ingestion Logging for the full field reference.

Key fields used by this page:

FieldUsed for
connectionFiltering logs by EHR connection (search param)
sourceResourceTypeGrouping by resource type (Level 2)
statusSuccess/failed counts and row highlighting
syncBatchCounting distinct sync runs
ehrData.payloadRaw EHR data in Detail Modal and Bundle viewer
storedResourceFetching the stored FHIR resource in Detail Modal
timing.durationMsDuration column
outcome.error.messageError column and modal error block