# cheocarmine/skycode architecture

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

- Interactive diagram: https://gitdiagram.com/cheocarmine/skycode
- Repository: https://github.com/cheocarmine/skycode

## Overview

##### Main Components Identification
- Frontend:
- Templates: The HTML templates in the “templates” directory (e.g., “base.html”, “login.html”, “reports.html”, etc.) provide the user interface for various pages such as authentication, enrollment, reports, and schedules.
- Static Files: The “static” directory includes CSS (for styles), JavaScript (for interactivity, charts, and other client-side functionalities), images, and pre-generated PDF reports. This represents client-side resources for the web interface.
- Backend:
- Application Entry Point: The “app.py” file initializes the application, likely sets up routing and dependency injection.
- Routing & Services: “routes.py” handles the HTTP routes, and “services.py” likely encapsulates business logic.
- Business Logic Modules: Under the “functions” directory, there are organized subdirectories (like “academic_progress”, “auth”, “enrollment”, “evaluations”, “reports”, “schedule”, “statistics”, “sync_data”, and “user_management”) grouping the core functionalities. These modules form the backbone of the application’s operations.
- Database Layer: “database.py” manages database connections and interactions, with “models.py” likely defining the data structure (ORM models) used across the system.
- Configurations: “config.py” and the handling of environment variables (.env file using the example file) manage system configuration such as database URI, secret keys, and debug settings.
- External Integration:
- Modules like those in “functions/sync_data” (e.g., “sync_with_teacher_system.py”) illustrate that the system synchronizes data with an external teacher system, integrating schedules, grades, and active subjects from another source.

##### Relationships and Interactions
- Data Flow and Requests:
- The client-side (frontend) makes HTTP requests (form submissions, AJAX calls) interacting with endpoints defined in “routes.py.”
- Routes pass requests to relevant business logic functions in the “functions” modules, which process data, manage logic (e.g., enrollment, academic progress, evaluations, user management), and interact with the database via “database.py” and “models.py.”
- Once processed, data is sent back to the frontend, often rendered within HTML templates.
- External Communication:
- The “sync_data” module clearly indicates a dedicated pathway for synchronizing or fetching data from an external teacher system, ensuring that the academic data remains up-to-date.

##### Technologies and Frameworks
- Python 3.13+ as the runtime environment.
- Likely using a Python web framework (Flask or similar) given the structure (app.py, routes.py, templates, static).
- Integration libraries for chart generation and dynamic reporting in the “static/JS” directory.
- A dependency manager (requirements.txt) ensures reproducibility.

##### Elements
- Frontend: Templates and Static Assets
- Backend Core (with submodules like authentication, enrollment, evaluation, etc.)
- Database/Model Layer
- External Systems Integration (teacher system)

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend"
        FT["Templates"]:::frontend
        FS["Static Assets"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        CONF["Configurations"]:::config
        AE["Application Entry (app.py)"]:::backend
        RS["Routing (routes.py)"]:::backend
        SS["Services (services.py)"]:::backend
        subgraph "Business Logic Modules"
            AP["Academic Progress"]:::module
            AU["Authentication"]:::module
            EN["Enrollment"]:::module
            EV["Evaluations"]:::module
            RE["Reports"]:::module
            SC["Schedule"]:::module
            ST["Statistics"]:::module
            SY["Data Synchronization"]:::module
            UM["User Management"]:::module
        end
    end

    %% Database Layer
    DB["Database Layer"]:::database

    %% External Integration
    EXT["External Teacher System"]:::external

    %% Data Flow Connections
    FT -->|"HTTP_requests"| RS
    FS -->|"Static_resources"| RS

    CONF -->|"configures"| AE
    AE -->|"initializes"| RS
    RS -->|"invokes"| SS
    SS -->|"executes"| AP
    SS -->|"executes"| AU
    SS -->|"executes"| EN
    SS -->|"executes"| EV
    SS -->|"executes"| RE
    SS -->|"executes"| SC
    SS -->|"executes"| ST
    SS -->|"executes"| SY
    SS -->|"executes"| UM

    AP -->|"DB_operations"| DB
    AU -->|"DB_operations"| DB
    EN -->|"DB_operations"| DB
    EV -->|"DB_operations"| DB
    RE -->|"DB_operations"| DB
    SC -->|"DB_operations"| DB
    ST -->|"DB_operations"| DB
    UM -->|"DB_operations"| DB

    SY -->|"syncs_data_with"| EXT

    %% Click Events
    click FT "https://github.com/cheocarmine/skycode/tree/main/templates/"
    click FS "https://github.com/cheocarmine/skycode/tree/main/static/"
    click AE "https://github.com/cheocarmine/skycode/blob/main/app.py"
    click RS "https://github.com/cheocarmine/skycode/blob/main/routes.py"
    click SS "https://github.com/cheocarmine/skycode/blob/main/services.py"
    click AP "https://github.com/cheocarmine/skycode/tree/main/functions/academic_progress/"
    click AU "https://github.com/cheocarmine/skycode/tree/main/functions/auth/"
    click EN "https://github.com/cheocarmine/skycode/tree/main/functions/enrollment/"
    click EV "https://github.com/cheocarmine/skycode/tree/main/functions/evaluations/"
    click RE "https://github.com/cheocarmine/skycode/tree/main/functions/reports/"
    click SC "https://github.com/cheocarmine/skycode/tree/main/functions/schedule/"
    click ST "https://github.com/cheocarmine/skycode/tree/main/functions/statistics/"
    click SY "https://github.com/cheocarmine/skycode/tree/main/functions/sync_data/"
    click UM "https://github.com/cheocarmine/skycode/tree/main/functions/user_management/"
    click DB "https://github.com/cheocarmine/skycode/blob/main/database.py"
    click CONF "https://github.com/cheocarmine/skycode/blob/main/config.py"

    %% Styles
    classDef frontend fill:#edf8fb,stroke:#1f77b4,stroke-width:2px;
    classDef backend fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px;
    classDef module fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef database fill:#fdebd0,stroke:#e67e22,stroke-width:2px;
    classDef external fill:#e8daef,stroke:#8e44ad,stroke-width:2px;
    classDef config fill:#fadbd8,stroke:#e74c3c,stroke-width:2px;
```
