A complete tutorial for setting up and using EHRbase with openEHR to store and query patient vital signs data (Blood Pressure).
This project demonstrates how to:
- Set up EHRbase (openEHR clinical data repository) with PostgreSQL
- Upload openEHR templates
- Create Electronic Health Records (EHRs)
- Store vital signs data (Blood Pressure measurements)
- Query clinical data using AQL (Archetype Query Language)
┌─────────────────┐
│ EHRbase API │ Port 8080
│ (openEHR CDR) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ PostgreSQL │ Port 5432
│ Database │
└─────────────────┘
- Docker and Docker Compose installed
- Postman (desktop app or web workspace)
docker-compose up -dThis will start:
- PostgreSQL 14 on port 5432
- EHRbase on port 8080
docker psYou should see both ehrdb and ehrbase containers running.
- In Postman, click Import → Files and choose:
postman/openEHR Vitals Tutorial.postman_collection.jsonpostman/openEHR Local.postman_environment.json
- Select the
openEHR Localenvironment and confirm the variables:base_urlshould remainhttp://localhost:8080/ehrbase/rest.- Update
patient_id,composer_name, andmeasurement_timeif you want different defaults.
- Open the
Check EHRbase Statusrequest in the collection and press Send. - Expect a
200 OKresponse confirming the server is healthy.
- Run
Upload Blood Pressure Template. - Ensure the body points at
templates/blood_pressure.opt. Postman will stream the file automatically. - Expect a
201 Createdor204 No Contentresponse.
- Run
List Templatesto confirm the upload. A200 OKresponse with the template metadata indicates success.
Create an EHR for a patient without touching the CLI:
- Run
Create EHRto register the patient. The request inherits user credentials from the collection. - Run
Find EHR by Subject. The test script stores the returnedehr_idin the environment for later requests. You can also copy it manually from the response.
- Run
Create Blood Pressure Measurementto log a baseline reading. Variables such asmeasurement_timeandcomposer_namecome from the environment—change them there or edit the body before sending. - Run
Create High BP Measurementfor a 140/90 example. Feel free to duplicate and tailor additional scenarios.
- Run
AQL – All Blood Pressure Readingsto retrieve every measurement captured for the currentehr_id.
The system uses HTTP Basic Authentication with two sets of credentials:
- Username:
ehrbase-user - Password:
SuperSecretPassword
openerh-vitals/
├── docker-compose.yml # Docker services configuration
├── init.sql # Database initialization script
├── postman # Postman requests
├── templates/
│ └── blood_pressure.opt # Blood pressure openEHR template
└── README.md # This file
# EHRbase logs
docker logs openerh-vitals-ehrbase-1
# PostgreSQL logs
docker logs openerh-vitals-ehrdb-1docker-compose down
docker-compose up -ddocker-compose down -v
docker-compose up -d