| name | ipm-advisor |
| description | Analyze pest pressure trends, identify fields needing intervention, evaluate spray effectiveness, and provide IPM recommendations. Use when asked which fields need spraying, whether a spray worked for a specific pest, how pressure has changed over time, which pest is worst this season, the cost-effectiveness of spray programs, or any analytical question about integrated pest management strategy. Triggers include "IPM summary", "spray effectiveness", "pressure trend", "which fields to spray", "worst pest", "season analysis", "spray program", "intervention needed", or any strategic pest management question. |
ipm-advisor
Analyze pest pressure data from pest-disease-log to identify intervention needs, evaluate spray effectiveness, and guide IPM strategy decisions.
When to Use
- Identifying which fields have pressure above action thresholds
- Comparing pressure before and after a spray application
- Ranking pests by frequency and severity across the season
- Estimating whether spray programs are cost-effective
- Finding fields where pressure is increasing (trend analysis)
Action Threshold Logic
The pest_library table stores an action_threshold integer (0-10) per pest. When a field's current severity for a pest exceeds this threshold, intervention is recommended.
curl http://localhost:3006/api/pest-library
Identifying Fields Needing Intervention
curl http://localhost:3006/api/analytics/field-summary
Fields with max_severity >= 7 (High or Critical) generally require immediate action.
Evaluating Spray Effectiveness
To compare pressure before and after a spray:
curl "http://localhost:3006/api/sprays?field_id={id}"
curl "http://localhost:3006/api/observations?field_id={id}&to={spray_date}&pest_type=Aphids"
curl "http://localhost:3006/api/observations?field_id={id}&from={spray_date}&pest_type=Aphids"
Pressure Trend Analysis
curl "http://localhost:3006/api/analytics/pressure-trend?field_id={id}&from=2025-06-01"
A pest is "trending up" if three consecutive observations show increasing severity. This is an early warning to act before reaching the action threshold.
Season Ranking
curl "http://localhost:3006/api/analytics/pest-frequency?from=2025-04-01"
curl http://localhost:3006/api/analytics/ipm-summary
From the IPM summary, calculate:
- Spray efficiency:
total_cost / observations_count - lower is better
- Pressure-to-spray ratio:
avg_severity / spray_count - high ratio means under-treated
- Field priority: sort fields by
max_severity DESC, last_scouted ASC
Spray Cost Analysis
curl "http://localhost:3006/api/analytics/spray-cost?from=2025-04-01"
curl "http://localhost:3006/api/sprays?field_id={id}&from=2025-04-01"
IPM Recommendations
| Situation | Recommendation |
|---|
| Severity >= action threshold | Apply targeted treatment |
| Severity trending up for 3+ observations | Scout more frequently, prepare treatment |
| High severity but spray applied recently | Wait for PHI to clear, re-scout |
| Low severity after spray | Treatment effective, continue monitoring |
| No spray applied but severity >= 7 | Immediate action needed |
| Severity 1-3, stable | Monitor weekly |
Before/After Report Pattern
To generate a before/after report for an amendment:
- Get all spray records for a field:
GET /api/sprays?field_id={id}
- For each spray, find observations in 14 days before:
GET /api/observations?field_id={id}&pest_type={pest}&to={spray_date}&limit=5
- Find observations in 14 days after:
GET /api/observations?field_id={id}&pest_type={pest}&from={spray_date}&limit=5
- Calculate:
before_avg = mean(pre_severities), after_avg = mean(post_severities), reduction = before_avg - after_avg
- If
reduction >= 2.0: treatment was effective. If reduction < 1.0: treatment had minimal effect.
Common IPM Questions
Which field has the worst pressure right now?
curl http://localhost:3006/api/analytics/field-summary
Which pest is hardest to control this season?
Is pressure increasing or decreasing on North Field?
curl "http://localhost:3006/api/analytics/pressure-trend?field_id={north_field_id}&from=2025-07-01"