Architecture Note: Multi-stage AI system for healthcare market intelligence, analyzing state initiatives, generating sales content, and identifying feature gaps for the Rural Reach Telehealth Platform.
%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart LR
subgraph Input["π₯ Data Sources"]
PDF["π State Initiative PDFs"]
PRO["π RHTP Proposal"]
end
subgraph Extract["βοΈ Extraction"]
BI["π§ Batch Import"]
IN["π Initiative Text"]
end
subgraph AI["π€ Claude Analysis"]
CL["π§ Claude Sonnet 4"]
SC["π Compatibility Score"]
end
subgraph Store["πΎ Storage"]
DB[("ποΈ SQLite")]
AN["π Analyses Table"]
SI["π Initiatives Table"]
end
PDF --> BI
PRO --> CL
BI --> IN
IN --> CL
CL --> SC
SC --> AN
IN --> SI
AN --> DB
SI --> DB
%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
subgraph Input["π₯ Enrichment Data"]
POP["π₯ Population"]
RUR["ποΈ Rural %"]
CAH["π₯ CAH Count"]
UNI["π Uninsured Rate"]
MED["π Medicaid Status"]
end
subgraph Factors["π 7 Boost Factors"]
F1["π Coverage Gap +5"]
F2["ποΈ Rural Pop Β±3"]
F3["π₯ CAH Density Β±3"]
F4["π Uninsured +2"]
F5["π΄ Elderly 65+ +2"]
F6["π° Income Adj -1"]
F7["πΊοΈ Regional Β±1"]
end
subgraph Calc["π’ Calculation"]
BS["π Base Score"]
BT["β Boost Total"]
FS["β
Final Score
Cap 0-100"]
end
subgraph Output["π€ Rankings"]
RK["π State Rankings"]
TR["π Tier Assignment"]
end
POP --> F2
RUR --> F2
CAH --> F3
UNI --> F4
MED --> F1
F1 --> BT
F2 --> BT
F3 --> BT
F4 --> BT
F5 --> BT
F6 --> BT
F7 --> BT
BS --> FS
BT --> FS
FS --> RK
RK --> TR
%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart LR
subgraph Context["π State Context"]
AN["π Analysis"]
EN["π Enrichment"]
BS["π Boost Scores"]
CT["π€ Contacts"]
end
subgraph Prompt["π Prompt Engineering"]
SY["π Sales Coach Prompt"]
GR["π RHT Grant Categories"]
TM["π₯ Team Roles"]
end
subgraph AI["π€ Claude Sonnet 4"]
CL["π§ Generate Script"]
JS["π JSON Output"]
end
subgraph Parse["π§ Parsing"]
OP["π’ Opening"]
TP["π Talking Points"]
OB["β οΈ Objections"]
CL2["π Closing"]
end
subgraph Store["πΎ Storage"]
DB[("ποΈ call_scripts")]
end
AN --> SY
EN --> SY
BS --> SY
CT --> SY
SY --> GR
GR --> TM
TM --> CL
CL --> JS
JS --> OP
JS --> TP
JS --> OB
JS --> CL2
OP --> DB
TP --> DB
%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
subgraph Input["π₯ Analysis Input"]
ST["π State Analysis"]
IN["π Initiatives"]
FT["π§ RHTP Features"]
end
subgraph AI["π€ Gap Detection"]
PR["π Gap Prompt"]
CL["π§ Claude Sonnet 4"]
JS["π JSON Gaps Array"]
end
subgraph Parse["π§ Gap Extraction"]
TI["π Gap Title"]
DE["π Description"]
CA["π Category"]
IM["π Impact Score"]
end
subgraph Dedup["π Deduplication"]
CH["π Title Match?"]
AP["β Append State"]
NW["π New Gap"]
end
subgraph Store["πΎ Storage"]
DB[("ποΈ proposal_idea_gaps")]
end
ST --> PR
IN --> PR
FT --> PR
PR --> CL
CL --> JS
JS --> TI
JS --> DE
JS --> CA
JS --> IM
TI --> CH
CH -->|"Yes"| AP
CH -->|"No"| NW
AP --> DB
NW --> DB
%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
subgraph Data["πΎ Data Sources"]
AN["π Analyses"]
EN["π Enrichment"]
BS["π Boost Scores"]
SC["π Call Scripts"]
EM["βοΈ Cold Emails"]
end
subgraph API["π Flask API"]
EP["π€οΈ Endpoints"]
AG["π₯ Aggregation"]
end
subgraph Export["π€ Export Formats"]
CSV["π CRM CSV"]
PDF["π Analysis PDF"]
PB["π Playbook PDF"]
ZIP["π¦ Tier ZIP"]
end
subgraph Dashboard["π₯οΈ Web UI"]
MAP["πΊοΈ Interactive Map"]
TT["π¬ Tooltips"]
FLT["π§ Filters"]
end
AN --> AG
EN --> AG
BS --> AG
SC --> AG
EM --> AG
AG --> EP
EP --> CSV
EP --> PDF
EP --> PB
EP --> ZIP
EP --> MAP
MAP --> TT
MAP --> FLT