# bahri-adem/application-web-des-patients architecture

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

- Interactive diagram: https://gitdiagram.com/bahri-adem/application-web-des-patients
- Repository: https://github.com/bahri-adem/application-web-des-patients

## Overview

##### Project Type and Purpose
- This is a full-stack Java EE web application (“Application web qui centralise les données des patients”) built on Tomcat using Servlets/JSP (MVC), DAO pattern, a MySQL database, and front-end assets (HTML/CSS/JS/Bootstrap).
- Its goal is to centralize patient data and facilitate interactions among doctors, patients, pharmacies, laboratories, radiology centers, and clinics.

##### File-Structure Analysis
- Top-level:
- src/main/webapp: JSP pages, CSS, JS, images → presentation layer (UI)
- src/main/java/com/servelt: Servlets → controller layer
- src/main/java/com/DAO: DAO & Service classes → business & persistence layers
- src/main/java/com/javaBeans: domain model (POJOs)
- database/database.sql: schema definition
- Tests in src/main/java/test: unit tests for services and DB config.
- Configuration: WEB-INF/web.xml, MySQL connector JAR.
- Build output under build/classes.

##### Architecture Overview
- Pattern: MVC + DAO (separation of concerns).
- Layers:
a. Presentation (JSP, CSS, JS)
b. Controller (Servlets)
c. Service/DAO (business logic, data access)
d. Database (MySQL)
- Data flow: User → JSP → Servlet → Service → DAO → MySQL DB → back up the chain.

##### Main Components and Relationships
a. Presentation Layer
- JSP pages (under webapp/) + CSS/JS libraries (Bootstrap, custom scripts).
- Served by Tomcat HTTP server.
b. Controller Layer
- com.servelt.* Servlets handle HTTP requests, invoke service methods, forward to JSPs.
c. Business & Persistence Layer
- Service classes (e.g., AppointmentService) implement business workflows.
- DAO classes (e.g., AppointmentDAO) handle CRUD against MySQL via JDBC.
- Domain JavaBeans map DB tables to Java objects.
d. Database
- MySQL containing tables for users, patients, consultations, radiographies, analyses, prescriptions, etc.
e. External/Infra
- Tomcat application server, MySQL server, optional Docker container.

##### Architectural Patterns & Principles
- MVC: JSP = View, Servlets = Controller, Service/DAO = Model.
- DAO Pattern: isolates JDBC code.
- Layered Architecture: clear separation between UI, control flow, business logic, and data.
- Dependency Injection is manual (Servlets instantiate Services/DAOs).
- JUnit tests for service and DB config validation.

##### Detailed Elements
- MySQL connector JAR in the WEB-INF/lib.
- Build/test artifacts (optional side note).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers Top to Bottom
    subgraph "Client Layer"
        direction TB
        Browser["Client Browser\n(HTML/CSS/JS)"] 
    end

    subgraph "Presentation Layer" 
        direction TB
        JSP["JSP Pages"]:::ui
        CSS["CSS Files"]:::ui
        JS["JavaScript Files"]:::ui
        Images["Image Assets"]:::ui
    end

    subgraph "Controller Layer" 
        direction TB
        Servlets["com.servelt.* Servlets"]:::controller
    end

    subgraph "Business Layer" 
        direction TB
        Services["*Service.java Classes"]:::logic
    end

    subgraph "Persistence Layer" 
        direction TB
        DAOs["*DAO.java Classes"]:::dao
        JavaBeans["JavaBeans/POJOs"]:::dao
    end

    subgraph "Database Layer" 
        direction TB
        DB[(MySQL Database)]:::db
    end

    %% Connections
    Browser -->|"HTTP Request"| Servlets
    Servlets -->|"invoke Service"| Services
    Services -->|"JDBC Calls"| DAOs
    DAOs -->|"SQL Queries"| DB
    DB -->|"Result Sets"| DAOs
    DAOs -->|"return Objects"| Services
    Services -->|"forward Data"| Servlets
    Servlets -->|"render JSP"| JSP
    JSP -->|"serve to"| Browser

    %% Click Events
    click JSP "https://github.com/bahri-adem/application-web-des-patients/tree/main/src/main/webapp"
    click CSS "https://github.com/bahri-adem/application-web-des-patients/tree/main/src/main/webapp/css"
    click JS "https://github.com/bahri-adem/application-web-des-patients/tree/main/src/main/webapp/js"
    click Images "https://github.com/bahri-adem/application-web-des-patients/tree/main/src/main/webapp/images"
    click Servlets "https://github.com/bahri-adem/application-web-des-patients/tree/main/src/main/java/com/servelt"
    click Services "https://github.com/bahri-adem/application-web-des-patients/blob/main/src/main/java/com/DAO/*Service.java"
    click DAOs "https://github.com/bahri-adem/application-web-des-patients/blob/main/src/main/java/com/DAO/*DAO.java"
    click JavaBeans "https://github.com/bahri-adem/application-web-des-patients/tree/main/src/main/java/com/javaBeans"
    click DB "https://github.com/bahri-adem/application-web-des-patients/blob/main/database/database.sql"
    click Config "https://github.com/bahri-adem/application-web-des-patients/blob/main/src/main/webapp/WEB-INF/web.xml"
    click Connector "https://github.com/bahri-adem/application-web-des-patients/blob/main/src/main/webapp/WEB-INF/lib/mysql-connector-java-8.0.20.jar"
    click Tests "https://github.com/bahri-adem/application-web-des-patients/tree/main/src/main/java/test"

    %% Styles
    classDef ui fill:#add8e6,stroke:#333,stroke-width:1px
    classDef controller fill:#90ee90,stroke:#333,stroke-width:1px
    classDef logic fill:#ffa500,stroke:#333,stroke-width:1px
    classDef dao fill:#ffdead,stroke:#333,stroke-width:1px
    classDef db fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef infra fill:#f0f0f0,stroke:#333,stroke-width:1px
```
