← Projects
LiveLocal-first (Zscaler blocks Telegram on the BCG VPN)

Prescription Assistant

Telegram bot for a doctor — types one messy line, gets back a properly filled Rx pad as a JPG.

PythonTelegram Bot APIClaude SonnetPillow
/rx
Prescription

The problem

Handwritten prescriptions are slow, often illegible, and lossy if anyone needs to go back to them later. Existing EMR software is overkill for a small clinic that just wants to put a clean piece of paper into a patient's hand. The doctor I built this for wanted to type one line — something like "Maria Cruz, 34F, Las Pinas, amox 500 tid x 7d" — and get back a properly formatted Rx pad with the clinic letterhead, the right license numbers, and no handwriting.

The solution

Prescription Assistant is a Telegram bot tuned for a single doctor at a small clinic. The doctor types `/rx` followed by free-form text, and Claude Sonnet does the parsing — it knows Philippine geography, it knows medical abbreviations like tid and bid and qod, and it understands shorthand for dosing. The bot shows a preview with Confirm, Edit and Cancel buttons; the Edit flow drills into either individual fields or individual medications. On Confirm, the bot runs one more AI review pass for a dosage sanity check and drug-name spelling, then renders the filled Rx template as a JPG and sends it back.

Features

  • One-line `/rx` command takes messy free-form text and produces a finished prescription
  • Understands Philippine geography for addresses, and medical abbreviations like tid, bid and qod
  • Preview step with Confirm, Edit and Cancel buttons before anything is final
  • Edit flow that drills into individual patient fields or individual medications
  • Final AI review pass for dosage sanity and drug-name spelling on every confirm
  • Output is a JPG of the filled Rx pad, ready to send or print
  • Access gated by Telegram user ID

Architecture

  • Sonnet powers the initial parse, the edit drill-down, and the final review pass before rendering
  • Pillow stamps text onto the clinic's Rx template at fixed coordinates
  • Telegram inline buttons drive the Confirm, Edit and Cancel flow, with no custom keyboard scaffolding
  • ALLOWED_USER_1 through ALLOWED_USER_5 environment variables gate access by Telegram user ID
  • Runs locally off-VPN, because Zscaler blocks api.telegram.org on the BCG network