# trezarex/samarkandproject architecture

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

- Interactive diagram: https://gitdiagram.com/trezarex/samarkandproject
- Repository: https://github.com/trezarex/samarkandproject

## Overview

##### Project type and purpose
- This is a web-based, full-stack “Samarkand Data Dashboard” built on Flask (Python) as the backend, serving HTML/CSS/JS to a browser, and visualizing synthetic CSV datasets for hospitals, schools, and preschools. It also embeds an AI-powered chatbot for Q&A.

##### File structure
- app.py at the root: single Flask application
- data/: CSV files (final_hos_df.csv, final_school_df.csv, final_preschool_df.csv)
- templates/: Jinja2 HTML template (Index.html)
- static/: CSS, JS, images
- css/style.css, chatbot-table.css
- js/charting scripts (hospital.js, school.js, preschool.js), chatBot.js, script.js

##### README for additional insights
- Describes features (interactive charts, filtering, AI chatbot)
- Confirms tech stack: Flask+Jinja, front-end scripts, synthetic CSVs

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client (Browser/UI)"
        direction TB
        Browser["Browser / UI"]:::client
        Index["Index.html"]:::client
        StyleCSS["style.css"]:::client
        TableCSS["chatbot-table.css"]:::client
        HospitalJS["hospital.js"]:::client
        SchoolJS["school.js"]:::client
        PreschoolJS["preschool.js"]:::client
        ChatbotJS["chatBot.js"]:::client
        ScriptJS["script.js"]:::client
    end

    %% Server Layer
    subgraph "Server (Flask Application)"
        direction TB
        App["app.py"]:::server
        Req["requirements.txt"]:::server
    end

    %% Data Store Layer
    subgraph "Data Store"
        direction TB
        HosCSV["final_hos_df.csv"]:::data
        SchoolCSV["final_school_df.csv"]:::data
        PreCSV["final_preschool_df.csv"]:::data
    end

    %% External Systems
    subgraph "External Services"
        direction TB
        AIService["External AI Service"]:::external
    end

    %% Documentation
    subgraph "Project Documentation"
        direction TB
        README["README.md"]:::docs
        Gitignore[".gitignore"]:::docs
    end

    %% Connections
    Browser -->|"HTTP GET /"| App
    App -->|"HTTP 200 HTML"| Browser
    App -->|"serves Index.html"| Index
    Index -->|"loads CSS/JS assets"| Browser

    Browser -->|"AJAX GET /api/data"| App
    App -->|"reads CSV files"| HosCSV
    App -->|"reads CSV files"| SchoolCSV
    App -->|"reads CSV files"| PreCSV
    HosCSV -->|"CSV data"| App
    SchoolCSV -->|"CSV data"| App
    PreCSV -->|"CSV data"| App
    App -->|"JSON data"| Browser

    Browser -->|"AJAX POST /api/chatbot"| App
    App -->|"forwards request"| AIService
    AIService -->|"response JSON"| App
    App -->|"JSON response"| Browser

    %% Click Events
    click Index "https://github.com/trezarex/samarkandproject/blob/main/templates/Index.html"
    click StyleCSS "https://github.com/trezarex/samarkandproject/blob/main/static/css/style.css"
    click TableCSS "https://github.com/trezarex/samarkandproject/blob/main/static/css/chatbot-table.css"
    click HospitalJS "https://github.com/trezarex/samarkandproject/blob/main/static/js/hospital.js"
    click SchoolJS "https://github.com/trezarex/samarkandproject/blob/main/static/js/school.js"
    click PreschoolJS "https://github.com/trezarex/samarkandproject/blob/main/static/js/preschool.js"
    click ChatbotJS "https://github.com/trezarex/samarkandproject/blob/main/static/js/chatBot.js"
    click ScriptJS "https://github.com/trezarex/samarkandproject/blob/main/static/js/script.js"

    click App "https://github.com/trezarex/samarkandproject/blob/main/app.py"
    click Req "https://github.com/trezarex/samarkandproject/blob/main/requirements.txt"

    click HosCSV "https://github.com/trezarex/samarkandproject/blob/main/data/final_hos_df.csv"
    click SchoolCSV "https://github.com/trezarex/samarkandproject/blob/main/data/final_school_df.csv"
    click PreCSV "https://github.com/trezarex/samarkandproject/blob/main/data/final_preschool_df.csv"

    click README "https://github.com/trezarex/samarkandproject/blob/main/README.md"
    click Gitignore "https://github.com/trezarex/samarkandproject/blob/main/.gitignore"

    %% Styles
    classDef client fill:#cce5ff,stroke:#0366d6,color:#0366d6
    classDef server fill:#d4edda,stroke:#28a745,color:#155724
    classDef data fill:#ffe5b4,stroke:#e69500,color:#663c00
    classDef external fill:#e2d6f5,stroke:#6f42c1,color:#381085
    classDef docs fill:#f0f0f0,stroke:#6c757d,color:#343a40
```
