# vkg6835/dotslash architecture

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

- Interactive diagram: https://gitdiagram.com/vkg6835/dotslash
- Repository: https://github.com/vkg6835/dotslash

## Overview

RoadLens combines an edge road-damage detection and sync concept with a municipal command dashboard and citizen transparency portal. The principal workflow is fleet detections entering incident ingestion, becoming prioritized/map-visible records, then being exported for repair and marked complete through a Sheets webhook. README capabilities also include fleet status, crack deadlines, traffic context, and ward health. Several endpoints and integrations are documented or indexed but not excerpted; those links are included only where the README or an excerpt supports them.

Main entry points: [`src/lib/dataStore.ts`](https://github.com/vkg6835/dotslash/blob/main/src/lib/dataStore.ts) (Incident and fleet data), [`src/app/dashboard/page.tsx`](https://github.com/vkg6835/dotslash/blob/main/src/app/dashboard/page.tsx) (Command dashboard), [`src/app/page.tsx`](https://github.com/vkg6835/dotslash/blob/main/src/app/page.tsx) (Citizen portal), [`src/lib/apiClient.ts`](https://github.com/vkg6835/dotslash/blob/main/src/lib/apiClient.ts) (Incident queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Edge detection"]
  node_edge_detector["YOLO detection<br/>[yolo_edge_sim.py]"]
  node_edge_batch["Edge batching<br/>[edgeSimulator.ts]"]
end

subgraph group_backend["Incident services"]
  node_ingest["Detection ingest<br/>[route.ts]"]
  node_incident_store[("Incident and fleet data<br/>[dataStore.ts]")]
  node_ingest_pipeline["Cloud ingest<br/>[route.ts]"]
  node_incident_api["Incident queries<br/>[apiClient.ts]"]
  node_traffic["Traffic context<br/>[route.ts]"]
  node_crack_queue["Crack deadlines<br/>[route.ts]"]
  node_crack_schedule["Crack scheduling<br/>[route.ts]"]
  node_triage["Priority triage<br/>[route.ts]"]
  node_fleet_status["Fleet status<br/>[route.ts]"]
  node_repair_hook["Repair confirmation<br/>[route.ts]"]
  node_public_map["Public incident map<br/>[route.ts]"]
  node_ward_health["Ward health scores<br/>[route.ts]"]
end

subgraph group_operations["Municipal operations"]
  node_dashboard["Command dashboard<br/>[page.tsx]"]
  node_map["Incident map<br/>[MapInner.tsx]"]
  node_filters["Dashboard filters<br/>[AreaFilter.tsx]"]
  node_realtime["Realtime updates"]
  node_login["Staff authentication<br/>[actions.ts]"]
  node_sheets_actions["Repair exports<br/>[sheets.ts]"]
end

subgraph group_public["Public portal"]
  node_public_page["Citizen portal<br/>[page.tsx]"]
  node_public_search["Area search"]
end

subgraph group_integrations["External integrations"]
  node_sheets_service["Sheets connector<br/>[sheetsService.ts]"]
  node_sheets["Google Sheets"]
  node_supabase[("Supabase database")]
  node_nominatim["Nominatim geocoder"]
end

node_fleet(("Transit fleet"))

node_fleet -->|"captures roads"| node_edge_detector
node_edge_detector -.->|"batches detections"| node_edge_batch
node_edge_batch -.->|"uploads detections"| node_ingest
node_ingest -->|"merges records"| node_incident_store
node_ingest_pipeline -.->|"ingests records"| node_incident_store
node_ingest_pipeline -.->|"geocodes locations"| node_nominatim
node_incident_store -->|"serves incident data"| node_incident_api
node_incident_api -->|"queries tables"| node_supabase
node_dashboard -->|"fetches records"| node_incident_api
node_dashboard -->|"renders incidents"| node_map
node_dashboard -->|"renders filters"| node_filters
node_dashboard -->|"subscribes updates"| node_realtime
node_dashboard -->|"exports repairs"| node_sheets_actions
node_dashboard -.->|"shows priorities"| node_triage
node_dashboard -.->|"shows crack queue"| node_crack_queue
node_dashboard -.->|"shows fleet health"| node_fleet_status
node_triage -->|"ranks incidents"| node_incident_store
node_crack_queue -->|"filters cracks"| node_incident_store
node_crack_schedule -->|"updates deadline"| node_incident_store
node_fleet_status -->|"reads telemetry"| node_incident_store
node_traffic -.->|"uses traffic data"| node_incident_store
node_sheets_actions -->|"exports incidents"| node_sheets_service
node_sheets_service -->|"appends rows"| node_sheets
node_sheets -->|"posts completion"| node_repair_hook
node_repair_hook -->|"marks repaired"| node_incident_store
node_public_page -->|"renders search"| node_public_search
node_public_page -.->|"loads public data"| node_incident_api
node_public_page -.->|"displays incidents"| node_public_map
node_public_page -.->|"shows ward health"| node_ward_health
node_public_map -.->|"reads incidents"| node_incident_store
node_ward_health -.->|"derives health"| node_incident_store
node_login -->|"authenticates staff"| node_supabase

click node_edge_detector "https://github.com/vkg6835/dotslash/blob/main/src/scripts/yolo_edge_sim.py"
click node_edge_batch "https://github.com/vkg6835/dotslash/blob/main/src/scripts/edgeSimulator.ts"
click node_ingest "https://github.com/vkg6835/dotslash/blob/main/src/app/api/incidents/ingest/route.ts"
click node_incident_store "https://github.com/vkg6835/dotslash/blob/main/src/lib/dataStore.ts"
click node_ingest_pipeline "https://github.com/vkg6835/dotslash/blob/main/src/app/api/ingest/route.ts"
click node_incident_api "https://github.com/vkg6835/dotslash/blob/main/src/lib/apiClient.ts"
click node_traffic "https://github.com/vkg6835/dotslash/blob/main/src/app/api/traffic/route.ts"
click node_crack_queue "https://github.com/vkg6835/dotslash/blob/main/src/app/api/cracks/active/route.ts"
click node_crack_schedule "https://github.com/vkg6835/dotslash/blob/main/src/app/api/cracks/%5Bid%5D/schedule/route.ts"
click node_triage "https://github.com/vkg6835/dotslash/blob/main/src/app/api/incidents/triage/route.ts"
click node_fleet_status "https://github.com/vkg6835/dotslash/blob/main/src/app/api/fleet/status/route.ts"
click node_dashboard "https://github.com/vkg6835/dotslash/blob/main/src/app/dashboard/page.tsx"
click node_map "https://github.com/vkg6835/dotslash/blob/main/src/components/MapInner.tsx"
click node_filters "https://github.com/vkg6835/dotslash/blob/main/src/components/AreaFilter.tsx"
click node_realtime "https://github.com/vkg6835/dotslash/blob/main/src/components/RealtimeSubscriber.tsx"
click node_login "https://github.com/vkg6835/dotslash/blob/main/src/app/login/actions.ts"
click node_sheets_actions "https://github.com/vkg6835/dotslash/blob/main/src/app/actions/sheets.ts"
click node_sheets_service "https://github.com/vkg6835/dotslash/blob/main/src/lib/sheetsService.ts"
click node_repair_hook "https://github.com/vkg6835/dotslash/blob/main/src/app/api/webhooks/sheets/route.ts"
click node_public_page "https://github.com/vkg6835/dotslash/blob/main/src/app/page.tsx"
click node_public_search "https://github.com/vkg6835/dotslash/blob/main/src/components/PublicSearchBar.tsx"
click node_public_map "https://github.com/vkg6835/dotslash/blob/main/src/app/api/public/incidents/map/route.ts"
click node_ward_health "https://github.com/vkg6835/dotslash/blob/main/src/app/api/public/wards/health/route.ts"

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_edge_detector,node_edge_batch toneBlue
class node_ingest,node_incident_store,node_ingest_pipeline,node_incident_api,node_traffic,node_crack_queue,node_crack_schedule,node_triage,node_fleet_status,node_repair_hook,node_public_map,node_ward_health toneAmber
class node_dashboard,node_map,node_filters,node_realtime,node_login,node_sheets_actions toneMint
class node_public_page,node_public_search toneRose
class node_sheets_service,node_sheets,node_supabase,node_nominatim,node_fleet toneIndigo
```

## Components

### Edge detection

- [YOLO detection](https://github.com/vkg6835/dotslash/blob/main/src/scripts/yolo_edge_sim.py): `src/scripts/yolo_edge_sim.py`
- [Edge batching](https://github.com/vkg6835/dotslash/blob/main/src/scripts/edgeSimulator.ts): `src/scripts/edgeSimulator.ts`

### Incident services

- [Detection ingest](https://github.com/vkg6835/dotslash/blob/main/src/app/api/incidents/ingest/route.ts): `src/app/api/incidents/ingest/route.ts`
- [Incident and fleet data](https://github.com/vkg6835/dotslash/blob/main/src/lib/dataStore.ts): `src/lib/dataStore.ts`
- [Cloud ingest](https://github.com/vkg6835/dotslash/blob/main/src/app/api/ingest/route.ts): `src/app/api/ingest/route.ts`
- [Incident queries](https://github.com/vkg6835/dotslash/blob/main/src/lib/apiClient.ts): `src/lib/apiClient.ts`
- [Traffic context](https://github.com/vkg6835/dotslash/blob/main/src/app/api/traffic/route.ts): `src/app/api/traffic/route.ts`
- [Crack deadlines](https://github.com/vkg6835/dotslash/blob/main/src/app/api/cracks/active/route.ts): `src/app/api/cracks/active/route.ts`
- [Crack scheduling](https://github.com/vkg6835/dotslash/blob/main/src/app/api/cracks/%5Bid%5D/schedule/route.ts): `src/app/api/cracks/[id]/schedule/route.ts`
- [Priority triage](https://github.com/vkg6835/dotslash/blob/main/src/app/api/incidents/triage/route.ts): `src/app/api/incidents/triage/route.ts`
- [Fleet status](https://github.com/vkg6835/dotslash/blob/main/src/app/api/fleet/status/route.ts): `src/app/api/fleet/status/route.ts`
- [Repair confirmation](https://github.com/vkg6835/dotslash/blob/main/src/app/api/webhooks/sheets/route.ts): `src/app/api/webhooks/sheets/route.ts`
- [Public incident map](https://github.com/vkg6835/dotslash/blob/main/src/app/api/public/incidents/map/route.ts): `src/app/api/public/incidents/map/route.ts`
- [Ward health scores](https://github.com/vkg6835/dotslash/blob/main/src/app/api/public/wards/health/route.ts): `src/app/api/public/wards/health/route.ts`

### Municipal operations

- [Command dashboard](https://github.com/vkg6835/dotslash/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Incident map](https://github.com/vkg6835/dotslash/blob/main/src/components/MapInner.tsx): `src/components/MapInner.tsx`
- [Dashboard filters](https://github.com/vkg6835/dotslash/blob/main/src/components/AreaFilter.tsx): `src/components/AreaFilter.tsx`
- [Realtime updates](https://github.com/vkg6835/dotslash/blob/main/src/components/RealtimeSubscriber.tsx): `src/components/RealtimeSubscriber.tsx`
- [Staff authentication](https://github.com/vkg6835/dotslash/blob/main/src/app/login/actions.ts): `src/app/login/actions.ts`
- [Repair exports](https://github.com/vkg6835/dotslash/blob/main/src/app/actions/sheets.ts): `src/app/actions/sheets.ts`

### Public portal

- [Citizen portal](https://github.com/vkg6835/dotslash/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Area search](https://github.com/vkg6835/dotslash/blob/main/src/components/PublicSearchBar.tsx): `src/components/PublicSearchBar.tsx`

### External integrations

- [Sheets connector](https://github.com/vkg6835/dotslash/blob/main/src/lib/sheetsService.ts): `src/lib/sheetsService.ts`
- **Google Sheets**
- **Supabase database**
- **Nominatim geocoder**

### Other components

- **Transit fleet**

## Connections

- Transit fleet → YOLO detection: captures roads
- YOLO detection → Edge batching: batches detections
- Edge batching → Detection ingest: uploads detections
- Detection ingest → Incident and fleet data: merges records (evidence: `src/app/api/incidents/ingest/route.ts`)
- Cloud ingest → Incident and fleet data: ingests records
- Cloud ingest → Nominatim geocoder: geocodes locations
- Incident and fleet data → Incident queries: serves incident data (evidence: `src/lib/apiClient.ts`)
- Incident queries → Supabase database: queries tables (evidence: `src/lib/apiClient.ts`)
- Command dashboard → Incident queries: fetches records (evidence: `src/app/dashboard/page.tsx`)
- Command dashboard → Incident map: renders incidents (evidence: `src/app/dashboard/page.tsx`)
- Command dashboard → Dashboard filters: renders filters (evidence: `src/app/dashboard/page.tsx`)
- Command dashboard → Realtime updates: subscribes updates (evidence: `src/app/dashboard/page.tsx`)
- Command dashboard → Repair exports: exports repairs (evidence: `src/app/dashboard/page.tsx`)
- Command dashboard → Priority triage: shows priorities
- Command dashboard → Crack deadlines: shows crack queue
- Command dashboard → Fleet status: shows fleet health
- Priority triage → Incident and fleet data: ranks incidents (evidence: `src/app/api/incidents/triage/route.ts`)
- Crack deadlines → Incident and fleet data: filters cracks (evidence: `src/app/api/cracks/active/route.ts`)
- Crack scheduling → Incident and fleet data: updates deadline (evidence: `src/app/api/cracks/[id]/schedule/route.ts`)
- Fleet status → Incident and fleet data: reads telemetry (evidence: `src/app/api/fleet/status/route.ts`)
- Traffic context → Incident and fleet data: uses traffic data
- Repair exports → Sheets connector: exports incidents (evidence: `src/app/actions/sheets.ts`)
- Sheets connector → Google Sheets: appends rows (evidence: `src/lib/sheetsService.ts`)
- Google Sheets → Repair confirmation: posts completion (evidence: `src/app/api/webhooks/sheets/route.ts`)
- Repair confirmation → Incident and fleet data: marks repaired (evidence: `src/app/api/webhooks/sheets/route.ts`)
- Citizen portal → Area search: renders search (evidence: `src/app/page.tsx`)
- Citizen portal → Incident queries: loads public data (evidence: `src/app/page.tsx`)
- Citizen portal → Public incident map: displays incidents
- Citizen portal → Ward health scores: shows ward health
- Public incident map → Incident and fleet data: reads incidents (evidence: `src/app/api/public/incidents/map/route.ts`)
- Ward health scores → Incident and fleet data: derives health
- Staff authentication → Supabase database: authenticates staff (evidence: `src/app/login/actions.ts`)
