# eaglepython/healthcare-analytics-portfolio architecture

> Architecture diagram of the GitHub repository eaglepython/healthcare-analytics-portfolio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eaglepython/healthcare-analytics-portfolio
- Repository: https://github.com/eaglepython/healthcare-analytics-portfolio

## Overview

##### Project type and purpose
- This is a multi-project analytics portfolio repository (“Healthcare-Analytics-Portfolio”) that bundles two production-grade Streamlit applications (Project A: cardiovascular risk prediction; Project B: heart-failure readmission prevention), plus two supplemental dashboards (financial performance and patient outcomes).
- Each sub-project implements an end-to-end ML pipeline (data ingestion/engineering, model training, model storage) and an interactive dashboard UI, all containerized via Docker Compose for local deployment.

##### Top-level view of the file structure
- Root: demo.py, requirements.txt, Dockerfile, docker-compose.yml
- Two main subfolders under Healthcare-Analytics-Portfolio/:
- cardiovascular-risk-prediction/
- heart-failure-readmission-prevention/
- Two supplemental “Suplemental Projects/” folders: Project-1-Financial-Performance, Project-2-Patient-Outcomes
- Notebook: Real_Time_Warranty_Claim_Anomaly_Detection_System.ipynb
- Each sub-project contains:
- data_generation.py (synthetic or ingestion scripts)
- analysis_pipeline.py or intervention_analysis.py (model training & evaluation)
- dashboard.py or hf_analytics_platform.py (Streamlit UI)
- models/ (serialized ML models)
- reports/ (executive summaries)

##### Key README insights
- Two production dashboards exposed on different ports via Docker Compose (8501, 8502)
- MLflow service on port 5000 for experiment tracking (defined in docker-compose.yml)
- Data sources: synthetic datasets, EMR API integrations (HL7 FHIR), real-time streaming alerts
- Technology stack: Python 3.8+, Streamlit, XGBoost, Random Forest, Docker, Docker Compose, MLflow

##### Main components and their interactions
A. Data Sources & Ingestion
- Synthetic data generator (data_generation.py) or real EMR‐FHIR API
- Raw files (.csv/.xlsx) under data/ and ingestion scripts
B. ETL & Feature Engineering
- analysis_pipeline.py / intervention_analysis.py
- Preprocessing → feature store (in memory or local filesystem)
C. Model Training & Model Store
- Multiple algorithms (Logistic Regression, Random Forest, XGBoost, Neural Net, Survival Analysis)
- Outputs saved to models/ directory or tracked in MLflow
D. Dashboard UI (Streamlit)
- dashboard.py / hf_analytics_platform.py expose:
- Real‐time risk calculator
- Population analytics and cohort trends
- Executive KPI dashboards (ROI, cost‐effectiveness)
E. MLOps & Monitoring
- MLflow service for experiment tracking and model registry
- Logging & audit trails for compliance (HIPAA)
F. Container Orchestration
- Dockerfile for each service (two Streamlit apps + MLflow)
- docker-compose.yml wires up:
- cardiovascular risk app (port 8501)
- heart-failure app (port 8502)
- MLflow server (port 5000)

##### Architectural patterns & design principles
- ETL pipeline (data → features → models → dashboards)
- MVC-like separation:
- Model: analysis_pipeline.py & models/
- View: Streamlit dashboards
- Controller: Streamlit app orchestrates data fetch → model inference → rendering
- Containerized micro-services (each dashboard + MLflow)
- MLOps best practices: experiment tracking, model registry
- Secure by design: role‐based access, encryption, audit logs

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Sources Layer
    subgraph "Data Sources"
        direction TB
        Synthetic["Synthetic Data Generator\ndata_generation.py"]:::compute
        RawFiles[(Raw Data Files)]:::storage
        EMRAPI{"EMR/FHIR API"}:::external
    end

    %% ETL & Model Training Layer
    subgraph "ETL & Model Training" 
        direction TB
        CRP_ETL["analysis_pipeline.py\n(scikit-learn/XGBoost)"]:::compute
        HF_ETL["hf_analytics_platform.py\n(ETL & Training)"]:::compute
    end

    %% Model Store / MLflow Layer
    subgraph "Model Store & Tracking"
        direction TB
        MLflow[(MLflow Server\nPort 5000)]:::storage
        ModelDir[(Serialized Models\nmodels/ )]:::storage
    end

    %% Dashboards Layer
    subgraph "Dashboards (Streamlit UI)"
        direction TB
        CRP_UI["dashboard.py\n(Streamlit, Port 8501)"]:::ui
        HF_UI["hf_analytics_platform.py\n(Streamlit, Port 8502)"]:::ui
        FP_UI["financial_dashboard.py\n(Streamlit)"]:::ui
        PO_UI["patient_outcomes.py\n(Streamlit)"]:::ui
    end

    %% Orchestration Layer
    subgraph "Container Orchestration"
        direction TB
        Compose["docker-compose.yml"]:::orchestration
        Dockerfile["Dockerfile"]:::orchestration
        Demo["demo.py"]:::orchestration
        Requirements["requirements.txt"]:::orchestration
    end

    %% Data Flows
    Synthetic --> CRP_ETL
    RawFiles --> CRP_ETL
    EMRAPI --> CRP_ETL

    Synthetic --> HF_ETL
    RawFiles --> HF_ETL
    EMRAPI --> HF_ETL

    CRP_ETL --> MLflow
    HF_ETL --> MLflow
    CRP_ETL --> ModelDir
    HF_ETL --> ModelDir

    MLflow --> CRP_UI
    ModelDir --> CRP_UI
    MLflow --> HF_UI
    ModelDir --> HF_UI

    RawFiles --> FP_UI
    FP_UI --> MLflow
    FP_UI --> ModelDir

    RawFiles --> PO_UI
    PO_UI --> MLflow
    PO_UI --> ModelDir

    %% Orchestration Connections
    Compose --> CRP_UI
    Compose --> HF_UI
    Compose --> MLflow
    Dockerfile --> Compose
    Demo --> Compose
    Requirements --> Compose

    %% Click Events
    click Synthetic "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/cardiovascular-risk-prediction/data_generation.py"
    click CRP_ETL "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/cardiovascular-risk-prediction/analysis_pipeline.py"
    click CRP_UI "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/cardiovascular-risk-prediction/dashboard.py"
    click HF_ETL "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/heart-failure-readmission-prevention/hf_analytics_platform.py"
    click HF_UI "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/heart-failure-readmission-prevention/hf_analytics_platform.py"
    click FP_UI "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/Project-1-Financial-Performance/financial_dashboard.py"
    click PO_UI "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/Project-2-Patient-Outcomes/patient_outcomes.py"
    click Compose "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/docker-compose.yml"
    click Dockerfile "https://github.com/eaglepython/healthcare-analytics-portfolio/tree/main/Dockerfile"
    click Demo "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/demo.py"
    click Requirements "https://github.com/eaglepython/healthcare-analytics-portfolio/blob/main/requirements.txt"
    click RawFiles "https://github.com/eaglepython/healthcare-analytics-portfolio/tree/main/Project-1-Financial-Performance/data/"
    click RawFiles "https://github.com/eaglepython/healthcare-analytics-portfolio/tree/main/Project-2-Patient-Outcomes/data/"

    %% Styles
    classDef compute fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef storage fill:#E6FFDA,stroke:#228B22,color:#228B22;
    classDef ui fill:#FFEFD5,stroke:#FF8C00,color:#FF8C00;
    classDef external fill:#F0F0F0,stroke:#696969,color:#696969;
    classDef orchestration fill:#F3E6FF,stroke:#800080,color:#800080;
```
