# divyaprasad-sahu/marsh-policy-intelligence architecture

> Architecture diagram of the GitHub repository divyaprasad-sahu/marsh-policy-intelligence, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/divyaprasad-sahu/marsh-policy-intelligence
- Repository: https://github.com/divyaprasad-sahu/marsh-policy-intelligence

## Overview

Marsh Policy Intelligence supports an advisor-led workflow: research a client company, confirm its profile and requirements, compare supplied health-policy brochures, generate a cited recommendation pitch, review and revise its evidence audit, then approve and export. The graph separates frontend workflow stages from backend services and workflow state. Sampled source confirms key API calls and audit behavior; some subsystem wiring is inferred only at the documented capability level, so uncertain internal links are omitted.

Main entry points: [`backend/app/main.py`](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/main.py) (HTTP API), [`frontend/src/components/AdvisoryJourney.tsx`](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/components/AdvisoryJourney.tsx) (Advisory journey), [`frontend/src/api.ts`](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/api.ts) (API client), [`backend/app/analysis.py`](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/analysis.py) (Advisory analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_advisor_ui["Advisor workspace"]
  node_journey["Advisory journey"]
  node_api_client["API client<br/>[api.ts]"]
  node_pitch_workspace["Pitch workspace<br/>[PitchWorkspace.tsx]"]
  node_audit_panel["Audit panel<br/>[AuditPanel.tsx]"]
end

subgraph group_advisory_services["Advisory services"]
  node_api["HTTP API<br/>[main.py]"]
  node_company_research["Company research<br/>[generation.py]"]
  node_requirements["Requirement extraction<br/>[generation.py]"]
  node_document_service["Policy document processing<br/>[documents.py]"]
  node_policy_corpus["Policy brochures"]
  node_policy_facts["Policy facts<br/>[policy_facts.py]"]
  node_analysis["Advisory analysis<br/>[analysis.py]"]
  node_pitch_generation["Pitch generation<br/>[generation.py]"]
end

subgraph group_review_workflow["Review and delivery"]
  node_workflow[("Pitch workflow<br/>[workflow_store.py]")]
  node_audit["Evidence audit<br/>[audit.py]"]
  node_exports["Pitch and report exports<br/>[pdf_export.py]"]
  node_pptx_export["PowerPoint export<br/>[pptx_export.py]"]
end

node_advisor(("Insurance advisor"))
node_public_company_source(("Public company source"))
node_gemini(("Gemini API"))

node_advisor -->|"provides client inputs"| node_journey
node_journey -->|"requests research and analysis"| node_api_client
node_journey -->|"reviews pitch"| node_pitch_workspace
node_journey -->|"reviews audit"| node_audit_panel
node_api_client -->|"sends API requests"| node_api
node_api -->|"requests company research"| node_company_research
node_company_research -.->|"looks up company"| node_public_company_source
node_api -->|"extracts requirements"| node_requirements
node_requirements -.->|"requests structured extraction"| node_gemini
node_api -->|"parses uploaded documents"| node_document_service
node_document_service -->|"reads policy documents"| node_policy_corpus
node_api -->|"requests policy comparison"| node_analysis
node_analysis -->|"uses policy evidence"| node_policy_facts
node_analysis -->|"compares supplied brochures"| node_policy_corpus
node_api -->|"generates recommendation pitch"| node_pitch_generation
node_api -->|"stores and retrieves pitch state"| node_workflow
node_api -->|"runs pitch audit"| node_audit
node_audit -->|"updates audit state"| node_workflow
node_api -->|"exports audit reports"| node_exports
node_api -->|"exports pitch slides"| node_pptx_export
node_api_client -->|"requests edits and approval"| node_api

click node_journey "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/components/AdvisoryJourney.tsx"
click node_api_client "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/api.ts"
click node_pitch_workspace "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/components/PitchWorkspace.tsx"
click node_audit_panel "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/components/AuditPanel.tsx"
click node_api "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/main.py"
click node_company_research "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/generation.py"
click node_requirements "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/generation.py"
click node_document_service "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/documents.py"
click node_policy_corpus "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/tree/main/backend/data/policies"
click node_policy_facts "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/policy_facts.py"
click node_analysis "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/analysis.py"
click node_pitch_generation "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/generation.py"
click node_workflow "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/workflow_store.py"
click node_audit "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/audit.py"
click node_exports "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/pdf_export.py"
click node_pptx_export "https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/pptx_export.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_journey,node_api_client,node_pitch_workspace,node_audit_panel toneBlue
class node_api,node_company_research,node_requirements,node_document_service,node_policy_corpus,node_policy_facts,node_analysis,node_pitch_generation toneAmber
class node_workflow,node_audit,node_exports,node_pptx_export,node_gemini toneMint
class node_advisor,node_public_company_source toneIndigo
```

## Components

### Advisor workspace

- [Advisory journey](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/components/AdvisoryJourney.tsx): `frontend/src/components/AdvisoryJourney.tsx`
- [API client](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [Pitch workspace](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/components/PitchWorkspace.tsx): `frontend/src/components/PitchWorkspace.tsx`
- [Audit panel](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/frontend/src/components/AuditPanel.tsx): `frontend/src/components/AuditPanel.tsx`

### Advisory services

- [HTTP API](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/main.py): `backend/app/main.py`
- [Company research](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/generation.py): `backend/app/generation.py`
- [Requirement extraction](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/generation.py): `backend/app/generation.py`
- [Policy document processing](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/documents.py): `backend/app/documents.py`
- [Policy brochures](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/tree/main/backend/data/policies): `backend/data/policies`
- [Policy facts](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/policy_facts.py): `backend/app/policy_facts.py`
- [Advisory analysis](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/analysis.py): `backend/app/analysis.py`
- [Pitch generation](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/generation.py): `backend/app/generation.py`

### Review and delivery

- [Pitch workflow](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/workflow_store.py): `backend/app/workflow_store.py`
- [Evidence audit](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/audit.py): `backend/app/audit.py`
- [Pitch and report exports](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/pdf_export.py): `backend/app/pdf_export.py`
- [PowerPoint export](https://github.com/divyaprasad-sahu/marsh-policy-intelligence/blob/main/backend/app/pptx_export.py): `backend/app/pptx_export.py`

### Other components

- **Insurance advisor**
- **Public company source**
- **Gemini API**

## Connections

- Insurance advisor → Advisory journey: provides client inputs
- Advisory journey → API client: requests research and analysis
- Advisory journey → Pitch workspace: reviews pitch
- Advisory journey → Audit panel: reviews audit
- API client → HTTP API: sends API requests
- HTTP API → Company research: requests company research
- Company research → Public company source: looks up company
- HTTP API → Requirement extraction: extracts requirements
- Requirement extraction → Gemini API: requests structured extraction
- HTTP API → Policy document processing: parses uploaded documents
- Policy document processing → Policy brochures: reads policy documents
- HTTP API → Advisory analysis: requests policy comparison
- Advisory analysis → Policy facts: uses policy evidence
- Advisory analysis → Policy brochures: compares supplied brochures
- HTTP API → Pitch generation: generates recommendation pitch
- HTTP API → Pitch workflow: stores and retrieves pitch state
- HTTP API → Evidence audit: runs pitch audit
- Evidence audit → Pitch workflow: updates audit state
- HTTP API → Pitch and report exports: exports audit reports
- HTTP API → PowerPoint export: exports pitch slides
- API client → HTTP API: requests edits and approval
