Skip to content

Latest commit

 

History

136 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AURORA EMR

AI-Powered Intelligent Electronic Medical Record System

Stack ML License

Live demo: https://auroraemr.app


Overview

AURORA EMR is a full-stack electronic medical record system with an AI-powered clinical decision support layer. It is designed for three user roles — doctors, patients, and admins — each with a dedicated portal and feature set.

The ML pipeline analyses 42 clinical features per patient (demographics, comorbidities, lab values, medications, encounter history) using a trained XGBoost model to produce a continuous risk score (0–100), a binary HIGH/LOW classification, and a 15-label risk factor breakdown.


Features

Doctor Portal

Feature Description
Dashboard Patient list with live risk badges, today's appointments, recent alerts
Patient Detail Full clinical record — conditions, medications, labs, allergies, AI insights, drug interaction warnings
Clinical Data Entry Add conditions, medications, lab results, and allergies with structured dropdowns aligned to ML model patterns
AI Risk Scoring Per-patient XGBoost risk prediction across 42 features with 15 explainable risk factor flags
Drug Interaction Checker DrugBank-powered interaction detection across active medications
Messaging Doctor–patient thread-based messaging with deep-link from patient profile
AI Chat Clinical query assistant with optional patient context
Pattern Detection Rule-based and ML-identified clinical patterns

Patient Portal

Feature Description
Dashboard Personal risk summary, active conditions, upcoming appointments, quick tiles
Medications Active medication list with allergy warnings
Lab Results Full lab history with abnormal flagging
Appointments Upcoming and past appointments
Messages Secure thread-based messaging with care team

Admin Portal

Feature Description
Stats System-wide patient, user, and appointment counts
User Management View all registered users
Audit Logs Full API-level audit trail (every request logged with user + action)
Notifications System notifications

Tech Stack

Frontend

Technology Purpose
React 18 + Vite UI framework and build tool
React Router v7 Client-side routing with role-based protected routes
Axios HTTP client with JWT interceptors
Lucide React Icon set
Vanilla CSS Custom design system with CSS variables

Backend

Technology Purpose
FastAPI Python REST API
SQLAlchemy ORM (15 models)
Neon PostgreSQL Cloud-hosted database
JWT (python-jose) Authentication and RBAC
bcrypt Password hashing
Starlette Middleware Audit logging on all /api requests

ML Pipeline

Technology Purpose
XGBoost Binary risk classifier (HIGH/LOW, 0–100 score)
Scikit-learn Multi-label ClassifierChain for 15 risk factor labels
Pandas + NumPy Feature engineering
psycopg2 Direct DB connection for feature extraction SQL

Deployment

Component Detail
Frontend nginx serving React build
Backend systemd + uvicorn on Raspberry Pi 4
Tunnel Cloudflare Tunnel (no port forwarding required)
Database Neon PostgreSQL (cloud)

Quick Start

Prerequisites

  • Node.js ≥ 18
  • Python ≥ 3.10
  • A PostgreSQL database (or copy .env.example.env for the shared Neon dev instance)

Frontend

cd frontend
npm install
npm run dev        # http://localhost:5173

Backend

cd backend
cp .env.example .env      # fill in DATABASE_URL and SECRET_KEY
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

API docs: http://localhost:8000/docs

Full Stack (Docker)

docker-compose up --build

Demo Credentials

Role Email Password
Doctor doctor@auroraemr.com aurora2026
Patient (use quick-login button on login page)
Admin (use quick-login button on login page)

Project Structure

AURORA_EMR/
├── frontend/
│   └── src/
│       ├── components/          # Layout, Sidebar, TopBar, PatientLayout, PatientRiskCard
│       ├── context/             # AuthContext (JWT + role-based routing)
│       ├── pages/               # One file per page, co-located .css
│       └── services/api.js      # Axios instance + all API calls
├── backend/
│   └── app/
│       ├── api/endpoints/       # auth, patients, doctors, appointments,
│       │                        #   admin, ai_services, predictions, messages
│       ├── core/                # config, JWT security, audit middleware
│       ├── database/            # SQLAlchemy engine + seed scripts
│       ├── models/              # 15 SQLAlchemy ORM models
│       ├── schemas/             # Pydantic request/response schemas
│       └── ml/
│           ├── ml_service.py    # Feature extraction (42 features) + inference
│           └── artifacts/       # Trained .pkl files (risk_model, risk_factor_model, scaler)
├── ML/                          # Jupyter notebooks: training, preprocessing, DrugBank ETL
├── deploy.sh                    # One-command build + rsync deploy to Pi
└── docker-compose.yml

ML Model

The risk model is an XGBoost binary classifier trained on synthetic patient data (Synthea). Features are extracted via a single SQL query with CTEs at inference time — no pre-computation or caching.

42 features across 6 groups:

  • Demographics — age, gender
  • Conditions — total count, chronic count, 7 disease flags (diabetes, hypertension, heart disease, mental health, asthma/COPD, obesity, CKD), comorbidity index
  • Labs — abnormal count, test diversity, 14 named lab values (HbA1c, LDL, HDL, CRP, creatinine, glucose, fasting glucose, triglycerides, BUN, WBC, hemoglobin, platelets, heart rate, total cholesterol)
  • Medications — active count, total count, polypharmacy flag (≥5)
  • Encounters — total, hospitalisations, ED visits, average duration, frequencies
  • Allergies — total count, active count, drug allergy flag

15 risk factor labels (multi-label ClassifierChain): RF_ABNORMAL_LABS, RF_CARDIOVASCULAR_RISK, RF_CHRONIC_MULTIMORBIDITY, RF_DIABETIC_RISK, RF_DRUG_ALLERGY_RISK, RF_ELDERLY_HIGH_RISK, RF_FREQUENT_HOSPITALIZATION, RF_HIGH_ED_UTILISATION, RF_HIGH_HBA1C_RISK, RF_HYPERTENSION_RISK, RF_MENTAL_HEALTH_RISK, RF_METABOLIC_RISK, RF_POLYPHARMACY, RF_RENAL_RISK, RF_RESPIRATORY_RISK


Team

Name Role
Sabbir Ahamed ML Pipeline
Abdullah Al Sakib Chowdhury Full Stack + DevOps
Kamrun Nahar Majumder Kakon Frontend + Backend Support

Course: CSE299 — Junior Design Project University: North South University Semester: Spring 2026

About

AI-powered Electronic Medical Record system with React frontend, FastAPI backend, PostgreSQL, and XGBoost-based ML risk prediction. CSE299 capstone project

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages