# libuna2005/tabulation-system architecture

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

- Interactive diagram: https://gitdiagram.com/libuna2005/tabulation-system
- Repository: https://github.com/libuna2005/tabulation-system

## Overview

This is a PHP/MySQL tabulation system for school competitions. Its public workflow serves live scoreboard data, computes section and overall totals and ranks, then displays standings and a winners reveal. Separate admin and secretary workflows manage competition setup and encode scores; the judge panel records criterion-based event scores. The source excerpts show the scoreboard and shared scoring logic, but not the secretary implementation or the full admin/API query flow, so those links are limited to documented or visible relationships.

Main entry points: [`lib.php`](https://github.com/libuna2005/tabulation-system/blob/main/lib.php) (Database and helpers), [`index.php`](https://github.com/libuna2005/tabulation-system/blob/main/index.php) (Live scoreboard), [`admin.php`](https://github.com/libuna2005/tabulation-system/blob/main/admin.php) (Admin management), [`login.php`](https://github.com/libuna2005/tabulation-system/blob/main/login.php) (Secretary login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public Results"]
  node_scoreboard["Live scoreboard<br/>[index.php]"]
  node_score_api["Results API<br/>[api.php]"]
end

subgraph group_scoring["Scoring and Tabulation"]
  node_tabulation["Totals and ranking<br/>[lib.php]"]
  node_judge["Judge scoring<br/>[judge.php]"]
  node_secretary["Secretary encoding<br/>[secretary.php]"]
end

subgraph group_operations["Competition Operations"]
  node_admin["Admin management<br/>[admin.php]"]
  node_login["Secretary login<br/>[login.php]"]
  node_installer["Competition setup<br/>[install.php]"]
  node_cultural_update["Cultural game setup"]
  node_sports_split["Frisbee game update<br/>[split_frisbee.php]"]
  node_photo_split["Photo game update<br/>[split_photo.php]"]
end

subgraph group_infra["Shared Infrastructure"]
  node_shared["Database and helpers<br/>[lib.php]"]
  node_config["Database configuration<br/>[config.php]"]
end

node_viewer(("Scoreboard viewer"))
node_mysql[("MySQL database")]

node_viewer -->|"opens"| node_scoreboard
node_scoreboard -->|"fetches results"| node_score_api
node_score_api -->|"requests board data"| node_tabulation
node_tabulation -.->|"returns ranked data"| node_scoreboard
node_judge -->|"writes scores"| node_mysql
node_secretary -.->|"encodes results"| node_mysql
node_admin -->|"uses helpers"| node_shared
node_admin -->|"manages competitions"| node_mysql
node_login -->|"uses helpers"| node_shared
node_login -->|"redirects on login"| node_secretary
node_installer -->|"uses helpers"| node_shared
node_installer -->|"creates scoring tables"| node_mysql
node_cultural_update -->|"replaces cultural games"| node_mysql
node_sports_split -->|"updates sports games"| node_mysql
node_photo_split -->|"updates cultural games"| node_mysql
node_shared -->|"loads settings"| node_config
node_shared -->|"queries data"| node_mysql

click node_scoreboard "https://github.com/libuna2005/tabulation-system/blob/main/index.php"
click node_score_api "https://github.com/libuna2005/tabulation-system/blob/main/api.php"
click node_tabulation "https://github.com/libuna2005/tabulation-system/blob/main/lib.php"
click node_judge "https://github.com/libuna2005/tabulation-system/blob/main/judge.php"
click node_secretary "https://github.com/libuna2005/tabulation-system/blob/main/secretary.php"
click node_admin "https://github.com/libuna2005/tabulation-system/blob/main/admin.php"
click node_login "https://github.com/libuna2005/tabulation-system/blob/main/login.php"
click node_installer "https://github.com/libuna2005/tabulation-system/blob/main/install.php"
click node_cultural_update "https://github.com/libuna2005/tabulation-system/blob/main/update_cultural.php"
click node_sports_split "https://github.com/libuna2005/tabulation-system/blob/main/split_frisbee.php"
click node_photo_split "https://github.com/libuna2005/tabulation-system/blob/main/split_photo.php"
click node_shared "https://github.com/libuna2005/tabulation-system/blob/main/lib.php"
click node_config "https://github.com/libuna2005/tabulation-system/blob/main/config.php"

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_scoreboard,node_score_api,node_viewer toneBlue
class node_tabulation,node_judge,node_secretary,node_mysql toneAmber
class node_admin,node_login,node_installer,node_cultural_update,node_sports_split,node_photo_split toneMint
class node_shared,node_config toneRose
```

## Components

### Public Results

- [Live scoreboard](https://github.com/libuna2005/tabulation-system/blob/main/index.php): `index.php`
- [Results API](https://github.com/libuna2005/tabulation-system/blob/main/api.php): `api.php`

### Scoring and Tabulation

- [Totals and ranking](https://github.com/libuna2005/tabulation-system/blob/main/lib.php): `lib.php`
- [Judge scoring](https://github.com/libuna2005/tabulation-system/blob/main/judge.php): `judge.php`
- [Secretary encoding](https://github.com/libuna2005/tabulation-system/blob/main/secretary.php): `secretary.php`

### Competition Operations

- [Admin management](https://github.com/libuna2005/tabulation-system/blob/main/admin.php): `admin.php`
- [Secretary login](https://github.com/libuna2005/tabulation-system/blob/main/login.php): `login.php`
- [Competition setup](https://github.com/libuna2005/tabulation-system/blob/main/install.php): `install.php`
- [Cultural game setup](https://github.com/libuna2005/tabulation-system/blob/main/update_cultural.php): `update_cultural.php`
- [Frisbee game update](https://github.com/libuna2005/tabulation-system/blob/main/split_frisbee.php): `split_frisbee.php`
- [Photo game update](https://github.com/libuna2005/tabulation-system/blob/main/split_photo.php): `split_photo.php`

### Shared Infrastructure

- [Database and helpers](https://github.com/libuna2005/tabulation-system/blob/main/lib.php): `lib.php`
- [Database configuration](https://github.com/libuna2005/tabulation-system/blob/main/config.php): `config.php`

### Other components

- **Scoreboard viewer**
- **MySQL database**

## Connections

- Scoreboard viewer → Live scoreboard: opens (evidence: `README.md`)
- Live scoreboard → Results API: fetches results (evidence: `index.php`)
- Results API → Totals and ranking: requests board data (evidence: `api.php`)
- Totals and ranking → Live scoreboard: returns ranked data (evidence: `index.php`)
- Judge scoring → MySQL database: writes scores (evidence: `judge.php`)
- Secretary encoding → MySQL database: encodes results
- Admin management → Database and helpers: uses helpers (evidence: `admin.php`)
- Admin management → MySQL database: manages competitions (evidence: `admin.php`)
- Secretary login → Database and helpers: uses helpers (evidence: `login.php`)
- Secretary login → Secretary encoding: redirects on login (evidence: `login.php`)
- Competition setup → Database and helpers: uses helpers (evidence: `install.php`)
- Competition setup → MySQL database: creates scoring tables (evidence: `install.php`)
- Cultural game setup → MySQL database: replaces cultural games (evidence: `update_cultural.php`)
- Frisbee game update → MySQL database: updates sports games (evidence: `split_frisbee.php`)
- Photo game update → MySQL database: updates cultural games (evidence: `split_photo.php`)
- Database and helpers → Database configuration: loads settings (evidence: `lib.php`)
- Database and helpers → MySQL database: queries data (evidence: `lib.php`)
