7.1 KiB
7.1 KiB
3D Facility Viewer Enhancement Plan
Overview
Two major enhancements to transform the 3D facility viewer into a comprehensive, investor-ready data visualization platform.
Part 1: Visual Style Refactor
Goal
Replace 3D spheres with informative 2D icons/shapes that convey plant stage and health at a glance, while adding grid overlays for human readability.
Current State
- Plants are 3D spheres with color coding
- No visible grid structure
- Stage indicated only by color
Target State
- Flat 2D icons/polygons per growth stage
- Visible row/column/tier grid lines
- Labels for navigation (R1, R2, C1, C2, T1, T2)
- Information-dense schematic view
Technical Approach
Phase 1.1: Plant Icon System
Replace sphereGeometry with stage-specific 2D shapes:
| Stage | Shape | Color | Icon Concept |
|---|---|---|---|
| CLONE_IN | Small circle | #3b82f6 Blue | Seedling dot |
| VEGETATIVE | Leaf polygon | #22c55e Green | 3-point leaf |
| FLOWERING | Flower polygon | #a855f7 Purple | 5-petal flower |
| DRYING | Diamond | #f97316 Orange | Hanging diamond |
| CURING | Square | #92400e Brown | Jar square |
| HARVESTED | Circle outline | #6b7280 Gray | Empty circle |
Implementation:
- Use @react-three/drei Billboard for camera-facing icons
- Create SVG paths for each stage
- Scale based on zoom level
- Add pulse animation for highlighted plants
Phase 1.2: Grid Visualization
Add visible structure lines:
- Horizontal lines for rows (labeled R1-R8)
- Vertical lines for columns (labeled C1-C10)
- Tier indicators (T1-T3 vertical markers)
- Semi-transparent to not obscure content
- Toggle on/off via UI
Phase 1.3: Section Improvements
- Section boundaries with labeled borders
- Section name prominently displayed
- Row/column count indicator
- Plant count badge
Files to Modify
- PlantSystem.tsx - Replace sphere with icon system
- SmartRack.tsx - Add grid overlay
- types.ts - Add icon type definitions
- New: PlantIcon.tsx, GridOverlay.tsx, SectionLabel.tsx
Part 2: Plant Data Visualization System
Goal
Create a comprehensive data card with lifecycle timeline, sensor data, and hierarchical drill-down capabilities.
Components
2.1: PlantDataCard (Main Component)
A glassmorphic panel with:
- Header - Entity name, METRC tag, quick status badges
- Timeline - Visual lifecycle from clone to cure
- Vitals Grid - Health, temp, VPD, humidity gauges
- Activity Feed - Recent events/actions
- Actions - Quick action buttons
2.2: Lifecycle Timeline Component
SVG-animated timeline showing plant journey:
- Horizontal timeline with stage nodes
- Filled nodes for completed stages
- Animated current stage indicator
- Day count labels
- Estimated completion
- Click stages to see historical data
SVG Animation Ideas:
- Pulse effect on current stage
- Growth animation between stages
- Color gradient transitions
- Hover: expand stage details
2.3: VitalGauge Component
Radial or bar gauge for sensor readings:
- Animated fill based on value
- Color coding: Green (optimal), Yellow (warning), Red (critical)
- Sparkline showing 24h/7d trend
- Threshold markers
- Animated value counter
2.4: Drill-Down Aggregation
Levels:
| Level | Data Shown | Aggregation |
|---|---|---|
| Plant | Individual readings | Raw values |
| Tier | All plants on tier | Avg/Min/Max |
| Section | All tiers in section | Avg/Min/Max |
| Room | All sections in room | Avg/Range |
| Floor | All rooms | Summary counts |
Implementation:
- useAggregatedData(level, entityId) hook
- Calculates averages, ranges, outliers
- Returns unified data shape for PlantDataCard
2.5: Mock Data Generator
Rich, realistic demo data including:
- Stage history with dates
- Vitals: health, temperature, humidity, VPD with history
- Touch points, photos, notes, alerts
- Position data
Data Generation:
- Realistic stage duration distributions
- Seasonal temperature variations
- Circadian VPD patterns
- Random but plausible health events
- IPM schedule adherence
- Growth curve progression
Part 3: Implementation Phases
Sprint 1: Icon System & Grid (2-3 days)
- Create PlantIcon component with stage shapes
- Implement GridOverlay with row/column lines
- Add section labels with plant counts
- Toggle for grid visibility
- Test rendering performance
Sprint 2: Data Card Foundation (2-3 days)
- Create PlantDataCard shell component
- Implement glassmorphic styling
- Add header with entity info
- Wire up to plant selection
- Position card in UI (side panel or overlay)
Sprint 3: Lifecycle Timeline (1-2 days)
- Create LifecycleTimeline component
- SVG path animations
- Stage click handlers
- Day calculation logic
- Integration with data card
Sprint 4: Vital Gauges (1-2 days)
- Create VitalGauge component
- Animated value display
- Color thresholds
- Sparkline mini-charts
- Mock sensor data hookup
Sprint 5: Aggregation & Drill-down (Contextual Data) ✅
- Contextual Overlays:
SummaryOverlaycomponent for room and section aggregation.- Hover states for racks/sections showing plant counts, health, and env stats.
- Floating "Room Summary" badges above rooms in 3D space.
- Drill-down Interaction:
- Hover Plant -> Show detailed
PlantDataCard(persistent side panel). - Hover Section -> Show aggregate data.
- Hover Plant -> Show detailed
- Data Aggregation:
- Implemented logic to calculate plant counts and mock environment averages.
- Displayed aggregates in the summary overlays.
Sprint 6: Mock Data & Polish (Completed) ✅
- Realistic Mock Data:
- Updated
getMockVitalswith deterministic seeding based on Plant ID. - Generated realistic "history" arrays for sparklines using sine wave functions.
- Added Batch IDs and Batch Names.
- Added "Last Updated" timestamps.
- Updated
- UI Refinement:
- Polished
PlantDataCardwith glassmorphism and animations. - Enhanced section grid labels with hover interactions.
- Verified rendering and responsiveness.
- Polished
File Structure
frontend/src/components/facility3d/
- coordinates.ts (existing)
- PlantSystem.tsx (refactor to use icons)
- PlantIcon.tsx (NEW - stage icons)
- GridOverlay.tsx (NEW - grid lines)
- SectionLabel.tsx (NEW - section info)
- PlantDataCard/
- index.tsx
- LifecycleTimeline.tsx
- VitalGauge.tsx
- ActivityFeed.tsx
- ActionButtons.tsx
- hooks/
- useAggregatedData.ts
- usePlantLifecycle.ts
- mocks/
- plantDataGenerator.ts
Success Criteria
- Visual Clarity - Investors understand facility layout in <5 seconds
- Stage Recognition - Growth stages identifiable without color dependency
- Data Richness - All relevant plant data visible in single card
- Performance - 60fps with 500+ plants rendered
- Interactivity - Smooth animations, responsive drill-down
- Realism - Mock data feels like real cultivation facility
Open Questions
- Should the data card be a side panel (persistent) or overlay (modal)?
- Preferred icon style: geometric shapes, emoji, or custom SVG illustrations?
- Priority between "pretty" vs "informative" if tradeoffs arise?
- Any specific Metrc fields that MUST be displayed?