Files

2.0 KiB

Treatment Milestone Tracker Implementation

Database Schema Changes

Add to prisma/schema.prisma:

model TreatmentPlan {
  id          String    @id @default(cuid())
  workspaceId String    @unique
  title       String    // e.g., "Grace's Chemotherapy Plan"
  totalCycles Int
  currentCycle Int      @default(0)
  startDate   DateTime?
  estimatedEnd DateTime?
  status      String    @default("ACTIVE") // ACTIVE, PAUSED, COMPLETED
  cycleType   String    @default("WEEKLY") // WEEKLY, BIWEEKLY, MONTHLY, CUSTOM
  cycleDays   Int       @default(7)        // Days between cycles
  createdAt   DateTime  @default(now())
  updatedAt   DateTime  @updatedAt
  createdById String
  
  workspace   Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
  createdBy   User      @relation(fields: [createdById], references: [id])
  milestones  TreatmentMilestone[]
}

model TreatmentMilestone {
  id          String    @id @default(cuid())
  planId      String
  cycleNumber Int       // Which cycle this milestone represents
  date        DateTime  // When it happened (or estimated)
  status      String    @default("UPCOMING") // UPCOMING, COMPLETED, SKIPPED
  notes       String?   // Personal reflection
  sideEffects String?   // What was experienced
  celebratedAt DateTime? // When we showed the celebration
  createdAt   DateTime  @default(now())
  
  plan        TreatmentPlan @relation(fields: [planId], references: [id], onDelete: Cascade)
}

API Routes

GET /api/workspaces/[id]/treatment-plan

Get the treatment plan for a workspace

POST /api/workspaces/[id]/treatment-plan

Create or update treatment plan

POST /api/workspaces/[id]/treatment-plan/milestones/[cycleNumber]/complete

Mark a milestone as completed

GET /api/workspaces/[id]/treatment-plan/progress

Get progress stats

Components

  • TreatmentProgress - Main progress widget
  • MilestoneCelebration - Celebration modal
  • TreatmentCalendar - Timeline view
  • CycleDetailView - Individual cycle details