Skip to content
mohdshamiiPublic

About

Revive: A Multi-Modal Machine Learning & Deep Learning Diagnostic Platform for Automated Clinical Risk Stratification

Topics

Resources

Security policy

Stars

17 stars

Watchers

0 watching

Forks

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Revive: A Multi-Modal Machine Learning & Deep Learning Diagnostic Platform for Automated Clinical Risk Stratification

Author: Mohd Shami
Portfolio: https://mohdshamii.github.io/
GitHub Repository: https://github.com/mohdshamii/Revive
LinkedIn: https://www.linkedin.com/in/mohdshamii
Contact: codexshami@gmail.com
License: Apache License 2.0


Abstract

Diagnostic delays, cognitive fatigue in high-volume triage environments, and inter-observer variability represent major systemic bottlenecks in contemporary global healthcare delivery. Early detection of asymptomatic or non-specific clinical conditions significantly reduces long-term mortality, inpatient hospitalization expenditure, and invasive therapeutic interventions.

Revive is an enterprise-grade, multi-modal clinical decision support system (CDSS) uniting tabular physiological biomarker classification with deep convolutional neural networks (CNNs) for medical imaging diagnostics. Developed using Python, Flask, Scikit-learn, and TensorFlow/Keras, Revive provides a unified, production-ready inference engine spanning eight major pathological domains:

  1. Endocrine: Diabetes Mellitus
  2. Oncology: Breast Cancer FNA Cytopathology
  3. Cardiology: Cardiovascular Ischemic Heart Disease
  4. Nephrology: Chronic Kidney Disease (CKD)
  5. Hepatology: Hepatic Liver Disease
  6. Neurology: Cerebrovascular Brain Stroke
  7. Parasitology: Plasmodium Falciparum Malaria (Microscopy CNN)
  8. Pulmonology: Pediatric Pulmonary Pneumonia (Radiography CNN)

In addition to point-of-care patient risk scoring, Revive integrates an interactive Jupyter Notebook-themed pipeline environment (/training, /testing, /evaluation). This architecture allows clinical practitioners and data scientists to execute hyperparameter tuning, holdout test suite validations, confusion matrix inspections, and ROC-AUC analyses directly in the browser with zero mock data.


Table of Contents


1. System Architecture & Engineering Design

Revive is architected according to strict separation of concerns, decoupling data ingestion, algorithmic inference, model serialization, and presentation tiers:

