# kacytran1122/-billo architecture

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

- Interactive diagram: https://gitdiagram.com/kacytran1122/-billo
- Repository: https://github.com/kacytran1122/-billo

## Overview

Billo is an AI care companion spanning pre-visit safety and price comparison, visit tracking, after-care document review, benefit follow-up, and guarded simulated settlement. Patients enter through ASI:One or tagged iMessage; Fetch.ai agents coordinate specialist workflows and use the shared Core API for rules, OCR, and durable case data. The frontend presents the product experience. Relationships among sampled components are supported by source references or README statements; unsampled capability links are omitted where their wiring is not shown.

Main entry points: [`backend/api/app/main.py`](https://github.com/kacytran1122/-billo/blob/main/backend/api/app/main.py) (Core API), [`backend/fetch.ai/coordinator.py`](https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/coordinator.py) (Case Coordinator), [`backend/photon/src/main.ts`](https://github.com/kacytran1122/-billo/blob/main/backend/photon/src/main.ts) (Photon Bridge), [`backend/observability/sentry.py`](https://github.com/kacytran1122/-billo/blob/main/backend/observability/sentry.py) (Privacy-safe Sentry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Patient Experience"]
  node_frontend["Web Experience<br/>[LandingPage.tsx]"]
  node_photon["Photon Bridge<br/>[main.ts]"]
end

subgraph group_agents["Agent Workflows"]
  node_gateway["iMessage Gateway"]
  node_coordinator["Case Coordinator<br/>[coordinator.py]"]
  node_safety["Emergency Screening<br/>[red_flag.py]"]
  node_care["Care Finder<br/>[care_finder.py]"]
  node_auditor["Bill Auditor<br/>[bill_auditor.py]"]
  node_settlement["Settlement Router"]
  node_medic["Case Medic<br/>[case_medic.py]"]
end

subgraph group_core["Core Services"]
  node_api["Core API<br/>[main.py]"]
  node_rules["Deterministic Rules<br/>[rules.py]"]
  node_ocr["Bill Reader<br/>[reader.py]"]
  node_ocrengine["Local OCR Engine<br/>[engine.py]"]
  node_visa["Visa Simulation<br/>[visa.py]"]
end

subgraph group_state["Case Data"]
  node_store[("Case Store<br/>[store.py]")]
end

subgraph group_ops["Safety and Observability"]
  node_sentry["Privacy-safe Sentry<br/>[sentry.py]"]
end

node_patient(("Patient"))
node_asi["ASI:One"]
node_imessage["iMessage"]

node_patient -->|"asks for care"| node_asi
node_patient -->|"tags Billo"| node_imessage
node_patient -->|"uses experience"| node_frontend
node_imessage -->|"sends messages"| node_photon
node_photon -->|"forwards inbound"| node_gateway
node_photon -->|"uploads files"| node_api
node_asi -->|"submits cases"| node_coordinator
node_gateway -->|"routes messages"| node_coordinator
node_coordinator -->|"screens emergencies"| node_safety
node_coordinator -->|"finds care"| node_care
node_coordinator -->|"organizes bills"| node_auditor
node_coordinator -->|"routes settlement"| node_settlement
node_coordinator -->|"uses shared tools"| node_api
node_auditor -->|"requests case tools"| node_api
node_settlement -->|"posts checks"| node_api
node_api -->|"applies rules"| node_rules
node_api -->|"reads documents"| node_ocr
node_ocr -->|"runs local OCR"| node_ocrengine
node_api -->|"reads and writes"| node_store
node_api -->|"checks simulated payments"| node_visa
node_api -->|"reports telemetry"| node_sentry
node_coordinator -.->|"routes recovery"| node_medic
node_medic -.->|"requests recovery actions"| node_api
node_photon -->|"traces bridge"| node_sentry
node_coordinator -->|"traces cases"| node_sentry

click node_frontend "https://github.com/kacytran1122/-billo/blob/main/frontend/src/features/landing/LandingPage.tsx"
click node_photon "https://github.com/kacytran1122/-billo/blob/main/backend/photon/src/main.ts"
click node_gateway "https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/imessage_gateway.py"
click node_coordinator "https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/coordinator.py"
click node_safety "https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/red_flag.py"
click node_care "https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/care_finder.py"
click node_auditor "https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/bill_auditor.py"
click node_settlement "https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/settlement_router.py"
click node_medic "https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/case_medic.py"
click node_api "https://github.com/kacytran1122/-billo/blob/main/backend/api/app/main.py"
click node_rules "https://github.com/kacytran1122/-billo/blob/main/backend/api/app/rules.py"
click node_ocr "https://github.com/kacytran1122/-billo/blob/main/backend/ocr/reader.py"
click node_ocrengine "https://github.com/kacytran1122/-billo/blob/main/backend/ocr/engine.py"
click node_store "https://github.com/kacytran1122/-billo/blob/main/backend/api/app/store.py"
click node_visa "https://github.com/kacytran1122/-billo/blob/main/backend/api/app/visa.py"
click node_sentry "https://github.com/kacytran1122/-billo/blob/main/backend/observability/sentry.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_frontend,node_photon toneBlue
class node_gateway,node_coordinator,node_safety,node_care,node_auditor,node_settlement,node_medic toneAmber
class node_api,node_rules,node_ocr,node_ocrengine,node_visa toneMint
class node_store toneRose
class node_sentry,node_patient,node_asi,node_imessage toneIndigo
```

## Components

### Patient Experience

- [Web Experience](https://github.com/kacytran1122/-billo/blob/main/frontend/src/features/landing/LandingPage.tsx): `frontend/src/features/landing/LandingPage.tsx`
- [Photon Bridge](https://github.com/kacytran1122/-billo/blob/main/backend/photon/src/main.ts): `backend/photon/src/main.ts`

### Agent Workflows

- [iMessage Gateway](https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/imessage_gateway.py): `backend/fetch.ai/imessage_gateway.py`
- [Case Coordinator](https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/coordinator.py): `backend/fetch.ai/coordinator.py`
- [Emergency Screening](https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/red_flag.py): `backend/fetch.ai/red_flag.py`
- [Care Finder](https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/care_finder.py): `backend/fetch.ai/care_finder.py`
- [Bill Auditor](https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/bill_auditor.py): `backend/fetch.ai/bill_auditor.py`
- [Settlement Router](https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/settlement_router.py): `backend/fetch.ai/settlement_router.py`
- [Case Medic](https://github.com/kacytran1122/-billo/blob/main/backend/fetch.ai/case_medic.py): `backend/fetch.ai/case_medic.py`

### Core Services

- [Core API](https://github.com/kacytran1122/-billo/blob/main/backend/api/app/main.py): `backend/api/app/main.py`
- [Deterministic Rules](https://github.com/kacytran1122/-billo/blob/main/backend/api/app/rules.py): `backend/api/app/rules.py`
- [Bill Reader](https://github.com/kacytran1122/-billo/blob/main/backend/ocr/reader.py): `backend/ocr/reader.py`
- [Local OCR Engine](https://github.com/kacytran1122/-billo/blob/main/backend/ocr/engine.py): `backend/ocr/engine.py`
- [Visa Simulation](https://github.com/kacytran1122/-billo/blob/main/backend/api/app/visa.py): `backend/api/app/visa.py`

### Case Data

- [Case Store](https://github.com/kacytran1122/-billo/blob/main/backend/api/app/store.py): `backend/api/app/store.py`

### Safety and Observability

- [Privacy-safe Sentry](https://github.com/kacytran1122/-billo/blob/main/backend/observability/sentry.py): `backend/observability/sentry.py`

### Other components

- **Patient**
- **ASI:One**
- **iMessage**

## Connections

- Patient → ASI:One: asks for care (evidence: `README.md`)
- Patient → iMessage: tags Billo (evidence: `README.md`)
- Patient → Web Experience: uses experience (evidence: `README.md`)
- iMessage → Photon Bridge: sends messages (evidence: `README.md`)
- Photon Bridge → iMessage Gateway: forwards inbound (evidence: `backend/photon/src/main.ts`)
- Photon Bridge → Core API: uploads files (evidence: `backend/photon/src/main.ts`)
- ASI:One → Case Coordinator: submits cases (evidence: `README.md`)
- iMessage Gateway → Case Coordinator: routes messages (evidence: `README.md`)
- Case Coordinator → Emergency Screening: screens emergencies (evidence: `README.md`)
- Case Coordinator → Care Finder: finds care (evidence: `README.md`)
- Case Coordinator → Bill Auditor: organizes bills (evidence: `README.md`)
- Case Coordinator → Settlement Router: routes settlement (evidence: `README.md`)
- Case Coordinator → Core API: uses shared tools (evidence: `README.md`)
- Bill Auditor → Core API: requests case tools
- Settlement Router → Core API: posts checks (evidence: `backend/fetch.ai/settlement_router.py`)
- Core API → Deterministic Rules: applies rules (evidence: `backend/api/app/main.py`)
- Core API → Bill Reader: reads documents
- Bill Reader → Local OCR Engine: runs local OCR (evidence: `backend/ocr/reader.py`)
- Core API → Case Store: reads and writes (evidence: `backend/api/app/main.py`)
- Core API → Visa Simulation: checks simulated payments (evidence: `backend/api/app/main.py`)
- Core API → Privacy-safe Sentry: reports telemetry (evidence: `backend/api/app/main.py`)
- Case Coordinator → Case Medic: routes recovery
- Case Medic → Core API: requests recovery actions
- Photon Bridge → Privacy-safe Sentry: traces bridge (evidence: `backend/photon/src/main.ts`)
- Case Coordinator → Privacy-safe Sentry: traces cases
