--- title: Thyroid Initial Visit emoji: 🦋 colorFrom: pink colorTo: indigo sdk: gradio sdk_version: 5.5.0 python_version: "3.11" app_file: app.py pinned: false license: mit --- # Thyroid Initial-Visit Note Generator 4-section structured note for thyroid initial visit at endocrine / family-medicine outpatient, generated from form input. Phenotype-driven order selection (hyperthyroid / hypothyroid / goiter-nodule / abnormal-lab). Built-in ACR TI-RADS calculator on Tab 2. ## Output structure 1. 🚨 **Red flags** (conditional — only shown when triggered: thyroid storm, myxedema coma, airway compromise, suspicious malignancy on exam, sight-threatening Graves orbitopathy) 2. **History + ROS narrative** (phenotype-aware, includes meds/exposures and women-specific data) 3. **Physical examination** findings 4. **Initial workup plan**: A) checklist of suggested orders B) one-line narrative for HIS paste C) patient instructions D) brief differential and assessment thinking Phenotype-driven Section 4 orders: - Hyper → TSH, FT4, T3, TRAb, CBC, AST/ALT/bili (baseline before ATD), ECG - Hypo → TSH, FT4, anti-TPO, ± anti-Tg, lipid, CBC, Na/Cr - Goiter/nodule → US, cervical LN US, ± thyroid scan if TSH suppressed - Abnormal lab → repeat in 4-6 weeks + conditional antibodies ## Tab 2: ACR TI-RADS calculator Pure local calculation (no API call). Inputs: composition / echogenicity / shape / margin / echogenic foci (multi-select, additive) + nodule size. Outputs TR1-5 category + size-based FNA / follow-up recommendation per ACR TI-RADS 2017. ## Setup Required Space secrets (Settings → Variables and secrets): - `ANTHROPIC_API_KEY` — Claude API key - `GDRIVE_CLIENT_ID` — Google OAuth client ID (desktop type) - `GDRIVE_CLIENT_SECRET` — Google OAuth client secret - `GDRIVE_REFRESH_TOKEN` — obtained via `python get_refresh_token.py` locally Optional: - `THYROID_PASSWORD` — Gradio basic-auth password (username: `doctor`) - `GDRIVE_FOLDER_NAME` — default `Thyroid Initial Visits` - `THYROID_MODEL` — default `claude-sonnet-4-6` Without the three `GDRIVE_*` secrets, GDrive sync is disabled; manual `.md` download still works. ## Local run ```bash pip install -r requirements.txt export ANTHROPIC_API_KEY=sk-ant-... python app.py ``` > Not for clinical use without physician verification.