First synculous 2 Big-Pickle pass.

This commit is contained in:
2026-02-12 23:07:48 -06:00
parent 25d05e0e86
commit 3e1134575b
26 changed files with 2729 additions and 59 deletions

View File

@@ -2,8 +2,14 @@
## 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
Lines 10-17: imported route modules and added to `ROUTE_MODULES`:
- `api.routes.routines`
- `api.routes.medications`
- `api.routes.routine_steps_extended`
- `api.routes.routine_sessions_extended`
- `api.routes.routine_templates`
- `api.routes.routine_stats`
- `api.routes.routine_tags`
## Bot command registration — `bot/bot.py`
@@ -35,10 +41,72 @@ 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)
## Extended Routines API — New Modules
- `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
### Routine Steps Extended — `api/routes/routine_steps_extended.py`
- `PUT /api/routines/<id>/steps/<step_id>/instructions` — update step instructions
- `PUT /api/routines/<id>/steps/<step_id>/type` — update step type (timer, checklist, etc)
- `PUT /api/routines/<id>/steps/<step_id>/media` — update media URL
### Routine Sessions Extended — `api/routes/routine_sessions_extended.py`
- `POST /api/sessions/<id>/pause` — pause active session
- `POST /api/sessions/<id>/resume` — resume paused session
- `POST /api/sessions/<id>/abort` — abort with reason
- `POST /api/sessions/<id>/note` — add note to session
- `PUT /api/sessions/<id>/duration` — record actual duration
- `GET /api/sessions/<id>` — get session with notes
### Routine Templates — `api/routes/routine_templates.py`
- `GET /api/templates` — list templates
- `POST /api/templates` — create template
- `GET /api/templates/<id>` — get template with steps
- `POST /api/templates/<id>/clone` — clone to user's routines
- `PUT /api/templates/<id>` — update template
- `DELETE /api/templates/<id>` — delete template
- `POST /api/templates/<id>/steps` — add step to template
### Routine Stats — `api/routes/routine_stats.py`
- `GET /api/routines/<id>/stats` — completion stats
- `GET /api/routines/streaks` — all user streaks
- `GET /api/routines/<id>/streak` — specific routine streak
- `GET /api/routines/weekly-summary` — weekly progress
### Routine Tags — `api/routes/routine_tags.py`
- `GET /api/tags` — list tags
- `POST /api/tags` — create tag
- `DELETE /api/tags/<id>` — delete tag
- `POST /api/routines/<id>/tags` — add tags to routine
- `DELETE /api/routines/<id>/tags/<tag_id>` — remove tag
- `GET /api/routines/<id>/tags` — get routine's tags
## Core Modules — Business Logic
### `core/routines.py`
Shared functions for routine operations:
- `start_session()` — create and start a new session
- `pause_session()` — pause an active session
- `resume_session()` — resume a paused session
- `abort_session()` — abort with reason
- `complete_session()` — mark complete and update streak
- `clone_template()` — clone template to user's routines
- `calculate_streak()` — get current streak
### `core/stats.py`
Statistics calculation functions:
- `get_routine_stats()` — completion rate, avg duration, total time
- `get_user_streaks()` — all streaks for user
- `get_weekly_summary()` — weekly progress summary
- `get_monthly_summary()` — monthly progress summary
## Bot Commands — Extended Routines
New actions added to `bot/commands/routines.py`:
- `pause` — pause current session
- `resume` — resume paused session
- `abort` — abort with reason
- `note` — add note to session
- `stats` — show completion statistics
- `streak` — show current streak
- `templates` — list available templates
- `clone` — clone a template
- `tag` — add tag to routine