# keerthannuu/diseasegene architecture

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

- Interactive diagram: https://gitdiagram.com/keerthannuu/diseasegene
- Repository: https://github.com/keerthannuu/diseasegene

## Overview

FinalDiseaseGene is a genomic disease–gene exploration and analytics platform with a Next.js web client, a Capacitor Android wrapper, and a FastAPI/SQLAlchemy backend. The principal workflow is to search or browse genomic entities, inspect their relationships and evidence, and view analytics; account and administration features support that use. The README also describes AI literature insights, citations and exports, and ETL ingestion. Backend routes and core wiring are evidenced by the supplied excerpts and index; several frontend integrations and unsampled features are documented only at product level.

Main entry points: [`backend/app/api/v1/router.py`](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/router.py) (API route registry), [`backend/app/db/models.py`](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/db/models.py) (Relational data models), [`frontend/app/page.tsx`](https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/page.tsx) (Web application), [`backend/app/api/v1/endpoints/search.py`](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/search.py) (Global search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User interfaces"]
  node_web["Web application<br/>[page.tsx]"]
  node_explorer["Genomic explorer<br/>[page.tsx]"]
  node_entity_pages["Entity detail pages<br/>[page.js]"]
  node_analytics_ui["Analytics views<br/>[page.tsx]"]
  node_ai_ui["AI insights view<br/>[page.tsx]"]
  node_android["Android client"]
end

subgraph group_api["API capabilities"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_api_router["API route registry<br/>[router.py]"]
  node_search["Global search<br/>[search.py]"]
  node_entity_routes["Entity endpoints<br/>[genes.py]"]
  node_association_routes["Association endpoints<br/>[associations.py]"]
  node_drug_routes["Drug endpoints<br/>[drugs.py]"]
  node_publication_routes["Publication endpoints<br/>[publications.py]"]
  node_stats["Statistics endpoint<br/>[main.py]"]
  node_ai_reports["Literature insights<br/>[page.tsx]"]
  node_citation_export["Citation and exports<br/>[page.tsx]"]
end

subgraph group_data["Data and services"]
  node_orm["Relational data models<br/>[models.py]"]
  node_db_session["Database session<br/>[session.py]"]
  node_database[("Relational database")]
  node_elastic[("Elasticsearch")]
  node_ingest["Data ingestion<br/>[ingest.py]"]
end

subgraph group_operations["Accounts and operations"]
  node_auth["Authentication and roles<br/>[auth.py]"]
  node_security["Token security<br/>[security.py]"]
  node_email["Email notifications<br/>[email_service.py]"]
  node_admin["Admin controls<br/>[admin.py]"]
end

node_researcher(("Researcher"))
node_email_provider["Email provider<br/>external system"]

node_researcher -->|"uses"| node_web
node_researcher -->|"uses"| node_android
node_web -->|"requests API"| node_api_app
node_android -->|"requests API"| node_api_app
node_api_app -->|"mounts routes"| node_api_router
node_api_router -->|"registers"| node_search
node_api_router -->|"registers"| node_entity_routes
node_api_router -->|"registers"| node_association_routes
node_api_router -->|"registers"| node_drug_routes
node_api_router -->|"registers"| node_publication_routes
node_api_router -->|"registers"| node_stats
node_api_router -->|"registers"| node_auth
node_api_router -->|"registers"| node_admin
node_search -->|"queries optionally"| node_elastic
node_search -->|"queries fallback"| node_database
node_search -->|"queries entities"| node_orm
node_entity_routes -->|"queries entities"| node_orm
node_association_routes -->|"queries associations"| node_orm
node_drug_routes -->|"queries data"| node_orm
node_publication_routes -->|"queries data"| node_orm
node_stats -->|"aggregates counts"| node_orm
node_orm -->|"persists records"| node_database
node_db_session -->|"opens sessions"| node_database
node_api_app -->|"creates tables"| node_db_session
node_ingest -.->|"loads datasets"| node_database
node_auth -->|"hashes and signs"| node_security
node_auth -->|"sends reset email"| node_email
node_email -.->|"sends messages"| node_email_provider
node_admin -->|"manages users"| node_orm
node_explorer -.->|"opens details"| node_entity_pages
node_web -.->|"views analytics"| node_analytics_ui
node_web -.->|"opens insights"| node_ai_ui
node_ai_ui -.->|"requests summaries"| node_ai_reports
node_web -.->|"exports results"| node_citation_export

click node_web "https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/page.tsx"
click node_explorer "https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/explorer/page.tsx"
click node_entity_pages "https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/genes/%5Bid%5D/page.js"
click node_analytics_ui "https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/analytics/page.tsx"
click node_ai_ui "https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/ai-insights/page.tsx"
click node_android "https://github.com/keerthannuu/diseasegene/blob/main/frontend/capacitor.config.ts"
click node_api_app "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/main.py"
click node_api_router "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/router.py"
click node_search "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/search.py"
click node_entity_routes "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/genes.py"
click node_association_routes "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/associations.py"
click node_drug_routes "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/drugs.py"
click node_publication_routes "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/publications.py"
click node_stats "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/main.py"
click node_ai_reports "https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/ai-insights/page.tsx"
click node_citation_export "https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/database/page.tsx"
click node_orm "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/db/models.py"
click node_db_session "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/db/session.py"
click node_ingest "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/scripts/ingest.py"
click node_auth "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/auth.py"
click node_security "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/services/security.py"
click node_email "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/services/email_service.py"
click node_admin "https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/admin.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_web,node_explorer,node_entity_pages,node_analytics_ui,node_ai_ui,node_android toneBlue
class node_api_app,node_api_router,node_search,node_entity_routes,node_association_routes,node_drug_routes,node_publication_routes,node_stats,node_ai_reports,node_citation_export toneAmber
class node_orm,node_db_session,node_database,node_elastic,node_ingest toneMint
class node_auth,node_security,node_email,node_admin toneRose
class node_researcher,node_email_provider toneIndigo
```

## Components

### User interfaces

- [Web application](https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Genomic explorer](https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/explorer/page.tsx): `frontend/app/explorer/page.tsx`
- [Entity detail pages](https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/genes/%5Bid%5D/page.js): `frontend/app/genes/[id]/page.js`
- [Analytics views](https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/analytics/page.tsx): `frontend/app/analytics/page.tsx`
- [AI insights view](https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/ai-insights/page.tsx): `frontend/app/ai-insights/page.tsx`
- [Android client](https://github.com/keerthannuu/diseasegene/blob/main/frontend/capacitor.config.ts): `frontend/capacitor.config.ts`

### API capabilities

- [FastAPI application](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/main.py): `backend/app/main.py`
- [API route registry](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Global search](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/search.py): `backend/app/api/v1/endpoints/search.py`
- [Entity endpoints](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/genes.py): `backend/app/api/v1/endpoints/genes.py`
- [Association endpoints](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/associations.py): `backend/app/api/v1/endpoints/associations.py`
- [Drug endpoints](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/drugs.py): `backend/app/api/v1/endpoints/drugs.py`
- [Publication endpoints](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/publications.py): `backend/app/api/v1/endpoints/publications.py`
- [Statistics endpoint](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/main.py): `backend/app/main.py`
- [Literature insights](https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/ai-insights/page.tsx): `frontend/app/ai-insights/page.tsx`
- [Citation and exports](https://github.com/keerthannuu/diseasegene/blob/main/frontend/app/database/page.tsx): `frontend/app/database/page.tsx`

### Data and services

- [Relational data models](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/db/models.py): `backend/app/db/models.py`
- [Database session](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- **Relational database**
- **Elasticsearch**
- [Data ingestion](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/scripts/ingest.py): `backend/app/scripts/ingest.py`

### Accounts and operations

- [Authentication and roles](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/auth.py): `backend/app/api/v1/endpoints/auth.py`
- [Token security](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/services/security.py): `backend/app/services/security.py`
- [Email notifications](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/services/email_service.py): `backend/app/services/email_service.py`
- [Admin controls](https://github.com/keerthannuu/diseasegene/blob/main/backend/app/api/v1/endpoints/admin.py): `backend/app/api/v1/endpoints/admin.py`

### Other components

- **Researcher**
- **Email provider**: external system

## Connections

- Researcher → Web application: uses (evidence: `README.md`)
- Researcher → Android client: uses (evidence: `README.md`)
- Web application → FastAPI application: requests API (evidence: `README.md`)
- Android client → FastAPI application: requests API (evidence: `README.md`)
- FastAPI application → API route registry: mounts routes (evidence: `backend/app/main.py`)
- API route registry → Global search: registers (evidence: `backend/app/api/v1/router.py`)
- API route registry → Entity endpoints: registers (evidence: `backend/app/api/v1/router.py`)
- API route registry → Association endpoints: registers (evidence: `backend/app/api/v1/router.py`)
- API route registry → Drug endpoints: registers (evidence: `backend/app/api/v1/router.py`)
- API route registry → Publication endpoints: registers (evidence: `backend/app/api/v1/router.py`)
- API route registry → Statistics endpoint: registers (evidence: `backend/app/api/v1/router.py`)
- API route registry → Authentication and roles: registers (evidence: `backend/app/api/v1/router.py`)
- API route registry → Admin controls: registers (evidence: `backend/app/api/v1/router.py`)
- Global search → Elasticsearch: queries optionally (evidence: `backend/app/api/v1/endpoints/search.py`)
- Global search → Relational database: queries fallback (evidence: `backend/app/api/v1/endpoints/search.py`)
- Global search → Relational data models: queries entities (evidence: `backend/app/api/v1/endpoints/search.py`)
- Entity endpoints → Relational data models: queries entities (evidence: `backend/app/api/v1/endpoints/genes.py`)
- Association endpoints → Relational data models: queries associations (evidence: `backend/app/api/v1/endpoints/associations.py`)
- Drug endpoints → Relational data models: queries data (evidence: `backend/app/api/v1/endpoints/drugs.py`)
- Publication endpoints → Relational data models: queries data (evidence: `backend/app/api/v1/endpoints/publications.py`)
- Statistics endpoint → Relational data models: aggregates counts (evidence: `backend/app/main.py`)
- Relational data models → Relational database: persists records
- Database session → Relational database: opens sessions (evidence: `backend/app/db/session.py`)
- FastAPI application → Database session: creates tables (evidence: `backend/app/main.py`)
- Data ingestion → Relational database: loads datasets (evidence: `README.md`)
- Authentication and roles → Token security: hashes and signs (evidence: `backend/app/api/v1/endpoints/auth.py`)
- Authentication and roles → Email notifications: sends reset email (evidence: `backend/app/api/v1/endpoints/auth.py`)
- Email notifications → Email provider: sends messages (evidence: `backend/app/services/email_service.py`)
- Admin controls → Relational data models: manages users (evidence: `backend/app/api/v1/endpoints/admin.py`)
- Genomic explorer → Entity detail pages: opens details (evidence: `README.md`)
- Web application → Analytics views: views analytics (evidence: `README.md`)
- Web application → AI insights view: opens insights (evidence: `README.md`)
- AI insights view → Literature insights: requests summaries (evidence: `README.md`)
- Web application → Citation and exports: exports results (evidence: `README.md`)
