# ranuramadan/uas-gen-ai architecture

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

- Interactive diagram: https://gitdiagram.com/ranuramadan/uas-gen-ai
- Repository: https://github.com/ranuramadan/uas-gen-ai

## Overview

SIGAP Kota is a citizen-reporting chatbot and staff dashboard. Residents chat to supply five required complaint details; Gemini classifies a complete report and returns a confirmation summary, which the resident can submit. Residents can look up report status by phone, while staff use the demo admin dashboard to review reports and change their status. Evidence is limited to the README and sampled files; frontend-to-API links are shown where fetch calls are excerpted, while admin detail navigation is not mapped because its implementation was not sampled.

Main entry points: [`Backend/routes/progressRoutes.js`](https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/routes/progressRoutes.js) (Progress endpoints), [`Backend/firebase.js`](https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/firebase.js) (Report operations), [`Frontend/js/app.js`](https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/js/app.js) (Complaint chat), [`Backend/gemini.js`](https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/gemini.js) (Complaint analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_resident["Resident reporting"]
  node_chatui["Complaint chat<br/>[app.js]"]
  node_review["Summary and submission<br/>[app.js]"]
  node_history["Resident history lookup<br/>[app.js]"]
end

subgraph group_backend["API and AI"]
  node_chatapi["Chat endpoint<br/>[chatRoutes.js]"]
  node_analysis["Complaint analysis<br/>[gemini.js]"]
end

subgraph group_reports["Report management"]
  node_progressapi["Progress endpoints<br/>[progressRoutes.js]"]
  node_reportdata["Report operations<br/>[firebase.js]"]
  node_sqlite[("SQLite reports<br/>[db.js]")]
end

subgraph group_staff["Staff dashboard"]
  node_dashboard["Admin dashboard<br/>[admin.js]"]
  node_adminpage["Admin report detail<br/>[hasil.html]"]
end

node_citizen(("Resident"))
node_gemini{{"Gemini API"}}
node_staff(("Staff"))

node_citizen -->|"submits details"| node_chatui
node_chatui -->|"sends chat"| node_chatapi
node_chatapi -->|"dispatches to"| node_analysis
node_analysis -->|"analyzes with"| node_gemini
node_analysis -->|"returns analysis"| node_chatapi
node_chatui -->|"renders summary"| node_review
node_citizen -->|"confirms report"| node_review
node_review -->|"submits report"| node_progressapi
node_progressapi -->|"creates report"| node_reportdata
node_progressapi -->|"lists reports"| node_reportdata
node_progressapi -->|"updates status"| node_reportdata
node_reportdata -->|"reads and writes"| node_sqlite
node_citizen -->|"looks up status"| node_history
node_history -->|"requests by phone"| node_progressapi
node_staff -->|"reviews reports"| node_dashboard
node_dashboard -->|"loads and updates"| node_progressapi
node_dashboard -->|"opens details"| node_adminpage

click node_chatui "https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/js/app.js"
click node_chatapi "https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/routes/chatRoutes.js"
click node_analysis "https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/gemini.js"
click node_review "https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/js/app.js"
click node_progressapi "https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/routes/progressRoutes.js"
click node_reportdata "https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/firebase.js"
click node_sqlite "https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/db.js"
click node_history "https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/js/app.js"
click node_dashboard "https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/js/admin.js"
click node_adminpage "https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/hasil.html"

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_chatui,node_review,node_history toneBlue
class node_chatapi,node_analysis toneAmber
class node_progressapi,node_reportdata,node_sqlite,node_gemini toneMint
class node_dashboard,node_adminpage toneRose
class node_citizen,node_staff toneIndigo
```

## Components

### Resident reporting

- [Complaint chat](https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/js/app.js): `Frontend/js/app.js`
- [Summary and submission](https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/js/app.js): `Frontend/js/app.js`
- [Resident history lookup](https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/js/app.js): `Frontend/js/app.js`

### API and AI

- [Chat endpoint](https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/routes/chatRoutes.js): `Backend/routes/chatRoutes.js`
- [Complaint analysis](https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/gemini.js): `Backend/gemini.js`

### Report management

- [Progress endpoints](https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/routes/progressRoutes.js): `Backend/routes/progressRoutes.js`
- [Report operations](https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/firebase.js): `Backend/firebase.js`
- [SQLite reports](https://github.com/ranuramadan/uas-gen-ai/blob/main/Backend/db.js): `Backend/db.js`

### Staff dashboard

- [Admin dashboard](https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/js/admin.js): `Frontend/js/admin.js`
- [Admin report detail](https://github.com/ranuramadan/uas-gen-ai/blob/main/Frontend/hasil.html): `Frontend/hasil.html`

### Other components

- **Resident**
- **Gemini API**
- **Staff**

## Connections

- Resident → Complaint chat: submits details (evidence: `README.md`)
- Complaint chat → Chat endpoint: sends chat (evidence: `Frontend/js/app.js`)
- Chat endpoint → Complaint analysis: dispatches to (evidence: `Backend/routes/chatRoutes.js`)
- Complaint analysis → Gemini API: analyzes with (evidence: `Backend/gemini.js`)
- Complaint analysis → Chat endpoint: returns analysis (evidence: `Backend/gemini.js`)
- Complaint chat → Summary and submission: renders summary (evidence: `Frontend/js/app.js`)
- Resident → Summary and submission: confirms report (evidence: `README.md`)
- Summary and submission → Progress endpoints: submits report (evidence: `Frontend/js/app.js`)
- Progress endpoints → Report operations: creates report (evidence: `Backend/routes/progressRoutes.js`)
- Progress endpoints → Report operations: lists reports (evidence: `Backend/routes/progressRoutes.js`)
- Progress endpoints → Report operations: updates status (evidence: `Backend/routes/progressRoutes.js`)
- Report operations → SQLite reports: reads and writes (evidence: `Backend/firebase.js`)
- Resident → Resident history lookup: looks up status (evidence: `README.md`)
- Resident history lookup → Progress endpoints: requests by phone (evidence: `Frontend/js/app.js`)
- Staff → Admin dashboard: reviews reports (evidence: `README.md`)
- Admin dashboard → Progress endpoints: loads and updates (evidence: `README.md`)
- Admin dashboard → Admin report detail: opens details (evidence: `Frontend/js/admin.js`)