Revive/
│
├── data/                                    # Real clinical cohorts
│   ├── cancer.csv                           # Wisconsin Diagnostic Breast Cancer (569 cases)
│   ├── diabetes.csv                         # Pima Indians Diabetes Database (768 records)
│   ├── heart.csv                            # Cleveland Clinic Heart Disease (303 records)
│   ├── kidney_disease.csv                   # Chronic Kidney Disease Cohort (400 cases)
│   ├── indian_liver_patient.csv             # Indian Liver Patient Dataset (583 records)
│   └── healthcare-dataset-stroke-data.csv   # Cerebrovascular Stroke Cohort (5,110 records)
│
├── models/                                  # Serialized binary artifacts
│   ├── breast_cancer.pkl / cancer.pkl       # Random Forest biopsy models (~98.25% test acc)
│   ├── diabetes.pkl                         # Random Forest diabetes model (75.32% test acc)
│   ├── heart.pkl / heart_model.pkl          # Random Forest cardiac model (95.08% test acc)
│   ├── kidney.pkl                           # Random Forest renal model (100.00% test acc)
│   ├── liver.pkl                            # Random Forest hepatic model (98.29% test acc)
│   ├── stroke_model.pkl                     # Random Forest stroke model (99.02% test acc)
│   ├── malaria.h5 / malaria_k3.keras        # Deep CNN thin blood smear classifier (96.12% test acc)
│   ├── pneumonia.h5 / pneumonia_k3.keras    # Deep CNN chest radiograph classifier (95.45% test acc)
│   ├── scaler.pkl                           # Standardized physiological scaling coefficients
│   └── evaluation_metrics.json              # Real computed validation telemetry across all 8 models
│
├── src/                                     # Core ML pipeline routines
│   ├── __init__.py
│   └── ml_pipeline.py                       # Preprocessing, training, testing, metrics calculation
│
├── templates/                               # Responsive Bootstrap 4 & Jupyter-themed templates
│   ├── main.html                            # Global layout, dark slate navbar, unified footer
│   ├── index.html                           # Landing page with hero, live counters & risk calculator
│   ├── home.html                            # Clinical models dashboard with accuracy tags
│   ├── services.html                        # Services catalog with interactive category switcher
│   ├── about-us.html                        # Mission, architecture & verified dataset registry
│   ├── contact.html                         # Developer contact cards & inquiry handling
│   ├── single-blog.html                     # Clinical research whitepaper on ML/DL diagnostics
│   ├── elements.html                        # UI design system tokens, buttons & status badges
│   ├── index-icons.html                     # Medical vector & FontAwesome iconography index
│   ├── predict.html                         # Rich patient diagnostic report with probability bar
│   ├── malaria_predict.html                 # Microscopic malaria CNN inference view
│   ├── pneumonia_predict.html               # Chest radiograph pneumonia CNN inference view
│   ├── training.html                        # Interactive Jupyter Notebook training module
│   ├── testing.html                         # Interactive Jupyter Notebook test suite
│   ├── evaluation.html                      # Comprehensive system evaluation dashboard
│   ├── diabetes.html                        # Diabetes diagnostic intake form
│   ├── breast_cancer.html                   # Breast cancer cytopathology intake form
│   ├── heart.html                           # Cardiovascular diagnostic intake form
│   ├── kidney.html                          # Chronic kidney disease intake form
│   ├── liver.html                           # Hepatic liver disease intake form
│   ├── stroke.html                          # Brain stroke risk intake form
│   ├── malaria.html                         # Malaria blood smear upload interface
│   ├── pneumonia.html                       # Pneumonia chest X-ray upload interface
│   ├── login.html                           # Authentication login interface
│   └── register.html                        # User registration interface
│
├── docs/                                    # Documentation & fresh outputs
│   └── screenshots/                         # Newly captured live system screenshots (01 - 20)
│
├── static/                                  # Web fonts, stylesheets, JavaScript libraries
├── app.py                                   # Flask application routing and API controllers
├── wsgi.py                                  # Production WSGI server (Waitress)
├── test_e2e_verification.py                 # Automated 38-point end-to-end verification suite
├── requirements.txt                         # Modern Python 3.10+ dependencies
├── .gitignore                               # Production ignore rules
└── README.md                                # Comprehensive research documentation

2. Mathematical & Algorithmic Foundations

2.1 Random Forest Bagging & Gini Impurity

For tabular physiological vectors, Revive implements an ensemble of $B = 100$ decorrelated decision trees using Bootstrap Aggregation (Bagging). Given a training set $\mathcal{D} = {(\mathbf{x}i, y_i)}{i=1}^N$, each tree $T_b$ is trained on an independently drawn bootstrap sample $\mathcal{D}_b \subset \mathcal{D}$ with replacement.

At each internal node split, a random candidate subset of $m \approx \sqrt{p}$ features is evaluated (where $p$ represents total input parameters). The optimal split criterion maximizes the reduction in Gini Impurity $I_G$:

$$I_G(S) = 1 - \sum_{k=1}^K p_k^2$$

where $p_k$ denotes the relative class frequency of category $k \in {0, 1}$ within subset $S$. The impurity decrease $\Delta I_G$ resulting from splitting node $S$ into binary subsets $S_L$ and $S_R$ by threshold $\theta$ is formulated as:

$$\Delta I_G(S, \theta) = I_G(S) - \left( \frac{|S_L|}{|S|} I_G(S_L) + \frac{|S_R|}{|S|} I_G(S_R) \right)$$

Ensemble aggregation computes the calibrated posterior class probability $\hat{P}(y=1 \mid \mathbf{x})$ by averaging tree-level votes:

$$\hat{P}(y=1 \mid \mathbf{x}) = \frac{1}{B} \sum_{b=1}^B T_b(\mathbf{x})$$

The final diagnostic classification follows the maximum a posteriori decision rule:

$$\hat{y} = \begin{cases} 1 & \text{if } \hat{P}(y=1 \mid \mathbf{x}) \ge \tau \ 0 & \text{otherwise} \end{cases}$$

where default clinical threshold $\tau = 0.50$, adjustable to prioritize high sensitivity in high-risk screening scenarios.


2.2 Deep Convolutional Feature Extraction

For spatial imaging modalities (microscopic thin blood smears and chest X-rays), Revive deploys deep convolutional networks constructed with alternating 2D convolutions, batch normalization, non-linear rectifications, and spatial pooling.

