# markamper04/dnsc-eclearance-hub architecture

> Architecture diagram of the GitHub repository markamper04/dnsc-eclearance-hub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/markamper04/dnsc-eclearance-hub
- Repository: https://github.com/markamper04/dnsc-eclearance-hub

## Overview

DNSC e-Clearance Hub combines a role-based web hub with scheduled drop-folder ingestion. Students sign in to view office clearance statuses and deadlines, then obtain and verify a signed QR slip once cleared; staff update office statuses, while administrators review audit data and reports. Separately, automation imports signed Library XML and Accounting CSV data, updates clearance records, archives or quarantines files, and produces HOLD summaries. The README documents Registrar, Student Affairs, and Philippine-holiday integrations. Some endpoint and import details are unsampled, so only documented or excerpt-supported relationships are shown.

Main entry points: [`app.py`](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py) (Hub API), [`automate.py`](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/automate.py) (Import automation), [`schema.sql`](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/schema.sql) (Clearance database), [`static/app.js`](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/static/app.js) (PWA interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hub["Clearance Hub"]
  node_pwa["PWA interface<br/>[app.js]"]
  node_api["Hub API<br/>[app.py]"]
  node_auth["Authentication and roles<br/>[app.py]"]
  node_clearance["Clearance status<br/>[app.py]"]
  node_slips["QR slips and verification<br/>[app.py]"]
  node_reports["Admin reports and audit<br/>[app.py]"]
end

subgraph group_ingestion["Data Ingestion"]
  node_automation["Import automation<br/>[automate.py]"]
  node_library_import["Library XML import<br/>[importers.py]"]
  node_accounting_import["Accounting CSV import<br/>[importers.py]"]
  node_manifest_security["Manifest validation<br/>[importers.py]"]
  node_hold_summary["Daily HOLD summary<br/>[automate.py]"]
end

subgraph group_integrations["External Integrations"]
  node_deadline["Deadline calculation<br/>[clients.py]"]
  node_registrar_client["Registrar client<br/>[clients.py]"]
end

subgraph group_state["Persistence"]
  node_sqlite[("Clearance database<br/>[schema.sql]")]
end

node_student_staff_admin(("Hub users"))
node_registrar_api["Registrar API"]
node_holiday_api["Nager.Date holidays"]
node_drop_folder["Signed drop files"]

node_student_staff_admin -->|"uses"| node_pwa
node_pwa -->|"requests"| node_api
node_api -->|"checks roles"| node_auth
node_api -->|"reads and writes"| node_sqlite
node_api -->|"serves status"| node_clearance
node_api -->|"issues and verifies"| node_slips
node_api -->|"serves reports"| node_reports
node_api -->|"computes deadline"| node_deadline
node_deadline -->|"fetches holidays"| node_holiday_api
node_automation -->|"validates manifests"| node_manifest_security
node_automation -->|"invokes importer"| node_library_import
node_automation -->|"invokes importer"| node_accounting_import
node_automation -->|"reads and writes"| node_sqlite
node_automation -->|"generates report"| node_hold_summary
node_drop_folder -.->|"provides files"| node_automation
node_library_import -->|"upserts clearance"| node_sqlite
node_accounting_import -->|"upserts clearance"| node_sqlite
node_registrar_client -->|"fetches students"| node_registrar_api
node_api -.->|"syncs student data"| node_registrar_client

click node_pwa "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/static/app.js"
click node_api "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py"
click node_auth "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py"
click node_clearance "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py"
click node_slips "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py"
click node_reports "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py"
click node_deadline "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/clients.py"
click node_automation "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/automate.py"
click node_library_import "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/importers.py"
click node_accounting_import "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/importers.py"
click node_manifest_security "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/importers.py"
click node_hold_summary "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/automate.py"
click node_registrar_client "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/clients.py"
click node_sqlite "https://github.com/markamper04/dnsc-eclearance-hub/blob/main/schema.sql"

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_pwa,node_api,node_auth,node_clearance,node_slips,node_reports,node_student_staff_admin toneBlue
class node_automation,node_library_import,node_accounting_import,node_manifest_security,node_hold_summary toneAmber
class node_deadline,node_registrar_client,node_registrar_api toneMint
class node_sqlite toneRose
class node_holiday_api,node_drop_folder toneIndigo
```

## Components

### Clearance Hub

- [PWA interface](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/static/app.js): `static/app.js`
- [Hub API](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py): `app.py`
- [Authentication and roles](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py): `app.py`
- [Clearance status](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py): `app.py`
- [QR slips and verification](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py): `app.py`
- [Admin reports and audit](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/app.py): `app.py`

### Data Ingestion

- [Import automation](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/automate.py): `automate.py`
- [Library XML import](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/importers.py): `importers.py`
- [Accounting CSV import](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/importers.py): `importers.py`
- [Manifest validation](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/importers.py): `importers.py`
- [Daily HOLD summary](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/automate.py): `automate.py`

### External Integrations

- [Deadline calculation](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/clients.py): `clients.py`
- [Registrar client](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/clients.py): `clients.py`

### Persistence

- [Clearance database](https://github.com/markamper04/dnsc-eclearance-hub/blob/main/schema.sql): `schema.sql`

### Other components

- **Hub users**
- **Registrar API**
- **Nager.Date holidays**
- **Signed drop files**

## Connections

- Hub users → PWA interface: uses (evidence: `README.md`)
- PWA interface → Hub API: requests (evidence: `static/app.js`)
- Hub API → Authentication and roles: checks roles (evidence: `app.py`)
- Hub API → Clearance database: reads and writes (evidence: `app.py`)
- Hub API → Clearance status: serves status (evidence: `app.py`)
- Hub API → QR slips and verification: issues and verifies (evidence: `app.py`)
- Hub API → Admin reports and audit: serves reports (evidence: `app.py`)
- Hub API → Deadline calculation: computes deadline (evidence: `app.py`)
- Deadline calculation → Nager.Date holidays: fetches holidays (evidence: `clients.py`)
- Import automation → Manifest validation: validates manifests (evidence: `automate.py`)
- Import automation → Library XML import: invokes importer (evidence: `automate.py`)
- Import automation → Accounting CSV import: invokes importer (evidence: `automate.py`)
- Import automation → Clearance database: reads and writes (evidence: `automate.py`)
- Import automation → Daily HOLD summary: generates report (evidence: `automate.py`)
- Signed drop files → Import automation: provides files (evidence: `README.md`)
- Library XML import → Clearance database: upserts clearance (evidence: `importers.py`)
- Accounting CSV import → Clearance database: upserts clearance (evidence: `importers.py`)
- Registrar client → Registrar API: fetches students (evidence: `clients.py`)
- Hub API → Registrar client: syncs student data (evidence: `README.md`)
