agroplan-ai-cli 1.0.31 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cli_version": "1.0.
|
|
3
|
-
"backend_template_version": "1.0.
|
|
2
|
+
"cli_version": "1.0.33",
|
|
3
|
+
"backend_template_version": "1.0.33",
|
|
4
4
|
"zarc_index_version": "2025-2026-fast-index-v2",
|
|
5
5
|
"price_index_version": "2025-05-reference-v1",
|
|
6
6
|
"features": [
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"market_profit_experimental_optimizer",
|
|
21
21
|
"smart_crop_calendar_engine",
|
|
22
22
|
"manual_field_registration",
|
|
23
|
-
"crop_calendar_from_manual_field"
|
|
23
|
+
"crop_calendar_from_manual_field",
|
|
24
|
+
"expanded_crop_calendar_10_cultures",
|
|
25
|
+
"calendar_date_safety"
|
|
24
26
|
],
|
|
25
|
-
"generated_at": "2026-05-
|
|
27
|
+
"generated_at": "2026-05-10T20:00:00Z"
|
|
26
28
|
}
|
|
@@ -207,6 +207,517 @@ CROP_CYCLES: Dict[str, Dict] = {
|
|
|
207
207
|
"optimal_temp_max": 29,
|
|
208
208
|
"critical_water_phases": ["germinacao", "florescimento", "enchimento_graos"],
|
|
209
209
|
"harvest_window_days": 10
|
|
210
|
+
},
|
|
211
|
+
"cafe": {
|
|
212
|
+
"cycle_days": 730,
|
|
213
|
+
"phases": [
|
|
214
|
+
{
|
|
215
|
+
"name": "preparo",
|
|
216
|
+
"days": 30,
|
|
217
|
+
"description": "Preparo do solo e coveamento",
|
|
218
|
+
"critical_water": False,
|
|
219
|
+
"tasks": [
|
|
220
|
+
{"type": "prepare_soil", "title": "Preparar solo e covas", "priority": "high", "weather_sensitive": False},
|
|
221
|
+
{"type": "fertilize", "title": "Aplicar calcário e adubação de base", "priority": "high", "weather_sensitive": True}
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"name": "plantio",
|
|
226
|
+
"days": 60,
|
|
227
|
+
"description": "Plantio de mudas e estabelecimento",
|
|
228
|
+
"critical_water": True,
|
|
229
|
+
"tasks": [
|
|
230
|
+
{"type": "plant", "title": "Plantar mudas de café", "priority": "critical", "weather_sensitive": True},
|
|
231
|
+
{"type": "irrigate", "title": "Irrigar mudas - fase crítica", "priority": "critical", "weather_sensitive": True},
|
|
232
|
+
{"type": "inspect_pests", "title": "Monitorar pegamento das mudas", "priority": "high", "weather_sensitive": False}
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"name": "conducao",
|
|
237
|
+
"days": 365,
|
|
238
|
+
"description": "Condução e formação da lavoura",
|
|
239
|
+
"critical_water": False,
|
|
240
|
+
"tasks": [
|
|
241
|
+
{"type": "fertilize", "title": "Aplicar adubação de crescimento", "priority": "high", "weather_sensitive": True},
|
|
242
|
+
{"type": "inspect_pests", "title": "Monitorar pragas e doenças", "priority": "high", "weather_sensitive": False},
|
|
243
|
+
{"type": "monitor_growth", "title": "Avaliar desenvolvimento vegetativo", "priority": "medium", "weather_sensitive": False},
|
|
244
|
+
{"type": "irrigate", "title": "Irrigar conforme necessidade", "priority": "medium", "weather_sensitive": True}
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"name": "pre_producao",
|
|
249
|
+
"days": 180,
|
|
250
|
+
"description": "Preparação para primeira produção",
|
|
251
|
+
"critical_water": False,
|
|
252
|
+
"tasks": [
|
|
253
|
+
{"type": "fertilize", "title": "Aplicar adubação de produção", "priority": "high", "weather_sensitive": True},
|
|
254
|
+
{"type": "inspect_diseases", "title": "Monitorar sanidade da lavoura", "priority": "high", "weather_sensitive": False},
|
|
255
|
+
{"type": "monitor_growth", "title": "Avaliar floração inicial", "priority": "medium", "weather_sensitive": False}
|
|
256
|
+
]
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"name": "colheita",
|
|
260
|
+
"days": 95,
|
|
261
|
+
"description": "Primeira colheita",
|
|
262
|
+
"critical_water": False,
|
|
263
|
+
"tasks": [
|
|
264
|
+
{"type": "monitor_growth", "title": "Monitorar maturação dos frutos", "priority": "high", "weather_sensitive": False},
|
|
265
|
+
{"type": "harvest", "title": "Preparar colheita", "priority": "high", "weather_sensitive": True}
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"optimal_temp_min": 18,
|
|
270
|
+
"optimal_temp_max": 28,
|
|
271
|
+
"critical_water_phases": ["plantio"],
|
|
272
|
+
"harvest_window_days": 60,
|
|
273
|
+
"category": "perene",
|
|
274
|
+
"water_need": "media",
|
|
275
|
+
"risk_notes": "Sensível a geadas e déficit hídrico em fases críticas.",
|
|
276
|
+
"calendar_notes": "Calendário simplificado para implantação e primeiros manejos. Cultura perene com ciclo longo."
|
|
277
|
+
},
|
|
278
|
+
"cana": {
|
|
279
|
+
"cycle_days": 365,
|
|
280
|
+
"phases": [
|
|
281
|
+
{
|
|
282
|
+
"name": "preparo",
|
|
283
|
+
"days": 15,
|
|
284
|
+
"description": "Preparo do solo",
|
|
285
|
+
"critical_water": False,
|
|
286
|
+
"tasks": [
|
|
287
|
+
{"type": "prepare_soil", "title": "Preparar solo para plantio", "priority": "high", "weather_sensitive": False},
|
|
288
|
+
{"type": "fertilize", "title": "Aplicar adubação de base", "priority": "high", "weather_sensitive": True}
|
|
289
|
+
]
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"name": "plantio",
|
|
293
|
+
"days": 30,
|
|
294
|
+
"description": "Plantio de mudas e brotação",
|
|
295
|
+
"critical_water": True,
|
|
296
|
+
"tasks": [
|
|
297
|
+
{"type": "plant", "title": "Plantar mudas de cana", "priority": "critical", "weather_sensitive": True},
|
|
298
|
+
{"type": "irrigate", "title": "Irrigar para brotação", "priority": "high", "weather_sensitive": True},
|
|
299
|
+
{"type": "inspect_pests", "title": "Monitorar brotação", "priority": "medium", "weather_sensitive": False}
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"name": "perfilhamento",
|
|
304
|
+
"days": 60,
|
|
305
|
+
"description": "Perfilhamento e estabelecimento",
|
|
306
|
+
"critical_water": False,
|
|
307
|
+
"tasks": [
|
|
308
|
+
{"type": "fertilize", "title": "Aplicar adubação de cobertura", "priority": "high", "weather_sensitive": True},
|
|
309
|
+
{"type": "inspect_pests", "title": "Monitorar plantas daninhas", "priority": "high", "weather_sensitive": False},
|
|
310
|
+
{"type": "irrigate", "title": "Irrigar moderadamente", "priority": "medium", "weather_sensitive": True}
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"name": "crescimento",
|
|
315
|
+
"days": 180,
|
|
316
|
+
"description": "Crescimento vegetativo intenso",
|
|
317
|
+
"critical_water": False,
|
|
318
|
+
"tasks": [
|
|
319
|
+
{"type": "inspect_pests", "title": "Monitorar pragas (broca, cigarrinha)", "priority": "high", "weather_sensitive": False},
|
|
320
|
+
{"type": "monitor_growth", "title": "Avaliar desenvolvimento", "priority": "medium", "weather_sensitive": False},
|
|
321
|
+
{"type": "irrigate", "title": "Irrigar conforme necessidade", "priority": "medium", "weather_sensitive": True}
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"name": "maturacao",
|
|
326
|
+
"days": 60,
|
|
327
|
+
"description": "Maturação e acúmulo de sacarose",
|
|
328
|
+
"critical_water": False,
|
|
329
|
+
"tasks": [
|
|
330
|
+
{"type": "monitor_growth", "title": "Monitorar maturação", "priority": "high", "weather_sensitive": False},
|
|
331
|
+
{"type": "harvest", "title": "Preparar colheita", "priority": "high", "weather_sensitive": True}
|
|
332
|
+
]
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": "colheita",
|
|
336
|
+
"days": 20,
|
|
337
|
+
"description": "Colheita",
|
|
338
|
+
"critical_water": False,
|
|
339
|
+
"tasks": [
|
|
340
|
+
{"type": "harvest", "title": "Colher cana", "priority": "critical", "weather_sensitive": True}
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
],
|
|
344
|
+
"optimal_temp_min": 20,
|
|
345
|
+
"optimal_temp_max": 35,
|
|
346
|
+
"critical_water_phases": ["plantio"],
|
|
347
|
+
"harvest_window_days": 30,
|
|
348
|
+
"category": "semi-perene",
|
|
349
|
+
"water_need": "alta",
|
|
350
|
+
"risk_notes": "Sensível a geadas. Requer manejo adequado de plantas daninhas.",
|
|
351
|
+
"calendar_notes": "Calendário para cana-planta (primeiro ciclo). Soqueiras têm ciclo diferente."
|
|
352
|
+
},
|
|
353
|
+
"arroz": {
|
|
354
|
+
"cycle_days": 120,
|
|
355
|
+
"phases": [
|
|
356
|
+
{
|
|
357
|
+
"name": "preparo",
|
|
358
|
+
"days": 10,
|
|
359
|
+
"description": "Preparo do solo e sistematização",
|
|
360
|
+
"critical_water": False,
|
|
361
|
+
"tasks": [
|
|
362
|
+
{"type": "prepare_soil", "title": "Preparar solo para plantio", "priority": "high", "weather_sensitive": False},
|
|
363
|
+
{"type": "fertilize", "title": "Aplicar adubação de base", "priority": "high", "weather_sensitive": True}
|
|
364
|
+
]
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"name": "germinacao",
|
|
368
|
+
"days": 15,
|
|
369
|
+
"description": "Germinação e emergência",
|
|
370
|
+
"critical_water": True,
|
|
371
|
+
"tasks": [
|
|
372
|
+
{"type": "plant", "title": "Semear arroz", "priority": "critical", "weather_sensitive": True},
|
|
373
|
+
{"type": "irrigate", "title": "Manter lâmina d'água", "priority": "critical", "weather_sensitive": True},
|
|
374
|
+
{"type": "inspect_pests", "title": "Monitorar emergência", "priority": "medium", "weather_sensitive": False}
|
|
375
|
+
]
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"name": "vegetativa",
|
|
379
|
+
"days": 40,
|
|
380
|
+
"description": "Crescimento vegetativo e perfilhamento",
|
|
381
|
+
"critical_water": True,
|
|
382
|
+
"tasks": [
|
|
383
|
+
{"type": "fertilize", "title": "Aplicar adubação nitrogenada", "priority": "high", "weather_sensitive": True},
|
|
384
|
+
{"type": "irrigate", "title": "Manter manejo hídrico", "priority": "high", "weather_sensitive": True},
|
|
385
|
+
{"type": "inspect_pests", "title": "Monitorar pragas e plantas daninhas", "priority": "high", "weather_sensitive": False}
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"name": "reproducao",
|
|
390
|
+
"days": 30,
|
|
391
|
+
"description": "Floração e formação de grãos",
|
|
392
|
+
"critical_water": True,
|
|
393
|
+
"tasks": [
|
|
394
|
+
{"type": "irrigate", "title": "Manter lâmina d'água - fase crítica", "priority": "critical", "weather_sensitive": True},
|
|
395
|
+
{"type": "inspect_diseases", "title": "Monitorar doenças (brusone)", "priority": "high", "weather_sensitive": False},
|
|
396
|
+
{"type": "monitor_growth", "title": "Avaliar floração", "priority": "medium", "weather_sensitive": False}
|
|
397
|
+
]
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"name": "maturacao",
|
|
401
|
+
"days": 25,
|
|
402
|
+
"description": "Maturação dos grãos",
|
|
403
|
+
"critical_water": False,
|
|
404
|
+
"tasks": [
|
|
405
|
+
{"type": "monitor_growth", "title": "Monitorar maturação", "priority": "high", "weather_sensitive": False},
|
|
406
|
+
{"type": "harvest", "title": "Preparar colheita", "priority": "high", "weather_sensitive": True}
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
],
|
|
410
|
+
"optimal_temp_min": 20,
|
|
411
|
+
"optimal_temp_max": 35,
|
|
412
|
+
"critical_water_phases": ["germinacao", "vegetativa", "reproducao"],
|
|
413
|
+
"harvest_window_days": 15,
|
|
414
|
+
"category": "anual",
|
|
415
|
+
"water_need": "muito_alta",
|
|
416
|
+
"risk_notes": "Requer manejo hídrico intensivo. Sensível a déficit hídrico.",
|
|
417
|
+
"calendar_notes": "Calendário para arroz irrigado. Arroz de sequeiro tem manejo diferente."
|
|
418
|
+
},
|
|
419
|
+
"trigo": {
|
|
420
|
+
"cycle_days": 120,
|
|
421
|
+
"phases": [
|
|
422
|
+
{
|
|
423
|
+
"name": "preparo",
|
|
424
|
+
"days": 10,
|
|
425
|
+
"description": "Preparo do solo",
|
|
426
|
+
"critical_water": False,
|
|
427
|
+
"tasks": [
|
|
428
|
+
{"type": "prepare_soil", "title": "Preparar solo para plantio", "priority": "high", "weather_sensitive": False},
|
|
429
|
+
{"type": "fertilize", "title": "Aplicar adubação de base", "priority": "high", "weather_sensitive": True}
|
|
430
|
+
]
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"name": "germinacao",
|
|
434
|
+
"days": 12,
|
|
435
|
+
"description": "Germinação e emergência",
|
|
436
|
+
"critical_water": True,
|
|
437
|
+
"tasks": [
|
|
438
|
+
{"type": "plant", "title": "Semear trigo", "priority": "critical", "weather_sensitive": True},
|
|
439
|
+
{"type": "irrigate", "title": "Irrigar se necessário", "priority": "high", "weather_sensitive": True},
|
|
440
|
+
{"type": "inspect_pests", "title": "Monitorar emergência", "priority": "medium", "weather_sensitive": False}
|
|
441
|
+
]
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"name": "perfilhamento",
|
|
445
|
+
"days": 35,
|
|
446
|
+
"description": "Perfilhamento",
|
|
447
|
+
"critical_water": False,
|
|
448
|
+
"tasks": [
|
|
449
|
+
{"type": "fertilize", "title": "Aplicar adubação nitrogenada", "priority": "high", "weather_sensitive": True},
|
|
450
|
+
{"type": "inspect_pests", "title": "Monitorar pragas (pulgão)", "priority": "high", "weather_sensitive": False},
|
|
451
|
+
{"type": "irrigate", "title": "Irrigar moderadamente", "priority": "medium", "weather_sensitive": True}
|
|
452
|
+
]
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"name": "espigamento",
|
|
456
|
+
"days": 28,
|
|
457
|
+
"description": "Espigamento e floração",
|
|
458
|
+
"critical_water": True,
|
|
459
|
+
"tasks": [
|
|
460
|
+
{"type": "irrigate", "title": "Irrigar - fase crítica", "priority": "critical", "weather_sensitive": True},
|
|
461
|
+
{"type": "inspect_diseases", "title": "Monitorar doenças foliares", "priority": "high", "weather_sensitive": False},
|
|
462
|
+
{"type": "monitor_growth", "title": "Avaliar floração", "priority": "medium", "weather_sensitive": False}
|
|
463
|
+
]
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"name": "enchimento_graos",
|
|
467
|
+
"days": 25,
|
|
468
|
+
"description": "Enchimento de grãos",
|
|
469
|
+
"critical_water": True,
|
|
470
|
+
"tasks": [
|
|
471
|
+
{"type": "irrigate", "title": "Irrigar - fase crítica", "priority": "critical", "weather_sensitive": True},
|
|
472
|
+
{"type": "monitor_growth", "title": "Monitorar desenvolvimento dos grãos", "priority": "high", "weather_sensitive": False}
|
|
473
|
+
]
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"name": "maturacao",
|
|
477
|
+
"days": 10,
|
|
478
|
+
"description": "Maturação",
|
|
479
|
+
"critical_water": False,
|
|
480
|
+
"tasks": [
|
|
481
|
+
{"type": "harvest", "title": "Preparar colheita", "priority": "high", "weather_sensitive": True},
|
|
482
|
+
{"type": "monitor_growth", "title": "Monitorar umidade dos grãos", "priority": "medium", "weather_sensitive": False}
|
|
483
|
+
]
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
"optimal_temp_min": 10,
|
|
487
|
+
"optimal_temp_max": 24,
|
|
488
|
+
"critical_water_phases": ["germinacao", "espigamento", "enchimento_graos"],
|
|
489
|
+
"harvest_window_days": 12,
|
|
490
|
+
"category": "anual",
|
|
491
|
+
"water_need": "media",
|
|
492
|
+
"risk_notes": "Sensível a chuvas excessivas na colheita. Requer clima ameno.",
|
|
493
|
+
"calendar_notes": "Calendário para trigo de inverno. Adaptar conforme região e cultivar."
|
|
494
|
+
},
|
|
495
|
+
"sorgo": {
|
|
496
|
+
"cycle_days": 110,
|
|
497
|
+
"phases": [
|
|
498
|
+
{
|
|
499
|
+
"name": "preparo",
|
|
500
|
+
"days": 8,
|
|
501
|
+
"description": "Preparo do solo",
|
|
502
|
+
"critical_water": False,
|
|
503
|
+
"tasks": [
|
|
504
|
+
{"type": "prepare_soil", "title": "Preparar solo para plantio", "priority": "high", "weather_sensitive": False},
|
|
505
|
+
{"type": "fertilize", "title": "Aplicar adubação de base", "priority": "high", "weather_sensitive": True}
|
|
506
|
+
]
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"name": "germinacao",
|
|
510
|
+
"days": 10,
|
|
511
|
+
"description": "Germinação e emergência",
|
|
512
|
+
"critical_water": True,
|
|
513
|
+
"tasks": [
|
|
514
|
+
{"type": "plant", "title": "Semear sorgo", "priority": "critical", "weather_sensitive": True},
|
|
515
|
+
{"type": "irrigate", "title": "Irrigar se necessário", "priority": "high", "weather_sensitive": True},
|
|
516
|
+
{"type": "inspect_pests", "title": "Monitorar emergência", "priority": "medium", "weather_sensitive": False}
|
|
517
|
+
]
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"name": "vegetativa",
|
|
521
|
+
"days": 40,
|
|
522
|
+
"description": "Crescimento vegetativo",
|
|
523
|
+
"critical_water": False,
|
|
524
|
+
"tasks": [
|
|
525
|
+
{"type": "fertilize", "title": "Aplicar adubação nitrogenada", "priority": "high", "weather_sensitive": True},
|
|
526
|
+
{"type": "inspect_pests", "title": "Monitorar pragas (pulgão, lagarta)", "priority": "high", "weather_sensitive": False},
|
|
527
|
+
{"type": "irrigate", "title": "Irrigar moderadamente", "priority": "medium", "weather_sensitive": True}
|
|
528
|
+
]
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"name": "florescimento",
|
|
532
|
+
"days": 22,
|
|
533
|
+
"description": "Florescimento e polinização",
|
|
534
|
+
"critical_water": True,
|
|
535
|
+
"tasks": [
|
|
536
|
+
{"type": "irrigate", "title": "Irrigar - fase crítica", "priority": "critical", "weather_sensitive": True},
|
|
537
|
+
{"type": "monitor_growth", "title": "Avaliar floração", "priority": "medium", "weather_sensitive": False}
|
|
538
|
+
]
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"name": "enchimento_graos",
|
|
542
|
+
"days": 20,
|
|
543
|
+
"description": "Enchimento de grãos",
|
|
544
|
+
"critical_water": True,
|
|
545
|
+
"tasks": [
|
|
546
|
+
{"type": "irrigate", "title": "Irrigar - fase crítica", "priority": "critical", "weather_sensitive": True},
|
|
547
|
+
{"type": "monitor_growth", "title": "Monitorar desenvolvimento dos grãos", "priority": "high", "weather_sensitive": False}
|
|
548
|
+
]
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
"name": "maturacao",
|
|
552
|
+
"days": 10,
|
|
553
|
+
"description": "Maturação",
|
|
554
|
+
"critical_water": False,
|
|
555
|
+
"tasks": [
|
|
556
|
+
{"type": "harvest", "title": "Preparar colheita", "priority": "high", "weather_sensitive": True},
|
|
557
|
+
{"type": "monitor_growth", "title": "Monitorar umidade dos grãos", "priority": "medium", "weather_sensitive": False}
|
|
558
|
+
]
|
|
559
|
+
}
|
|
560
|
+
],
|
|
561
|
+
"optimal_temp_min": 21,
|
|
562
|
+
"optimal_temp_max": 35,
|
|
563
|
+
"critical_water_phases": ["germinacao", "florescimento", "enchimento_graos"],
|
|
564
|
+
"harvest_window_days": 15,
|
|
565
|
+
"category": "anual",
|
|
566
|
+
"water_need": "baixa",
|
|
567
|
+
"risk_notes": "Tolerante à seca. Boa opção para regiões com déficit hídrico.",
|
|
568
|
+
"calendar_notes": "Calendário para sorgo granífero. Sorgo forrageiro tem manejo diferente."
|
|
569
|
+
},
|
|
570
|
+
"mandioca": {
|
|
571
|
+
"cycle_days": 300,
|
|
572
|
+
"phases": [
|
|
573
|
+
{
|
|
574
|
+
"name": "preparo",
|
|
575
|
+
"days": 15,
|
|
576
|
+
"description": "Preparo do solo e seleção de manivas",
|
|
577
|
+
"critical_water": False,
|
|
578
|
+
"tasks": [
|
|
579
|
+
{"type": "prepare_soil", "title": "Preparar solo para plantio", "priority": "high", "weather_sensitive": False},
|
|
580
|
+
{"type": "fertilize", "title": "Aplicar adubação de base", "priority": "high", "weather_sensitive": True}
|
|
581
|
+
]
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
"name": "plantio",
|
|
585
|
+
"days": 30,
|
|
586
|
+
"description": "Plantio de manivas e brotação",
|
|
587
|
+
"critical_water": True,
|
|
588
|
+
"tasks": [
|
|
589
|
+
{"type": "plant", "title": "Plantar manivas", "priority": "critical", "weather_sensitive": True},
|
|
590
|
+
{"type": "irrigate", "title": "Irrigar para brotação", "priority": "high", "weather_sensitive": True},
|
|
591
|
+
{"type": "inspect_pests", "title": "Monitorar brotação", "priority": "medium", "weather_sensitive": False}
|
|
592
|
+
]
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"name": "estabelecimento",
|
|
596
|
+
"days": 60,
|
|
597
|
+
"description": "Estabelecimento e crescimento inicial",
|
|
598
|
+
"critical_water": False,
|
|
599
|
+
"tasks": [
|
|
600
|
+
{"type": "inspect_pests", "title": "Controlar plantas daninhas", "priority": "high", "weather_sensitive": False},
|
|
601
|
+
{"type": "fertilize", "title": "Aplicar adubação de cobertura", "priority": "medium", "weather_sensitive": True},
|
|
602
|
+
{"type": "irrigate", "title": "Irrigar se necessário", "priority": "medium", "weather_sensitive": True}
|
|
603
|
+
]
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
"name": "desenvolvimento",
|
|
607
|
+
"days": 120,
|
|
608
|
+
"description": "Desenvolvimento vegetativo e formação de raízes",
|
|
609
|
+
"critical_water": False,
|
|
610
|
+
"tasks": [
|
|
611
|
+
{"type": "inspect_pests", "title": "Monitorar pragas (mandarová, ácaros)", "priority": "high", "weather_sensitive": False},
|
|
612
|
+
{"type": "monitor_growth", "title": "Avaliar desenvolvimento", "priority": "medium", "weather_sensitive": False},
|
|
613
|
+
{"type": "irrigate", "title": "Irrigar conforme necessidade", "priority": "low", "weather_sensitive": True}
|
|
614
|
+
]
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"name": "engrossamento",
|
|
618
|
+
"days": 60,
|
|
619
|
+
"description": "Engrossamento das raízes",
|
|
620
|
+
"critical_water": False,
|
|
621
|
+
"tasks": [
|
|
622
|
+
{"type": "monitor_growth", "title": "Avaliar desenvolvimento das raízes", "priority": "high", "weather_sensitive": False},
|
|
623
|
+
{"type": "inspect_pests", "title": "Monitorar sanidade", "priority": "medium", "weather_sensitive": False}
|
|
624
|
+
]
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
"name": "colheita",
|
|
628
|
+
"days": 15,
|
|
629
|
+
"description": "Colheita",
|
|
630
|
+
"critical_water": False,
|
|
631
|
+
"tasks": [
|
|
632
|
+
{"type": "harvest", "title": "Colher mandioca", "priority": "high", "weather_sensitive": True}
|
|
633
|
+
]
|
|
634
|
+
}
|
|
635
|
+
],
|
|
636
|
+
"optimal_temp_min": 20,
|
|
637
|
+
"optimal_temp_max": 35,
|
|
638
|
+
"critical_water_phases": ["plantio"],
|
|
639
|
+
"harvest_window_days": 60,
|
|
640
|
+
"category": "anual",
|
|
641
|
+
"water_need": "baixa",
|
|
642
|
+
"risk_notes": "Tolerante à seca após estabelecimento. Sensível a encharcamento.",
|
|
643
|
+
"calendar_notes": "Calendário para mandioca de mesa. Mandioca industrial pode ter ciclo mais longo."
|
|
644
|
+
},
|
|
645
|
+
"algodao": {
|
|
646
|
+
"cycle_days": 180,
|
|
647
|
+
"phases": [
|
|
648
|
+
{
|
|
649
|
+
"name": "preparo",
|
|
650
|
+
"days": 10,
|
|
651
|
+
"description": "Preparo do solo",
|
|
652
|
+
"critical_water": False,
|
|
653
|
+
"tasks": [
|
|
654
|
+
{"type": "prepare_soil", "title": "Preparar solo para plantio", "priority": "high", "weather_sensitive": False},
|
|
655
|
+
{"type": "fertilize", "title": "Aplicar adubação de base", "priority": "high", "weather_sensitive": True}
|
|
656
|
+
]
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"name": "germinacao",
|
|
660
|
+
"days": 12,
|
|
661
|
+
"description": "Germinação e emergência",
|
|
662
|
+
"critical_water": True,
|
|
663
|
+
"tasks": [
|
|
664
|
+
{"type": "plant", "title": "Semear algodão", "priority": "critical", "weather_sensitive": True},
|
|
665
|
+
{"type": "irrigate", "title": "Irrigar para emergência", "priority": "high", "weather_sensitive": True},
|
|
666
|
+
{"type": "inspect_pests", "title": "Monitorar emergência", "priority": "medium", "weather_sensitive": False}
|
|
667
|
+
]
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
"name": "vegetativa",
|
|
671
|
+
"days": 50,
|
|
672
|
+
"description": "Crescimento vegetativo",
|
|
673
|
+
"critical_water": False,
|
|
674
|
+
"tasks": [
|
|
675
|
+
{"type": "fertilize", "title": "Aplicar adubação nitrogenada", "priority": "high", "weather_sensitive": True},
|
|
676
|
+
{"type": "inspect_pests", "title": "Monitorar pragas (bicudo, lagarta)", "priority": "high", "weather_sensitive": False},
|
|
677
|
+
{"type": "irrigate", "title": "Irrigar moderadamente", "priority": "medium", "weather_sensitive": True}
|
|
678
|
+
]
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"name": "florescimento",
|
|
682
|
+
"days": 40,
|
|
683
|
+
"description": "Florescimento",
|
|
684
|
+
"critical_water": True,
|
|
685
|
+
"tasks": [
|
|
686
|
+
{"type": "irrigate", "title": "Irrigar - fase crítica", "priority": "critical", "weather_sensitive": True},
|
|
687
|
+
{"type": "inspect_diseases", "title": "Monitorar doenças (ramulária)", "priority": "high", "weather_sensitive": False},
|
|
688
|
+
{"type": "monitor_growth", "title": "Avaliar floração", "priority": "medium", "weather_sensitive": False}
|
|
689
|
+
]
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
"name": "formacao_macas",
|
|
693
|
+
"days": 48,
|
|
694
|
+
"description": "Formação e abertura de maçãs",
|
|
695
|
+
"critical_water": True,
|
|
696
|
+
"tasks": [
|
|
697
|
+
{"type": "irrigate", "title": "Irrigar - fase crítica", "priority": "critical", "weather_sensitive": True},
|
|
698
|
+
{"type": "inspect_pests", "title": "Monitorar pragas nas maçãs", "priority": "high", "weather_sensitive": False},
|
|
699
|
+
{"type": "monitor_growth", "title": "Avaliar desenvolvimento das maçãs", "priority": "high", "weather_sensitive": False}
|
|
700
|
+
]
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
"name": "maturacao",
|
|
704
|
+
"days": 20,
|
|
705
|
+
"description": "Maturação e abertura dos capulhos",
|
|
706
|
+
"critical_water": False,
|
|
707
|
+
"tasks": [
|
|
708
|
+
{"type": "monitor_growth", "title": "Monitorar abertura dos capulhos", "priority": "high", "weather_sensitive": False},
|
|
709
|
+
{"type": "harvest", "title": "Preparar colheita", "priority": "high", "weather_sensitive": True}
|
|
710
|
+
]
|
|
711
|
+
}
|
|
712
|
+
],
|
|
713
|
+
"optimal_temp_min": 20,
|
|
714
|
+
"optimal_temp_max": 30,
|
|
715
|
+
"critical_water_phases": ["germinacao", "florescimento", "formacao_macas"],
|
|
716
|
+
"harvest_window_days": 30,
|
|
717
|
+
"category": "anual",
|
|
718
|
+
"water_need": "media",
|
|
719
|
+
"risk_notes": "Sensível a pragas. Requer manejo fitossanitário intensivo.",
|
|
720
|
+
"calendar_notes": "Calendário para algodão herbáceo. Requer monitoramento constante de pragas."
|
|
210
721
|
}
|
|
211
722
|
}
|
|
212
723
|
|
|
@@ -364,6 +875,48 @@ def gerar_calendario_cultura(
|
|
|
364
875
|
# Ordenar tarefas por data
|
|
365
876
|
tasks.sort(key=lambda t: t.date)
|
|
366
877
|
|
|
878
|
+
# Detectar e ajustar tarefas no passado
|
|
879
|
+
today = date.today()
|
|
880
|
+
adjusted_tasks_count = 0
|
|
881
|
+
calendar_warnings = []
|
|
882
|
+
|
|
883
|
+
for task in tasks:
|
|
884
|
+
if task.date < today:
|
|
885
|
+
# Marcar tarefa como ajustada
|
|
886
|
+
task.original_date = task.date
|
|
887
|
+
task.date = today
|
|
888
|
+
task.adjusted = True
|
|
889
|
+
|
|
890
|
+
# Aumentar prioridade se não for crítica
|
|
891
|
+
if task.priority != TaskPriority.CRITICAL:
|
|
892
|
+
task.priority = TaskPriority.HIGH
|
|
893
|
+
|
|
894
|
+
# Adicionar observação à descrição
|
|
895
|
+
task.description += f" [AJUSTADA: Data original era {task.original_date.isoformat()}, mas já passou. Tarefa reagendada para hoje.]"
|
|
896
|
+
|
|
897
|
+
adjusted_tasks_count += 1
|
|
898
|
+
|
|
899
|
+
# Adicionar avisos se houver tarefas ajustadas
|
|
900
|
+
if adjusted_tasks_count > 0:
|
|
901
|
+
calendar_warnings.append(
|
|
902
|
+
f"{adjusted_tasks_count} tarefa(s) foram ajustadas porque a data original já havia passado. "
|
|
903
|
+
"Considere escolher uma data de plantio mais distante no futuro."
|
|
904
|
+
)
|
|
905
|
+
|
|
906
|
+
# Verificar se data de plantio está muito próxima
|
|
907
|
+
days_until_planting = (planting_date - today).days
|
|
908
|
+
if days_until_planting <= 7 and days_until_planting >= 0:
|
|
909
|
+
calendar_warnings.append(
|
|
910
|
+
f"Sua data de plantio está em {days_until_planting} dia(s). "
|
|
911
|
+
"Tarefas preparatórias podem ter sido ajustadas. "
|
|
912
|
+
"Recomendamos planejar com pelo menos 2 semanas de antecedência."
|
|
913
|
+
)
|
|
914
|
+
elif days_until_planting < 0:
|
|
915
|
+
calendar_warnings.append(
|
|
916
|
+
"A data de plantio escolhida já passou. "
|
|
917
|
+
"O calendário foi ajustado, mas recomendamos escolher uma data futura."
|
|
918
|
+
)
|
|
919
|
+
|
|
367
920
|
# Montar resposta
|
|
368
921
|
return {
|
|
369
922
|
"cultura": cultura,
|
|
@@ -377,6 +930,10 @@ def gerar_calendario_cultura(
|
|
|
377
930
|
"optimal_temp_max": cycle_data["optimal_temp_max"],
|
|
378
931
|
"critical_water_phases": cycle_data["critical_water_phases"],
|
|
379
932
|
"harvest_window_days": cycle_data["harvest_window_days"],
|
|
933
|
+
"category": cycle_data.get("category", "anual"),
|
|
934
|
+
"water_need": cycle_data.get("water_need", "media"),
|
|
935
|
+
"risk_notes": cycle_data.get("risk_notes", ""),
|
|
936
|
+
"calendar_notes": cycle_data.get("calendar_notes", ""),
|
|
380
937
|
"phases": [
|
|
381
938
|
{
|
|
382
939
|
"name": phase["name"],
|
|
@@ -390,7 +947,11 @@ def gerar_calendario_cultura(
|
|
|
390
947
|
"tasks": [task.to_dict() for task in tasks],
|
|
391
948
|
"total_tasks": len(tasks),
|
|
392
949
|
"weather_sensitive_tasks": sum(1 for task in tasks if task.weather_sensitive),
|
|
393
|
-
"critical_tasks": sum(1 for task in tasks if task.priority == TaskPriority.CRITICAL)
|
|
950
|
+
"critical_tasks": sum(1 for task in tasks if task.priority == TaskPriority.CRITICAL),
|
|
951
|
+
"has_adjusted_tasks": adjusted_tasks_count > 0,
|
|
952
|
+
"adjusted_tasks_count": adjusted_tasks_count,
|
|
953
|
+
"calendar_warnings": calendar_warnings,
|
|
954
|
+
"cautela": "Este calendário é uma base inicial de planejamento. As datas e tarefas devem ser ajustadas conforme clima, solo, cultivar, manejo e orientação técnica."
|
|
394
955
|
}
|
|
395
956
|
|
|
396
957
|
|
|
@@ -259,9 +259,11 @@ class CalendarTask:
|
|
|
259
259
|
status: TaskStatus = TaskStatus.PENDING
|
|
260
260
|
weather_sensitive: bool = False
|
|
261
261
|
completed_at: Optional[datetime] = None
|
|
262
|
+
adjusted: bool = False # Se a tarefa foi ajustada por estar no passado
|
|
263
|
+
original_date: Optional[date] = None # Data original antes do ajuste
|
|
262
264
|
|
|
263
265
|
def to_dict(self) -> Dict:
|
|
264
|
-
|
|
266
|
+
result = {
|
|
265
267
|
"id": self.id,
|
|
266
268
|
"crop_plan_id": self.crop_plan_id,
|
|
267
269
|
"date": self.date.isoformat(),
|
|
@@ -272,8 +274,14 @@ class CalendarTask:
|
|
|
272
274
|
"source": self.source,
|
|
273
275
|
"status": self.status.value,
|
|
274
276
|
"weather_sensitive": self.weather_sensitive,
|
|
275
|
-
"completed_at": self.completed_at.isoformat() if self.completed_at else None
|
|
277
|
+
"completed_at": self.completed_at.isoformat() if self.completed_at else None,
|
|
278
|
+
"adjusted": self.adjusted
|
|
276
279
|
}
|
|
280
|
+
|
|
281
|
+
if self.original_date:
|
|
282
|
+
result["original_date"] = self.original_date.isoformat()
|
|
283
|
+
|
|
284
|
+
return result
|
|
277
285
|
|
|
278
286
|
|
|
279
287
|
@dataclass
|