# znarfm/daa-project architecture

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

- Interactive diagram: https://gitdiagram.com/znarfm/daa-project
- Repository: https://github.com/znarfm/daa-project

## Overview

##### Main Components

a. User Interface Layer:
- Sub-components for each page:
- Main Dashboard (main.py)
- Instructors Page (pages/instructors.py)
- Subjects Page (pages/subjects.py)
- Management Page (pages/manage.py)
- About Page (pages/about.py)

b. Application Logic Layer:
- A "Scheduling Engine" component that implements the algorithm
- "Schedule Validation" component for conflict checking

c. Data Layer:
- Following database tables (derived from db_stuff):
- Instructors
- Subjects
- Classes
- Instructor_Subject mappings

##### Component Relationships

- User Interface → Application Logic (Schedule requests)
- Application Logic → Database (CRUD operations)
- Database → Application Logic (Data retrieval)
- Application Logic → User Interface (Results display)

##### Specific Design Elements

Use the following visual elements:
- Blue containers for UI components
- Green containers for application logic
- Yellow containers for database components

##### Additional Details

a. External Dependencies:
- Streamlit Framework
- Python Runtime
- SQLite Engine

b. Key Processes:
- Schedule Generation Flow
- Conflict Resolution Path
- Data Management Operations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        direction TB
        Dashboard["Main Dashboard"]
        InstructorsPage["Instructors Page"]
        SubjectsPage["Subjects Page"]
        ManagementPage["Management Page"]
        AboutPage["About Page"]
    end

    subgraph Logic["Application Logic Layer"]
        direction TB
        BacktrackingDFS["Backtracking DFS Algorithm"]:::algorithm
        SchedulingEngine["Scheduling Engine"]:::engine
        ValidationComponent["Schedule Validation"]:::validation
    end

    subgraph Data["Data Layer"]
        direction TB
        Database[(SQLite Database)]:::database
        subgraph Tables["Database Tables"]
            direction TB
            InstructorsTable[("Instructors")]:::table
            SubjectsTable[("Subjects")]:::table
            ClassesTable[("Classes")]:::table
            MappingTable[("Instructor-Subject Mappings")]:::table
        end
    end

    %% UI Layer Connections
    Dashboard --> BacktrackingDFS
    InstructorsPage --> SchedulingEngine
    SubjectsPage --> SchedulingEngine
    ManagementPage --> ValidationComponent

    %% Logic Layer Connections
    BacktrackingDFS --> SchedulingEngine
    SchedulingEngine --> ValidationComponent
    ValidationComponent --> Database

    %% Data Layer Connections
    Database --> InstructorsTable
    Database --> SubjectsTable
    Database --> ClassesTable
    Database --> MappingTable

    %% Data Flow
    InstructorsTable -.-> ValidationComponent
    SubjectsTable -.-> ValidationComponent
    ClassesTable -.-> ValidationComponent
    MappingTable -.-> ValidationComponent

    %% Component Mappings
    click Dashboard "https://github.com/znarfm/DAA-Project/blob/main/main.py"
    click InstructorsPage "https://github.com/znarfm/DAA-Project/blob/main/pages/instructors.py"
    click SubjectsPage "https://github.com/znarfm/DAA-Project/blob/main/pages/subjects.py"
    click ManagementPage "https://github.com/znarfm/DAA-Project/blob/main/pages/manage.py"
    click AboutPage "https://github.com/znarfm/DAA-Project/blob/main/pages/about.py"
    click Database "https://github.com/znarfm/DAA-Project/blob/main/synchllabus_database.db"
    click InstructorsTable "https://github.com/znarfm/DAA-Project/blob/main/db_stuff/createinstructorsdb.py"
    click SubjectsTable "https://github.com/znarfm/DAA-Project/blob/main/db_stuff/createsubjectsdb.py"
    click ClassesTable "https://github.com/znarfm/DAA-Project/blob/main/db_stuff/createSampleClasses.py"
    click MappingTable "https://github.com/znarfm/DAA-Project/blob/main/db_stuff/createinstructor_subjecttable.py"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef algorithm fill:#90EE90,stroke:#333
    classDef engine fill:#98FB98,stroke:#333
    classDef validation fill:#98FB98,stroke:#333
    classDef database fill:#FFE4B5,stroke:#333
    classDef table fill:#FFE4B5,stroke:#333

    %% Legend
    subgraph Legend
        direction TB
        UI_Component["UI Component"]:::default
        Algorithm["Algorithm Component"]:::algorithm
        Logic_Component["Logic Component"]:::engine
        DB_Component[("Database Component")]:::database
        DataFlow["---> Control Flow"]
        DataFlow2["--> Data Flow"]
    end
```
