45 lines
1.8 KiB
Markdown
45 lines
1.8 KiB
Markdown
# Where the hooks are
|
|
|
|
## API route registration — `api/main.py`
|
|
|
|
Lines 10-11: imported `api.routes.routines` and `api.routes.medications`
|
|
Line 16: added both to `ROUTE_MODULES` list so they auto-register on startup
|
|
|
|
## Bot command registration — `bot/bot.py`
|
|
|
|
Lines 23-24: imported `bot.commands.routines` and `bot.commands.medications`
|
|
These imports trigger `register_module()` and `register_validator()` at load time,
|
|
which makes the bot's AI parser route "routine" and "medication" interaction types
|
|
to the right handlers.
|
|
|
|
## Bot command handlers — `bot/commands/routines.py`, `bot/commands/medications.py`
|
|
|
|
Each file:
|
|
- Defines an async handler (`handle_routine`, `handle_medication`)
|
|
- Defines a JSON validator for the AI parser
|
|
- Calls `register_module()` to hook into the command registry
|
|
- Calls `ai_parser.register_validator()` to hook into parse validation
|
|
|
|
## Scheduler — `scheduler/daemon.py`
|
|
|
|
`poll_callback()` now calls three check functions on every tick:
|
|
- `check_medication_reminders()` — sends notifications for doses due now
|
|
- `check_routine_reminders()` — sends notifications for scheduled routines
|
|
- `check_refills()` — warns when medication supply is running low
|
|
|
|
All three use `core.notifications._sendToEnabledChannels()` to deliver.
|
|
|
|
## AI config — `ai/ai_config.json`
|
|
|
|
Updated the `command_parser` system prompt to list the two interaction types
|
|
(`routine`, `medication`) and the fields to extract for each. This is what
|
|
tells the LLM how to parse natural language into the right action structure.
|
|
|
|
## What's NOT hooked yet (needs implementation)
|
|
|
|
- `config/schema.sql` — needs tables for routines, routine_steps,
|
|
routine_sessions, routine_schedules, medications, med_logs
|
|
- The actual body of every API route (all prototyped as `pass`)
|
|
- The actual body of both bot command handlers
|
|
- The three scheduler check functions
|