# banerjeesoumya/misfits architecture

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

- Interactive diagram: https://gitdiagram.com/banerjeesoumya/misfits
- Repository: https://github.com/banerjeesoumya/misfits

## Overview

##### Main Components
- ML (Disease Prediction) Module:
- Found in the “DiseasePrediction” folder (and the root, via notebooks and Python files).
- Contains Jupyter notebooks, Python scripts (app.py, symptom.py), pickled models (disease_prediction_model.pkl, trained_model_symptom.pkl), and a vectorizer (vectorizer_symptom.pkl).
- Likely responsible for processing medical data and predicting diseases based on symptoms.
- Backend Service:
- Located in the “backend” directory.
- Contains Node/TypeScript code (src/index.ts and various route files for admin, doctor, and user endpoints).
- Uses Prisma for database schema migrations, indicating interaction with a relational database.
- Contains configuration files (package.json, tsconfig.json, etc.) and migration scripts for schema management.
- Frontend Service:
- Under the “frontend” folder.
- Contains React components (App.tsx, pages like Dashboard, Landing, authentication pages, etc.).
- Utilizes tools like Vite for the project build, Tailwind CSS for styling, and integrates libraries for state management and HTTP communication (seen in /src/lib/axios.ts).
- Provides the user interface that interacts with the backend service.

##### Relationships and Data Flow
- The Frontend communicates with the Backend API using HTTP requests.
- The Backend serves as the central business logic and data provider, interfacing with:
- The Database (through Prisma migrations and schema). Although the specific DB server isn’t in the file tree, the presence of Prisma suggests a relational database (such as PostgreSQL or MySQL).
- The ML Module. When a disease prediction is requested by the frontend (or another part of the system), the backend could either:
▪ Call the Python service (via a REST API, inter-process communication, or direct integration), or
▪ Run processes that load the ML models stored as pickled files.
- Integration points and flows between these components must show data input and output clearly.

##### Noting Architectural Patterns and Technologies
- MVC/Microservice-like Separation:
- The layered separation between frontend, backend, and the ML prediction module.
- The backend organizes endpoints into routes (admin, doctor, user) that can be seen as controllers within an MVC structure.
- Technology Stack:
- Python ML stack: Jupyter notebooks, pickle models, CSV data.
- Backend: Node.js/TypeScript, Prisma for ORM and migrations.
- Frontend: React (with TypeScript) built using Vite and styled with Tailwind CSS.
- Each component should be clearly labeled along with the technology and role it plays.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend Layer (Client)"
        FE["Frontend App (React/Vite)"]:::frontend
        FE_SRC["Source Code (frontend/src)"]:::frontend
        FE_APP["App.tsx"]:::frontend
        FE_VITE["vite.config.ts"]:::frontend
        FE_TAILWIND["tailwind.config.js"]:::frontend
        FE --> FE_SRC
        FE_SRC --> FE_APP
        FE --> FE_VITE
        FE --> FE_TAILWIND
    end

    subgraph "Backend Layer (API Server)"
        BE["Backend API (Node/TS/Prisma)"]:::backend
        BE_SRC["Source Code (backend/src)"]:::backend
        BE_INDEX["index.ts"]:::backend
        BE_ADMIN["admin.ts"]:::backend
        BE_DOCTOR["doctor.ts"]:::backend
        BE_USER["user.ts"]:::backend
        BE_PRISMA["Prisma Directory (backend/prisma)"]:::backend
        BE_SCHEMA["schema.prisma"]:::backend
        BE --> BE_SRC
        BE_SRC --> BE_INDEX
        BE_SRC --> BE_ADMIN
        BE_SRC --> BE_DOCTOR
        BE_SRC --> BE_USER
        BE --> BE_PRISMA
        BE_PRISMA --> BE_SCHEMA
    end

    subgraph "Database Layer"
        DB["Database (SQL via Prisma)"]:::database
    end

    subgraph "Machine Learning Service"
        ML["ML Module (Disease Prediction)"]:::ml
        ML_FOLDER["Folder (DiseasePrediction)"]:::ml
        ML_NOTEBOOK["DiseasePrediction.ipynb"]:::ml
        ML_APP_FILE["app.py"]:::ml
        ML_SYMPTOM["symptom.py"]:::ml
        ML_MODEL["disease_prediction_model.pkl"]:::ml
        ML_TRAINED["trained_model_symptom.pkl"]:::ml
        ML_VECT["vectorizer_symptom.pkl"]:::ml
        ML --> ML_FOLDER
        ML_FOLDER --> ML_NOTEBOOK
        ML_FOLDER --> ML_APP_FILE
        ML_FOLDER --> ML_SYMPTOM
        ML_FOLDER --> ML_MODEL
        ML_FOLDER --> ML_TRAINED
        ML_FOLDER --> ML_VECT
    end

    FE -->|"API_Requests"| BE
    BE -->|"CRUD_Operations"| DB
    BE -->|"Prediction_Requests"| ML
    ML -->|"Prediction_Results"| BE

    click FE_SRC "https://github.com/banerjeesoumya/misfits/tree/main/frontend/src"
    click FE_APP "https://github.com/banerjeesoumya/misfits/blob/main/frontend/src/App.tsx"
    click FE_VITE "https://github.com/banerjeesoumya/misfits/blob/main/frontend/vite.config.ts"
    click FE_TAILWIND "https://github.com/banerjeesoumya/misfits/blob/main/frontend/tailwind.config.js"
    click BE_SRC "https://github.com/banerjeesoumya/misfits/tree/main/backend/src"
    click BE_INDEX "https://github.com/banerjeesoumya/misfits/blob/main/backend/src/index.ts"
    click BE_ADMIN "https://github.com/banerjeesoumya/misfits/blob/main/backend/src/admin.ts"
    click BE_DOCTOR "https://github.com/banerjeesoumya/misfits/blob/main/backend/src/doctor.ts"
    click BE_USER "https://github.com/banerjeesoumya/misfits/blob/main/backend/src/user.ts"
    click BE_PRISMA "https://github.com/banerjeesoumya/misfits/tree/main/backend/prisma"
    click BE_SCHEMA "https://github.com/banerjeesoumya/misfits/blob/main/backend/prisma/schema.prisma"
    click ML_FOLDER "https://github.com/banerjeesoumya/misfits/tree/main/DiseasePrediction"
    click ML_NOTEBOOK "https://github.com/banerjeesoumya/misfits/blob/main/DiseasePrediction/DiseasePrediction.ipynb"
    click ML_APP_FILE "https://github.com/banerjeesoumya/misfits/blob/main/DiseasePrediction/app.py"
    click ML_SYMPTOM "https://github.com/banerjeesoumya/misfits/blob/main/DiseasePrediction/symptom.py"
    click ML_MODEL "https://github.com/banerjeesoumya/misfits/blob/main/DiseasePrediction/disease_prediction_model.pkl"
    click ML_TRAINED "https://github.com/banerjeesoumya/misfits/blob/main/DiseasePrediction/trained_model_symptom.pkl"
    click ML_VECT "https://github.com/banerjeesoumya/misfits/blob/main/DiseasePrediction/vectorizer_symptom.pkl"

    classDef frontend fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px;
    classDef backend fill:#d1f2eb,stroke:#17a589,stroke-width:2px;
    classDef database fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
    classDef ml fill:#aed6f1,stroke:#3498db,stroke-width:2px;
```
