- Updated README.md to clarify the conditions for including `last_applied_treatment` in the advice JSON structure. - Modified job.py to pass `as_of` and `field_id` to the advice generation function. - Enhanced advice_context.py to conditionally add `last_applied_treatment` based on recent treatment history and allowed products. - Introduced new functions in treatments.py to group treatments by day and load the last treatment before the recent window. - Updated _output_format.md to specify the conditions under which `last_applied_treatment` is included in the advisory.
2.8 KiB
OUTPUT FORMAT
Respond with a single raw JSON object and nothing else. No markdown code fences, no introduction, no commentary outside the JSON.
| Key | Type | Rules |
|---|---|---|
full_advice |
string | Your complete advisory text, in Italian. |
advice_summary |
string | Italian summary of full_advice, at most 1010 characters. It must state the recommendation: whether a treatment should be administered or not; if yes, for what reason, on what date (and why that date), and with which product; if no, for what reason. Use calendar dates only (for example 13 aprile 2026 or 13-04-2026). Never use relative day words such as oggi, ieri, domani, dopodomani, today, yesterday, or tomorrow — even when a calendar date follows them. Do not start with labels such as Attenzione:, Nota:, or Importante:. Do not close with a reminder to follow the product label; that belongs in full_advice. |
apply_treatment |
integer | 1 if you recommend applying a product, 0 otherwise. |
treatments |
array of strings | Names of the recommended product(s), exactly as written in the input payload. Empty array [] when you recommend no product. |
dosage |
array of strings | Prescribed dose for each product in treatments, in the same order (for example "1.5 l/ha"). Empty array [] when you recommend no product. |
apply_date |
string or null | Recommended application date as YYYY-MM-DD. null when you recommend no product. |
If allowed_products is empty, you must not prescribe any product (treatments
must be [] and apply_treatment must be 0), even if
last_advice.suggested_products names one.
When you do recommend a treatment (apply_treatment = 1) and allowed_products
is non-empty: if last_advice.suggested_products names one or more products
that are still appropriate now (phenology, weather, disease-model risk, and
that product's own label constraints), treatments must be those products —
same names, and the same set if it was a tank mix — even when they are absent
from allowed_products. Do not prescribe a product solely because last_advice
did. Otherwise recommend only products that appear in allowed_products. Never
invent a name that appears in neither last_advice.suggested_products nor
allowed_products.
date_of_today is oggi for this advisory. last_advice was issued on last_advice.date,
which is an earlier day; do not read dates in that block as the current day.
last_applied_treatment appears only when no spray occurred in the past-5-day
meteorological window but one did occur within the past 25 days; its date is
that spray day, not oggi.
Example shape
{ "full_advice": "...", "advice_summary": "...", "apply_treatment": 1, "treatments": ["PRODUCT NAME"], "dosage": ["1.5 l/ha"], "apply_date": "2026-08-14" }