# mandeep15686/meridian architecture

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

- Interactive diagram: https://gitdiagram.com/mandeep15686/meridian
- Repository: https://github.com/mandeep15686/meridian

## Overview

Meridian is a multimodal regulatory-compliance analysis platform. A user submits files and regulatory scope through the API; a queued worker runs the LangGraph workflow, which dispatches modality-specific analysis, retrieves regulatory evidence, synthesizes and verifies gaps, then persists results for report and status retrieval. The README documents audio, document, image, and tabular inputs plus PDF/JSON outputs. Some modality and report implementation details were not sampled, so those links rely on documented workflow statements; other links are limited to shown references or calls.

Main entry points: [`src/graph/graph.py`](https://github.com/mandeep15686/meridian/blob/main/src/graph/graph.py) (LangGraph orchestration), [`src/api/routes/all.py`](https://github.com/mandeep15686/meridian/blob/main/src/api/routes/all.py) (Submission and report routes), [`src/api/worker.py`](https://github.com/mandeep15686/meridian/blob/main/src/api/worker.py) (Async job worker), [`src/rag/retrieve.py`](https://github.com/mandeep15686/meridian/blob/main/src/rag/retrieve.py) (Hybrid retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["Submission and access"]
  node_api["FastAPI application<br/>[main.py]"]
  node_routes["Submission and report routes<br/>[all.py]"]
  node_schemas["API schemas<br/>[all.py]"]
  node_ui["Demo interface<br/>[app.py]"]
  node_worker["Async job worker<br/>[worker.py]"]
end

subgraph group_workflow["Analysis workflow"]
  node_graph["LangGraph orchestration<br/>[graph.py]"]
  node_state["Shared analysis state<br/>[state.py]"]
  node_router["Input router<br/>[router.py]"]
  node_doc["Document analysis<br/>[doc_agent.py]"]
  node_audio["Audio analysis<br/>[audio_agent.py]"]
  node_vision["Image analysis<br/>[vision_agent.py]"]
  node_data["Tabular analysis<br/>[data_agent.py]"]
  node_synthesis["Gap synthesis<br/>[synthesis_agent.py]"]
  node_gate{{"Grounding gate<br/>[gate.py]"}}
  node_models["Model wrappers<br/>[registry.py]"]
end

subgraph group_evidence["Regulatory evidence"]
  node_corpus["Regulatory corpus loaders"]
  node_ingest["Chunk and embed ingestion<br/>[ingest.py]"]
  node_retrieve["Hybrid retrieval<br/>[retrieve.py]"]
end

subgraph group_persistence["State and results"]
  node_database[("PostgreSQL and pgvector<br/>[models.py]")]
  node_sessions["Database sessions<br/>[session.py]"]
  node_storage["Upload and report storage<br/>[base.py]"]
  node_report["Compliance report<br/>[worker.py]"]
end

subgraph group_quality["Evaluation"]
  node_evaluation["RAG and gap evaluation<br/>[run_ragas.py]"]
  node_thresholds["Evaluation thresholds<br/>[thresholds.py]"]
end

node_user(("Compliance user"))

node_user -->|"submits case"| node_api
node_user -->|"uses demo"| node_ui
node_api -->|"registers routes"| node_routes
node_routes -->|"validates requests"| node_schemas
node_routes -->|"queues job"| node_worker
node_worker -->|"runs pipeline"| node_graph
node_graph -->|"routes inputs"| node_router
node_graph -->|"shares state"| node_state
node_graph -->|"dispatches"| node_doc
node_graph -->|"dispatches"| node_audio
node_graph -->|"dispatches"| node_vision
node_graph -->|"dispatches"| node_data
node_graph -->|"combines findings"| node_synthesis
node_doc -->|"retrieves context"| node_retrieve
node_doc -->|"extracts entities"| node_models
node_synthesis -->|"reasons with LLM"| node_models
node_synthesis -->|"verifies claims"| node_gate
node_corpus -->|"supplies documents"| node_ingest
node_ingest -->|"stores chunks"| node_database
node_retrieve -->|"searches clauses"| node_database
node_retrieve -->|"reranks results"| node_models
node_routes -->|"opens sessions"| node_sessions
node_worker -->|"opens sessions"| node_sessions
node_sessions -->|"connects to"| node_database
node_routes -->|"stores uploads"| node_storage
node_worker -->|"stores artifacts"| node_storage
node_worker -->|"persists findings"| node_report
node_routes -->|"returns report"| node_report
node_evaluation -->|"evaluates retrieval"| node_retrieve
node_evaluation -->|"checks scores"| node_thresholds

click node_api "https://github.com/mandeep15686/meridian/blob/main/src/api/main.py"
click node_routes "https://github.com/mandeep15686/meridian/blob/main/src/api/routes/all.py"
click node_schemas "https://github.com/mandeep15686/meridian/blob/main/src/api/schemas/all.py"
click node_ui "https://github.com/mandeep15686/meridian/blob/main/src/ui/app.py"
click node_worker "https://github.com/mandeep15686/meridian/blob/main/src/api/worker.py"
click node_graph "https://github.com/mandeep15686/meridian/blob/main/src/graph/graph.py"
click node_state "https://github.com/mandeep15686/meridian/blob/main/src/graph/state.py"
click node_router "https://github.com/mandeep15686/meridian/blob/main/src/graph/router.py"
click node_doc "https://github.com/mandeep15686/meridian/blob/main/src/agents/doc_agent.py"
click node_audio "https://github.com/mandeep15686/meridian/blob/main/src/agents/audio_agent.py"
click node_vision "https://github.com/mandeep15686/meridian/blob/main/src/agents/vision_agent.py"
click node_data "https://github.com/mandeep15686/meridian/blob/main/src/agents/data_agent.py"
click node_synthesis "https://github.com/mandeep15686/meridian/blob/main/src/agents/synthesis_agent.py"
click node_gate "https://github.com/mandeep15686/meridian/blob/main/src/graph/nodes/gate.py"
click node_models "https://github.com/mandeep15686/meridian/blob/main/src/models/registry.py"
click node_corpus "https://github.com/mandeep15686/meridian/tree/main/src/rag/corpus"
click node_ingest "https://github.com/mandeep15686/meridian/blob/main/src/rag/ingest.py"
click node_retrieve "https://github.com/mandeep15686/meridian/blob/main/src/rag/retrieve.py"
click node_database "https://github.com/mandeep15686/meridian/blob/main/src/db/models.py"
click node_sessions "https://github.com/mandeep15686/meridian/blob/main/src/db/session.py"
click node_storage "https://github.com/mandeep15686/meridian/blob/main/src/storage/base.py"
click node_report "https://github.com/mandeep15686/meridian/blob/main/src/api/worker.py"
click node_evaluation "https://github.com/mandeep15686/meridian/blob/main/src/eval/run_ragas.py"
click node_thresholds "https://github.com/mandeep15686/meridian/blob/main/src/eval/thresholds.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_api,node_routes,node_schemas,node_ui,node_worker,node_user toneBlue
class node_graph,node_state,node_router,node_doc,node_audio,node_vision,node_data,node_synthesis,node_gate,node_models toneAmber
class node_corpus,node_ingest,node_retrieve toneMint
class node_database,node_sessions,node_storage,node_report toneRose
class node_evaluation,node_thresholds toneIndigo
```

## Components

### Submission and access

- [FastAPI application](https://github.com/mandeep15686/meridian/blob/main/src/api/main.py): `src/api/main.py`
- [Submission and report routes](https://github.com/mandeep15686/meridian/blob/main/src/api/routes/all.py): `src/api/routes/all.py`
- [API schemas](https://github.com/mandeep15686/meridian/blob/main/src/api/schemas/all.py): `src/api/schemas/all.py`
- [Demo interface](https://github.com/mandeep15686/meridian/blob/main/src/ui/app.py): `src/ui/app.py`
- [Async job worker](https://github.com/mandeep15686/meridian/blob/main/src/api/worker.py): `src/api/worker.py`

### Analysis workflow

- [LangGraph orchestration](https://github.com/mandeep15686/meridian/blob/main/src/graph/graph.py): `src/graph/graph.py`
- [Shared analysis state](https://github.com/mandeep15686/meridian/blob/main/src/graph/state.py): `src/graph/state.py`
- [Input router](https://github.com/mandeep15686/meridian/blob/main/src/graph/router.py): `src/graph/router.py`
- [Document analysis](https://github.com/mandeep15686/meridian/blob/main/src/agents/doc_agent.py): `src/agents/doc_agent.py`
- [Audio analysis](https://github.com/mandeep15686/meridian/blob/main/src/agents/audio_agent.py): `src/agents/audio_agent.py`
- [Image analysis](https://github.com/mandeep15686/meridian/blob/main/src/agents/vision_agent.py): `src/agents/vision_agent.py`
- [Tabular analysis](https://github.com/mandeep15686/meridian/blob/main/src/agents/data_agent.py): `src/agents/data_agent.py`
- [Gap synthesis](https://github.com/mandeep15686/meridian/blob/main/src/agents/synthesis_agent.py): `src/agents/synthesis_agent.py`
- [Grounding gate](https://github.com/mandeep15686/meridian/blob/main/src/graph/nodes/gate.py): `src/graph/nodes/gate.py`
- [Model wrappers](https://github.com/mandeep15686/meridian/blob/main/src/models/registry.py): `src/models/registry.py`

### Regulatory evidence

- [Regulatory corpus loaders](https://github.com/mandeep15686/meridian/tree/main/src/rag/corpus): `src/rag/corpus`
- [Chunk and embed ingestion](https://github.com/mandeep15686/meridian/blob/main/src/rag/ingest.py): `src/rag/ingest.py`
- [Hybrid retrieval](https://github.com/mandeep15686/meridian/blob/main/src/rag/retrieve.py): `src/rag/retrieve.py`

### State and results

- [PostgreSQL and pgvector](https://github.com/mandeep15686/meridian/blob/main/src/db/models.py): `src/db/models.py`
- [Database sessions](https://github.com/mandeep15686/meridian/blob/main/src/db/session.py): `src/db/session.py`
- [Upload and report storage](https://github.com/mandeep15686/meridian/blob/main/src/storage/base.py): `src/storage/base.py`
- [Compliance report](https://github.com/mandeep15686/meridian/blob/main/src/api/worker.py): `src/api/worker.py`

### Evaluation

- [RAG and gap evaluation](https://github.com/mandeep15686/meridian/blob/main/src/eval/run_ragas.py): `src/eval/run_ragas.py`
- [Evaluation thresholds](https://github.com/mandeep15686/meridian/blob/main/src/eval/thresholds.py): `src/eval/thresholds.py`

### Other components

- **Compliance user**

## Connections

- Compliance user → FastAPI application: submits case
- Compliance user → Demo interface: uses demo
- FastAPI application → Submission and report routes: registers routes (evidence: `src/api/main.py`)
- Submission and report routes → API schemas: validates requests (evidence: `src/api/routes/all.py`)
- Submission and report routes → Async job worker: queues job (evidence: `src/api/routes/all.py`)
- Async job worker → LangGraph orchestration: runs pipeline (evidence: `src/api/worker.py`)
- LangGraph orchestration → Input router: routes inputs
- LangGraph orchestration → Shared analysis state: shares state
- LangGraph orchestration → Document analysis: dispatches
- LangGraph orchestration → Audio analysis: dispatches
- LangGraph orchestration → Image analysis: dispatches
- LangGraph orchestration → Tabular analysis: dispatches
- LangGraph orchestration → Gap synthesis: combines findings
- Document analysis → Hybrid retrieval: retrieves context (evidence: `src/agents/doc_agent.py`)
- Document analysis → Model wrappers: extracts entities (evidence: `src/agents/doc_agent.py`)
- Gap synthesis → Model wrappers: reasons with LLM (evidence: `src/agents/synthesis_agent.py`)
- Gap synthesis → Grounding gate: verifies claims
- Regulatory corpus loaders → Chunk and embed ingestion: supplies documents
- Chunk and embed ingestion → PostgreSQL and pgvector: stores chunks (evidence: `src/rag/ingest.py`)
- Hybrid retrieval → PostgreSQL and pgvector: searches clauses (evidence: `src/rag/retrieve.py`)
- Hybrid retrieval → Model wrappers: reranks results (evidence: `src/rag/retrieve.py`)
- Submission and report routes → Database sessions: opens sessions (evidence: `src/api/routes/all.py`)
- Async job worker → Database sessions: opens sessions (evidence: `src/api/worker.py`)
- Database sessions → PostgreSQL and pgvector: connects to (evidence: `src/db/session.py`)
- Submission and report routes → Upload and report storage: stores uploads (evidence: `src/api/routes/all.py`)
- Async job worker → Upload and report storage: stores artifacts (evidence: `src/api/worker.py`)
- Async job worker → Compliance report: persists findings (evidence: `src/api/worker.py`)
- Submission and report routes → Compliance report: returns report (evidence: `src/api/routes/all.py`)
- RAG and gap evaluation → Hybrid retrieval: evaluates retrieval (evidence: `src/eval/run_ragas.py`)
- RAG and gap evaluation → Evaluation thresholds: checks scores (evidence: `src/eval/run_ragas.py`)
