A demonstrator application showcasing how the HSE National Medicinal Product Catalogue (NMPC) can power structured electronic prescribing using the HL7 FHIR R4 standard. SafeRx generates compliant FHIR resources in real time from SNOMED CT-coded medication concepts sourced from Ireland's national terminology server.
Disclaimer — This is an educational tool. All patient data is fictitious. Not intended for clinical use.
- NMPC Medication Search — Typeahead search via FHIR
ValueSet/$expandacross Virtual Medicinal Products (VMPs), brand products, and Actual Medicinal Product Packs (AMPPs). - Live FHIR R4 Preview — Real-time generation and display of
MedicationRequest,Medication, andBundleresources as the prescribing form is completed. - Prescribing Workflow — Full clinical form: medication, dose, unit, route, frequency, duration, repeats, instructions, and PRN indication.
- Medication Record — Accumulated prescription list with active/cancelled statuses, filterable views, and per-record FHIR inspection.
- Allergy Management — Record and manage allergies with type, severity, manifestation, and clinical status.
- ECL Builder — Interactive SNOMED CT Expression Constraint Language query builder with 15 pre-built templates, live execution, and a visual query anatomy breakdown.
- Export — Download FHIR resources as
.jsonor copy to clipboard.
| Layer | Technology |
|---|---|
| Frontend | Vanilla JavaScript (ES6+), HTML5, CSS3 — no framework |
| Backend | Node.js (cors-anywhere proxy for local dev) |
| API | HSE NMPC Ontoserver — FHIR R4 terminology server |
| Auth | OAuth2 client credentials (OpenID Connect) |
| Terminology | SNOMED CT, ATC, UCUM |
- Node.js (for the local CORS proxy)
- NMPC OAuth2 client credentials (client ID and secret)
-
Clone the repository
git clone https://github.com/snbyrnes/SafeRx.git cd SafeRx -
Create your config file
cp js/config.template.js js/config.js
Edit
js/config.jsand add yourFHIR_CLIENT_IDandFHIR_CLIENT_SECRET. -
Install dependencies
npm install
-
Start the CORS proxy
node proxy.js
Runs on
http://127.0.0.1:8090. -
Open
index.htmlin a browser — no build step required.
Credentials can also be configured at runtime via the Settings modal (persisted in localStorage).
| Setting | Description |
|---|---|
FHIR_BASE_URL |
NMPC FHIR server endpoint |
FHIR_TOKEN_URL |
OAuth2 token endpoint |
FHIR_CLIENT_ID |
OAuth2 client ID |
FHIR_CLIENT_SECRET |
OAuth2 client secret |
js/config.js is gitignored to prevent credential leaks. For CI/CD, js/config.template.js uses __FHIR_CLIENT_ID__ / __FHIR_CLIENT_SECRET__ placeholders replaced by GitHub Actions at deploy time.
Config priority: localStorage → SAFERX_CONFIG global → hardcoded defaults.
├── index.html # Main prescribing application
├── ecl-builder.html # ECL Builder tool
├── proxy.js # Local CORS proxy (cors-anywhere)
├── package.json
├── js/
│ ├── app.js # Main application logic
│ ├── ecl-builder.js # ECL Builder logic
│ ├── fhir-service.js # FHIR API client & resource construction
│ ├── data.js # Static reference data
│ ├── config.js # Local config (gitignored)
│ └── config.template.js # Config template for CI/CD
├── css/
│ ├── styles.css
│ └── ecl-builder.css
└── NMPC HSE Collection.postman_collection.json
The included Postman collection (NMPC HSE Collection.postman_collection.json) contains 61 requests documenting the full NMPC Ontoserver FHIR API, including:
- ValueSet — expand, search, validate-code, delta queries
- CodeSystem — lookup, subsumes, validate-code
- ConceptMap — translate across code systems (SNOMED → ATC, PCRS, HPRA)
- Authenticated flows — OAuth2 token acquisition, AMPP typeahead, property lookups
Set the {{terminology-server}} collection variable to your NMPC base URL before use.
See repository for licence details.