DEV Community

Lavish Sheth
Lavish Sheth

Posted on

Dose Buddy: a Medicine Reminder That Reads Prescriptions Locally with Gemma

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🤝

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

What I Built

Dose Buddy is a privacy-first medicine reminder that turns a doctor's instructions into a ready-to-use schedule. I built it for two people I care about: my dad and my friend Abhay.

Reminder apps are only useful if someone has the patience to set them up. Entering every medicine, dose and timing by hand is tedious, and one typo means a missed or wrong reminder. I wanted something where you type the instructions exactly as the doctor wrote them, and the app does the rest.

How it works. You type the prescription instructions, or upload a photo of the prescription. A local AI model reads them and builds the schedule. You review it in an editable table, fix anything wrong, and save. Then Dose Buddy reminds you on the laptop and on a phone.

Feature What it does
Natural-language input Understands text like "Amoxicillin 250mg every 8 hours for 5 days"
Photo input Reads a prescription photo with a vision-capable model
Human confirmation Shows an editable table; nothing is saved until the user approves
Today view Lists today's doses with done and upcoming markers
Phone alarms Exports a .ics calendar file with a repeating alarm per dose, which works offline
Desktop alerts A background script shows a notification at each dose time

Safety note: Dose Buddy only sends reminders. It is not medical advice, and the schedule must always be checked against the original prescription.

Demo

The walkthrough shows:

  1. Entering prescription instructions
  2. The AI producing an editable schedule table
  3. Saving the schedule and viewing today's doses
  4. The reminder script firing an alert at the scheduled time

Code

💊 Dose Buddy

A medicine reminder built for one real person. Give it a prescription photo or plain text a local open model reads it, you confirm the result, and it sets reminders.

Everything runs on your own machine through Ollama. No cloud AI, no API key and no health data leaves the laptop.

Run it

# 1. Install Ollama, then pull an open model that can read images
ollama pull gemma3:4b

# 2. Install and start the app
pip install -r requirements.txt
streamlit run app.py

# 3. In a second terminal, start the reminder script
python reminder.py
Enter fullscreen mode Exit fullscreen mode

How it works

  1. Type the instructions or upload a photo.
  2. The model returns JSON (medicine, dose, times, days).
  3. You check and edit every row. Nothing is saved until you confirm.
  4. Reminders: download an .ics file for phone alarms (works offline), and/or run reminder.py for desktop alerts.

Optional Telegram messages (needs internet):

…
Enter fullscreen mode Exit fullscreen mode

dose-buddy/
├── app.py            # Streamlit interface
├── core.py           # Prompt, JSON parsing, schedule logic, .ics export
├── reminder.py       # Background reminder alerts
├── requirements.txt
└── README.md
Enter fullscreen mode Exit fullscreen mode

How I Built It

Open-source stack

  • Gemma 3 (4B): Google's open-weight model, which reads and structures the instructions
  • Ollama: runs the model locally on my laptop
  • Streamlit and Python: the interface and application logic

Architecture

Typed text or photo
        ↓
Gemma 3 via Ollama (runs locally)
        ↓
Structured JSON (medicine, dose, times, days, notes)
        ↓
Editable table, confirmed by the user
        ↓
Saved schedule
        ↓
.ics phone alarms  +  desktop alerts (reminder.py)
Enter fullscreen mode Exit fullscreen mode

Design decisions

  • Structured output. The model must return a fixed JSON format at temperature 0, so the same input gives the same result. The parser also tolerates extra text around the JSON.
  • No guessing. The prompt tells the model to copy names and doses exactly as written and to return UNCLEAR when something can't be read. The app refuses to save any row marked UNCLEAR.
  • Human in the loop. Small models can misread doses, so the user always reviews and edits the table before saving.
  • Plain-language time rules. Phrases like "after dinner" or "every 8 hours" are mapped to clock times in one place, so they are easy to adjust.
  • Two reminder paths. The .ics file works on any phone without internet, and reminder.py covers the laptop.

Testing

I tested the parsing, scheduling and calendar-export logic with scripts covering time formats, malformed model output, course lengths and calendar rules. Then I ran the full app on my laptop with Ollama and recorded the demo. To check that alerts fire, I set a dose a couple of minutes ahead and watched reminder.py trigger it on time. I also made a clearly labelled sample prescription image for testing the photo path.

What I learned along the way

  • Setup has more steps than the code. The model has to be downloaded first, and Ollama has to be running before the app can use it. I added a status indicator in the sidebar so a missing connection is obvious.
  • A calendar file is not obvious to everyone. My first instinct was to "run" the downloaded .ics file. It is meant to be opened on a phone, where it imports the alarms. The app's reminders tab now explains this.
  • Small models need guardrails. Telling the model to say UNCLEAR instead of guessing, and forcing a human review, matters more than any prompt cleverness.

Limitations and next steps

  • Small local models can misread handwriting or blurry photos, so the confirmation step is essential.
  • reminder.py only works while the laptop is on.
  • Next: a "mark as taken" button, alerts for missed doses, and more languages.

How AI helped me build it

I wrote the code with help from Claude in a chat. The AI running inside the application is the open model, Gemma.

Handing it over

Dose Buddy is built for my dad and Abhay, and I'm putting it in their hands with this submission. Their feedback is the real test, because they are the ones who will decide whether it saves them effort. I'll update this post with what they say.

Why Does Open Innovation Matter?

Privacy. A medicine list is sensitive personal information. Because Gemma runs locally through Ollama, prescription text and photos never leave the laptop, and the AI step needs no internet connection. For something this personal, I didn't want to send it to someone else's servers.

Cost. There are no API keys, per-request fees or usage limits, so family and friends can use it every day without a bill.

Control. The model is a single setting in the sidebar, so it can be swapped for another open model, including a larger one for better handwriting. The behavior lives in one readable prompt I can edit directly. With a closed API, I couldn't control where the data goes, what it costs, or which model version I depend on.

Prize Categories

  • Best Use of Gemma: the core of the app is Gemma 3 running locally through Ollama.

Top comments (0)