# wangzhengpengjay/ai-health-steward architecture

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

- Interactive diagram: https://gitdiagram.com/wangzhengpengjay/ai-health-steward
- Repository: https://github.com/wangzhengpengjay/ai-health-steward

## Overview

AI Health Steward is a private, single-family health-management application with a full WebUI and a lighter Feishu entry point. The principal workflow is to collect reports or health measurements, extract and confirm structured data, maintain per-member health profiles, and use those profiles for dashboards, consultation, recommendations, summaries, and follow-up tasks. The graph includes the documented assessment, trend, settings, and semantic-search capabilities. Some service and route internals were not sampled, so those links are documented at product level or omitted rather than inferred from names.

Main entry points: [`frontend/src/App.tsx`](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/App.tsx) (Web application), [`backend/app/api/v1/router.py`](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/api/v1/router.py) (Versioned API routes), [`backend/app/models/health.py`](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/models/health.py) (Health profile records), [`backend/app/services/consultation.py`](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/consultation.py) (AI consultation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web management"]
  node_web_app["Web application<br/>[App.tsx]"]
  node_web_dashboard["Dashboard and trends<br/>[Dashboard.tsx]"]
  node_web_reports["Report management<br/>[Reports.tsx]"]
  node_web_metrics["Metric entry<br/>[MetricInput.tsx]"]
  node_web_chat["Consultation UI<br/>[Chat.tsx]"]
  node_web_settings["System settings<br/>[Settings.tsx]"]
  node_web_other["Other health pages"]
end

subgraph group_api["API and channels"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_api_routes["Versioned API routes<br/>[router.py]"]
  node_feishu["Feishu channel<br/>[feishu.py]"]
end

subgraph group_health["Health workflows"]
  node_report_flow["Report extraction and filing<br/>[reports.py]"]
  node_profile_flow["Health profile and metrics<br/>[profile.py]"]
  node_checkup["Checkup recommendations"]
  node_scales["Risk assessments"]
  node_summaries["Periodic health summaries<br/>[summary_service.py]"]
  node_tasks["Follow-up task management<br/>[task_service.py]"]
end

subgraph group_intelligence["AI and models"]
  node_consultation["AI consultation<br/>[consultation.py]"]
  node_model_router["Model provider routing<br/>[router.py]"]
  node_rag["Report semantic search<br/>[rag.py]"]
end

subgraph group_data["Health records"]
  node_records[("Health profile records<br/>[health.py]")]
  node_member_records[("Family members<br/>[family.py]")]
  node_task_records[("Health tasks<br/>[tasks.py]")]
  node_file_storage[("Local health files<br/>[file_storage.py]")]
  node_database[("Database sessions<br/>[database.py]")]
end

node_family_user(("Family user"))
node_model_services["Configured model services"]

node_family_user -->|"uses"| node_web_app
node_web_app -->|"routes to"| node_web_dashboard
node_web_app -->|"routes to"| node_web_reports
node_web_app -->|"routes to"| node_web_metrics
node_web_app -->|"routes to"| node_web_chat
node_web_app -->|"routes to"| node_web_settings
node_web_app -->|"routes to"| node_web_other
node_web_app -.->|"requests API"| node_api_routes
node_api_app -->|"mounts"| node_api_routes
node_api_routes -->|"registers"| node_report_flow
node_api_routes -->|"registers"| node_profile_flow
node_api_routes -->|"registers chat route"| node_consultation
node_api_routes -->|"registers checkup route"| node_checkup
node_report_flow -.->|"files extracted data"| node_records
node_profile_flow -->|"reads and writes"| node_records
node_consultation -.->|"selects provider"| node_model_router
node_model_router -->|"routes requests"| node_model_services
node_consultation -.->|"searches reports"| node_rag
node_rag -->|"retrieves report data"| node_records
node_checkup -.->|"uses member profile"| node_member_records
node_summaries -->|"summarizes health data"| node_records
node_summaries -->|"creates follow-ups"| node_tasks
node_tasks -->|"manages tasks"| node_task_records
node_file_storage -->|"organizes files by member"| node_member_records
node_api_app -->|"starts and stops"| node_feishu
node_feishu -.->|"answers via AI"| node_consultation
node_web_other -.->|"offers self-assessment"| node_scales
node_database -->|"provides ORM base"| node_member_records
node_database -->|"provides ORM base"| node_records
node_database -->|"provides ORM base"| node_task_records

click node_web_app "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/App.tsx"
click node_web_dashboard "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/Dashboard.tsx"
click node_web_reports "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/Reports.tsx"
click node_web_metrics "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/MetricInput.tsx"
click node_web_chat "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/Chat.tsx"
click node_web_settings "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/Settings.tsx"
click node_web_other "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/CheckupRecommend.tsx"
click node_api_app "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/main.py"
click node_api_routes "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/api/v1/router.py"
click node_report_flow "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/api/routes/reports.py"
click node_profile_flow "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/api/routes/profile.py"
click node_consultation "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/consultation.py"
click node_model_router "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/providers/router.py"
click node_rag "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/rag.py"
click node_checkup "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/checkup_recommend.py"
click node_scales "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/core/assessment_scales.py"
click node_summaries "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/summary_service.py"
click node_tasks "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/task_service.py"
click node_feishu "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/feishu.py"
click node_records "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/models/health.py"
click node_member_records "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/models/family.py"
click node_task_records "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/models/tasks.py"
click node_file_storage "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/file_storage.py"
click node_database "https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/core/database.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_app,node_web_dashboard,node_web_reports,node_web_metrics,node_web_chat,node_web_settings,node_web_other,node_family_user toneBlue
class node_api_app,node_api_routes,node_feishu toneAmber
class node_report_flow,node_profile_flow,node_checkup,node_scales,node_summaries,node_tasks toneMint
class node_consultation,node_model_router,node_rag toneRose
class node_records,node_member_records,node_task_records,node_file_storage,node_database,node_model_services toneIndigo
```

## Components

### Web management

- [Web application](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard and trends](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Report management](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/Reports.tsx): `frontend/src/pages/Reports.tsx`
- [Metric entry](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/MetricInput.tsx): `frontend/src/pages/MetricInput.tsx`
- [Consultation UI](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/Chat.tsx): `frontend/src/pages/Chat.tsx`
- [System settings](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/Settings.tsx): `frontend/src/pages/Settings.tsx`
- [Other health pages](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/frontend/src/pages/CheckupRecommend.tsx): `frontend/src/pages/CheckupRecommend.tsx`

### API and channels

- [FastAPI application](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/main.py): `backend/app/main.py`
- [Versioned API routes](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Feishu channel](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/feishu.py): `backend/app/services/feishu.py`

### Health workflows

- [Report extraction and filing](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/api/routes/reports.py): `backend/app/api/routes/reports.py`
- [Health profile and metrics](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/api/routes/profile.py): `backend/app/api/routes/profile.py`
- [Checkup recommendations](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/checkup_recommend.py): `backend/app/services/checkup_recommend.py`
- [Risk assessments](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/core/assessment_scales.py): `backend/app/core/assessment_scales.py`
- [Periodic health summaries](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/summary_service.py): `backend/app/services/summary_service.py`
- [Follow-up task management](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/task_service.py): `backend/app/services/task_service.py`

### AI and models

- [AI consultation](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/consultation.py): `backend/app/services/consultation.py`
- [Model provider routing](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/providers/router.py): `backend/app/providers/router.py`
- [Report semantic search](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/rag.py): `backend/app/services/rag.py`

### Health records

- [Health profile records](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/models/health.py): `backend/app/models/health.py`
- [Family members](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/models/family.py): `backend/app/models/family.py`
- [Health tasks](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/models/tasks.py): `backend/app/models/tasks.py`
- [Local health files](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/services/file_storage.py): `backend/app/services/file_storage.py`
- [Database sessions](https://github.com/wangzhengpengjay/ai-health-steward/blob/main/backend/app/core/database.py): `backend/app/core/database.py`

### Other components

- **Family user**
- **Configured model services**

## Connections

- Family user → Web application: uses (evidence: `README.md`)
- Web application → Dashboard and trends: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Report management: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Metric entry: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Consultation UI: routes to (evidence: `frontend/src/App.tsx`)
- Web application → System settings: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Other health pages: routes to (evidence: `frontend/src/App.tsx`)
- Web application → Versioned API routes: requests API
- FastAPI application → Versioned API routes: mounts (evidence: `backend/app/main.py`)
- Versioned API routes → Report extraction and filing: registers (evidence: `backend/app/api/v1/router.py`)
- Versioned API routes → Health profile and metrics: registers (evidence: `backend/app/api/v1/router.py`)
- Versioned API routes → AI consultation: registers chat route (evidence: `backend/app/api/v1/router.py`)
- Versioned API routes → Checkup recommendations: registers checkup route (evidence: `backend/app/api/v1/router.py`)
- Report extraction and filing → Health profile records: files extracted data
- Health profile and metrics → Health profile records: reads and writes (evidence: `backend/app/api/routes/profile.py`)
- AI consultation → Model provider routing: selects provider
- Model provider routing → Configured model services: routes requests (evidence: `backend/app/providers/router.py`)
- AI consultation → Report semantic search: searches reports
- Report semantic search → Health profile records: retrieves report data (evidence: `backend/app/services/rag.py`)
- Checkup recommendations → Family members: uses member profile
- Periodic health summaries → Health profile records: summarizes health data (evidence: `backend/app/services/summary_service.py`)
- Periodic health summaries → Follow-up task management: creates follow-ups (evidence: `backend/app/services/summary_service.py`)
- Follow-up task management → Health tasks: manages tasks (evidence: `backend/app/services/task_service.py`)
- Local health files → Family members: organizes files by member (evidence: `backend/app/services/file_storage.py`)
- FastAPI application → Feishu channel: starts and stops (evidence: `backend/app/main.py`)
- Feishu channel → AI consultation: answers via AI
- Other health pages → Risk assessments: offers self-assessment (evidence: `README.md`)
- Database sessions → Family members: provides ORM base (evidence: `backend/app/models/family.py`)
- Database sessions → Health profile records: provides ORM base (evidence: `backend/app/models/health.py`)
- Database sessions → Health tasks: provides ORM base (evidence: `backend/app/models/tasks.py`)