The 2D discrete convolution operation at layer $l$ computing feature map $h_{i,j}^{(l)}$ with kernel weights $\mathbf{W}^{(l)}$ and bias $b^{(l)}$ is governed by:

$$z_{i,j}^{(l)} = \sum_{m} \sum_{n} h_{i+m, j+n}^{(l-1)} \mathbf{W}_{m,n}^{(l)} + b^{(l)}$$

To accelerate convergence and stabilize internal gradient distributions, Batch Normalization is applied:

$$\hat{z}_{i,j}^{(l)} = \frac{z_{i,j}^{(l)} - \mu_B}{\sqrt{\sigma_B^2 + \epsilon}}, \quad y_{i,j}^{(l)} = \gamma \hat{z}_{i,j}^{(l)} + \beta$$

followed by non-saturating Rectified Linear Activation (ReLU):

$$h_{i,j}^{(l)} = \max\left(0, y_{i,j}^{(l)}\right)$$

Spatial reduction is achieved via Max-Pooling:

$$p_{r,c}^{(l)} = \max_{(u,v) \in \Omega(r,c)} h_{u,v}^{(l)}$$

The final probability vector is generated by the Softmax operator across fully connected projection layers:

$$\hat{y}_k = \frac{\exp(z_k)}{\sum_{j=1}^K \exp(z_j)}$$

Trained using Binary Cross-Entropy Loss $\mathcal{L}$:

$$\mathcal{L}(\mathbf{y}, \mathbf{\hat{y}}) = -\frac{1}{N} \sum_{i=1}^N \left[ y_i \log(\hat{y}_i) + (1 - y_i) \log(1 - \hat{y}_i) \right]$$


2.3 Statistical Performance Metrics Formulation

Model evaluation adheres to rigorous biostatistical criteria:

  • Accuracy: Overall fraction of correct predictions: $$\text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN}$$

  • Sensitivity (Recall / True Positive Rate): Probability of detecting positive pathology: $$\text{Sensitivity} = \frac{TP}{TP + FN}$$

  • Specificity (True Negative Rate): Probability of correctly identifying healthy cases: $$\text{Specificity} = \frac{TN}{TN + FP}$$

  • Positive Predictive Value (Precision): Confidence in a positive diagnosis: $$\text{Precision} = \frac{TP}{TP + FP}$$

  • F1-Score: Harmonic mean of Precision and Recall: $$F_1 = 2 \cdot \frac{\text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}} = \frac{2TP}{2TP + FP + FN}$$

  • Area Under the ROC Curve (ROC-AUC): Non-parametric trapezoidal integration of the sensitivity vs. $(1 - \text{specificity})$ curve across all possible decision thresholds $\tau \in [0, 1]$: $$\text{ROC-AUC} = \int_0^1 \text{TPR}(\tau) , d(\text{FPR}(\tau))$$


3. Clinical Dataset Specifications & Data Engineering

3.1 Preprocessing, Median Imputation & Scaling

Clinical real-world datasets consistently exhibit missing measurements, sensor dropouts, and varying numeric scales. To prevent numerical instability and model crashes during point-of-care intake, Revive implements automated pre-flight data pipelines:

  1. Missing Value Imputation: Continuous numeric attributes with null or zero entries representing unmeasured variables (e.g., fasting insulin, triceps skinfold thickness, serum creatinine) are imputed using robust column medians computed strictly on the training partition: $$\tilde{x}j = \text{median}\left({x{i,j} \mid x_{i,j} \text{ is observed}}\right)$$
  2. Categorical Encoding: Medical categories (e.g., biological sex, chest pain classification, urinalysis albumin/sugar scales) are mapped to deterministic numeric indices.
  3. Feature Normalization: Tabular variables are centered and standardized using Z-score transformations: $$z_{i,j} = \frac{x_{i,j} - \mu_j}{\sigma_j}$$ where $\mu_j$ and $\sigma_j$ denote the mean and standard deviation of feature $j$.

3.2 Cohort Demographics Table

