# phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da architecture

> Architecture diagram of the GitHub repository phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da
- Repository: https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da

## Overview

This is a classroom-exit tracking application: a fingerprint ID (or simulated terminal input) toggles a student’s exit/return state, applying time and repeat-overrun rules and recording the result. Teachers can review students outside, inspect histories, release a restricted student once, and reset counters. The same domain logic is exposed through a web API, with a simulated clock and demo controls. Source excerpts show the principal calls; the HTML page is present in the tree but its client-side behavior was not sampled.

Main entry points: [`api.py`](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/api.py) (Web API), [`main.py`](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/main.py) (Terminal menu), [`banco.py`](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/banco.py) (Database access), [`regras.py`](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/regras.py) (Exit rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_cli["Terminal menu<br/>[main.py]"]
  node_fingerprint["Fingerprint reader<br/>[sensor.py]"]
  node_web_server["Web server launcher<br/>[servidor.py]"]
  node_web_page["Web page<br/>[index.html]"]
  node_api["Web API<br/>[api.py]"]
end

subgraph group_domain["Exit management"]
  node_exit_rules["Exit rules<br/>[regras.py]"]
  node_student_records["Student records<br/>[regras.py]"]
  node_teacher_controls["Teacher controls<br/>[regras.py]"]
  node_exit_history["Exit history<br/>[regras.py]"]
end

subgraph group_storage["Persistence and time"]
  node_database_access["Database access<br/>[banco.py]"]
  node_school_database[("School database<br/>[escola_demo.db]")]
  node_simulation_clock["Simulation clock<br/>[relogio.py]"]
end

node_terminal_user(("Terminal user"))
node_web_user(("Web user"))

node_terminal_user -->|"uses menu"| node_cli
node_cli -->|"reads ID"| node_fingerprint
node_cli -->|"submits ID"| node_exit_rules
node_cli -->|"registers student"| node_student_records
node_cli -->|"requests controls"| node_teacher_controls
node_cli -->|"requests history"| node_exit_history
node_web_server -->|"starts app"| node_api
node_web_user -->|"sends requests"| node_api
node_api -->|"serves page"| node_web_page
node_api -->|"calls rules"| node_exit_rules
node_api -->|"uses clock"| node_simulation_clock
node_api -->|"registers student"| node_student_records
node_api -->|"changes access"| node_teacher_controls
node_api -->|"reads state"| node_exit_history
node_exit_rules -->|"reads and writes"| node_database_access
node_database_access -->|"opens SQLite"| node_school_database
node_cli -->|"initializes schema"| node_database_access
node_api -->|"initializes schema"| node_database_access

click node_cli "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/main.py"
click node_fingerprint "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/sensor.py"
click node_web_server "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/servidor.py"
click node_web_page "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/index.html"
click node_api "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/api.py"
click node_exit_rules "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/regras.py"
click node_student_records "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/regras.py"
click node_teacher_controls "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/regras.py"
click node_exit_history "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/regras.py"
click node_database_access "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/banco.py"
click node_school_database "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/escola_demo.db"
click node_simulation_clock "https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/relogio.py"

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_cli,node_fingerprint,node_web_server,node_web_page,node_api,node_terminal_user,node_web_user toneBlue
class node_exit_rules,node_student_records,node_teacher_controls,node_exit_history toneAmber
class node_database_access,node_school_database,node_simulation_clock toneMint
```

## Components

### User interfaces

- [Terminal menu](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/main.py): `main.py`
- [Fingerprint reader](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/sensor.py): `sensor.py`
- [Web server launcher](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/servidor.py): `servidor.py`
- [Web page](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/index.html): `index.html`
- [Web API](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/api.py): `api.py`

### Exit management

- [Exit rules](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/regras.py): `regras.py`
- [Student records](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/regras.py): `regras.py`
- [Teacher controls](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/regras.py): `regras.py`
- [Exit history](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/regras.py): `regras.py`

### Persistence and time

- [Database access](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/banco.py): `banco.py`
- [School database](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/escola_demo.db): `escola_demo.db`
- [Simulation clock](https://github.com/phenrique65499-lgtm/projeto-de-seguran-a-limite-de-tempo-de-sa-da/blob/main/relogio.py): `relogio.py`

### Other components

- **Terminal user**
- **Web user**

## Connections

- Terminal user → Terminal menu: uses menu (evidence: `main.py`)
- Terminal menu → Fingerprint reader: reads ID (evidence: `main.py`)
- Terminal menu → Exit rules: submits ID (evidence: `main.py`)
- Terminal menu → Student records: registers student (evidence: `main.py`)
- Terminal menu → Teacher controls: requests controls (evidence: `main.py`)
- Terminal menu → Exit history: requests history (evidence: `main.py`)
- Web server launcher → Web API: starts app (evidence: `servidor.py`)
- Web user → Web API: sends requests (evidence: `api.py`)
- Web API → Web page: serves page (evidence: `api.py`)
- Web API → Exit rules: calls rules (evidence: `api.py`)
- Web API → Simulation clock: uses clock (evidence: `api.py`)
- Web API → Student records: registers student (evidence: `api.py`)
- Web API → Teacher controls: changes access (evidence: `api.py`)
- Web API → Exit history: reads state (evidence: `api.py`)
- Exit rules → Database access: reads and writes (evidence: `regras.py`)
- Database access → School database: opens SQLite (evidence: `banco.py`)
- Terminal menu → Database access: initializes schema (evidence: `main.py`)
- Web API → Database access: initializes schema (evidence: `api.py`)
