# jxnier/proyecto architecture

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

- Interactive diagram: https://gitdiagram.com/jxnier/proyecto
- Repository: https://github.com/jxnier/proyecto

## Overview

##### Project Overview and Main Components
- Project Type: It is a web application that offers distinct interfaces for different user roles (Administrador, Paciente, Psicologo) along with an AI component to aid in detection/assessment.
- Web Client / Browser: Serves the different HTML pages for administrators, patients, and psychologists.
- Frontend Static Resources: HTML pages (organized by role under “html/”), CSS files (styling assets in “css/”), and JavaScript files (organized by user type inside “js/”).
- Backend/API Layer: Python scripts (such as ApiBD.py and PrediccionIA.py) that likely handle database interactions and provide the AI predictions.
- Database: Represented by SQL dump files (proyecto.sql) which indicate the application's data persistence and user information.
- Data/Model Assets: For AI, include the mental disorders dataset (Dataset-Mental-Disorders.csv) which is used by the prediction script.

##### Analyzing the File Structure for Architectural Patterns and Interactions
- Role-based UI: Notice the segmentation in the HTML and JavaScript directories for “Administrador”, “Paciente”, and “Psicologo” – these represent different front-end modules.
- Dashboard and Data Visualizations: Multiple JS files under js/Administrador/Dashboard (g2.js, g3.js, etc.) suggest the existence of a dynamic admin panel with charts and data graphs.
- API and AI Integration: The Python directory includes an API script (ApiBD.py) likely serving as a middleware to connect the UI with the database, and PrediccionIA.py for running AI-based assessments.
- Database Layer: The provided SQL files denote an underlying database architecture that stores user data, tasks, records, etc.

- Client Side:
- Browser: Show three main pathways:
▪ Administrador: HTML pages, CSS styles, and JS dashboard scripts.
▪ Paciente: Their dedicated HTML pages and JS validations/tasks.
▪ Psicologo: Their dedicated HTML pages and JS functionalities (e.g. task assignment, publications).
- Web Server/Static File Server:
- Static Assets: Hosting of HTML, CSS, and JS files.
- Authentication & Routing: Although not explicitly shown in the file tree, the separation of login and role pages suggests an authentication layer.
- Backend/API Layer:
- Python API (ApiBD.py): Acts as the endpoint connecting the frontend to the database.
- AI Prediction Module (PrediccionIA.py): Contains the logic for processing the “Dataset-Mental-Disorders.csv” data and generating predictions.
- Database:
- SQL Database: Represented by the SQL dump files, storing administrator, patient, and psychologist data as well as logs or tasks.

b. Relationships and Data Flow:
- That the web server interacts with the Backend API when users log in or submit data.
- Once the AI module generates results, this is sent back upstream via the API to update the UI (for example, when a patient’s risk is assessed).

c. Architectural Patterns & Technologies:
- MVC / Separation of Concerns: Even though this is mostly static HTML/CSS/JS, the separation into different directories for roles suggests a design keeping user interfaces distinct.
- RESTful APIs: The Python API likely exposes endpoints that serve both the AI predictions and database operations.
- Data Visualization & Dashboard Integration: Use of multiple JavaScript charts (g2.js, g3.js, etc.) indicates a part of the project dedicated to admin analytics.
- Frontend Validation & Effects: Dedicated JS files handling login and form validations for different roles.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Side Layer
    subgraph "Client Side"
        AUI["Administrador UI (HTML)"]:::frontend
        PUI["Paciente UI (HTML)"]:::frontend
        PSI["Psicologo UI (HTML)"]:::frontend
        CSS["CSS Assets"]:::frontend
        JS["JavaScript Assets"]:::frontend
    end

    %% Application Server Layer
    subgraph "Application Server"
        WS["Web Server (Static Asset & Auth)"]:::server
        API["Backend API (ApiBD.py)"]:::server
    end

    %% Data & AI Layer
    subgraph "Data & AI Layer"
        AI["AI Prediction Module (PrediccionIA.py)"]:::ai
        DATA["AI Dataset (Dataset-Mental-Disorders.csv)"]:::ai
        DB["SQL Database"]:::database
        D1["Dump File (proyecto.sql)"]:::database
        D2["Dump File (proyecto (1).sql)"]:::database
    end

    %% Data Flow: Client to Server
    AUI --> WS
    PUI --> WS
    PSI --> WS
    CSS --> WS
    JS  --> WS

    %% Data Flow: Server Processing
    WS --> API

    %% Data Flow: API interactions with Database and AI
    API --> DB
    API --> AI
    AI -->|"sends prediction"| API
    AI -->|"uses"| DATA

    %% Database Assets
    DB -->|"contains"| D1
    DB -->|"contains"| D2

    %% Click Events for Client Side
    click AUI "https://github.com/jxnier/proyecto/blob/main/html/Administrador/0Administrador.html"
    click PUI "https://github.com/jxnier/proyecto/blob/main/html/Paciente/0Paciente.html"
    click PSI "https://github.com/jxnier/proyecto/blob/main/html/Psicologo/0Psicologo.html"
    click CSS "https://github.com/jxnier/proyecto/tree/main/css/"
    click JS "https://github.com/jxnier/proyecto/tree/main/js/"

    %% Click Events for Server and AI Components
    click API "https://github.com/jxnier/proyecto/blob/main/python/ApiBD.py"
    click AI "https://github.com/jxnier/proyecto/blob/main/python/PrediccionIA.py"
    click DATA "https://github.com/jxnier/proyecto/blob/main/python/Dataset-Mental-Disorders.csv"
    click D1 "https://github.com/jxnier/proyecto/blob/main/proyecto.sql"
    click D2 "https://github.com/jxnier/proyecto/blob/main/proyecto (1).sql"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#0000FF,stroke-width:2px;
    classDef server fill:#FFE4B5,stroke:#FF8C00,stroke-width:2px;
    classDef ai fill:#FFFFE0,stroke:#DAA520,stroke-width:2px;
    classDef database fill:#D3D3D3,stroke:#696969,stroke-width:2px;
```