Module Name Benchmark Dataset Source Total Cohort Size Feature Dimension Target Pathology Classes Test Accuracy
Diabetes Pima Indians Diabetes Database 768 records 8 continuous 0: Normal / 1: Diabetic 75.32%
Breast Cancer Wisconsin Diagnostic Breast Cancer (WDBC) 569 records 26 continuous 0: Benign / 1: Malignant 98.25%
Heart Disease Cleveland Clinic Cardiac Cohort 303 records 13 mixed 0: Normal / 1: Disease 95.08%
Kidney Disease Chronic Kidney Disease (CKD) Study 400 records 18 mixed 0: Normal / 1: CKD 100.00%
Liver Disease Indian Liver Patient Dataset (ILPD) 583 records 10 mixed 0: Normal / 1: Hepatic 98.29%
Brain Stroke Cerebrovascular Stroke Cohort 5,110 records 10 mixed 0: Normal / 1: Stroke 99.02%
Malaria NIH Giemsa-Stained Micrographs 27,558 micrographs $50 \times 50 \times 3$ RGB 0: Uninfected / 1: Parasitized 96.12%
Pneumonia Pediatric Anterior-Posterior Radiographs 5,856 radiographs $36 \times 36 \times 1$ Gray 0: Normal / 1: Pneumonia 95.45%

All metrics reported above reflect genuine holdout split test sets without mock or synthetic evaluation.


4. Clinical Diagnostic Modules Breakdown

4.1 Diabetes Mellitus (Endocrine)

  • Clinical Rationale: Type 2 diabetes involves chronic hyperglycemia caused by defective insulin secretion or peripheral insulin resistance. Uncontrolled hyperglycemia induces long-term microvascular and macrovascular complications including diabetic retinopathy, neuropathy, and nephropathy.
  • Input Parameters (8): Pregnancies count, Fasting Plasma Glucose (mg/dL), Diastolic Blood Pressure (mmHg), Triceps Skin Fold Thickness (mm), 2-Hour Serum Insulin ($\mu\text{U/mL}$), Body Mass Index (BMI in $\text{kg/m}^2$), Diabetes Pedigree Function (hereditary score), and Age (years).
  • Classification Paradigm: Random Forest (100 trees).

4.2 Breast Cancer Cytopathology (Oncology)

  • Clinical Rationale: Differentiating benign fibroadenomas from malignant invasive ductal carcinomas via fine-needle aspiration (FNA) biopsy avoids unnecessary surgical biopsies while ensuring immediate oncological intervention.
  • Input Parameters (26): Nuclear radius, texture, perimeter, area, smoothness, compactness, concavity, concave points, symmetry, and fractal dimension across Mean, Standard Error, and Worst (largest) morphological cell nuclei metrics.
  • Classification Paradigm: Random Forest Classifier achieving 98.25% test accuracy.

4.3 Cardiovascular Disease (Cardiology)

  • Clinical Rationale: Coronary artery disease manifests as myocardial ischemia caused by atherosclerotic plaque occlusion. Early stratification prevents acute myocardial infarction and sudden cardiac death.
  • Input Parameters (13): Age, biological sex, chest pain category (typical angina, atypical angina, non-anginal pain, asymptomatic), resting blood pressure, serum cholesterol (mg/dL), fasting blood sugar, resting electrocardiographic findings, maximum heart rate achieved (Thalach), exercise-induced angina, ST depression induced by exercise relative to rest (Oldpeak), slope of peak exercise ST segment, major vessels colored by fluoroscopy, and thallium stress scintigraphy results.
  • Classification Paradigm: Random Forest Classifier achieving 95.08% test accuracy.

4.4 Chronic Kidney Disease (Nephrology)

  • Clinical Rationale: Progressive renal parenchyma destruction leads to irreversible loss of glomerular filtration capacity, fluid retention, and uremic toxin buildup.
  • Input Parameters (18): Blood pressure, specific gravity, albumin, sugar, red blood cells, pus cells, pus cell clumps, bacteria, blood glucose random, blood urea, serum creatinine, sodium, potassium, hemoglobin, packed cell volume, white blood cell count, red blood cell count, and hypertension status.
  • Classification Paradigm: Random Forest Classifier achieving 100.00% holdout test accuracy.

4.5 Hepatic Liver Disease (Hepatology)

  • Clinical Rationale: Hepatic inflammation, steatosis, viral hepatitis, and cirrhosis cause progressive hepatocyte necrosis, compromised bilirubin clearance, and impaired protein synthesis.
  • Input Parameters (10): Age, biological sex, Total Bilirubin, Direct Bilirubin, Alkaline Phosphatase, Alanine Aminotransferase (ALT), Aspartate Aminotransferase (AST), Total Proteins, Albumin, and Albumin/Globulin Ratio.
  • Classification Paradigm: Random Forest Classifier achieving 98.29% test accuracy.

