# italo2403/sistema_horario architecture

> Architecture diagram of the GitHub repository italo2403/sistema_horario, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/italo2403/sistema_horario
- Repository: https://github.com/italo2403/sistema_horario

## Overview

Gestor de Horários Docentes is a local timetable-management application. Users edit academic records, configure class shifts and periods, set teacher availability and weekly teaching requirements, then generate and review a heuristic schedule proposal before applying it. They can also inspect timetable and audit views and export CSV. The browser UI calls the local HTTP server, which validates operations and persists state in SQLite. The excerpts show these core paths; other UI views and API capabilities are included where documented by the UI, but their internal implementation details were not sampled.

Main entry points: [`server.py`](https://github.com/italo2403/sistema_horario/blob/main/server.py) (HTTP API), [`static/app.js`](https://github.com/italo2403/sistema_horario/blob/main/static/app.js) (Timetable UI), [`launcher.py`](https://github.com/italo2403/sistema_horario/blob/main/launcher.py) (Desktop launcher), [`static/index.html`](https://github.com/italo2403/sistema_horario/blob/main/static/index.html) (Web page assets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_launcher["Desktop launcher<br/>[launcher.py]"]
end

subgraph group_web["Browser interface"]
  node_ui["Timetable UI<br/>[app.js]"]
  node_web_assets["Web page assets<br/>[index.html]"]
end

subgraph group_scheduling["Scheduling domain"]
  node_records["Academic records<br/>[server.py]"]
  node_availability["Teacher availability<br/>[server.py]"]
  node_periods["Shifts and periods<br/>[server.py]"]
  node_requirements["Lesson requirements<br/>[server.py]"]
  node_validation["Schedule validation<br/>[server.py]"]
  node_proposal["Proposal generator<br/>[server.py]"]
  node_audit["Schedule audit<br/>[server.py]"]
  node_views["Timetable views<br/>[server.py]"]
  node_csv["CSV export<br/>[server.py]"]
end

subgraph group_persistence["Persistence"]
  node_http["HTTP API<br/>[server.py]"]
  node_sqlite[("SQLite database<br/>[server.py]")]
  node_seed[("Seed database")]
end

node_user(("User"))
node_browser(("Browser"))

node_user -->|"starts"| node_launcher
node_launcher -->|"copies if absent"| node_seed
node_launcher -->|"starts server"| node_http
node_launcher -->|"opens local app"| node_browser
node_browser -->|"uses"| node_ui
node_ui -->|"requests API"| node_http
node_http -->|"reads and writes"| node_sqlite
node_http -->|"handles records"| node_records
node_http -.->|"handles availability"| node_availability
node_http -->|"handles periods"| node_periods
node_http -->|"stores requirements"| node_requirements
node_http -->|"validates entries"| node_validation
node_http -->|"builds proposal"| node_proposal
node_http -.->|"serves audit"| node_audit
node_http -->|"serves state"| node_views
node_http -->|"exports CSV"| node_csv
node_ui -->|"requests generation"| node_proposal
node_ui -->|"edits demands"| node_requirements
node_ui -->|"edits periods"| node_periods
node_ui -.->|"shows audit"| node_audit
node_ui -.->|"renders schedules"| node_views
node_ui -.->|"renders page"| node_web_assets

click node_launcher "https://github.com/italo2403/sistema_horario/blob/main/launcher.py"
click node_ui "https://github.com/italo2403/sistema_horario/blob/main/static/app.js"
click node_web_assets "https://github.com/italo2403/sistema_horario/blob/main/static/index.html"
click node_records "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_availability "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_periods "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_requirements "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_validation "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_proposal "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_audit "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_views "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_csv "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_http "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_sqlite "https://github.com/italo2403/sistema_horario/blob/main/server.py"
click node_seed "https://github.com/italo2403/sistema_horario/blob/main/dados_iniciais.sqlite3"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_launcher,node_user,node_browser toneBlue
class node_ui,node_web_assets toneAmber
class node_records,node_availability,node_periods,node_requirements,node_validation,node_proposal,node_audit,node_views,node_csv toneMint
class node_http,node_sqlite,node_seed toneRose
```

## Components

### Desktop runtime

- [Desktop launcher](https://github.com/italo2403/sistema_horario/blob/main/launcher.py): `launcher.py`

### Browser interface

- [Timetable UI](https://github.com/italo2403/sistema_horario/blob/main/static/app.js): `static/app.js`
- [Web page assets](https://github.com/italo2403/sistema_horario/blob/main/static/index.html): `static/index.html`

### Scheduling domain

- [Academic records](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [Teacher availability](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [Shifts and periods](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [Lesson requirements](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [Schedule validation](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [Proposal generator](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [Schedule audit](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [Timetable views](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [CSV export](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`

### Persistence

- [HTTP API](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [SQLite database](https://github.com/italo2403/sistema_horario/blob/main/server.py): `server.py`
- [Seed database](https://github.com/italo2403/sistema_horario/blob/main/dados_iniciais.sqlite3): `dados_iniciais.sqlite3`

### Other components

- **User**
- **Browser**

## Connections

- User → Desktop launcher: starts (evidence: `launcher.py`)
- Desktop launcher → Seed database: copies if absent (evidence: `launcher.py`)
- Desktop launcher → HTTP API: starts server (evidence: `launcher.py`)
- Desktop launcher → Browser: opens local app (evidence: `launcher.py`)
- Browser → Timetable UI: uses (evidence: `static/app.js`)
- Timetable UI → HTTP API: requests API (evidence: `static/app.js`)
- HTTP API → SQLite database: reads and writes (evidence: `server.py`)
- HTTP API → Academic records: handles records (evidence: `server.py`)
- HTTP API → Teacher availability: handles availability (evidence: `server.py`)
- HTTP API → Shifts and periods: handles periods (evidence: `server.py`)
- HTTP API → Lesson requirements: stores requirements (evidence: `server.py`)
- HTTP API → Schedule validation: validates entries (evidence: `server.py`)
- HTTP API → Proposal generator: builds proposal (evidence: `server.py`)
- HTTP API → Schedule audit: serves audit (evidence: `server.py`)
- HTTP API → Timetable views: serves state (evidence: `server.py`)
- HTTP API → CSV export: exports CSV (evidence: `server.py`)
- Timetable UI → Proposal generator: requests generation (evidence: `static/app.js`)
- Timetable UI → Lesson requirements: edits demands (evidence: `static/app.js`)
- Timetable UI → Shifts and periods: edits periods (evidence: `static/app.js`)
- Timetable UI → Schedule audit: shows audit
- Timetable UI → Timetable views: renders schedules
- Timetable UI → Web page assets: renders page
