| name | pest-disease-log |
| description | Record field scouting observations, track pest and disease pressure, and manage spray application records. Use when asked to log a new pest sighting, check which fields have high pressure, find all codling moth observations, view spray history for a field, or check if a pre-harvest interval has cleared. Triggers include "log observation", "scouting report", "pest pressure", "disease found", "field scouting", "spray record", "PHI", "pre-harvest interval", "observation history", "high pressure fields", or any task involving pest or disease tracking. |
pest-disease-log
Record and query field scouting observations for pests, diseases, and weeds. Track spray application records with pre-harvest interval (PHI) awareness.
When to Use
- Logging a new scouting observation (pest type, severity 0-10, affected area)
- Checking which fields currently have high or critical pressure
- Finding all observations of a specific pest across fields
- Viewing spray records for a field and checking PHI status
- Querying pressure trends over time for a specific pest and field
Pressure Severity Scale
| Level | Severity | Meaning | Action |
|---|
| None | 0 | Clean - no pest present | No action |
| Low | 1-3 | Minor presence | Monitor only |
| Moderate | 4-6 | Notable presence | Consider action |
| High | 7-8 | Significant pressure | Action recommended |
| Critical | 9-10 | Severe infestation | Immediate action required |
Observation Categories
pest - insects, mites, worms, etc.
disease - fungal, bacterial, viral diseases
weed - weed pressure
other - other observations
API Quick Reference
curl -X POST http://localhost:3006/api/observations \
-H "Content-Type: application/json" \
-d '{
"field_id": "your-field-id",
"crop_id": "your-crop-id",
"observed_at": "2025-07-20T10:30:00Z",
"pest_type": "Aphids",
"category": "pest",
"severity": 8,
"affected_area_pct": 60,
"growth_stage": "Flowering",
"notes": "Heavy colonies on new growth",
"scouted_by": "J. Martinez"
}'
curl "http://localhost:3006/api/observations?field_id={id}&min_severity=7&from=2025-07-01"
curl http://localhost:3006/api/analytics/field-summary
curl "http://localhost:3006/api/analytics/pressure-trend?field_id={id}&from=2025-06-01"
curl "http://localhost:3006/api/analytics/pest-frequency?from=2025-07-01"
curl http://localhost:3006/api/analytics/ipm-summary
curl http://localhost:3006/api/fields
curl http://localhost:3006/api/crops
Spray Records
curl -X POST http://localhost:3006/api/sprays \
-H "Content-Type: application/json" \
-d '{
"field_id": "your-field-id",
"observation_id": "obs-id-that-prompted-this",
"applied_at": "2025-07-20",
"product_name": "Spinosad SC",
"active_ingredient": "Spinosad",
"rate_per_acre": 0.75,
"unit": "L",
"area_acres": 8.1,
"total_cost": 148,
"re_entry_hours": 4,
"phi_days": 7,
"notes": "Applied morning, good coverage"
}'
curl "http://localhost:3006/api/sprays?field_id={id}"
curl "http://localhost:3006/api/analytics/spray-cost?from=2025-07-01"
PHI Calculation
A PHI (Pre-Harvest Interval) restriction is active when:
applied_at + phi_days > today
If a spray was applied on Jul 20 with phi_days=7, the PHI clears on Jul 27.
Environment Variables
| Variable | Description | Default |
|---|
| PORT | HTTP port | 3006 |
| DATA_DIR | SQLite + uploads directory | ./data |
| AUTH_PASSWORD | Optional login password | (empty) |
| NODE_ENV | development or production | development |
| SESSION_SECRET | Required in production | (required) |
Troubleshooting
Observation not appearing in field summary
The field summary shows the latest observation per field. If you just created the observation, refresh with GET /api/analytics/field-summary.
PHI indicator not showing
The PHI is calculated at query time from applied_at + phi_days. Ensure phi_days was set when logging the spray. A value of 0 means no PHI restriction.
Photo upload failing
Photos must be JPEG, PNG, or WebP format, max 5MB. Upload via POST /api/observations/{id}/photo as multipart/form-data with field name photo.