🧮 Hive bottom board & varroa monitoring
🎯 Purpose
Track varroa mite infestation levels by uploading and analyzing images of the hive bottom board (the white slideable panel used for varroa mite counting).
🎭 User Story
- As a beekeeper
- I want to upload photos of my hive bottom board
- So that I can monitor varroa mite levels over time and take action when necessary
🚀 Key Benefits
- Easy Monitoring: Simple image upload process for varroa tracking
- Historical Tracking: Images versioned with inspections for trend analysis
- Automated Detection: Images automatically queued for AI-powered varroa mite counting (coming soon)
- Treatment Planning: Visual evidence helps decide when treatment is needed
🔧 Technical Overview
The bottom board is implemented as a new box type (BOTTOM) in the hive structure, similar to other box types like deep boxes, supers, and entrance gates.
Architecture:
Components:
- swarm-api: Manages the BOTTOM box type in the database
- GraphQL schema with BOTTOM enum value
- Database migration for boxes table
- Box creation and management API
- web-app: Provides UI for adding bottom boxes and uploading images
- BottomBox component for image upload
- Two-step upload process (upload → link)
- Integration with hive structure view
- image-splitter: Handles image uploads, storage, and processing
- File upload to S3
- Database linking (
files_box_reltable) - Varroa detection job queueing
- Thumbnail generation
Database Schema:
-- swarm-api: boxes table
-- Box type enum includes BOTTOM
ALTER TABLE boxes CHANGE type type
ENUM('DEEP','SUPER','GATE','VENTILATION','QUEEN_EXCLUDER','HORIZONTAL_FEEDER','BOTTOM')
CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'DEEP';
-- image-splitter: files_box_rel table
-- Links uploaded images to specific boxes
CREATE TABLE files_box_rel (
box_id int unsigned NOT NULL,
file_id int unsigned NOT NULL,
user_id int unsigned NOT NULL,
inspection_id INT NULL DEFAULT NULL,
added_time datetime DEFAULT CURRENT_TIMESTAMP,
INDEX (user_id, box_id, inspection_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
Image Upload Flow:
- User selects image in BottomBox component
- Step 1:
uploadFrameSidemutation uploads file to S3- Returns
fileIdand image URLs - Queues varroa detection job
- Returns
- Step 2:
addFileToBoxmutation links file to box- Creates record in
files_box_reltable - Links:
box_id ↔ file_id ↔ user_id ↔ inspection_id
- Creates record in
- Storage: Image stored in S3, metadata in MySQL
Images are stored separately from frame sides but use the same S3 infrastructure. Inspection versioning is supported through the inspection_id field.
📋 How to Use
1. Adding a Bottom Board to Your Hive
- Navigate to your hive structure view
- Click the dropdown menu with additional box options
- Select "Add bottom" button
- The bottom board section will be added to your hive structure
2. Uploading Bottom Board Images
- Select the bottom board in your hive structure
- Click "Upload bottom board image"
- Choose a photo from your device showing the white slideable panel
- The image will be uploaded and automatically queued for varroa detection
Photo Tips:
- Ensure the white slideable panel is visible and clean
- Take photos in good lighting conditions
- Include the entire bottom board in the frame
- Photos taken at the same angle help with comparison over time
3. Tracking Over Time
Bottom board images are automatically versioned with inspections:
- When you create a new inspection, the current bottom board image is saved as a snapshot
- This allows you to track varroa levels over time
- Historical images remain accessible through the inspection timeline
🔍 What Gets Tracked
Currently:
- ✅ Bottom board image uploads
- ✅ Image storage and versioning with inspections
- ✅ Integration with hive structure management
Coming Soon:
- 🚧 Automated varroa mite counting from images
- 🚧 Varroa count displayed on image with detection regions
- 🚧 Historical charts showing varroa trends
- 🚧 Alerts when varroa exceeds treatment thresholds
- 🚧 Treatment recommendations based on mite counts
🏗️ Implementation Details
Box Types Available:
- Deep - Brood frames (typically 10-frame boxes)
- Super - Honey storage frames
- Entrance (formerly "Base") - Hive entrance with gates
- Inner Lid - Ventilation layer on top
- Queen Excluder - Prevents queen from moving up
- Feeder - Sugar syrup feeding box
- Bottom - ⭐ NEW - Bottom board for varroa monitoring
🚫 Out of Scope
- Physical bottom board hardware (this is a software feature for image tracking)
- Real-time varroa detection (images are processed asynchronously)
- Automatic treatment application (recommendations only)
📊 Technical Specifications
File Support:
- Image formats: JPEG, PNG, WebP
- Maximum file size: 30 MB
- Recommended resolution: 1920x1080 or higher
Storage:
- Images stored in AWS S3 at
{user_id}/{hash}/original.{ext} - Database records in:
filestable (file metadata)files_box_reltable (box associations)files_hive_reltable (hive associations)
- Inspection versioning via
inspection_idfield infiles_box_rel
GraphQL API Endpoints:
# 1. Add bottom box to hive
mutation addBox($hiveId: ID!, $position: Int!, $type: BoxType!) {
addBox(hiveId: $hiveId, position: $position, type: $type) {
id
type
position
}
}
# 2. Upload image file
mutation uploadFrameSide($file: Upload!) {
uploadFrameSide(file: $file) {
id
url
resizes {
id
url
max_dimension_px
}
}
}
# 3. Link uploaded file to bottom box
mutation addFileToBox($boxId: ID!, $fileId: ID!, $hiveId: ID!) {
addFileToBox(boxId: $boxId, fileId: $fileId, hiveId: $hiveId)
}
Frontend Components:
src/page/hiveEdit/bottomBox/BottomBox.tsx- Main upload componentsrc/page/hiveEdit/boxes/hiveButtons.tsx- "Add bottom" buttonsrc/page/hiveEdit/index.tsx- Integration with hive viewsrc/models/boxes.ts- Box type definitions
Backend Services:
- swarm-api (Go):
graph/schema.graphql- GraphQL schemagraph/model/box.go- Box modelmigrations/20251201025115_add_bottom_box_type.sql- Migration
- image-splitter (TypeScript):
src/models/boxFile.ts- Box file associations modelsrc/graphql/resolvers.ts- GraphQL resolversmigrations/018-box-files.sql- Files table migration
🔗 Related Features
- 🔎 Inspection Management - Inspection versioning
- 📺 Video Streaming Playback - Gate entrance monitoring
- Varroa Detection Model (in development)
📚 Resources & References
- Bottom Board Varroa Monitoring Guide - Best practices
- [Tech Stack & Conventions](../../../../docs/📱 Web-app/Tech stack, conventions, environments.md)
💬 Implementation Notes
Migrations Required:
Both backend services require database migrations before the feature works:
# 1. swarm-api migration - Add BOTTOM box type
cd swarm-api
just migrate-db-dev
# Runs: migrations/20251201025115_add_bottom_box_type.sql
# 2. image-splitter migration - Create files_box_rel table
cd image-splitter
just stop && just start # Rebuilds container and auto-runs migrations
# Runs: migrations/018-box-files.sql
Deployment Steps:
- Deploy swarm-api with BOTTOM box type
- Deploy image-splitter with files_box_rel table
- Deploy web-app with BottomBox component
- Restart graphql-router to pick up new schema
Build Info:
- Backend: swarm-api v1.0 (Go 1.23+)
- Image Service: image-splitter v1.0 (TypeScript/Node.js)
- Frontend: web-app v1.0 (Preact/React)
- Build size: 2.17 MB (gzipped 681 KB)
Key Files:
- Migrations:
swarm-api/migrations/20251201025115_add_bottom_box_type.sqlimage-splitter/migrations/018-box-files.sql
- Models:
swarm-api/graph/model/box.goimage-splitter/src/models/boxFile.ts
- Components:
web-app/src/page/hiveEdit/bottomBox/BottomBox.tsx
Testing:
After deployment, verify:
-- Check box type enum includes BOTTOM
SHOW COLUMNS FROM boxes LIKE 'type';
-- Check files_box_rel table exists
DESCRIBE files_box_rel;
-- Test: Create bottom box and upload image
-- Verify records created:
SELECT * FROM boxes WHERE type = 'BOTTOM';
SELECT * FROM files_box_rel ORDER BY added_time DESC LIMIT 5;
Known Limitations:
- Images display not yet implemented in UI (upload works, viewing coming soon)
- Varroa detection model still in development
- Historical charts not yet available
Last Updated: December 1, 2025 Status: Beta - Image upload functional, AI detection in development Implementation: Complete (3 services: swarm-api, web-app, image-splitter) Next Review: January 2026