# sandipkatel/nirogya---a-personal-health-monitor architecture

> Architecture diagram of the GitHub repository sandipkatel/nirogya---a-personal-health-monitor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sandipkatel/nirogya---a-personal-health-monitor
- Repository: https://github.com/sandipkatel/nirogya---a-personal-health-monitor

## Overview

##### Project Type and Purpose
- This is a standalone desktop/mobile app (Kivy-based) for personal health monitoring—symptom checking, disease prediction, metric calculation (BMI, BP), reminders, & data visualization.

##### Decompose the File Structure into High‐Level Layers
A. Presentation Layer (UI)
- main.py – app entry point, Kivy App class
- style.kv – UI layout & styling
- visual.py & src/display.py – screen management & UI rendering

B. Controller / Orchestration Layer
- src/manager.py – central controller, routes events from UI to services

C. Domain & Service Layer
- src/predictor.py – disease identification logic (uses CSV symptom data)
- src/pressure.py – blood‐pressure calculations
- src/scheduler.py – water/medicine/appointment reminders
- src/value.py – models for health metrics (e.g., BMI, heart rate)
- src/graph.py – data visualization routines (charts/plots)

D. Data Access & Persistence Layer
- src/file.py – reading/writing JSON (appointments) & CSV (datasets)
- dataset/ – source CSV/JSON for symptoms, prevention, cure, hospitals, appointments
- dependencies/txt_files & dependencies/pics – static reference data & assets

E. Utilities / Algorithm Library
- src/DSA_Stuff/ – AVLTree, binary_search, merge_sort for underlying data structures/algorithms

##### Component Relationships & Data Flow
- UI (Presentation) → Manager (Controller) → invokes Service modules (Predictor, Pressure, Scheduler, Graph)
- Services → File module → dataset & dependencies for lookup & persistence
- Utility algorithms feed into Predictor & Graph as needed
- Scheduler triggers notifications → UI
- Graph outputs → UI for display

##### Architectural Patterns
- Layered architecture (UI / Controller / Services / Data)
- MVC‐style separation (View: Kivy screens; Controller: manager.py; Model/Services: predictor, value, pressure)
- Event‐driven (Kivy callbacks → Manager methods → Service logic)
- Reusable utility library (DSA_Stuff) decoupled from domain logic

##### Essential Elements
- Layers: Presentation, Controller, Services, Data, Utilities
- Main modules & their grouping
- Data sources (dataset/, dependencies/)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer (UI)"
        direction TB
        Main["main.py"]:::ui
        Style["style.kv"]:::ui
        Visual["visual.py"]:::ui
        Display["src/display.py"]:::ui
    end

    %% Controller Layer
    subgraph "Controller / Orchestration Layer"
        direction TB
        Manager["src/manager.py"]:::controller
    end

    %% Services Layer
    subgraph "Domain & Service Layer"
        direction TB
        Predictor["src/predictor.py"]:::service
        Pressure["src/pressure.py"]:::service
        Scheduler["src/scheduler.py"]:::service
        Value["src/value.py"]:::service
        Graph["src/graph.py"]:::service
    end

    %% Data Access Layer
    subgraph "Data Access & Persistence Layer"
        direction TB
        FileModule["src/file.py"]:::data
        DataStore[(Dataset & JSON Data)]:::data
        DependenciesPics[(dependencies/pics)]:::data
        DependenciesTxt[(dependencies/txt_files)]:::data
    end

    %% Utilities Layer
    subgraph "Utilities / Algorithm Library"
        direction TB
        AVLTree["src/DSA_Stuff/AVLTree.py"]:::util
        BinarySearch["src/DSA_Stuff/binary_search.py"]:::util
        MergeSort["src/DSA_Stuff/merge_sort.py"]:::util
    end

    %% Connections
    Main -->|start app| Manager
    Visual -->|UI render| Manager
    Display -->|screen switch| Manager
    Style -->|styles UI| Visual

    Manager -->|invoke prediction| Predictor
    Manager -->|invoke pressure calc| Pressure
    Manager -->|schedule reminders| Scheduler
    Manager -->|compute metrics| Value
    Manager -->|generate charts| Graph

    Predictor -->|uses algorithms| AVLTree
    Predictor -->|uses algorithms| BinarySearch
    Predictor -->|uses algorithms| MergeSort

    Graph -->|uses algorithms| MergeSort

    Predictor -->|read CSV| FileModule
    Pressure -->|persist data| FileModule
    Scheduler -->|read/write JSON| FileModule
    Value -->|read/write JSON| FileModule
    Graph -->|read data| FileModule

    FileModule -->|access| DataStore
    FileModule -->|access| DependenciesPics
    FileModule -->|access| DependenciesTxt

    Scheduler -->|trigger notification| Main
    Scheduler -->|trigger reminder UI| Visual

    %% Click Events
    click Main "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/main.py"
    click Style "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/style.kv"
    click Visual "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/visual.py"
    click Display "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/display.py"
    click Manager "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/manager.py"
    click Predictor "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/predictor.py"
    click Pressure "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/pressure.py"
    click Scheduler "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/scheduler.py"
    click Value "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/value.py"
    click Graph "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/graph.py"
    click FileModule "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/file.py"
    click DataStore "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/tree/main/dataset/"
    click DependenciesPics "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/tree/main/dependencies/pics"
    click DependenciesTxt "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/tree/main/dependencies/txt_files"
    click AVLTree "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/DSA_Stuff/AVLTree.py"
    click BinarySearch "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/DSA_Stuff/binary_search.py"
    click MergeSort "https://github.com/sandipkatel/nirogya---a-personal-health-monitor/blob/main/src/DSA_Stuff/merge_sort.py"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#1B4F72,color:#1B2631
    classDef controller fill:#ABEBC6,stroke:#1D8348,color:#145A32
    classDef service fill:#ABEBC6,stroke:#1D8348,color:#145A32
    classDef data fill:#F9E79F,stroke:#B9770E,color:#7E5109
    classDef util fill:#D5D8DC,stroke:#566573,color:#2C3E50
```