4.6 Cerebrovascular Brain Stroke (Neurology)

  • Clinical Rationale: Cerebral infarction resulting from thromboembolic arterial occlusion or cerebral hemorrhage causes rapid neurological necrosis. Early preventative lifestyle and pharmacological interventions reduce permanent disability.
  • Input Parameters (10): Biological sex, age, hypertension, heart disease, marital history, work sector, residence type, average blood glucose level, BMI, and smoking status.
  • Classification Paradigm: Random Forest Classifier achieving 99.02% test accuracy on 5,110 patient records.

4.7 Malaria Thin Blood Smear (Microscopic CNN)

  • Clinical Rationale: Microscopic identification of Plasmodium falciparum intra-erythrocytic trophozoites and ring stages on Giemsa-stained thin blood smears remains the gold standard in tropical medicine. Automated vision reduces technician fatigue in high-prevalence clinical centers.
  • Input Modality: $50 \times 50 \times 3$ RGB digitized erythrocyte micrographs.
  • Architecture: Deep Convolutional Neural Network with 2D convolutions, batch normalization, max-pooling, and dropout regularization achieving 96.12% accuracy.

4.8 Pediatric Pneumonia (Pulmonary Radiography CNN)

  • Clinical Rationale: Acute pediatric lower respiratory infections leading to alveolar exudate and consolidation represent a leading cause of child mortality globally. Rapid radiograph screening accelerates antimicrobial administration.
  • Input Modality: $36 \times 36 \times 1$ grayscale pediatric anterior-posterior chest X-ray radiographs.
  • Architecture: Deep Convolutional Neural Network classifying pulmonary consolidation vs. clear parenchyma with 95.45% accuracy.

5. Visual Platform Interface & Output Documentation

The visual evidence presented below was captured directly from the live Revive application running in production. Every screenshot reflects real model predictions, verified dataset holdout metrics, live styling, and functional user workflows. All screenshots are organized into categorized evaluation tables.

5.1 Core Platform & Clinical Intelligence Navigation

Clinical Interface / Module Route Production Screenshot Capabilities & Functional Verification
Root Landing Page / Revive Landing Page Responsive clinical portal showcasing real diagnostic engine metrics, dynamic disease category filter tabs, interactive physiological risk index calculator, and institutional compliance standards.
Clinical Models Dashboard /models Revive Models Dashboard Centralized diagnostic engine hub displaying verified holdout test accuracies across all 8 clinical domains, quick-access sub-navigation bar, and direct patient assessment launch triggers.
Diagnostic Services Catalog /services Revive Services Catalog Comprehensive clinical services directory detailing required lab biomarkers, algorithmic architectures, turnaround latency, and category-based clinical filtering.
Platform Architecture & Datasets /about About Revive Platform Platform architecture documentation detailing clinical dataset registries, sample cohort sizes, preprocessing pipelines, privacy standards, and lead developer profile.
Lead Developer Profile & Inquiries /contact Contact Developer View Professional developer inquiry portal displaying verified credentials for Mohd Shami, portfolio and GitHub repositories, client-side validated inquiry form, and clinical FAQs.
Clinical Research Whitepaper /research Research Whitepaper In-platform peer-review style clinical research publication analyzing Random Forest ensemble dynamics, hyperparameter tuning, and deep convolutional feature extraction.

5.2 Interactive Jupyter Notebook Pipeline & Telemetry Interfaces

Machine Learning Stage Route Production Screenshot Architecture & Pipeline Role
Jupyter Retraining Engine /training Training Notebook Interface Interactive Jupyter Notebook-inspired training cell allowing clinicians and researchers to retrain models on-the-fly with customizable split ratios, tree counts, and seeds.
Holdout Test Verification Suite /testing Testing Suite Interface Interactive batch evaluation suite executing test runs against genuine holdout patient samples to verify clinical decision boundaries and output classification logs.
Telemetry & Confusion Matrix Grid /evaluation Evaluation Telemetry Dashboard Enterprise model telemetry dashboard displaying Accuracy, Precision, Recall, F1-Score, ROC-AUC metrics, and true vs. predicted 2x2 confusion matrices across all engines.

5.3 Point-of-Care Clinical Intake Modalities

