# sih-team-void/sih_finale architecture

> Architecture diagram of the GitHub repository sih-team-void/sih_finale, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sih-team-void/sih_finale
- Repository: https://github.com/sih-team-void/sih_finale

## Overview

##### Project Overview and Purpose
- The project (SIH_Finale) is a full-stack healthcare/management system that appears to serve multiple user roles (admin, government officials, end-users) and covers various key functionalities like user management, bed management, doctor management, prescription handling, inventory, and more.
- The README is brief (“# SIH_Finale”), but combined with the clear separation between a Django backend (under “Backend_dj/Backend”) and a React-based frontend (inside “frontend/simpleswastha”), it is evident that this is a web application with a clear backend API service and a rich client side.

##### Backend Architecture (Django)
- The backend is structured as a Django project with a number of distinct apps. Key apps include:
- “api”: Likely contains core API routing and administrative setup.
- “bed_management”: Manages hospital bed allocation and related workflows.
- “doctor_management”: Deals with doctor schedules, patient doctor interactions, OPD booking, etc.
- “user_management”: Handles user registration, authentication, and role/orientation.
- “govschemes”: Manages government schemes which may be relevant to patient care or social health policies.
- “inventory_management”: Manages inventory details including expiry dates and stock.
- “chatbot”: Provides a conversational interface or automated assistance.
- Other supportive directories like “admission_letters”, “discharge_documents”, “prescriptions”, and “death_certificates” indicate file storage/handling components for document management.
- Under “Backend_dj/Backend”, you have the standard Django project configuration (settings, URLs, ASGI/WGSI files) along with a “db.sqlite3” that shows the use of an SQLite database (at least in development or a light-weight context).

##### Frontend Architecture (React application)
- Under the “frontend/simpleswastha” directory, the frontend is built likely with React given the presence of JS files such as App.js, index.js, and a webpack.config.js file.
- The project organizes different views/components based on user roles:
- The “admin” folder holds components and pages for administrative tasks (bed management, inventory, login, etc.).
- The “user” folder includes components and styles for end-user interactions, such as user login, account, OPD bookings, etc.
- There is also a “goverment” (government) folder that likely aids government-related functionalities and reporting.
- A “welcome” section suggests generic landing/welcome pages.
- The structure is modular with clear separations (CSS, images, temporary files) which hints at an emphasis on UI component reuse and clear separation of concerns.

##### Elements
- Browser → Frontend (User Requests)
- Frontend → Backend API (HTTP calls)
- Backend → Database (CRUD operations)
- Backend → File Storage (Document handling)
- Rectangles for modules (like Django apps and React components).
- Annotations on any middleware, routing logic, or API gateways if necessary.

##### Final Remarks
- The goal is to represent all essential architectural elements to ease further enhancements or integrations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    B("Client/Browser"):::client

    subgraph "Frontend Layer (React)"
        FE("Frontend - React Application"):::frontend
        FE_Admin("Admin Module"):::frontend
        FE_User("User Module"):::frontend
        FE_Gov("Government Module"):::frontend
        FE_Welcome("Welcome Module"):::frontend
    end

    subgraph "Backend Layer (Django)"
        BE_Config("Django Project Config"):::backend
        subgraph "Django Apps"
            BE_API("API App"):::backend
            BE_Bed("Bed Management"):::backend
            BE_Doctor("Doctor Management"):::backend
            BE_User("User Management"):::backend
            BE_Govsch("Government Schemes"):::backend
            BE_Inventory("Inventory Management"):::backend
            BE_Chatbot("Chatbot"):::backend
        end
    end

    subgraph "Data Layer"
        DB("Database - SQLite"):::db
        subgraph "File Storage"
            FS_Admission("Admission Letters"):::storage
            FS_Discharge("Discharge Documents"):::storage
            FS_Prescriptions("Prescriptions"):::storage
            FS_Death("Death Certificates"):::storage
        end
    end

    B -->|"HTTP_Request"| FE
    FE -->|"API_Call"| BE_Config
    FE_Admin ---|"component"| FE
    FE_User ---|"component"| FE
    FE_Gov ---|"component"| FE
    FE_Welcome ---|"component"| FE

    BE_Config -->|"CRUD"| DB
    BE_Config -->|"FileHandling"| FS_Admission
    BE_Config -->|"FileHandling"| FS_Discharge
    BE_Config -->|"FileHandling"| FS_Prescriptions
    BE_Config -->|"FileHandling"| FS_Death

    BE_Config -->|"Initializes"| BE_API
    BE_Config -->|"Initializes"| BE_Bed
    BE_Config -->|"Initializes"| BE_Doctor
    BE_Config -->|"Initializes"| BE_User
    BE_Config -->|"Initializes"| BE_Govsch
    BE_Config -->|"Initializes"| BE_Inventory
    BE_Config -->|"Initializes"| BE_Chatbot

    click FE "https://github.com/sih-team-void/sih_finale/tree/main/frontend/simpleswastha"
    click FE_Admin "https://github.com/sih-team-void/sih_finale/tree/main/frontend/simpleswastha/src/admin"
    click FE_User "https://github.com/sih-team-void/sih_finale/tree/main/frontend/simpleswastha/src/user"
    click FE_Gov "https://github.com/sih-team-void/sih_finale/tree/main/frontend/simpleswastha/src/goverment"
    click FE_Welcome "https://github.com/sih-team-void/sih_finale/tree/main/frontend/simpleswastha/src/welcome"
    click BE_Config "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/backend"
    click BE_API "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/api"
    click BE_Bed "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/bed_management"
    click BE_Doctor "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/doctor_management"
    click BE_User "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/user_management"
    click BE_Govsch "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/govschemes"
    click BE_Inventory "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/inventory_management"
    click BE_Chatbot "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/chatbot"
    click FS_Admission "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/admission_letters"
    click FS_Discharge "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/discharge_documents"
    click FS_Prescriptions "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/prescriptions"
    click FS_Death "https://github.com/sih-team-void/sih_finale/tree/main/Backend_dj/Backend/death_certificates"
    click DB "https://github.com/sih-team-void/sih_finale/blob/main/Backend_dj/Backend/db.sqlite3"

    classDef client fill:#f9e79f,stroke:#333,stroke-width:2px
    classDef frontend fill:#aed6f1,stroke:#333,stroke-width:2px
    classDef backend fill:#abebc6,stroke:#333,stroke-width:2px
    classDef db fill:#d7bde2,stroke:#333,stroke-width:2px
    classDef storage fill:#f9e79f,stroke:#333,stroke-width:2px
```
