import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'packages' / 'agromatrix-tools')) from agromatrix_tools import tool_operation_plan as op plan_id = op.create_plan({ 'scope': {'field_ids': ['field_001'], 'crop_ids': ['crop_wheat_winter'], 'date_window': {'start': '2026-02-08', 'end': '2026-02-15'}}, 'tasks': [ {'operation_id': 'op_sowing', 'planned_date': '2026-02-10', 'priority': 'normal', 'assignee': 'team', 'norms': {'labor_hours': 4, 'fuel_l': 20, 'materials': [{'material_id': 'mat_urea', 'rate': {'value': 150, 'unit': 'kg/ha'}}]}} ] }, trace_id='demo-trace') print('plan_id:', plan_id) op.record_fact(plan_id, { 'task_id': '', 'ts': '2026-02-10T12:00:00Z', 'field_id': 'field_001', 'operation_id': 'op_sowing', 'done_date': '2026-02-10', 'fact': {'labor_hours': 5, 'fuel_l': 18, 'materials': [{'material_id': 'mat_urea', 'amount': {'value': 160, 'unit': 'kg/ha'}}]}, 'quality': {'source': 'manual', 'confidence': 'trusted'} }, trace_id='demo-trace') print(op.plan_dashboard({'start': '2026-02-08', 'end': '2026-02-15'}))