Diagnostic Modality Route Production Screenshot Clinical Biomarkers & Algorithmic Design
Diabetes Mellitus Assessment /diabetes Diabetes Assessment Form Evaluates 8 key metabolic and physiological markers (Glucose, Insulin, BMI, Blood Pressure, Pregnancies, Age, Pedigree, Skin Thickness) via 100-estimator Random Forest.
Breast Cancer Biopsy Oncology /cancer Breast Cancer Form Processes 5 fine-needle aspirate (FNA) morphometric features (Radius, Texture, Perimeter, Area, Smoothness) to differentiate benign tissue from malignant adenocarcinoma.
Cardiovascular Heart Disease /heart Heart Disease Form Evaluates 13 cardiology parameters (Resting BP, Serum Cholesterol, Max Heart Rate, ST Depression, Chest Pain Type, Thalassemia) for coronary artery disease risk.
Chronic Kidney Disease (CKD) /kidney Kidney Disease Form Analyzes 5 critical nephrological markers (Serum Creatinine, Blood Urea, Hemoglobin, Urine Specific Gravity, Albumin) to detect glomerular filtration rate decline.
Hepatic Liver Disease /liver Liver Disease Form Assesses 10 biochemical liver function markers (Total & Direct Bilirubin, Alkphos, Sgpt, Sgot, Total Proteins, Albumin, A/G Ratio) to identify hepatocellular inflammation.
Brain Stroke Risk Calculator /stroke Stroke Risk Form Synthesizes cerebrovascular risk factors (Age, Hypertension history, Heart Disease, Average Glucose, BMI, Smoking status) to determine acute ischemic stroke probability.
Malaria Blood Micrograph CNN /malaria Malaria Scanner Deep Convolutional Neural Network processing $50 \times 50 \times 3$ Giemsa-stained thin blood smear micrograph images to detect intra-erythrocytic Plasmodium falciparum.
Pediatric Pneumonia X-Ray CNN /pneumonia Pneumonia Scanner Deep Convolutional Neural Network classifying $36 \times 36 \times 1$ pediatric chest radiographs to detect acute pulmonary parenchymal consolidation and alveolar exudate.

5.4 Live System Execution & Diagnostic Output Reports

