# arunkumar2611/advanced-health-record-rag-with-google-adk architecture

> Architecture diagram of the GitHub repository arunkumar2611/advanced-health-record-rag-with-google-adk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arunkumar2611/advanced-health-record-rag-with-google-adk
- Repository: https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk

## Overview

Personal Health RAG is an account-scoped health-record assistant. A user registers and signs in, uploads a report, then asks questions in a conversation. The API validates and processes uploads into structured records and searchable chunks; chat runs a safety, retrieval, optional drug-reference, and answer workflow. SQLite holds account, report, memory, and conversation data, while each account has a separate FAISS index. The README documents these capabilities; edges involving unsampled implementation details are limited to documented relationships.

Main entry points: [`health_rag/api/app.py`](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/api/app.py) (FastAPI routes), [`health_rag/graph.py`](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/graph.py) (Chat workflow), [`health_rag/vector_store/faiss_store.py`](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/vector_store/faiss_store.py) (Account FAISS index), [`health_rag/extraction.py`](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/extraction.py) (Report extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and API"]
  node_browser["Browser UI<br/>[app.js]"]
  node_api["FastAPI routes<br/>[app.py]"]
  node_auth["Token authentication<br/>[auth.py]"]
  node_events["Progress events<br/>[observability.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_ingest["Record ingestion"]
  node_loaders["Text loaders<br/>[loaders.py]"]
  node_ocr["Scanned PDF OCR<br/>[ocr.py]"]
  node_extraction["Report extraction<br/>[extraction.py]"]
  node_schema["Medical report schema<br/>[schemas.py]"]
  node_chunking["Report chunking<br/>[splitter.py]"]
end

subgraph group_state["Patient data"]
  node_sqlite[("SQLite records<br/>[database.py]")]
  node_uploads["Uploaded files<br/>[app.py]"]
  node_vectors[("Account FAISS index<br/>[faiss_store.py]")]
end

subgraph group_query["Question answering"]
  node_querygraph["Chat workflow<br/>[graph.py]"]
  node_answering["Grounded answer generation<br/>[answering.py]"]
  node_druglookup["Drug reference lookup<br/>[drug_reference.py]"]
end

subgraph group_integrations["Model and references"]
  node_agent["ADK agent<br/>[adk_agent.py]"]
  node_gemini{{"Google Gemini"}}
  node_drugservices{{"NIH RxNorm and FDA"}}
end

node_user(("Account holder"))

node_user -->|"uses"| node_browser
node_browser -->|"sends requests"| node_api
node_api -->|"authenticates"| node_auth
node_api -->|"reads and writes"| node_sqlite
node_api -->|"stores source"| node_uploads
node_api -->|"loads text"| node_loaders
node_api -->|"renders scans"| node_ocr
node_api -->|"extracts report"| node_extraction
node_extraction -->|"validates against"| node_schema
node_extraction -->|"extracts with"| node_gemini
node_api -->|"chunks report"| node_chunking
node_api -->|"indexes chunks"| node_vectors
node_vectors -->|"embeds text"| node_gemini
node_vectors -->|"stores chunk records"| node_sqlite
node_api -->|"invokes workflow"| node_querygraph
node_querygraph -->|"searches chunks"| node_vectors
node_querygraph -->|"loads context"| node_sqlite
node_querygraph -->|"looks up drug"| node_druglookup
node_druglookup -->|"queries"| node_drugservices
node_querygraph -->|"generates answer"| node_answering
node_answering -->|"runs"| node_agent
node_answering -->|"generates response"| node_gemini
node_api -->|"emits progress"| node_events
node_querygraph -->|"emits progress"| node_events

click node_browser "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/static/app.js"
click node_api "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/api/app.py"
click node_auth "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/security/auth.py"
click node_sqlite "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/persistence/database.py"
click node_uploads "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/api/app.py"
click node_loaders "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/data_loading/loaders.py"
click node_ocr "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/data_loading/ocr.py"
click node_extraction "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/extraction.py"
click node_schema "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/schemas.py"
click node_chunking "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/chunking/splitter.py"
click node_vectors "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/vector_store/faiss_store.py"
click node_querygraph "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/graph.py"
click node_answering "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/answering.py"
click node_agent "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/adk_agent.py"
click node_druglookup "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/external_sources/drug_reference.py"
click node_events "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/observability.py"
click node_config "https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/config.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_browser,node_api,node_auth,node_events,node_config toneBlue
class node_loaders,node_ocr,node_extraction,node_schema,node_chunking toneAmber
class node_sqlite,node_uploads,node_vectors toneMint
class node_querygraph,node_answering,node_druglookup toneRose
class node_agent,node_gemini,node_drugservices,node_user toneIndigo
```

## Components

### Access and API

- [Browser UI](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/static/app.js): `health_rag/static/app.js`
- [FastAPI routes](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/api/app.py): `health_rag/api/app.py`
- [Token authentication](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/security/auth.py): `health_rag/security/auth.py`
- [Progress events](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/observability.py): `health_rag/observability.py`
- [Runtime configuration](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/config.py): `health_rag/config.py`

### Record ingestion

- [Text loaders](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/data_loading/loaders.py): `health_rag/data_loading/loaders.py`
- [Scanned PDF OCR](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/data_loading/ocr.py): `health_rag/data_loading/ocr.py`
- [Report extraction](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/extraction.py): `health_rag/extraction.py`
- [Medical report schema](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/schemas.py): `health_rag/schemas.py`
- [Report chunking](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/chunking/splitter.py): `health_rag/chunking/splitter.py`

### Patient data

- [SQLite records](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/persistence/database.py): `health_rag/persistence/database.py`
- [Uploaded files](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/api/app.py): `health_rag/api/app.py`
- [Account FAISS index](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/vector_store/faiss_store.py): `health_rag/vector_store/faiss_store.py`

### Question answering

- [Chat workflow](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/graph.py): `health_rag/graph.py`
- [Grounded answer generation](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/answering.py): `health_rag/answering.py`
- [Drug reference lookup](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/external_sources/drug_reference.py): `health_rag/external_sources/drug_reference.py`

### Model and references

- [ADK agent](https://github.com/arunkumar2611/advanced-health-record-rag-with-google-adk/blob/develop/health_rag/adk_agent.py): `health_rag/adk_agent.py`
- **Google Gemini**
- **NIH RxNorm and FDA**

### Other components

- **Account holder**

## Connections

- Account holder → Browser UI: uses (evidence: `README.md`)
- Browser UI → FastAPI routes: sends requests (evidence: `README.md`)
- FastAPI routes → Token authentication: authenticates (evidence: `health_rag/api/app.py`)
- FastAPI routes → SQLite records: reads and writes (evidence: `health_rag/api/app.py`)
- FastAPI routes → Uploaded files: stores source (evidence: `README.md`)
- FastAPI routes → Text loaders: loads text (evidence: `health_rag/api/app.py`)
- FastAPI routes → Scanned PDF OCR: renders scans (evidence: `health_rag/api/app.py`)
- FastAPI routes → Report extraction: extracts report (evidence: `health_rag/api/app.py`)
- Report extraction → Medical report schema: validates against (evidence: `health_rag/extraction.py`)
- Report extraction → Google Gemini: extracts with (evidence: `README.md`)
- FastAPI routes → Report chunking: chunks report (evidence: `health_rag/api/app.py`)
- FastAPI routes → Account FAISS index: indexes chunks (evidence: `health_rag/api/app.py`)
- Account FAISS index → Google Gemini: embeds text (evidence: `health_rag/vector_store/faiss_store.py`)
- Account FAISS index → SQLite records: stores chunk records (evidence: `health_rag/vector_store/faiss_store.py`)
- FastAPI routes → Chat workflow: invokes workflow (evidence: `health_rag/api/app.py`)
- Chat workflow → Account FAISS index: searches chunks (evidence: `health_rag/graph.py`)
- Chat workflow → SQLite records: loads context (evidence: `health_rag/graph.py`)
- Chat workflow → Drug reference lookup: looks up drug (evidence: `health_rag/graph.py`)
- Drug reference lookup → NIH RxNorm and FDA: queries (evidence: `health_rag/external_sources/drug_reference.py`)
- Chat workflow → Grounded answer generation: generates answer (evidence: `health_rag/graph.py`)
- Grounded answer generation → ADK agent: runs (evidence: `health_rag/answering.py`)
- Grounded answer generation → Google Gemini: generates response (evidence: `README.md`)
- FastAPI routes → Progress events: emits progress (evidence: `health_rag/api/app.py`)
- Chat workflow → Progress events: emits progress (evidence: `health_rag/graph.py`)
