# alexdenche/healthcare architecture

> Architecture diagram of the GitHub repository alexdenche/healthcare, 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/alexdenche/healthcare
- Repository: https://github.com/alexdenche/healthcare

## Overview

##### Main Components
- Web Server & Environment: Represent your Apache server setup and MySQL database (importing the provided healthcare-estructura.sql and healthcare-datos.sql files).
- Application Layer (CodeIgniter): This includes the fundamental MVC parts:
- Views: Represent the “Views” layer that handles presentation for different profiles (in folders such as paciente, facultativo, gerente, etc.).
- Assets: Include your frontend components (CSS from assets/styles, JavaScript via assets/scripts, images, and fonts). These support the UI, interactivity, and overall client-side functionalities.

##### Relationships and Interactions
- Controllers invoke Models to fetch or manipulate data then pass it on to Views.
- Views interact with Assets (JavaScript, CSS) to render a dynamic UI.
- Out the API endpoints under controllers/API for system interconnectivity if other systems or services are to interact with HealthCare.

##### Architectural Patterns and Design Principles
- MVC Pattern: Clearly separate the Model, View, and Controller components.
- Role-Based Access: Highlight the segmentation between different controllers and views, each dedicated to user roles such as Admin, Gerente, Facultativo, etc.
- Modular Design: Note how assets (scripts/styles) and modules (within the views) are organized for reusability and maintainability.
- Configuration Layer: Include small notes on configuration (e.g., application/config files) that set up globals like database connections, routing, and autoloaders.

- For component blocks (e.g., Web Server, MVC layers, Database), use different shades of red. For example:
- A deep red for the Web Server layer.
- A slightly lighter red for the CodeIgniter MVC framework, further dividing it into Controllers (perhaps the darker variant), Models (a medium red), and Views (a bright red).
- Use white or light gray text against the black background to ensure readability.

##### Notable Deployment/Configuration Elements
- Briefly illustrate that the system is setup through configuration files (like config.php and routes.php) and that Composer is used for dependency management.
- That installation steps (such as Git initialization and adjustments in assets/scripts/public/login.js) are part of the deployment process—this can be annotated near the Web Server.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Web Server & Environment"
        W1("Apache (.htaccess)"):::web
        W2("index.php"):::web
        subgraph "Database (MySQL)"
            DB1("SQL Structure"):::web
            DB2("SQL Data"):::web
        end
    end

    subgraph "Application Layer (CodeIgniter MVC)"
        subgraph "Controllers"
            C_api("API Controllers"):::controller
            C_role("Role Controllers"):::controller
        end
        subgraph "Models"
            M_models("Models"):::model
        end
        subgraph "Views"
            V_admin("Admin Views"):::view
            V_administrativo("Administrativo Views"):::view
            V_facultativo("Facultativo Views"):::view
            V_gerente("Gerente Views"):::view
            V_laboratorio("Laboratorio Views"):::view
            V_paciente("Paciente Views"):::view
            V_modules("Shared Modules"):::view
        end
    end

    subgraph "Assets"
        A_scripts("Scripts"):::asset
        A_styles("Styles"):::asset
        A_fonts("Fonts"):::asset
        A_images("Images"):::asset
    end

    subgraph "External Dependencies"
        E_composer("Composer Dependencies"):::external
    end

    subgraph "Configuration Layer"
        Config_files("Config Files"):::config
    end

    %% Connections
    W1 -->|"HTTP_Request"| W2
    W2 -->|"Routes_to"| C_role
    W2 -->|"Routes_to"| C_api
    C_role -->|"Calls"| M_models
    C_api -->|"Calls"| M_models
    M_models -->|"CRUD"| DB1
    M_models -->|"CRUD"| DB2
    C_role -->|"Renders"| V_admin
    C_api -->|"Renders"| V_admin
    V_admin -->|"Uses"| A_scripts
    V_admin -->|"Uses"| A_styles
    Config_files -->|"Configures"| W2
    E_composer -->|"Manages"| W2

    %% Click Events
    click W1 "https://github.com/alexdenche/healthcare/blob/master/.htaccess"
    click W2 "https://github.com/alexdenche/healthcare/blob/master/index.php"
    click DB1 "https://github.com/alexdenche/healthcare/blob/master/healthcare-estructura.sql"
    click DB2 "https://github.com/alexdenche/healthcare/blob/master/healthcare-datos.sql"
    click C_api "https://github.com/alexdenche/healthcare/tree/master/application/controllers/API"
    click C_role "https://github.com/alexdenche/healthcare/tree/master/application/controllers"
    click M_models "https://github.com/alexdenche/healthcare/tree/master/application/models"
    click V_admin "https://github.com/alexdenche/healthcare/tree/master/application/views/admin"
    click V_administrativo "https://github.com/alexdenche/healthcare/tree/master/application/views/administrativo"
    click V_facultativo "https://github.com/alexdenche/healthcare/tree/master/application/views/facultativo"
    click V_gerente "https://github.com/alexdenche/healthcare/tree/master/application/views/gerente"
    click V_laboratorio "https://github.com/alexdenche/healthcare/tree/master/application/views/laboratorio"
    click V_paciente "https://github.com/alexdenche/healthcare/tree/master/application/views/paciente"
    click V_modules "https://github.com/alexdenche/healthcare/tree/master/application/views/modules"
    click A_scripts "https://github.com/alexdenche/healthcare/tree/master/assets/scripts"
    click A_styles "https://github.com/alexdenche/healthcare/tree/master/assets/styles"
    click A_fonts "https://github.com/alexdenche/healthcare/tree/master/assets/fonts"
    click A_images "https://github.com/alexdenche/healthcare/tree/master/assets/img"
    click E_composer "https://github.com/alexdenche/healthcare/blob/master/application/composer.json"
    click Config_files "https://github.com/alexdenche/healthcare/tree/master/application/config"

    %% Styles
    classDef web fill:#8B0000,stroke:#ff0000,color:#ffffff;
    classDef controller fill:#A52A2A,stroke:#ff5555,color:#ffffff;
    classDef model fill:#CD5C5C,stroke:#ff6666,color:#ffffff;
    classDef view fill:#FF6347,stroke:#ff7777,color:#ffffff;
    classDef asset fill:#DC143C,stroke:#ff8888,color:#ffffff;
    classDef external fill:#FF0000,stroke:#ff9999,color:#ffffff;
    classDef config fill:#FF4500,stroke:#ffaa00,color:#ffffff;
```
