Investment Plans workspace
Open raw ↗

Cancer Patient Management System - Architecture

System Overview

A comprehensive oncology care platform managing 8 real cancer patient cases with full medication protocols, role-based access, clinical alerting, and automated testing.

Architecture Layers

+--------------------------------------------------+
| PRESENTATION LAYER (Browser)                      |
| Single-page HTML/CSS/JS application               |
| Role-based UI (Admin/Doctor/Nurse/Patient views)  |
+--------------------------------------------------+
           | HTTP/JSON API
+--------------------------------------------------+
| API LAYER (Python HTTP Server)                    |
| REST-like endpoints, session authentication       |
| Role-based access control, audit logging          |
+--------------------------------------------------+
           | SQLite queries
+--------------------------------------------------+
| DATA LAYER (SQLite with WAL)                      |
| 11 tables, 10 indexes, foreign keys               |
| 8 patient cases, 35+ medications, 8 alerts        |
+--------------------------------------------------+

Database Schema (11 Tables)

TableRecordsPurpose
users17User accounts (1 admin, 4 doctors, 4 nurses, 8 patients)
patients8Cancer patient cases with full clinical data
medications35+Medication protocols with dosing, side effects, monitoring
treatment_cycles9Chemotherapy cycle tracking
vital_signs14+Temperature, HR, BP, SpO2, pain scores
lab_results18+Lab values with reference ranges and abnormal flags
symptom_reports12+Patient-reported symptoms with severity
alerts8Clinical alerts (critical/high/medium/low)
nurse_patient_assignments8Staff-patient alignment
audit_log10+System activity tracking
test_results-Test execution records

Cancer Cases Included

CodeCancer TypeStageTreatment ProtocolKey Medications
ONC-2024-001Breast Cancer (HER2+)IIBTCHPDocetaxel, Carboplatin, Trastuzumab, Pertuzumab
ONC-2024-002Lung Cancer (NSCLC)IIIACRT + DurvalumabCisplatin, Etoposide, Durvalumab
ONC-2024-003Colorectal CancerIIICFOLFOX + BevacizumabOxaliplatin, 5-FU, Bevacizumab
ONC-2024-004Prostate Cancer (mCRPC)IVCabazitaxelCabazitaxel, Enzalutamide, Prednisone
ONC-2024-005Acute Myeloid Leukemiade novo7+3 InductionCytarabine, Daunorubicin
ONC-2024-006Hodgkin LymphomaIIBABVDDoxorubicin, Bleomycin, Vinblastine, Dacarbazine
ONC-2024-007Pancreatic CancerIIIBmFOLFIRINOXOxaliplatin, Irinotecan, 5-FU
ONC-2024-008Ovarian CancerIVCarbo/Paclitaxel + OlaparibCisplatin, Paclitaxel, Olaparib

Role-Based Access Control

RoleView ScopeEdit ScopeSpecial Permissions
AdminAll patients, all dataUsers, system settingsAudit log, full control
DoctorAssigned patientsMedications, treatment plansPrescribing, alert acknowledgment
NurseAssigned patientsVitals, symptoms, nursing notesVital signs recording
PatientOwn records onlySelf-reported symptomsView medications, schedule

Clinical Alert System

Automatic alerts trigger on:

API Endpoints (17 endpoints)

Testing System

20 automated tests covering:

  1. Database connectivity and data integrity
  1. All 8 patient cases loaded correctly
  1. Medication records with full clinical detail
  1. Vital signs, labs, symptoms, cycles populated
  1. Alert system with critical/high/medium/low severity
  1. User accounts and role assignments
  1. Nurse-patient alignment
  1. Audit log tracking
  1. Authentication enforcement
  1. Cross-patient data aggregation

File Structure

CancerPatientSystem/
  database.py          - SQLite schema, connection, password hashing
  seed_data.py         - 8 cancer cases, 35+ medications, vitals, labs, alerts
  api_server.py        - HTTP API server with 17 endpoints
  cancer_patients.db   - SQLite database (auto-created)
  static/
    index.html         - Single-page application UI
  docs/
    SYSTEM_ARCHITECTURE.md  - This file
    README.md               - Setup and usage guide
  tests/
    test_runner.py     - Automated test suite

Deployment

  1. No dependencies required (Python standard library only)
  1. Run: python api_server.py
  1. Opens browser at http://127.0.0.1:8080
  1. Database auto-creates with demo data on first run

Data Sources

Patient cases based on published oncology protocols: