# rclalithkumar/ridewise-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/rclalithkumar/ridewise-assistant
- Repository: https://github.com/rclalithkumar/ridewise-assistant

## Overview

RideWise is a Streamlit evidence-grounded support assistant. Customers and support agents start a session, ask a question, and receive an answer based on customer-scoped operational records, approved policy passages, or both; the interface displays the answer and retrieved evidence. The main runtime is concentrated in app.py: it handles session validation, retrieval, LLM prompting, and chat display. The README documents the main capabilities; the source excerpt shows key calls, but some implementation details are omitted.

Main entry points: [`app.py`](https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py) (Chat interface), [`policies`](https://github.com/rclalithkumar/ridewise-assistant/tree/master/policies) (Approved policy PDFs), [`policies/verified_scanned_annexures.txt`](https://github.com/rclalithkumar/ridewise-assistant/blob/master/policies/verified_scanned_annexures.txt) (Verified annexures)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Session and chat"]
  node_streamlit["Chat interface<br/>[app.py]"]
  node_session["Role and session handling<br/>[app.py]"]
  node_customer_check["Customer ID validation<br/>[app.py]"]
  node_conversation["Conversation controls<br/>[app.py]"]
end

subgraph group_evidence["Evidence retrieval"]
  node_operational["Operational retrieval<br/>[app.py]"]
  node_policy_retrieval["Policy retrieval<br/>[app.py]"]
  node_policy_pdfs["Approved policy PDFs"]
  node_annexures["Verified annexures"]
  node_ridewise_db[("RideWise SQLite records")]
end

subgraph group_answer["Answer generation"]
  node_evidence_prompt["Evidence-grounded prompt<br/>[app.py]"]
  node_neostats["NeoStats LLM"]
  node_evidence_display["Answer and evidence display<br/>[app.py]"]
end

node_customer(("Customer"))
node_support(("Support agent"))

node_customer -->|"asks questions"| node_streamlit
node_support -->|"asks questions"| node_streamlit
node_streamlit -->|"selects role"| node_session
node_session -->|"validates ID"| node_customer_check
node_streamlit -->|"controls chat"| node_conversation
node_streamlit -->|"requests records"| node_operational
node_operational -->|"queries records"| node_ridewise_db
node_streamlit -->|"requests passages"| node_policy_retrieval
node_policy_retrieval -->|"reads approved PDFs"| node_policy_pdfs
node_policy_retrieval -->|"reads annexures"| node_annexures
node_streamlit -->|"answers question"| node_evidence_prompt
node_operational -->|"supplies records"| node_evidence_prompt
node_policy_retrieval -->|"supplies passages"| node_evidence_prompt
node_evidence_prompt -->|"requests answer"| node_neostats
node_neostats -->|"returns answer"| node_evidence_display
node_streamlit -->|"shows evidence"| node_evidence_display

click node_streamlit "https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py"
click node_session "https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py"
click node_customer_check "https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py"
click node_conversation "https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py"
click node_operational "https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py"
click node_policy_retrieval "https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py"
click node_policy_pdfs "https://github.com/rclalithkumar/ridewise-assistant/tree/master/policies"
click node_annexures "https://github.com/rclalithkumar/ridewise-assistant/blob/master/policies/verified_scanned_annexures.txt"
click node_evidence_prompt "https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py"
click node_evidence_display "https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.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_streamlit,node_session,node_customer_check,node_conversation toneBlue
class node_operational,node_policy_retrieval,node_policy_pdfs,node_annexures,node_ridewise_db toneAmber
class node_evidence_prompt,node_neostats,node_evidence_display toneMint
class node_customer,node_support toneIndigo
```

## Components

### Session and chat

- [Chat interface](https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py): `app.py`
- [Role and session handling](https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py): `app.py`
- [Customer ID validation](https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py): `app.py`
- [Conversation controls](https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py): `app.py`

### Evidence retrieval

- [Operational retrieval](https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py): `app.py`
- [Policy retrieval](https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py): `app.py`
- [Approved policy PDFs](https://github.com/rclalithkumar/ridewise-assistant/tree/master/policies): `policies`
- [Verified annexures](https://github.com/rclalithkumar/ridewise-assistant/blob/master/policies/verified_scanned_annexures.txt): `policies/verified_scanned_annexures.txt`
- **RideWise SQLite records**

### Answer generation

- [Evidence-grounded prompt](https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py): `app.py`
- **NeoStats LLM**
- [Answer and evidence display](https://github.com/rclalithkumar/ridewise-assistant/blob/master/app.py): `app.py`

### Other components

- **Customer**
- **Support agent**

## Connections

- Customer → Chat interface: asks questions (evidence: `README.md`)
- Support agent → Chat interface: asks questions (evidence: `README.md`)
- Chat interface → Role and session handling: selects role (evidence: `README.md`)
- Role and session handling → Customer ID validation: validates ID (evidence: `app.py`)
- Chat interface → Conversation controls: controls chat (evidence: `app.py`)
- Chat interface → Operational retrieval: requests records (evidence: `app.py`)
- Operational retrieval → RideWise SQLite records: queries records (evidence: `app.py`)
- Chat interface → Policy retrieval: requests passages (evidence: `app.py`)
- Policy retrieval → Approved policy PDFs: reads approved PDFs (evidence: `app.py`)
- Policy retrieval → Verified annexures: reads annexures (evidence: `app.py`)
- Chat interface → Evidence-grounded prompt: answers question (evidence: `app.py`)
- Operational retrieval → Evidence-grounded prompt: supplies records (evidence: `app.py`)
- Policy retrieval → Evidence-grounded prompt: supplies passages (evidence: `app.py`)
- Evidence-grounded prompt → NeoStats LLM: requests answer (evidence: `app.py`)
- NeoStats LLM → Answer and evidence display: returns answer (evidence: `app.py`)
- Chat interface → Answer and evidence display: shows evidence (evidence: `README.md`)
