A self-hosted worker that turns classroom announcements into verified, idempotent deadline reminders.
PythonasyncioGeminiPydanticTelegram
Role
Solo backend and AI automation engineer
Production status
Self-hosted 24/7 production Linux daemon
Core stack
Python asyncio · aiosqlite · Google Classroom API · Gemini · Pydantic · Telegram Bot API · SQLite
Business outcome
Built an unattended worker that monitors classroom feeds across two Google identities, extracts deadlines, and sends duplicate-safe reminders.
The real-world problem
What the system had to solve
University instructors post assignment deadlines inside casual, unstructured conversational announcements in both Arabic and English. Students frequently miss submission deadlines because basic prompt wrappers hallucinate dates and crash backend parsers by outputting invalid JSON formats.
What I built
Architecture shaped by the constraints
I built a self-hosted 24/7 background worker using Python asyncio and aiosqlite that continuously polls the Google Classroom API. Unstructured announcements pass to Google Gemini models bounded by strict Pydantic JSON schemas, and validated deadlines trigger stateful, idempotent 24-hour and 2-hour Telegram reminders.
Production proof
Delivered system
Running continuously in production on a self-hosted Linux server, tracking live course feeds and delivering zero-duplicate deadline alerts without maintenance interventions.
System flow
Architecture at a glance
01
Google Classroom
Course announcements are polled asynchronously.
02
Gemini + Pydantic
Unstructured posts become typed deadline records.
03
SQLite + Telegram
Stateful, duplicate-safe reminders are scheduled and dispatched.
Engineering decisions
Why the system works this way
Deterministic fields before AI extraction
Constraint
Sending every assignment through an LLM adds cost and can hallucinate dates already present in structured coursework fields.
What I engineered
Read dueDate and dueTime directly for coursework; only free-text announcements use Gemini constrained by Pydantic fields and urgency tags.
Production outcome
Official assignment dates stay deterministic while buried announcement deadlines can still be extracted.
SQLite state for idempotent reminders
Constraint
Repeated polling encounters the same posts and can send duplicate 24-hour and 2-hour alerts.
What I engineered
Persisted announcement IDs and alert flags in SQLite through aiosqlite, and checked them before scheduling or dispatch.
Production outcome
Suppressed repeat reminders across unattended polling cycles.
Headless multi-account token refresh
Constraint
Interactive OAuth libraries may open a browser when tokens expire, freezing a daemon without a desktop session.
What I engineered
Separated background refresh from interactive authorization and silently refreshed stored credentials for personal and university accounts.
Production outcome
Kept the worker running headlessly across both identities, with an operator alert when manual reauthorization is needed.
An asyncio loop polls Google Classroom course feeds for the personal and university identities and checks stored announcement IDs.
Classroom Sentinel workflow preview
Mahmoud Attia is a Full-Stack & Mobile Software Engineer based in Cairo, Egypt, working with clients across EU, US, and MENA time zones. His work spans offline-first mobile apps, transactional web platforms, and schema-constrained AI workflows. The portfolio archive contains 13 entries across projects, coursework, concepts, and specifications. HS VPN is a commercial app live on Google Play, supported by a self-hosted fleet of nine Linux server nodes.