Skip to content

About

Telegram bot that logs diabetes data from text, voice notes and sensor screenshots with AI, prototype of Diabetes Tracker App | Bot de Telegram que registra los datos de la diabetes a partir de texto, notas de voz y capturas del sensor con IA, prototipo de Diabetes Tracker App

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Diabetes Tracker: Federico, a Telegram bot that logs diabetes data

Federico logs the daily life of a person with diabetes from text, voice notes or glucose sensor screenshots, and always asks before saving.

Federico is a Telegram bot. It uses Google Gemini's multimodal AI to extract the data, shows what it understood and saves it only after you confirm. It is the working prototype of the entrepreneurship project Diabetes Tracker App.

Federico is a logging and support tool. It does not replace your medical team's judgement, and it never recommends doses or treatments.

   INPUT           EXTRACT          CONFIRM           STORE
 +--------+      +--------+      +----------+      +--------+
 | text   | -->  | Gemini | -->  | save     | -->  | SQLite |
 | voice  |      | fields |      | correct  |      | + undo |
 | photo  |      |        |      | discard  |      |        |
 +--------+      +--------+      +----------+      +--------+

Features

Feature What it does
Multimodal logging Accepts text, voice notes and sensor screenshots.
Mandatory confirmation Shows what it understood with three buttons: save, correct or discard. A correction can be spoken naturally, for example "eran 3 de rápida" ("it was 3 units of rapid insulin").
Stored data Glucose, rapid and basal insulin, carbohydrates, meals with times, exercise, hypoglycaemia, symptoms, notes and the sensor graph points.
Doubtful readings Asks you to check any implausible value, such as 900 mg/dL.
Descriptive summaries /hoy and /semana report totals, mean glucose, time in range (70-180) and hypoglycaemia events.
Undo /deshacer cancels the last saved record without deleting it.
Privacy Answers only the Telegram IDs on the allow list.

The project: Diabetes Tracker App

"Your diabetes, logged in 10 seconds." Federico is the first step towards a cross-platform app that removes logging fatigue: you speak or take a photo, the AI sorts it out and you only confirm.

Aspect Plan
Business model Freemium. Basic logging stays free; Premium (EUR 2.99 a month or EUR 24.99 a year) adds the report for the endocrinologist, caregiver mode, export and reminders.
Roadmap Telegram prototype (2026), pilot with 5 to 10 users (Q1 2027), cross-platform beta (Q2 2027), store launch (H2 2027).
Project documents (in Spanish)
Document Contents
docs/producto.md Product sheet, free and Premium features, quality requirements and limits
docs/modelo-de-negocio.md Lean Canvas, pricing, margin and break-even point
docs/hoja-de-ruta.md Phases and the status of each one
docs/decisiones.md The reasons behind each decision

The full business plan (market, competition and marketing) was written as the entrepreneurship project for IPE II: project report.


Getting started

  1. Clone the repository and create the virtual environment:

    git clone https://github.com/joseantoniopastorrivera-dev/diabetes-tracker-app.git
    cd diabetes-tracker-app
    python -m venv .venv
    source .venv/Scripts/activate   # Windows (Git Bash)
    pip install -r requirements.txt
  2. Copy .env.example to .env and fill it in. ALLOWED_USER_IDS is required: without it the bot refuses to start. To find your ID, message @userinfobot. When someone without access writes to the bot, the log records their ID as "Acceso denegado".

  3. Start the bot:

    python bot.py

    On the first run it migrates a v1 database automatically and keeps its records. Back up the database first.

Run the tests with:

python -m pytest

The tests need no network or API: they use a fake extractor.


Architecture

Repository layout
diabetes-tracker-app/
+-- bot.py              entry point: wires the layers and starts the bot
+-- config.py           reads .env, time zone and allow list
+-- modelos.py          records, states, summary and range warnings
+-- datos/
|   +-- repositorio.py  SQLite and migrations (PRAGMA user_version)
+-- ia/
|   +-- extractor.py    Extractor interface and DatosExtraidos schema (Pydantic)
|   +-- gemini.py       asynchronous Google Gemini implementation
+-- servicios.py        logic: analyse, confirm, correct, undo, summaries
+-- presentacion.py     HTML formatting of the messages
+-- telegram_bot.py     handlers, buttons, commands and allow list
+-- tests/              pytest suite
+-- docs/               product, business and decision records
Layer Technology
Language Python 3.13
Telegram python-telegram-bot 22
AI google-genai (Gemini)
Validation Pydantic
Storage SQLite
Tests pytest

Privacy

Rule Detail
Nothing sensitive in git The database (*.db), backups (backups/) and .env are never committed.
Minimal data to Gemini Only the message being processed is sent.
Clean logs Logs contain no health data and no bot token.

Maintainer

Name GitHub Role
José Antonio Pastor Rivera José Antonio Pastor Rivera @joseantoniopastorrivera-dev Creator

About

Telegram bot that logs diabetes data from text, voice notes and sensor screenshots with AI, prototype of Diabetes Tracker App | Bot de Telegram que registra los datos de la diabetes a partir de texto, notas de voz y capturas del sensor con IA, prototipo de Diabetes Tracker App

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages