# anhtu604/pyh architecture

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

- Interactive diagram: https://gitdiagram.com/anhtu604/pyh
- Repository: https://github.com/anhtu604/pyh

## Overview

Protect Your Health is an offline-first workflow for producing Vietnamese preventive-health videos from an operator-selected topic and doctor-approved brief, through evidence, script and storyboard, to rendered video, two explicit doctor reviews, and a manual publishing package. The graph preserves the v2 workflow kernel, evidence and visual-asset branches, AI-clip handoff, and voice/render capabilities. Edges follow README descriptions or shown source references; some implementation links are omitted because the sampled excerpts do not establish them.

Main entry points: [`src/healthvideo/cli.py`](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/cli.py) (Command interface), [`src/healthvideo/workflows/produce.py`](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/produce.py) (Video production), [`src/healthvideo/workflows/gate_review.py`](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/gate_review.py) (Doctor review gates), [`src/healthvideo/workflows/evidence.py`](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/evidence.py) (Evidence research)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Editorial workflow"]
  node_topic["Topic selection<br/>[topic.py]"]
  node_project["Project setup"]
  node_author["Brief and script<br/>[author.py]"]
  node_evidence["Evidence research<br/>[evidence.py]"]
  node_evidence_clients["Evidence clients<br/>[clients.py]"]
  node_storyboard["Storyboard<br/>[storyboard.py]"]
end

subgraph group_kernel["Workflow kernel"]
  node_state["Workflow state<br/>[state_graph.py]"]
  node_revision_store[("Revision storage<br/>[revisions.py]")]
end

subgraph group_production["Media production"]
  node_asset_workflow["Visual asset workflow<br/>[visual_assets.py]"]
  node_asset_manifest["Asset manifest<br/>[asset_manifest.py]"]
  node_ai_clips["AI clip workflow<br/>[ai_clips.py]"]
  node_veo["Veo provider<br/>[veo.py]"]
  node_tts["Speech generation"]
  node_render_workflow["Video production<br/>[produce.py]"]
  node_render_input["Render input<br/>[input.py]"]
  node_remotion["Remotion renderer<br/>[remotion.py]"]
  node_video_app["Video composition<br/>[HealthVideo.tsx]"]
  node_captions["Captions<br/>[Captions.tsx]"]
end

subgraph group_review["Review and release"]
  node_gate["Doctor review gates<br/>[gate_review.py]"]
  node_review_packet["HTML review packet<br/>[review_html.py]"]
  node_agent_review["Second-model handoff<br/>[agent_review.py]"]
  node_publish["Publishing package<br/>[package.py]"]
end

subgraph group_support["Operator support"]
  node_cli["Command interface<br/>[cli.py]"]
  node_backup["Project backup<br/>[backup.py]"]
end

node_operator(("Operator / doctor"))

node_operator -->|"issues commands"| node_cli
node_cli -->|"runs selection"| node_topic
node_cli -->|"creates project"| node_project
node_cli -->|"runs authoring"| node_author
node_cli -->|"starts research"| node_evidence
node_evidence -->|"uses clients"| node_evidence_clients
node_cli -->|"runs approvals"| node_gate
node_cli -->|"manages handoff"| node_agent_review
node_cli -->|"starts production"| node_render_workflow
node_cli -->|"creates package"| node_publish
node_render_workflow -->|"generates speech"| node_tts
node_render_workflow -.->|"prepares input"| node_render_input
node_render_workflow -->|"renders video"| node_remotion
node_remotion -.->|"renders composition"| node_video_app
node_video_app -->|"renders captions"| node_captions
node_asset_workflow -->|"registers assets"| node_asset_manifest
node_ai_clips -->|"updates manifest"| node_asset_manifest
node_ai_clips -.->|"requests clips"| node_veo
node_gate -->|"hashes assets"| node_asset_manifest
node_gate -->|"advances state"| node_state
node_gate -.->|"records review"| node_revision_store
node_review_packet -->|"reads evidence"| node_evidence
node_review_packet -->|"reads scenes"| node_storyboard
node_backup -.->|"backs up project"| node_revision_store

click node_cli "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/cli.py"
click node_topic "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/topic.py"
click node_project "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/create_project_v2.py"
click node_author "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/author.py"
click node_evidence "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/evidence.py"
click node_evidence_clients "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/evidence/clients.py"
click node_storyboard "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/domain/storyboard.py"
click node_state "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/domain/state_graph.py"
click node_revision_store "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/storage/revisions.py"
click node_asset_workflow "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/visual_assets.py"
click node_asset_manifest "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/domain/asset_manifest.py"
click node_ai_clips "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/ai_clips.py"
click node_veo "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/video_ai/veo.py"
click node_tts "https://github.com/anhtu604/pyh/tree/main/src/healthvideo/tts"
click node_render_workflow "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/produce.py"
click node_render_input "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/render/input.py"
click node_remotion "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/render/remotion.py"
click node_video_app "https://github.com/anhtu604/pyh/blob/main/video/src/HealthVideo.tsx"
click node_captions "https://github.com/anhtu604/pyh/blob/main/video/src/components/Captions.tsx"
click node_gate "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/gate_review.py"
click node_review_packet "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/review_html.py"
click node_agent_review "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/agent_review.py"
click node_publish "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/package.py"
click node_backup "https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/backup.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_topic,node_project,node_author,node_evidence,node_evidence_clients,node_storyboard toneBlue
class node_state,node_revision_store toneAmber
class node_asset_workflow,node_asset_manifest,node_ai_clips,node_veo,node_tts,node_render_workflow,node_render_input,node_remotion,node_video_app,node_captions toneMint
class node_gate,node_review_packet,node_agent_review,node_publish toneRose
class node_cli,node_backup,node_operator toneIndigo
```

## Components

### Editorial workflow

- [Topic selection](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/topic.py): `src/healthvideo/workflows/topic.py`
- [Project setup](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/create_project_v2.py): `src/healthvideo/workflows/create_project_v2.py`
- [Brief and script](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/author.py): `src/healthvideo/workflows/author.py`
- [Evidence research](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/evidence.py): `src/healthvideo/workflows/evidence.py`
- [Evidence clients](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/evidence/clients.py): `src/healthvideo/evidence/clients.py`
- [Storyboard](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/domain/storyboard.py): `src/healthvideo/domain/storyboard.py`

### Workflow kernel

- [Workflow state](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/domain/state_graph.py): `src/healthvideo/domain/state_graph.py`
- [Revision storage](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/storage/revisions.py): `src/healthvideo/storage/revisions.py`

### Media production

- [Visual asset workflow](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/visual_assets.py): `src/healthvideo/workflows/visual_assets.py`
- [Asset manifest](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/domain/asset_manifest.py): `src/healthvideo/domain/asset_manifest.py`
- [AI clip workflow](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/ai_clips.py): `src/healthvideo/workflows/ai_clips.py`
- [Veo provider](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/video_ai/veo.py): `src/healthvideo/video_ai/veo.py`
- [Speech generation](https://github.com/anhtu604/pyh/tree/main/src/healthvideo/tts): `src/healthvideo/tts`
- [Video production](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/produce.py): `src/healthvideo/workflows/produce.py`
- [Render input](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/render/input.py): `src/healthvideo/render/input.py`
- [Remotion renderer](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/render/remotion.py): `src/healthvideo/render/remotion.py`
- [Video composition](https://github.com/anhtu604/pyh/blob/main/video/src/HealthVideo.tsx): `video/src/HealthVideo.tsx`
- [Captions](https://github.com/anhtu604/pyh/blob/main/video/src/components/Captions.tsx): `video/src/components/Captions.tsx`

### Review and release

- [Doctor review gates](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/gate_review.py): `src/healthvideo/workflows/gate_review.py`
- [HTML review packet](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/review_html.py): `src/healthvideo/workflows/review_html.py`
- [Second-model handoff](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/agent_review.py): `src/healthvideo/workflows/agent_review.py`
- [Publishing package](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/package.py): `src/healthvideo/workflows/package.py`

### Operator support

- [Command interface](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/cli.py): `src/healthvideo/cli.py`
- [Project backup](https://github.com/anhtu604/pyh/blob/main/src/healthvideo/workflows/backup.py): `src/healthvideo/workflows/backup.py`

### Other components

- **Operator / doctor**

## Connections

- Operator / doctor → Command interface: issues commands (evidence: `README.md`)
- Command interface → Topic selection: runs selection (evidence: `src/healthvideo/cli.py`)
- Command interface → Project setup: creates project (evidence: `README.md`)
- Command interface → Brief and script: runs authoring
- Command interface → Evidence research: starts research (evidence: `README.md`)
- Evidence research → Evidence clients: uses clients (evidence: `src/healthvideo/evidence/clients.py`)
- Command interface → Doctor review gates: runs approvals (evidence: `src/healthvideo/cli.py`)
- Command interface → Second-model handoff: manages handoff (evidence: `src/healthvideo/cli.py`)
- Command interface → Video production: starts production (evidence: `README.md`)
- Command interface → Publishing package: creates package (evidence: `README.md`)
- Video production → Speech generation: generates speech (evidence: `README.md`)
- Video production → Render input: prepares input
- Video production → Remotion renderer: renders video (evidence: `README.md`)
- Remotion renderer → Video composition: renders composition
- Video composition → Captions: renders captions
- Visual asset workflow → Asset manifest: registers assets (evidence: `src/healthvideo/workflows/gate_review.py`)
- AI clip workflow → Asset manifest: updates manifest (evidence: `src/healthvideo/workflows/ai_clips.py`)
- AI clip workflow → Veo provider: requests clips
- Doctor review gates → Asset manifest: hashes assets (evidence: `src/healthvideo/workflows/gate_review.py`)
- Doctor review gates → Workflow state: advances state (evidence: `src/healthvideo/workflows/gate_review.py`)
- Doctor review gates → Revision storage: records review
- HTML review packet → Evidence research: reads evidence (evidence: `src/healthvideo/workflows/review_html.py`)
- HTML review packet → Storyboard: reads scenes (evidence: `src/healthvideo/workflows/review_html.py`)
- Project backup → Revision storage: backs up project
