# anasmumtaz2004/insuretrust architecture

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

- Interactive diagram: https://gitdiagram.com/anasmumtaz2004/insuretrust
- Repository: https://github.com/anasmumtaz2004/insuretrust

## Overview

This is a claims-adjudication platform with a customer and staff web UI, a FastAPI backend, and a multi-agent workflow. Users authenticate and submit or review claims; the backend persists claim data, runs adjudication, records audit/decision results, and supports human review. The graph preserves documented agent stages and the RAG subsystem, but their internal runtime calls are not fully shown in the excerpts. The README is empty, so capabilities and relationships are based on the source index and sampled files.

Main entry points: [`Backend/graph/main_graph.py`](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/graph/main_graph.py) (Graph composition), [`Backend/api/main.py`](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/api/main.py) (FastAPI application), [`Backend/database/database.py`](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/database/database.py) (Relational database), [`Backend/services/claim_service.py`](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/services/claim_service.py) (Claim service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Route application<br/>[App.jsx]"]
  node_client_pages["Client pages"]
  node_ops_pages["Operations pages"]
  node_auth_context["Auth context<br/>[AuthContext.jsx]"]
  node_client_api["Client API<br/>[clientApi.js]"]
end

subgraph group_api["API and services"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_claim_routes["Claim routes<br/>[claims.py]"]
  node_explanation_routes["Explanation routes<br/>[explanation.py]"]
  node_other_routes["Documents and ops routes"]
  node_claim_service["Claim service<br/>[claim_service.py]"]
  node_audit["Audit service<br/>[audit_service.py]"]
  node_database[("Relational database<br/>[database.py]")]
  node_models["Domain records<br/>[models.py]"]
end

subgraph group_workflow["Adjudication workflow"]
  node_orchestrator["Workflow orchestrator<br/>[tools.py]"]
  node_intake["Claim intake<br/>[graph.py]"]
  node_policy["Policy interpretation"]
  node_billing["Medical billing<br/>[graph.py]"]
  node_precedent["Precedent analysis"]
  node_debate["Decision debate<br/>[graph.py]"]
  node_drafting["Decision drafting<br/>[graph.py]"]
  node_compliance["Compliance guardrail<br/>[graph.py]"]
  node_graph["Graph composition<br/>[main_graph.py]"]
end

subgraph group_knowledge["Retrieval and storage"]
  node_rag_ingest["Document ingestion"]
  node_policy_retrieval["Policy retrieval"]
  node_precedent_retrieval["Precedent retrieval"]
  node_reranker["Result reranker<br/>[reranker.py]"]
  node_vectorstores[("Vector stores")]
end

node_user(("Customer or staff"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_client_pages
node_app -->|"routes to"| node_ops_pages
node_client_pages -.->|"uses auth"| node_auth_context
node_auth_context -->|"calls"| node_client_api
node_client_pages -.->|"requests data"| node_client_api
node_client_api -->|"HTTP requests"| node_api_app
node_api_app -->|"registers"| node_auth_routes
node_api_app -->|"registers"| node_claim_routes
node_api_app -->|"registers"| node_explanation_routes
node_api_app -->|"registers"| node_other_routes
node_auth_routes -->|"queries"| node_database
node_claim_routes -->|"delegates to"| node_claim_service
node_claim_routes -->|"queries"| node_database
node_explanation_routes -->|"reads state"| node_graph
node_claim_service -->|"streams workflow"| node_graph
node_claim_service -->|"persists results"| node_database
node_claim_service -->|"records steps"| node_audit
node_audit -->|"writes logs"| node_database
node_database -->|"maps records"| node_models
node_graph -->|"registers and routes"| node_orchestrator
node_graph -->|"registers"| node_intake
node_graph -->|"registers"| node_policy
node_graph -->|"registers"| node_billing
node_graph -->|"registers"| node_precedent
node_graph -->|"registers"| node_debate
node_graph -->|"registers"| node_drafting
node_graph -->|"registers"| node_compliance
node_policy -.->|"may retrieve"| node_policy_retrieval
node_precedent -.->|"may retrieve"| node_precedent_retrieval
node_policy_retrieval -->|"queries"| node_vectorstores
node_precedent_retrieval -->|"queries"| node_vectorstores
node_policy_retrieval -->|"reranks"| node_reranker
node_precedent_retrieval -->|"reranks"| node_reranker
node_rag_ingest -.->|"populates"| node_vectorstores

click node_app "https://github.com/anasmumtaz2004/insuretrust/blob/main/Frontend/src/App.jsx"
click node_client_pages "https://github.com/anasmumtaz2004/insuretrust/tree/main/Frontend/src/pages"
click node_ops_pages "https://github.com/anasmumtaz2004/insuretrust/tree/main/Frontend/src/pages"
click node_auth_context "https://github.com/anasmumtaz2004/insuretrust/blob/main/Frontend/src/auth/AuthContext.jsx"
click node_client_api "https://github.com/anasmumtaz2004/insuretrust/blob/main/Frontend/src/api/clientApi.js"
click node_api_app "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/api/main.py"
click node_auth_routes "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/api/routes/auth.py"
click node_claim_routes "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/api/routes/claims.py"
click node_explanation_routes "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/api/routes/explanation.py"
click node_other_routes "https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/api/routes"
click node_claim_service "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/services/claim_service.py"
click node_audit "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/services/audit_service.py"
click node_database "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/database/database.py"
click node_models "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/database/models.py"
click node_orchestrator "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/orchestration_agent/tools.py"
click node_intake "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/intake_agent/graph.py"
click node_policy "https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/agents/policy_interpretation_agent"
click node_billing "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/medical_billing_agent/graph.py"
click node_precedent "https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/agents/precedent_agent"
click node_debate "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/debate_agent/graph.py"
click node_drafting "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/decision_drafting_agent/graph.py"
click node_compliance "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/compliance_guardrail_agent/graph.py"
click node_graph "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/graph/main_graph.py"
click node_rag_ingest "https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/rag/ingestion"
click node_policy_retrieval "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/rag/retrievers/policy_retriever.py"
click node_precedent_retrieval "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/rag/retrievers/precedent_retriever.py"
click node_reranker "https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/rag/reranker.py"
click node_vectorstores "https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/rag/vectorstore"

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_app,node_client_pages,node_ops_pages,node_auth_context,node_client_api toneBlue
class node_api_app,node_auth_routes,node_claim_routes,node_explanation_routes,node_other_routes,node_claim_service,node_audit,node_database,node_models toneAmber
class node_orchestrator,node_intake,node_policy,node_billing,node_precedent,node_debate,node_drafting,node_compliance,node_graph toneMint
class node_rag_ingest,node_policy_retrieval,node_precedent_retrieval,node_reranker,node_vectorstores toneRose
class node_user toneIndigo
```

## Components

### Web application

- [Route application](https://github.com/anasmumtaz2004/insuretrust/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Client pages](https://github.com/anasmumtaz2004/insuretrust/tree/main/Frontend/src/pages): `Frontend/src/pages`
- [Operations pages](https://github.com/anasmumtaz2004/insuretrust/tree/main/Frontend/src/pages): `Frontend/src/pages`
- [Auth context](https://github.com/anasmumtaz2004/insuretrust/blob/main/Frontend/src/auth/AuthContext.jsx): `Frontend/src/auth/AuthContext.jsx`
- [Client API](https://github.com/anasmumtaz2004/insuretrust/blob/main/Frontend/src/api/clientApi.js): `Frontend/src/api/clientApi.js`

### API and services

- [FastAPI application](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/api/main.py): `Backend/api/main.py`
- [Authentication routes](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/api/routes/auth.py): `Backend/api/routes/auth.py`
- [Claim routes](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/api/routes/claims.py): `Backend/api/routes/claims.py`
- [Explanation routes](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/api/routes/explanation.py): `Backend/api/routes/explanation.py`
- [Documents and ops routes](https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/api/routes): `Backend/api/routes`
- [Claim service](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/services/claim_service.py): `Backend/services/claim_service.py`
- [Audit service](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/services/audit_service.py): `Backend/services/audit_service.py`
- [Relational database](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/database/database.py): `Backend/database/database.py`
- [Domain records](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/database/models.py): `Backend/database/models.py`

### Adjudication workflow

- [Workflow orchestrator](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/orchestration_agent/tools.py): `Backend/agents/orchestration_agent/tools.py`
- [Claim intake](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/intake_agent/graph.py): `Backend/agents/intake_agent/graph.py`
- [Policy interpretation](https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/agents/policy_interpretation_agent): `Backend/agents/policy_interpretation_agent`
- [Medical billing](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/medical_billing_agent/graph.py): `Backend/agents/medical_billing_agent/graph.py`
- [Precedent analysis](https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/agents/precedent_agent): `Backend/agents/precedent_agent`
- [Decision debate](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/debate_agent/graph.py): `Backend/agents/debate_agent/graph.py`
- [Decision drafting](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/decision_drafting_agent/graph.py): `Backend/agents/decision_drafting_agent/graph.py`
- [Compliance guardrail](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/agents/compliance_guardrail_agent/graph.py): `Backend/agents/compliance_guardrail_agent/graph.py`
- [Graph composition](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/graph/main_graph.py): `Backend/graph/main_graph.py`

### Retrieval and storage

- [Document ingestion](https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/rag/ingestion): `Backend/rag/ingestion`
- [Policy retrieval](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/rag/retrievers/policy_retriever.py): `Backend/rag/retrievers/policy_retriever.py`
- [Precedent retrieval](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/rag/retrievers/precedent_retriever.py): `Backend/rag/retrievers/precedent_retriever.py`
- [Result reranker](https://github.com/anasmumtaz2004/insuretrust/blob/main/Backend/rag/reranker.py): `Backend/rag/reranker.py`
- [Vector stores](https://github.com/anasmumtaz2004/insuretrust/tree/main/Backend/rag/vectorstore): `Backend/rag/vectorstore`

### Other components

- **Customer or staff**

## Connections

- Customer or staff → Route application: uses (evidence: `Frontend/src/App.jsx`)
- Route application → Client pages: routes to (evidence: `Frontend/src/App.jsx`)
- Route application → Operations pages: routes to (evidence: `Frontend/src/App.jsx`)
- Client pages → Auth context: uses auth
- Auth context → Client API: calls (evidence: `Frontend/src/auth/AuthContext.jsx`)
- Client pages → Client API: requests data
- Client API → FastAPI application: HTTP requests (evidence: `Frontend/src/api/clientApi.js`)
- FastAPI application → Authentication routes: registers (evidence: `Backend/api/main.py`)
- FastAPI application → Claim routes: registers (evidence: `Backend/api/main.py`)
- FastAPI application → Explanation routes: registers (evidence: `Backend/api/main.py`)
- FastAPI application → Documents and ops routes: registers (evidence: `Backend/api/main.py`)
- Authentication routes → Relational database: queries (evidence: `Backend/api/routes/auth.py`)
- Claim routes → Claim service: delegates to (evidence: `Backend/api/routes/claims.py`)
- Claim routes → Relational database: queries (evidence: `Backend/api/routes/claims.py`)
- Explanation routes → Graph composition: reads state (evidence: `Backend/api/routes/explanation.py`)
- Claim service → Graph composition: streams workflow (evidence: `Backend/services/claim_service.py`)
- Claim service → Relational database: persists results (evidence: `Backend/services/claim_service.py`)
- Claim service → Audit service: records steps (evidence: `Backend/services/claim_service.py`)
- Audit service → Relational database: writes logs (evidence: `Backend/services/audit_service.py`)
- Relational database → Domain records: maps records (evidence: `Backend/database/database.py`)
- Graph composition → Workflow orchestrator: registers and routes (evidence: `Backend/graph/main_graph.py`)
- Graph composition → Claim intake: registers (evidence: `Backend/graph/main_graph.py`)
- Graph composition → Policy interpretation: registers (evidence: `Backend/graph/main_graph.py`)
- Graph composition → Medical billing: registers (evidence: `Backend/graph/main_graph.py`)
- Graph composition → Precedent analysis: registers (evidence: `Backend/graph/main_graph.py`)
- Graph composition → Decision debate: registers (evidence: `Backend/graph/main_graph.py`)
- Graph composition → Decision drafting: registers (evidence: `Backend/graph/main_graph.py`)
- Graph composition → Compliance guardrail: registers (evidence: `Backend/graph/main_graph.py`)
- Policy interpretation → Policy retrieval: may retrieve
- Precedent analysis → Precedent retrieval: may retrieve
- Policy retrieval → Vector stores: queries (evidence: `Backend/rag/retrievers/policy_retriever.py`)
- Precedent retrieval → Vector stores: queries (evidence: `Backend/rag/retrievers/precedent_retriever.py`)
- Policy retrieval → Result reranker: reranks (evidence: `Backend/rag/retrievers/policy_retriever.py`)
- Precedent retrieval → Result reranker: reranks (evidence: `Backend/rag/retrievers/precedent_retriever.py`)
- Document ingestion → Vector stores: populates (evidence: `Backend/rag/vectorstore/policy_store.py`)
