Add Medicine and Activity trackers with voice command support
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

Added new tracking pages:
- Medicine tracker: track medication name, dosage, unit, route, and reason
- Activity tracker: track play, exercise, walks, music, reading, tummy time, etc.
- Both pages follow existing tracker patterns with recent activities list

Voice command improvements:
- Updated voice classification to support medicine and activity types
- Added detailed extraction fields for medicine (medicineName, dosage, unit, route, reason)
- Added detailed extraction fields for activity (activityType, duration, description)
- Enhanced unknown intent dialog with manual tracker selection
- Updated tracker options to match implemented pages (removed milestone)

Backend changes:
- Added MEDICINE and ACTIVITY to ActivityType enum
- Created migration V013 to add medicine/activity to database CHECK constraint
- Updated voice service prompts to include medicine and activity extraction

Frontend changes:
- Created /track/medicine page with full CRUD operations
- Created /track/activity page with full CRUD operations
- Added Medicine card to /track page with MedicalServices icon
- Updated VoiceFloatingButton unknown dialog with 4 tracker options

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-02 11:46:10 +00:00
parent a813a36cea
commit 26306d7ed8
7 changed files with 1174 additions and 11 deletions

View File

@@ -18,8 +18,10 @@ export enum ActivityType {
DIAPER = 'diaper',
GROWTH = 'growth',
MEDICATION = 'medication',
MEDICINE = 'medicine',
TEMPERATURE = 'temperature',
MILESTONE = 'milestone',
ACTIVITY = 'activity',
}
@Entity('activities')

View File

@@ -0,0 +1,9 @@
-- V013_add_medicine_activity_types.sql
-- Migration V013: Add 'medicine' and 'activity' to allowed activity types
-- Drop the existing constraint
ALTER TABLE activities DROP CONSTRAINT IF EXISTS activities_type_check;
-- Add the new constraint with medicine and activity included
ALTER TABLE activities ADD CONSTRAINT activities_type_check
CHECK (type IN ('feeding', 'sleep', 'diaper', 'growth', 'medication', 'medicine', 'temperature', 'milestone', 'activity'));

View File

@@ -16,7 +16,7 @@ export interface TranscriptionResult {
}
export interface ActivityExtractionResult {
type: string; // 'feeding', 'sleep', 'diaper', 'medicine', 'milestone'
type: string; // 'feeding', 'sleep', 'diaper', 'medicine', 'milestone', 'activity'
timestamp?: Date;
details: Record<string, any>;
confidence: number;
@@ -172,12 +172,15 @@ Extract activity details from the user's text and respond ONLY with valid JSON (
4. **medicine** - Any mention of medication, vitamin, supplement, drops, dose
- Extract: name, dosage, unit, notes
5. **milestone** - Any mention of first time events, developmental progress, achievements
5. **activity** - Any mention of play, exercise, walk, music, reading, tummy time, outdoor activities
- Extract: activityType (play/walk/exercise/music/reading/tummy_time/outdoor/other), duration (minutes), description, notes
6. **milestone** - Any mention of first time events, developmental progress, achievements, new skills
- Extract: description, category (motor/social/cognitive/language), notes
**Response Format:**
{
"type": "feeding|sleep|diaper|medicine|milestone|unknown",
"type": "feeding|sleep|diaper|medicine|activity|milestone|unknown",
"timestamp": "ISO 8601 datetime if mentioned (e.g., '3pm', '30 minutes ago'), otherwise use current time",
"details": {
// For feeding:
@@ -202,9 +205,17 @@ Extract activity details from the user's text and respond ONLY with valid JSON (
"notes": string or null
// For medicine:
"name": string,
"medicineName": string,
"dosage": number or string,
"unit": string or null,
"route": "oral|topical|injection|other" or null,
"reason": string or null,
"notes": string or null
// For activity:
"activityType": "play|walk|exercise|music|reading|tummy_time|outdoor|other",
"duration": number (minutes) or null,
"description": string or null,
"notes": string or null
// For milestone: