# saumitra2k4/cityflo-product-engineer-assignment architecture

> Architecture diagram of the GitHub repository saumitra2k4/cityflo-product-engineer-assignment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saumitra2k4/cityflo-product-engineer-assignment
- Repository: https://github.com/saumitra2k4/cityflo-product-engineer-assignment

## Overview

Cityflo morning rider triage is a non-persistent web tool for a support agent: it turns a fixed feedback snapshot into an auditable harm-first review, and separately previews one new message without adding it to the batch. The batch path validates and reconciles rows before ranking issues; the live path validates input, checks safety, and returns a human-review preview. Language judgement is advisory and may fall back deterministically. The README documents these capabilities; sampled source excerpts do not show every server dispatch, so only documented or evidenced wiring is included.

Main entry points: [`server.py`](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/server.py) (HTTP server), [`app/service.py`](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/service.py) (Triage service), [`static/app.js`](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/static/app.js) (Triage interface), [`app/judge.py`](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/judge.py) (Batch language judge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_browser["Triage interface<br/>[app.js]"]
  node_server["HTTP server<br/>[server.py]"]
end

subgraph group_batch["Batch triage"]
  node_service["Triage service<br/>[service.py]"]
  node_intake["Row intake<br/>[intake.py]"]
  node_domain["Record types<br/>[domain.py]"]
  node_triage["Ranking and ledger<br/>[triage.py]"]
end

subgraph group_live["Live preview"]
  node_safety["Safety assessment<br/>[safety.py]"]
  node_live_module["Live evaluation<br/>[live.py]"]
end

subgraph group_judgment["Language judgment"]
  node_judge["Batch language judge<br/>[judge.py]"]
end

subgraph group_inputs["Data and services"]
  node_snapshot["Feedback snapshot<br/>[feedback.csv]"]
  node_replay["Language replay"]
  node_batch_provider["Configured language service"]
  node_openai["OpenAI service"]
end

node_agent(("Support agent"))

node_agent -->|"uses"| node_browser
node_browser -->|"requests triage"| node_server
node_server -->|"returns API data"| node_browser
node_server -->|"requests batch triage"| node_service
node_snapshot -->|"loads rows"| node_intake
node_service -->|"ingests rows"| node_intake
node_service -->|"configures judge"| node_judge
node_service -->|"builds result"| node_triage
node_intake -->|"creates records"| node_domain
node_triage -->|"requests advisory checks"| node_judge
node_triage -->|"serializes records"| node_domain
node_judge -.->|"reads replays"| node_replay
node_judge -.->|"requests judgment"| node_batch_provider
node_browser -->|"submits message"| node_server
node_server -->|"evaluates message"| node_live_module
node_live_module -->|"assesses safety"| node_safety
node_live_module -.->|"requests judgment"| node_openai

click node_browser "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/static/app.js"
click node_server "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/server.py"
click node_service "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/service.py"
click node_snapshot "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/data/feedback.csv"
click node_intake "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/intake.py"
click node_domain "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/domain.py"
click node_triage "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/triage.py"
click node_safety "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/safety.py"
click node_judge "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/judge.py"
click node_replay "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/data/language_replay.json"
click node_live_module "https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/live.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_browser,node_server toneBlue
class node_service,node_intake,node_domain,node_triage toneAmber
class node_safety,node_live_module toneMint
class node_judge toneRose
class node_snapshot,node_replay,node_batch_provider,node_openai,node_agent toneIndigo
```

## Components

### Web interface

- [Triage interface](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/static/app.js): `static/app.js`
- [HTTP server](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/server.py): `server.py`

### Batch triage

- [Triage service](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/service.py): `app/service.py`
- [Row intake](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/intake.py): `app/intake.py`
- [Record types](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/domain.py): `app/domain.py`
- [Ranking and ledger](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/triage.py): `app/triage.py`

### Live preview

- [Safety assessment](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/safety.py): `app/safety.py`
- [Live evaluation](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/live.py): `app/live.py`

### Language judgment

- [Batch language judge](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/app/judge.py): `app/judge.py`

### Data and services

- [Feedback snapshot](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/data/feedback.csv): `data/feedback.csv`
- [Language replay](https://github.com/saumitra2k4/cityflo-product-engineer-assignment/blob/main/data/language_replay.json): `data/language_replay.json`
- **Configured language service**
- **OpenAI service**

### Other components

- **Support agent**

## Connections

- Support agent → Triage interface: uses
- Triage interface → HTTP server: requests triage
- HTTP server → Triage interface: returns API data
- HTTP server → Triage service: requests batch triage
- Feedback snapshot → Row intake: loads rows
- Triage service → Row intake: ingests rows
- Triage service → Batch language judge: configures judge
- Triage service → Ranking and ledger: builds result
- Row intake → Record types: creates records
- Ranking and ledger → Batch language judge: requests advisory checks
- Ranking and ledger → Record types: serializes records
- Batch language judge → Language replay: reads replays
- Batch language judge → Configured language service: requests judgment
- Triage interface → HTTP server: submits message
- HTTP server → Live evaluation: evaluates message
- Live evaluation → Safety assessment: assesses safety
- Live evaluation → OpenAI service: requests judgment
