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.
Record and query field scouting observations for pests, diseases, and weeds. Track spray application records with pre-harvest interval (PHI) awareness.
| 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 |
pest - insects, mites, worms, etc.disease - fungal, bacterial, viral diseasesweed - weed pressureother - other observations# Log a new observation
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"
}'
# List observations with filters
curl "http://localhost:3006/api/observations?field_id={id}&min_severity=7&from=2025-07-01"
# Get field pressure summary (all fields)
curl http://localhost:3006/api/analytics/field-summary
# Pressure trend for a field (by pest type over time)
curl "http://localhost:3006/api/analytics/pressure-trend?field_id={id}&from=2025-06-01"
# Pest frequency report
curl "http://localhost:3006/api/analytics/pest-frequency?from=2025-07-01"
# IPM summary per field
curl http://localhost:3006/api/analytics/ipm-summary
# List fields
curl http://localhost:3006/api/fields
# List crops
curl http://localhost:3006/api/crops
# Log a spray application
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"
}'
# List spray records for a field
curl "http://localhost:3006/api/sprays?field_id={id}"
# Check spray cost by field
curl "http://localhost:3006/api/analytics/spray-cost?from=2025-07-01"
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.
| 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) |
The field summary shows the latest observation per field. If you just created the observation, refresh with GET /api/analytics/field-summary.
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.
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.