Skip to content

snbyrnes/SafeRx

Repository files navigation

SafeRx

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.

Features

  • NMPC Medication Search — Typeahead search via FHIR ValueSet/$expand across Virtual Medicinal Products (VMPs), brand products, and Actual Medicinal Product Packs (AMPPs).
  • Live FHIR R4 Preview — Real-time generation and display of MedicationRequest, Medication, and Bundle resources 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 .json or copy to clipboard.

Tech Stack

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

Getting Started

Prerequisites

  • Node.js (for the local CORS proxy)
  • NMPC OAuth2 client credentials (client ID and secret)

Setup

  1. Clone the repository

    git clone https://github.com/snbyrnes/SafeRx.git
    cd SafeRx
  2. Create your config file

    cp js/config.template.js js/config.js

    Edit js/config.js and add your FHIR_CLIENT_ID and FHIR_CLIENT_SECRET.

  3. Install dependencies

    npm install
  4. Start the CORS proxy

    node proxy.js

    Runs on http://127.0.0.1:8090.

  5. Open index.html in a browser — no build step required.

Credentials can also be configured at runtime via the Settings modal (persisted in localStorage).

Configuration

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: localStorageSAFERX_CONFIG global → hardcoded defaults.

Project Structure

├── 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

Postman Collection

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.

Licence

See repository for licence details.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors