# prajwalay26/medivision architecture

> Architecture diagram of the GitHub repository prajwalay26/medivision, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prajwalay26/medivision
- Repository: https://github.com/prajwalay26/medivision

## Overview

##### Project type and purpose
- From the README and file tree, MediVision is a full‑stack web application combining a Flask/Python backend, HTML/CSS/JavaScript frontend, AI/ML model inference, and a cloud database (Firebase). Its purpose is to provide medicine recognition (via image uploads), prescription analysis, text‑to‑speech, multilingual chatbot, and medication reminders.

##### File structure
- Top‑level files:
- app.py / app2.py – Flask entry points (HTTP routes for image upload, chat, TTS, reminders)
- requirements.txt / packages.txt – Python dependencies (Flask, TensorFlow, OpenCV, Firebase SDK, etc.)
- model files (.h5, .keras) and Jupyter notebooks – AI/ML training and inference artifacts
- ocr_result.txt – sample output from OCR pipeline
- Directories:
- static/ – frontend assets (CSS, JS, images)
- templates/ – HTML templates served by Flask (index.html, medicinepage.html, signup.html, etc.)
- uploads/ – temporary storage for user‑uploaded images and prescriptions
- No separate microservices—backend is a monolith with distinct functional modules (image processing, chatbot, reminders).

##### Key insights from the README
- Tech stack: Frontend (HTML/CSS/JS), Backend (Flask/Python), Database (Firebase), AI/ML (TensorFlow, OpenCV), External APIs (Speech‑to‑Text, web scraping).
- Core features map to backend modules: medicine identification, TTS engine, chatbot, prescription analyzer, reminder scheduler.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Legend
    subgraph Legend
        direction TB
        U[User/Browser]:::client
        S[Static/Template Server]:::frontend
        B[Flask Backend]:::backend
        D[(Firebase Realtime DB)]:::database
        E[External APIs/Services]:::external
    end

    %% User Layer
    U["User Browser"]:::client

    %% Frontend Layer
    subgraph "Frontend Static Server"
        direction TB
        CSS1["home.css"]:::frontend
        CSS2["styles.css"]:::frontend
        JS1["home.js"]:::frontend
        JS2["script.js"]:::frontend
        IMG["assets/images"]:::frontend
        HTML1["home.html"]:::frontend
        HTML2["index.html"]:::frontend
        HTML3["medicinepage.html"]:::frontend
        HTML4["signup.html"]:::frontend
        HTML5["ds/"]:::frontend
    end

    %% Backend Layer
    subgraph "Flask Application Server" 
        direction TB
        AP1["app.py"]:::backend
        AP2["app2.py"]:::backend
        subgraph "Modules"
            direction TB
            M1["Image Processing & Model Inference"]:::backend
            M2["OCR & Prescription Analyzer"]:::backend
            M3["Text-to-Speech Service"]:::backend
            M4["Multilingual Chatbot & Web Scraper"]:::backend
            M5["Reminder Scheduler"]:::backend
            M6["File Upload Storage"]:::backend
            M7["Firebase Integration"]:::backend
        end
    end

    %% Database
    D[(Firebase Realtime DB)]:::database

    %% External Services
    subgraph "External APIs/Services"
        direction TB
        E1["Speech-to-Text API"]:::external
        E2["Medical Websites"]:::external
    end

    %% Connections
    U -->|"HTTP(S) requests"| CSS1
    U --> CSS2
    U --> JS1
    U --> JS2
    U --> IMG
    U --> HTML1
    U --> HTML2
    U --> HTML3
    U --> HTML4
    U --> HTML5

    CSS1 --> AP1
    CSS2 --> AP1
    JS1 --> AP1
    JS2 --> AP1
    HTML1 --> AP1
    HTML2 --> AP1
    HTML3 --> AP1
    HTML4 --> AP1
    HTML5 --> AP1

    AP1 --> M1
    AP1 --> M2
    AP1 --> M3
    AP1 --> M4
    AP1 --> M5
    AP1 --> M6
    AP1 --> M7

    M1 -->|"Loads .h5 model"| M1
    M2 -->|"Reads ocr_result.txt"| M2
    M3 --> E1
    M4 --> E2
    M5 --> D
    M7 --> D
    M6 --> AP1

    %% Click Events
    click AP1 "https://github.com/prajwalay26/medivision/blob/main/app.py"
    click AP2 "https://github.com/prajwalay26/medivision/blob/main/app2.py"
    click CSS1 "https://github.com/prajwalay26/medivision/blob/main/static/home.css"
    click CSS2 "https://github.com/prajwalay26/medivision/blob/main/static/styles.css"
    click JS1 "https://github.com/prajwalay26/medivision/blob/main/static/home.js"
    click JS2 "https://github.com/prajwalay26/medivision/blob/main/static/script.js"
    click IMG "https://github.com/prajwalay26/medivision/tree/main/assets/images/"
    click HTML1 "https://github.com/prajwalay26/medivision/blob/main/templates/home.html"
    click HTML2 "https://github.com/prajwalay26/medivision/blob/main/templates/index.html"
    click HTML3 "https://github.com/prajwalay26/medivision/blob/main/templates/medicinepage.html"
    click HTML4 "https://github.com/prajwalay26/medivision/blob/main/templates/signup.html"
    click HTML5 "https://github.com/prajwalay26/medivision/tree/main/templates/ds/"
    click M1 "https://github.com/prajwalay26/medivision/blob/main/medicine_model.h5"
    click M1 "https://github.com/prajwalay26/medivision/blob/main/model_saved.keras"
    click M1 "https://github.com/prajwalay26/medivision/blob/main/model-building.ipynb"
    click M2 "https://github.com/prajwalay26/medivision/blob/main/ocr_result.txt"
    click M6 "https://github.com/prajwalay26/medivision/tree/main/uploads/"
    click M7 "https://github.com/prajwalay26/medivision/blob/main/requirements.txt"
    click M7 "https://github.com/prajwalay26/medivision/blob/main/packages.txt"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef frontend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef backend fill:#98FB98,stroke:#333,stroke-width:1px
    classDef database fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:1px
```
