EHI Export Instructions
Export Format Documentation
For ONC Certification – §170.315(b)(10): Electronic Health Information export
Step-by-Step Instructions to export Single Patient EHI data [without developer assistance]
Step 1: Navigate to the EHI Export Page
- Log in to the EMR system with an authorized user account. You must be a “Systems Administrator” to download EHI reports.
- On the left navigation panel, click on the “Reports” section.
- Under “Reports”, click the “EHI Export” submenu item.
- The EHI Export interface will open on the right side of the screen.

Step 2: Enter Patient Reference Number
- You will see a text input labeled “Patient Reference Number.”
- Initially, the “Search” button will be disabled.
- Start typing a valid patient reference number.
- Once a non-empty value is entered, the “Search” button becomes enabled.

Step 3: Search for the Patient Record
- Click the “Search” button.
- The system will perform a lookup for the patient reference number you entered.
- Two possible outcomes:
- No Match Found: An alert is shown with the message.
- Match Found: The system displays some basic details.

Step 4: Generate the EHI Report
- Click the “Generate Report” button.
- The system will begin generating the report in the background.

Step 5: Retrieve the Downloadable File
- Once the report is ready, a new entry is added to the “Notifications” panel.
- Navigate to the Notifications section (accessible from the top navigation bar or user dashboard).
- Locate the notification using the Search bar using the Patient Reference Number.
- The notification includes:
- Patient Reference Number
- A Download link (hyperlinked filename or button)
- Click the Download link to get the file in the stated format: FHIR NDJSON (ZIP compressed) format.

Data Dictionary:
Find a sample exported ZIP file here
Instructions to export Patient Population EHI data [with developer assistance]
Overview
This script exports all patients and their associated resources from a FHIR server using the Patient/$everything operation. It uses axios for direct HTTP communication with the FHIR server, providing better control and flexibility.
Features
- Direct HTTP Communication: Uses axios for direct communication with the FHIR server.
- Flexible Patient Selection: You can export all patients or filter by specific IDs or creation dates.
- Batch Processing: Processes patients in configurable batches to avoid overwhelming the FHIR server.
- Complete Resource Export: Uses Patient/$everything to get all resources associated with each patient.
- Organized Output: Creates a separate JSON file for each resource type per patient.
- Compressed Archive: Creates a zip file containing all exported data.
- Comprehensive Logging: Provides detailed logging throughout the export process.
- Error Handling: Gracefully handles failures with detailed error reporting.
- Authentication Support: Supports Bearer token authentication.
- Configurable FHIR Server: Allows for easy configuration of the FHIR server URL.
Prerequisites
- Node.js installed on your system.
- Access to a FHIR server.
- FHIR server base URL.
- Authentication token (if your FHIR server requires it).
Installation Steps
- Navigate to Project Directory:
cd /path/to/your/patient-service. - Install Dependencies: Run
npm installoryarn install. - Verify
ts-nodeAvailability: Check ifts-nodeis available by runningnpx ts-node --version. If it is not available, install it by runningnpm install -g ts-node typescript.
Usage Instructions
- Method 1: Using
npx(Recommended):npx ts-node src/scripts/run-patient-export.ts --fhirUrl=YOUR_FHIR_SERVER_URL. - Method 2: Using npm script:
npm run export-patients -- --fhirUrl=YOUR_FHIR_SERVER_URL. - Method 3: Using Yarn:
yarn ts-node src/scripts/run-patient-export.ts --fhirUrl=YOUR_FHIR_SERVER_URL.
Command Line Parameters
--fhirUrl=URL: Specifies the FHIR server base URL.- Optional Parameters:
--authToken=TOKEN: The authentication Bearer token.--patientIds=id1,id2: Specific patient IDs to export.--createdAfter=YYYY-MM-DD: Exports patients created after this date.--createdBefore=YYYY-MM-DD: Exports patients created before this date.--batchSize=N: The number of patients to process in each batch (default is 50).--outputDir=path: The output directory for exported files (default is./patient-exports).--zipFileName=name: The base name for the zip file (default ispatient-export).
