# zack-morpho/projet-hotel architecture

> Architecture diagram of the GitHub repository zack-morpho/projet-hotel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zack-morpho/projet-hotel
- Repository: https://github.com/zack-morpho/projet-hotel

## Overview

##### Project type and purpose
- This is a full-stack hotel management app combining an Angular SPA (frontend) and a FastAPI service (backend) enhanced with simple data/ML-based predictions (agency recommendation, availability forecasting, booking optimization).
- Users interact via a browser UI (http://localhost:4200) which talks over REST to a Python FastAPI server (http://127.0.0.1:8000).

##### File structure
- Top-level “PRJ” contains two siblings:
- intelligent-hotel-ui/ (Angular code, feature-based modules under src/app)
- intelligent-hotel-api/ (FastAPI project under app/)
- Backend substructure:
- app/main.py – FastAPI app entry point
- app/routes/*.py – three REST endpoints: agencies, availability, optimize
- app/utils/predict_utils.py – helper functions to load CSV/model and run predictions
- app/Data/final_merged_data.csv – source dataset
- app/intelligent-hotel-models/ – trained model artifacts (pickles, etc.)
- Frontend substructure:
- app.component.ts, app.routes.ts – root component and router setup
- Three feature components: predict-agency, predict-optimal, predict-total-available
- app.config.ts – centralizes API base URLs and settings

##### README for additional insights
- Confirms the stack: Angular + FastAPI
- No external database: CSV + ML models form the data layer
- Usage instructions reveal the REST interface and development workflow

## Diagram (Mermaid)

```mermaid
graph TD
    %% Client
    Browser["Web Browser"]:::client

    %% Frontend
    subgraph "Frontend: Angular SPA"
        direction TB
        AngularApp["Angular SPA"]:::frontend
        RootComp["App Component"]:::frontend
        Router["App Routing"]:::frontend
        Config["App Config"]:::frontend
        AgencyMod["Predict Agency Module"]:::frontend
        OptimalMod["Predict Optimal Module"]:::frontend
        TotalMod["Predict Total Available Module"]:::frontend
    end

    %% Backend
    subgraph "Backend: FastAPI Service"
        direction TB
        FastAPI["FastAPI Service"]:::backend
        Main["main.py"]:::backend
        subgraph "API Router"
            Agencies["Agencies Endpoint"]:::backend
            Availability["Availability Endpoint"]:::backend
            Optimize["Optimize Endpoint"]:::backend
        end
        Utils["Predict Utils"]:::backend
        ModelsData["Pydantic Models"]:::backend
        DataCSV(("Data Source (CSV)")):::data
        ModelArt{{"Model Artifacts"}}:::model
    end

    %% Connections
    Browser -->|"loads Angular SPA"| AngularApp
    AngularApp --> RootComp
    AngularApp --> Router
    AngularApp --> Config
    AngularApp --> AgencyMod
    AngularApp --> OptimalMod
    AngularApp --> TotalMod

    AgencyMod -->|"calls /agencies"| FastAPI
    OptimalMod -->|"calls /optimize"| FastAPI
    TotalMod -->|"calls /availability"| FastAPI
    FastAPI -->|"routes to"| Main
    Main --> Agencies
    Main --> Availability
    Main --> Optimize

    Agencies --> Utils
    Availability --> Utils
    Optimize --> Utils

    Utils --> DataCSV
    Utils --> ModelArt
    Utils --> ModelsData

    FastAPI -->|"returns JSON"| AngularApp

    %% Click Events
    click AngularApp "https://github.com/zack-morpho/projet-hotel/tree/main/PRJ/intelligent-hotel-ui/src/app"
    click RootComp "https://github.com/zack-morpho/projet-hotel/blob/main/PRJ/intelligent-hotel-ui/src/app/app.component.ts"
    click Router "https://github.com/zack-morpho/projet-hotel/blob/main/PRJ/intelligent-hotel-ui/src/app/app.routes.ts"
    click Config "https://github.com/zack-morpho/projet-hotel/blob/main/PRJ/intelligent-hotel-ui/src/app/app.config.ts"
    click AgencyMod "https://github.com/zack-morpho/projet-hotel/tree/main/PRJ/intelligent-hotel-ui/src/app/predict-agency"
    click OptimalMod "https://github.com/zack-morpho/projet-hotel/tree/main/PRJ/intelligent-hotel-ui/src/app/predict-optimal"
    click TotalMod "https://github.com/zack-morpho/projet-hotel/tree/main/PRJ/intelligent-hotel-ui/src/app/predict-total-available"
    click Main "https://github.com/zack-morpho/projet-hotel/blob/main/PRJ/intelligent-hotel-api/app/main.py"
    click Agencies "https://github.com/zack-morpho/projet-hotel/blob/main/PRJ/intelligent-hotel-api/app/routes/agencies.py"
    click Availability "https://github.com/zack-morpho/projet-hotel/blob/main/PRJ/intelligent-hotel-api/app/routes/availability.py"
    click Optimize "https://github.com/zack-morpho/projet-hotel/blob/main/PRJ/intelligent-hotel-api/app/routes/optimize.py"
    click Utils "https://github.com/zack-morpho/projet-hotel/blob/main/PRJ/intelligent-hotel-api/app/utils/predict_utils.py"
    click DataCSV "https://github.com/zack-morpho/projet-hotel/blob/main/PRJ/intelligent-hotel-api/app/Data/final_merged_data.csv"
    click ModelArt "https://github.com/zack-morpho/projet-hotel/tree/main/PRJ/intelligent-hotel-api/app/intelligent-hotel-models"
    click ModelsData "https://github.com/zack-morpho/projet-hotel/tree/main/PRJ/intelligent-hotel-api/app/models"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:1px
    classDef frontend fill:#bbdefb,stroke:#1e88e5,stroke-width:2px
    classDef backend fill:#c8e6c9,stroke:#43a047,stroke-width:2px
    classDef data fill:#fff59d,stroke:#fbc02d,stroke-width:2px
    classDef model fill:#ffe0b2,stroke:#fb8c00,stroke-width:2px
```