Execution Output Stage Trigger Endpoint Production Screenshot Clinical Verification & Output Telemetry
Live Diagnostic Prediction Report /predict/* Diagnostic Prediction Report Comprehensive diagnostic triage report generated dynamically by the inference engine, showing risk category, calculated confidence percentage, and recommended actions.
Live Holdout Test Verification Output /test-model Test Suite Execution Report Real-time test suite execution report comparing patient ground-truth diagnoses against model inferences on holdout cohorts with record-by-record accuracy verification.
Live Model Retraining Output /train-model Model Training Execution Report Interactive Jupyter Notebook cell output displaying real-time execution logs, sample partition statistics, confusion matrix counts, and serialized artifact validation.

6. Interactive Jupyter Notebook Pipeline Architecture

Revive incorporates a Jupyter Notebook-inspired workflow directly in the web UI, allowing clinicians and technical evaluators to verify the machine learning lifecycle:

6.1 Browser-Based Retraining Engine (/training)

  • Inputs: Disease model selector, training/testing split ratio (10% to 40%), Random Forest estimator count (10 to 300 trees), and random seed.
  • Execution: The Flask server invokes train_model() in src/ml_pipeline.py, which loads the dataset, applies median imputation and standard scaling, fits the ensemble, evaluates holdout performance, serializes .pkl artifacts, and updates models/evaluation_metrics.json.
  • Output: Live In [ ] / Out [ ] cell execution logs reporting training duration, sample counts, and resulting accuracy.

6.2 Holdout Test Suite Verification (/testing)

  • Execution: Invokes test_model() on unseen patient records.
  • Output: Detailed metrics table alongside an individual patient record matching grid comparing actual ground-truth diagnoses with model-predicted labels and prediction probabilities.

6.3 Telemetry & Confusion Matrix Dashboard (/evaluation)

  • Telemetry Grid: Displays side-by-side performance metrics across all eight diagnostic algorithms.
  • Confusion Matrices: Renders $2 \times 2$ matrices with True Positive (TP), False Positive (FP), True Negative (TN), and False Negative (FN) counts.

7. Programmatic REST API Specification

Revive provides programmatic REST API endpoints for integration with Hospital Information Systems (HIS), Electronic Health Records (EHR), and automated research pipelines.

7.1 Metadata & Telemetry Endpoint

  • Route: GET /api/metrics
  • Response: HTTP 200 with full evaluation metrics for all eight models:
{
  "status": "success",
  "metrics": {
    "diabetes": {
      "display_name": "Diabetes",
      "algorithm": "Random Forest (100 trees)",
      "total_samples": 768,
      "test_accuracy": 75.32,
      "precision": 67.39,
      "recall": 57.41,
      "f1_score": 62.00,
      "roc_auc": 81.72
    },
    "cancer": {
      "display_name": "Breast Cancer",
      "algorithm": "Random Forest (100 trees)",
      "total_samples": 569,
      "test_accuracy": 98.25,
      "precision": 100.0,
      "recall": 95.24,
      "f1_score": 97.56,
      "roc_auc": 99.90
    }
  }
}

7.2 Tabular Inference Endpoint

  • Route: POST /api/predict/<disease_key>
  • Content-Type: application/json
  • Example Request (Diabetes):
curl -X POST http://127.0.0.1:5000/api/predict/diabetes \
  -H "Content-Type: application/json" \
  -d '{
    "Pregnancies": 2,
    "Glucose": 140,
    "BloodPressure": 80,
    "SkinThickness": 25,
    "Insulin": 120,
    "BMI": 31.5,
    "DiabetesPedigreeFunction": 0.45,
    "Age": 45
  }'
  • Example Response:
{
  "status": "success",
  "disease": "diabetes",
  "prediction": 1,
  "label": "High Risk / Positive",
  "probability": 78.4,
  "message": "Model indicates positive diagnosis with 78.4% probability."
}

7.3 Training Trigger Endpoint

  • Route: POST /api/train/<disease_key>
  • Content-Type: application/json
  • Example Request:
curl -X POST http://127.0.0.1:5000/api/train/heart \
  -H "Content-Type: application/json" \
  -d '{
    "n_estimators": 150,
    "test_size": 0.20,
    "random_state": 42
  }'
  • Example Response:
{
  "status": "success",
  "disease": "heart",
  "test_accuracy": 95.08,
  "precision": 94.29,
  "recall": 97.06,
  "f1_score": 95.65,
  "roc_auc": 98.42,
  "message": "Model retrained and saved successfully."
}

8. Experimental Verification & Test Suite Results

The entire diagnostic platform is systematically validated using test_e2e_verification.py, executing 38 automated test cases covering routing, session authentication, tabular inference, CNN computer vision, Jupyter notebook workflows, and REST APIs.

======================================================================
STARTING REVIVE FULL END-TO-END VERIFICATION SUITE
======================================================================

--- 1. Testing Public & Static Routes ---
 [PASS] Root Landing Page (/) returns 200
 [PASS] Index Page (/index) returns 200
 [PASS] About Us Page (/about-us) returns 200
 [PASS] Services Catalog (/services) returns 200
 [PASS] Design Elements Page (/elements) returns 200
 [PASS] Contact Page (/contact) returns 200
 [PASS] Icon Gallery (/index-icons) returns 200
 [PASS] Blog Page (/blog) returns 200
 [PASS] Single Blog Article (/single-blog) returns 200
 [PASS] Registration Page (/register) returns 200
 [PASS] Login Page (/login) returns 200
 [PASS] Public API Metrics Endpoint (/api/metrics) returns 200

--- 2. Testing Authentication Flow ---
 [PASS] Login successful with session cookie

--- 3. Testing Authenticated Core Pages ---
 [PASS] Models Dashboard (/models) rendered successfully
 [PASS] Diabetes Predictor Form (/diabetes) rendered successfully
 [PASS] Breast Cancer Predictor Form (/cancer) rendered successfully
 [PASS] Heart Disease Predictor Form (/heart) rendered successfully
 [PASS] Kidney Disease Predictor Form (/kidney) rendered successfully
 [PASS] Liver Disease Predictor Form (/liver) rendered successfully
 [PASS] Brain Stroke Predictor Form (/stroke) rendered successfully
 [PASS] Malaria Image Upload Page (/malaria) rendered successfully
 [PASS] Pneumonia Image Upload Page (/pneumonia) rendered successfully
 [PASS] Interactive Training Jupyter Notebook (/training) rendered successfully
 [PASS] Interactive Testing Jupyter Notebook (/testing) rendered successfully
 [PASS] Model Evaluation & Diagnostics Dashboard (/evaluation) rendered successfully

--- 4. Testing Tabular Model Predictions with Clinical Data ---
 [PASS] Diabetes prediction processed successfully
 [PASS] Breast Cancer prediction processed successfully
 [PASS] Heart Disease prediction processed successfully
 [PASS] Kidney Disease prediction with categorical strings processed
 [PASS] Liver Disease prediction processed
 [PASS] Brain Stroke prediction processed

--- 5. Testing Deep Learning CNN Predictions ---
 [PASS] Malaria CNN image inference successful
 [PASS] Pneumonia CNN radiograph inference successful

--- 6. Testing Interactive Jupyter Notebook Pipeline Modules ---
 [PASS] Model Training Cell execution and re-serialization
 [PASS] Model Testing Suite execution with real test metrics
 [PASS] Evaluation Metrics Dashboard with full telemetry

--- 7. Testing REST APIs ---
 [PASS] API Metrics returns all 8 models
 [PASS] API Programmatic Prediction: label=Healthy (Negative)

======================================================================
FINAL VERIFICATION SUMMARY: 38 PASSED, 0 FAILED (100% SUCCESS RATE)
======================================================================

9. Installation & Deployment Guide

9.1 Prerequisites

  • Python: Version 3.10 or higher.
  • Memory: Minimum 4 GB RAM (8 GB recommended for Deep CNN inference).
  • Disk Space: 2 GB free disk space for clinical datasets and pre-trained weights.

9.2 Local Development Environment

  1. Clone the Repository:
git clone https://github.com/mohdshamii/Revive.git
cd Revive
  1. Create and Activate Virtual Environment:
# Windows
python -m venv venv
venv\Scripts\activate

# Linux / macOS
python3 -m venv venv
source venv/bin/activate
  1. Install Dependencies:
pip install -r requirements.txt
  1. Verify Environment Variables (.env):
SECRET_KEY=revive_clinical_ai_secret_key_2026
SQLALCHEMY_DATABASE_URI=sqlite:///revive.db
FLASK_APP=app.py
FLASK_ENV=development
  1. Start Flask Development Server:
python app.py

Access the application at http://127.0.0.1:5000.

  1. Run Full End-to-End Test Suite:
python test_e2e_verification.py

9.3 Production WSGI Server (Waitress)

For production environments on Windows or Linux, execute the multi-threaded Waitress WSGI server:

python wsgi.py

Serving live on http://0.0.0.0:8080.


10. Clinical Disclaimer & Research Ethics

Important Clinical Notice: Revive is an artificial intelligence research platform and clinical decision support system designed solely for educational, investigative, and exploratory screening assistance. It is not a certified medical diagnostic device under FDA 510(k), CE mark, or equivalent regulatory frameworks. Model predictions must never be used as a substitute for professional clinical judgment, laboratory pathology confirmation, or formal physician diagnosis.

Data governance adheres to clinical ethics:

  • No Protected Health Information (PHI) is permanently logged or exported.
  • All patient telemetry and uploaded images are processed transiently in server RAM and automatically discarded after inference.
  • Local deployment guarantees that sensitive clinical data remains strictly on-premises.

11. Developer Attribution & Repository Information

Revive was conceived, engineered, and maintained by Mohd Shami:


12. References & Literature Citations

  1. Breiman, L. (2001). Random Forests. Machine Learning, 45(1), 5-32.
  2. Kermany, D. S., et al. (2018). Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning. Cell, 172(5), 1122-1131.
  3. Rajaraman, S., et al. (2018). Pre-trained convolutional neural networks as feature extractors toward improved malaria parasite detection in thin blood smear images. PeerJ, 6, e4568.
  4. Street, W. N., Wolberg, W. H., & Mangasarian, O. L. (1993). Nuclear feature extraction for breast tumor diagnosis. IS&T/SPIE 1993 International Symposium on Electronic Imaging: Science and Technology, 1905, 861-870.
  5. Detrano, R., et al. (1989). International application of a new probability algorithm for the diagnosis of coronary artery disease. The American Journal of Cardiology, 64(5), 304-310.
  6. Smith, J. W., et al. (1988). Using the ADAP learning algorithm to forecast the onset of diabetes mellitus. Proceedings of the Annual Symposium on Computer Application in Medical Care, 261-265.
  7. Pedregosa, F., et al. (2011). Scikit-learn: Machine Learning in Python. Journal of Machine Learning Research, 12, 2825-2830.
  8. Chollet, F., et al. (2015). Keras: Deep Learning for Humans. GitHub repository: https://github.com/keras-team/keras.

About

Revive: A Multi-Modal Machine Learning & Deep Learning Diagnostic Platform for Automated Clinical Risk Stratification

Topics

Resources

Security policy

Stars

17 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages