# conanwinner/schedule_project architecture

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

- Interactive diagram: https://gitdiagram.com/conanwinner/schedule_project
- Repository: https://github.com/conanwinner/schedule_project

## Overview

##### Project Type and Purpose
- The project’s objective of combining natural language models with an evolutionary algorithm points to a hybrid architecture with both AI-driven logic and conventional web API/backend components.

##### Main Components
a. Backend Application Layer (located in the "app" directory):
- API Layer: Represented by the files in app/api (list_all_api.py, schedule_api.py, search_api.py). These endpoints handle incoming requests.
- Configuration/Infrastructure: The app/config folder (database_configuration.py and embedding_model.py) that sets up the database connections and embedding models necessary for LLM usage.
- Business Logic/Services: The app/service folder (e.g., constraints_service.py) which encapsulate the core logic for scheduling constraints.
- Domain Models: The app/model folder (e.g., Class_Info.py) which defines the data structures.
- Constants: The app/constant directory, holding various constant definitions that are referenced across components.
- Entry Points: Files such as app/main.py and app/demo.py represent application startup and demonstration workflows.

b. Data Management and Processing:
- Data Scripts: Under the "data" folder, which includes batch translation (gemini_batch_translate.py) and several Excel input files alongside prompt.json for configuration.
- Database Embedding: The "database/embedding" folder, which likely deals with storing and retrieving embedding data related to timetable generation.

c. Frontend Component:
- The "frontend" directory suggests that there is a UI layer (even if simple) that interacts with the backend, providing the user interface for timetable generation and preferences input.

d. Validation and Testing:
- The "validation" folder contains data creation, validation scripts, and utilities. This illustrates that rigorous data validation is part of ensuring that generated timetables meet all constraints.
- The "app/mock" folder houses documentation and mock schedules/searches. These are useful for testing or documentation purposes.

##### Relationships and Interactions
- The user interacts with a web interface (frontend) that sends requests to the backend API endpoints.
- The API endpoints then delegate calls to the service layer where scheduling constraints are processed using NSGA-II and LLM techniques.
- The configuration settings determine connections to the database (and possibly external embedding services) needed by both the LLM and RAG modules.
- The data layer (scripts and Excel files) provides input data and complements validation scripts to ensure data integrity.
- Client (frontend browser) → API requests to the backend.
- Backend API → Service/Business logic processing.
- Service layer → Database/embedding and Data Validation services.
- Additionally, note dependency flows where the AI modules (LLM, RAG) feed into scheduling decisions.

##### Architectural Patterns and Key Technologies
- Separation of Concerns (layered architecture): Clearly distinct modules for API handling, business services, configuration, and domain models.
- Possibly an MVC or microservices-inspired design inside the 'app' directory.
- Key Technologies: Python (backbone of the app), LLM (VIT5), NSGA-II for optimization, and potentially RAG for augmented generation.
- The presence of extensive configuration and constant directories indicates careful adherence to maintainability and extensibility principles.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User (Browser)"]:::client
    F_UI["Frontend UI"]:::frontend
    EP1["Entry Point (main)"]:::backend
    EP2["Entry Point (demo)"]:::backend
    API["API Layer"]:::backend
    BL["Business Logic/Services (NSGA-II,LLM,RAG)"]:::backend
    CONF["Configuration/Infrastructure"]:::config
    DM["Domain Models"]:::model
    CONST["Constants"]:::constant
    DMP["Data Management & Processing"]:::data
    DBE["Database Embedding"]:::database
    VAL["Validation & Testing"]:::validation
    MOCK["Mock Data & Docs"]:::mock

    %% User interactions
    User --> F_UI
    F_UI --> API

    %% Entry point initialization
    EP1 --> API
    EP2 --> API

    %% Backend processing flow
    API --> BL
    DMP --> BL
    BL --> CONF
    BL --> DM
    BL --> CONST
    BL --> DBE

    %% Data layer interactions
    DMP --> DBE
    VAL -.-> DMP
    VAL -.-> MOCK

    %% Click Events
    click F_UI "https://github.com/conanwinner/schedule_project/tree/main/frontend"
    click API "https://github.com/conanwinner/schedule_project/tree/main/app/api"
    click BL "https://github.com/conanwinner/schedule_project/blob/main/app/service/constraints_service.py"
    click CONF "https://github.com/conanwinner/schedule_project/tree/main/app/config"
    click DM "https://github.com/conanwinner/schedule_project/blob/main/app/model/Class_Info.py"
    click CONST "https://github.com/conanwinner/schedule_project/tree/main/app/constant"
    click EP1 "https://github.com/conanwinner/schedule_project/blob/main/app/main.py"
    click EP2 "https://github.com/conanwinner/schedule_project/blob/main/app/demo.py"
    click DMP "https://github.com/conanwinner/schedule_project/tree/main/data"
    click DBE "https://github.com/conanwinner/schedule_project/tree/main/database/embedding"
    click VAL "https://github.com/conanwinner/schedule_project/tree/main/validation"
    click MOCK "https://github.com/conanwinner/schedule_project/tree/main/app/mock"

    %% Styles
    classDef client fill:#FAD7A0,stroke:#333,stroke-width:2px;
    classDef frontend fill:#AED6F1,stroke:#333,stroke-width:2px;
    classDef backend fill:#A9DFBF,stroke:#333,stroke-width:2px;
    classDef config fill:#F5B7B1,stroke:#333,stroke-width:2px;
    classDef model fill:#D2B4DE,stroke:#333,stroke-width:2px;
    classDef constant fill:#F9E79F,stroke:#333,stroke-width:2px;
    classDef data fill:#D6EAF8,stroke:#333,stroke-width:2px;
    classDef database fill:#E8DAEF,stroke:#333,stroke-width:2px;
    classDef validation fill:#FADBD8,stroke:#333,stroke-width:2px;
    classDef mock fill:#D5F5E3,stroke:#333,stroke-width:2px;
```
