# haneeshvarma2006-lab/24h architecture

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

- Interactive diagram: https://gitdiagram.com/haneeshvarma2006-lab/24h
- Repository: https://github.com/haneeshvarma2006-lab/24h

## Overview

Hayara.ai turns hospital bills and insurance claims into structured records, checks their arithmetic and completeness, and routes uncertain or invalid records for human review. Its main workflow runs from authenticated upload through extraction, validation, correction or approval, and export. Extraction can use Gemini or a local OCR-and-rules path; OCR also supports source highlights. The README documents account isolation, demo documents, claim-to-bill checks, and spreadsheet exports. Some route implementations were not excerpted, so those documented capabilities are shown without inferring their internal call chains.

Main entry points: [`backend/app.py`](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py) (API and workflow), [`backend/ocr_extract.py`](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/ocr_extract.py) (Local OCR parser), [`frontend/index.html`](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/frontend/index.html) (Dashboard), [`backend/locate.py`](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/locate.py) (Source highlights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["Dashboard and API"]
  node_dashboard["Dashboard<br/>[index.html]"]
  node_api["API and workflow<br/>[app.py]"]
end

subgraph group_extract["Document extraction"]
  node_extractor["Extraction router<br/>[app.py]"]
  node_gemini{{"Gemini vision"}}
  node_local_ocr["Local OCR parser<br/>[ocr_extract.py]"]
  node_field_model["Learned field finder<br/>[field_model.py]"]
  node_source_locator["Source highlights<br/>[locate.py]"]
  node_tesseract{{"Tesseract OCR"}}
end

subgraph group_review["Validation and review"]
  node_rules["Bill validation<br/>[validate.py]"]
  node_human_review["Corrections and approval<br/>[app.py]"]
  node_claim_check["Claim matching<br/>[app.py]"]
  node_export["Data export<br/>[app.py]"]
end

subgraph group_state["Accounts and records"]
  node_records[("Account and bill store<br/>[app.py]")]
end

node_reviewer(("Reviewer"))

node_reviewer -->|"uses"| node_dashboard
node_dashboard -->|"calls API"| node_api
node_api -->|"reads uploads"| node_extractor
node_extractor -->|"extracts with"| node_gemini
node_extractor -->|"falls back to"| node_local_ocr
node_local_ocr -->|"runs OCR"| node_tesseract
node_local_ocr -->|"applies model"| node_field_model
node_api -->|"finds highlights"| node_source_locator
node_source_locator -->|"runs OCR"| node_tesseract
node_api -->|"validates records"| node_rules
node_api -->|"checks claims"| node_claim_check
node_api -->|"reads and writes"| node_records
node_api -->|"offers review actions"| node_human_review
node_reviewer -->|"corrects or approves"| node_human_review
node_human_review -->|"saves changes"| node_records
node_api -->|"serves exports"| node_export
node_reviewer -->|"requests export"| node_export

click node_dashboard "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/frontend/index.html"
click node_api "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py"
click node_extractor "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py"
click node_local_ocr "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/ocr_extract.py"
click node_field_model "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/field_model.py"
click node_source_locator "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/locate.py"
click node_rules "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/validate.py"
click node_human_review "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py"
click node_claim_check "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py"
click node_export "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py"
click node_records "https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/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_dashboard,node_api,node_reviewer toneBlue
class node_extractor,node_gemini,node_local_ocr,node_field_model,node_source_locator,node_tesseract toneAmber
class node_rules,node_human_review,node_claim_check,node_export toneMint
class node_records toneRose
```

## Components

### Dashboard and API

- [Dashboard](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/frontend/index.html): `frontend/index.html`
- [API and workflow](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py): `backend/app.py`

### Document extraction

- [Extraction router](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py): `backend/app.py`
- **Gemini vision**
- [Local OCR parser](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/ocr_extract.py): `backend/ocr_extract.py`
- [Learned field finder](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/field_model.py): `backend/field_model.py`
- [Source highlights](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/locate.py): `backend/locate.py`
- **Tesseract OCR**

### Validation and review

- [Bill validation](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/validate.py): `backend/validate.py`
- [Corrections and approval](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py): `backend/app.py`
- [Claim matching](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py): `backend/app.py`
- [Data export](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py): `backend/app.py`

### Accounts and records

- [Account and bill store](https://github.com/haneeshvarma2006-lab/24h/blob/claude/funny-einstein-1mlbjh/backend/app.py): `backend/app.py`

### Other components

- **Reviewer**

## Connections

- Reviewer → Dashboard: uses (evidence: `README.md`)
- Dashboard → API and workflow: calls API (evidence: `README.md`)
- API and workflow → Extraction router: reads uploads (evidence: `backend/app.py`)
- Extraction router → Gemini vision: extracts with
- Extraction router → Local OCR parser: falls back to (evidence: `README.md`)
- Local OCR parser → Tesseract OCR: runs OCR (evidence: `backend/ocr_extract.py`)
- Local OCR parser → Learned field finder: applies model (evidence: `backend/ocr_extract.py`)
- API and workflow → Source highlights: finds highlights (evidence: `backend/app.py`)
- Source highlights → Tesseract OCR: runs OCR (evidence: `backend/locate.py`)
- API and workflow → Bill validation: validates records (evidence: `backend/app.py`)
- API and workflow → Claim matching: checks claims (evidence: `backend/app.py`)
- API and workflow → Account and bill store: reads and writes (evidence: `backend/app.py`)
- API and workflow → Corrections and approval: offers review actions (evidence: `README.md`)
- Reviewer → Corrections and approval: corrects or approves (evidence: `README.md`)
- Corrections and approval → Account and bill store: saves changes (evidence: `README.md`)
- API and workflow → Data export: serves exports (evidence: `README.md`)
- Reviewer → Data export: requests export (evidence: `README.md`)
