jamesxxx1997's picture
Initial commit: thyroid initial-visit note generator
30a5fc6
|
Raw
History Blame Contribute Delete
2.34 kB

A newer version of the Gradio SDK is available: 6.26.0

Upgrade
metadata
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

pip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-...
python app.py

Not for clinical use without physician verification.