# sahvsergio/treehouse_python_techdegree_unit5 architecture

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

- Interactive diagram: https://gitdiagram.com/sahvsergio/treehouse_python_techdegree_unit5
- Repository: https://github.com/sahvsergio/treehouse_python_techdegree_unit5

## Overview

##### Main Components Identification
The project is a full-stack web application with the following key components:

a. Web Application Layer
- Frontend (Templates and Static files)
- Backend (Flask application)
- Database (SQLite using SQLAlchemy)

b. Chatbot System
- Model Training component
- Trained Model storage
- Inference system

##### Component Relationships

- Frontend → Backend: HTTP requests
- Backend → Database: SQLAlchemy ORM queries
- Backend → Chatbot: Model inference calls
- Training System → Model Storage: Model updates

##### Detailed Component Breakdown

Frontend:
**Templates/**
- layout.html (Base template)
- index.html (Project listing)
- detail.html (Project details)
- chatbot.html (Chatbot interface)
- admin/ (Administrative interfaces)

Backend:
- app.py (Main application)
- models.py (Database models)
- utils.py (Utility functions)
- requirements.txt

Chatbot System:
**Model Training/**
- model_training.py
- intents.json
- model/
- chatbot_model.keras
- classes.pkl
- words.pkl

##### Technical Stack Indicators

Technology badges or labels for:
- Flask
- SQLAlchemy
- Keras/TensorFlow
- SQLite
- Jinja2 Templates
- JavaScript/CSS

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:white
    classDef chatbot fill:#9b59b6,stroke:#8e44ad,color:white
    
    %% Frontend Layer
    subgraph Frontend
        Templates["Templates"]
        Layout["layout.html"]
        Index["index.html"]
        Detail["detail.html"]
        ChatUI["chatbot.html"]
        AdminUI["Admin Interface"]
        Static["Static Assets"]
        CSS["styles.css"]
        JS["app.js"]
    end
    
    %% Backend Layer
    subgraph Backend
        Flask["Flask App"]
        Models["Database Models"]
        Utils["Utility Functions"]
        Routes["Routes/Controllers"]
    end
    
    %% Database Layer
    subgraph Database
        SQLite["SQLite Database"]
    end
    
    %% Chatbot System
    subgraph ChatbotSystem
        Training["Model Training"]
        ModelStorage["Model Storage"]
        Inference["Inference Engine"]
        Intents["Intents Data"]
    end
    
    %% Relationships
    Templates --> Flask
    Static --> Templates
    Flask --> SQLite
    Flask --> Inference
    Training --> ModelStorage
    ModelStorage --> Inference
    Intents --> Training
    Routes --> Models
    Models --> SQLite
    
    %% Component Hierarchy
    Templates --> Layout
    Templates --> Index
    Templates --> Detail
    Templates --> ChatUI
    Templates --> AdminUI
    Static --> CSS
    Static --> JS
    
    %% Styling
    class Templates,Layout,Index,Detail,ChatUI,AdminUI,Static,CSS,JS frontend
    class Flask,Models,Utils,Routes backend
    class SQLite database
    class Training,ModelStorage,Inference,Intents chatbot
    
    %% Click Events
    click Templates "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/tree/main/templates"
    click Layout "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/templates/layout.html"
    click Index "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/templates/index.html"
    click Detail "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/templates/detail.html"
    click ChatUI "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/templates/chatbot.html"
    click AdminUI "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/templates/admin/index.html"
    click Static "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/tree/main/static"
    click CSS "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/static/styles.css"
    click JS "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/static/app.js"
    click Flask "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/app.py"
    click Models "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/models.py"
    click Utils "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/utils.py"
    click SQLite "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/projects.db"
    click Training "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/Model Training/model_training.py"
    click Intents "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/blob/main/Model Training/intents.json"
    click ModelStorage "https://github.com/sahvsergio/treehouse_python_techdegree_unit5/tree/main/Model Training/model"
```
