DESCRIPTION — THE PROBLEM text

Polypharmacy — five or more concurrent medications — affects approximately 50% of people over 65 in the UK. Adverse drug reactions from polypharmacy cause an estimated 6.5% of unplanned hospital admissions and represent one of the most preventable causes of avoidable harm in primary care.

GPs face this daily: a patient's medication list grows incrementally across years and multiple prescribers, with no lightweight tool to flag when a patient has crossed into high-risk territory. The problem is documented in NHS England's 2021 Polypharmacy Guidance and in the STOPP/START clinical criteria — but unsupported by accessible, transparent decision tools at the point of care. DESCRIPTION — YOUR SOLUTION text

RxSafe is a Streamlit dashboard that generates transparent, auditable polypharmacy risk scores for a synthetic elderly patient cohort, combining Synthea synthetic patient records with live NHS prescribing data from the OpenPrescribing API.

It produces:

  • A colour-coded risk landscape (bubble chart: age × medication count × risk score) — immediately readable without clinical training
  • A prioritised high-risk patient table with flagged drug classes
  • A plain-English explanation of every score — formula published in the UI
  • A live chart of NHS statin prescribing trends from the OpenPrescribing API
  • A built-in limitations panel flagging known biases and appropriate deployment constraints

No machine learning black box. Every score is manually verifiable by a clinician in under 30 seconds. DESCRIPTION — HOW YOU BUILT IT text

Stack: Python 3.11 · Streamlit · Pandas · Plotly · Requests

Architecture:

  • data_loader.py: Loads Synthea CSV and fetches OpenPrescribing REST API
  • risk_scorer.py: Transparent rule-based scoring engine (formula published in-app and in the repository — no black box)
  • app.py: Streamlit dashboard with five components

Data pipeline:

  1. Synthea 1K CSV sample loaded and filtered to 65+ cohort
  2. Medication count per patient calculated via Pandas groupby
  3. Risk score applied: medication count × 10 + age penalty + high-risk drug class bonus (capped at 100)
  4. OpenPrescribing API called live for NHS prescribing context
  5. Results rendered as interactive Plotly bubble chart + sortable table

What we're proud of: The limitations panel is built into the application interface — not the README. In a clinical context, the clinician must encounter caveats at the point of use, not after the fact. This was a deliberate design decision. DESCRIPTION — WHAT'S NEXT text

With another week:

  1. Integrate the full BNF drug interaction database for pairwise interaction checking — not just drug class flags
  2. Add STOPP/START criteria v2 alignment — maps each patient's medication list against published inappropriate prescribing criteria
  3. Recalibrate Synthea demographic distribution to UK NHS population using NHS Digital simulation frameworks
  4. Build a GP-facing medication review trigger — generates a structured letter for the patient's next appointment
  5. Add a practice-level view — aggregate RxSafe scores by GP practice using OpenPrescribing's practice code API, enabling PCN-level identification of high-burden areas BUILT WITH TAGS text

Python · Streamlit · Pandas · Plotly · Requests · Synthea (Apache 2.0) · OpenPrescribing API (OGL v3.0)

SUBMISSION QUESTION — DATA, PRIVACY, CONSENT, BIAS

DATA USED AND PRIVACY CONSIDERATIONS

Source 1 — Synthea™ Synthetic Patient Records Licence: Apache 2.0 (MITRE Corporation) URL: synthea.mitre.org/downloads — 1K Sample CSV Privacy status: These are not real patients. Synthea generates clinically realistic but entirely fictional medical histories. No real patient, living or deceased, is represented at any point. No consent is required or applicable. No anonymisation decisions were made because there was nothing to anonymise.

Source 2 — OpenPrescribing API Licence: Open Government Licence v3.0 (Bennett Institute, Oxford) URL: openprescribing.net/api Privacy status: Published at practice level only — aggregate counts of prescriptions issued by a GP practice, not individual patient records. No patient is identifiable at any granularity available through this API.

BIAS CONSIDERATIONS — documented in the application UI

  1. Demographic bias in Synthea: Synthea's default demographic distribution reflects US Massachusetts census data, not UK NHS patient demographics. We flag this explicitly in the app's Limitations panel and note that a production system would require recalibration using UK-representative synthetic data.

  2. Polypharmacy tool bias — socially complex patients: Published research shows polypharmacy risk scoring tools have reduced validity for patients with complex social circumstances (homelessness, substance use disorders, language barriers), whose prescribing patterns differ systematically from the majority population. We document this in the app and note that clinical governance must account for this gap.

  3. Drug interaction completeness bias: Our MVP uses a simplified 20-drug high-risk class list, not the full BNF interaction database. We document this as a limitation — the tool may miss interactions for patients not on the flagged list.

DESIGN DECISION ON TRANSPARENCY: We chose to build the limitations panel into the live application interface — not the README or documentation. The rationale: in a clinical context, a clinician using the tool must encounter the caveats at the moment of use, not after opening a separate document. This is privacy and safety by design, not compliance theatre.

SUBMISSION QUESTION — WHAT WAS BUILT DURING HACKATHON vs PRE-EXISTING

All application code (app.py, data_loader.py, risk_scorer.py) was written during the hackathon.

Pre-existing / third-party:

  • Synthea 1K CSV sample data — downloaded from official MITRE repository (public, Apache 2.0). Not generated by us during the hackathon but freely and openly available.
  • OpenPrescribing API — a live public NHS data service (Open Government Licence v3.0). We wrote the API integration code during the hackathon.
  • Streamlit, Pandas, Plotly, Requests — open-source Python libraries used as tools, not as pre-built application logic.

No templates, no starter kits, no paid APIs.

Built With

Share this project:

Updates

Submission history