# Phase 6: Reporting & Analytics - Implementation Plan

## Goal

Provide actionable insights through dashboards and reports, helping operators understand yield trends, staff productivity, and operational health.

## 🏃 Sprint 1: Analytics API & Core Metrics

**Objective**: Build backend endpoints that aggregate data for reporting.

- **Backend**:
  - `AnalyticsController`: Endpoints for key metrics:
    - `GET /api/analytics/overview`: Total batches, active batches, tasks completed this week, etc.
    - `GET /api/analytics/yield`: Yield data by batch/strain (from weight logs).
    - `GET /api/analytics/tasks`: Task completion rates, overdue tasks.
- **Frontend**:
  - Enhanced Dashboard with real metrics (replace placeholder data).

## 🏃 Sprint 2: Yield Reports

**Objective**: Visualize harvest performance.

- **Frontend**:
  - **Yield Report Page**: Table/chart showing grams per batch, grams per plant, comparisons across strains.
  - **Strain Performance**: Which strains yield best?

## 🏃 Sprint 3: Staff Productivity & Task Analytics

**Objective**: Understand team performance.

- **Frontend**:
  - **Task Completion Dashboard**: Tasks completed per user, on-time vs overdue.
  - **Timeclock Summary**: Hours worked per user (integrate with existing timeclock).

---

## Technical Dependencies

- `WeightLog` model for yield data.
- `Task` model for completion tracking.
- `TimeClock` model for hours worked.
- Consider using a charting library like `recharts` or `chart.js`.
