Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sdarionicolas-boop/AgroIA-RAG/llms.txt

Use this file to discover all available pages before exploring further.

The AgroIA Streamlit dashboard is the primary visual interface for exploring all lots that have been processed by the pipeline. From a single browser tab you can inspect a field’s AgroIA Score, review six years of NDVI history, examine the score components, compare two fields side by side, generate a comparative PDF ranking across your entire portfolio, and ask the RAG agent agronomic questions in plain language. Everything in the dashboard reads from the same PostgreSQL database that the pipeline writes to, so newly analysed lots appear immediately.

Starting the dashboard

Start only the Streamlit interface on port 8501:
python start.py --ui
Once running, open your browser at:
http://localhost:8501
Run python start.py --check first to verify that PostgreSQL, Ollama, and all dependencies are available before starting the dashboard. A missing Ollama model will cause the RAG chat to fail silently.

Analysis modes

The dashboard sidebar exposes three modes selectable via radio buttons:

Inspect a lot — single field view

Select any lot from the dropdown to view:
  • Score AgroIA metric with delta vs. the previous year
  • Critical NDVI value for the most recent season
  • Heat stress in accumulated hours (NASA POWER)
  • Spatial CV (coefficient of variation across the field)
  • Four progress bars for the score components: Vigor (40), Estabilidad (30), Limpieza IA (20), Clima (10)
  • Zonification status — whether the field is homogeneous or split into A/B/C zones
Toggle the Evolución histórica and Componentes del Score checkboxes in the sidebar to show or hide the time-series charts below the metrics.
Select Lote A and Lote B from the sidebar dropdowns. The dashboard displays:
  • Side-by-side score and NDVI metrics with deltas
  • A bar chart comparing total scores
  • A grouped bar chart comparing all four score components
Click Ejecutar análisis comparativo to run a deep agronomic comparison through the RAG engine. The LLM returns a structured response with a comparative table, performance analysis, limiting factors, and a recommendation.Expand Evolución histórica comparada to overlay both fields’ historical NDVI curves on a single chart.
The ranking mode shows a summary across all lots in the database:
  • Total lots analysed, total surface area in hectares, and average AgroIA Score
  • A ranked bar chart of all lots by score (Ranking por Potencial)
  • A scatter plot of score vs. spatial CV (Potencial vs. Heterogeneidad)
  • A full detail table with lot ID, crop, surface, score, and spatial CV
Click Generar Reporte PDF to build a comparative PDF report (outputs/Ranking_Comparativo_AgroIA.pdf) and download it directly from the browser.

RAG chat interface

At the bottom of the single-lot inspection view, a persistent chat input lets you ask natural language questions about the selected lot. The RAG engine retrieves the lot’s stored report and historical records, then passes them as context to gemma3:4b via Ollama. Example queries you can send:
  • ¿Cómo viene el NDVI histórico de este lote?
  • ¿Cuál fue el peor año climático y por qué?
  • ¿Qué zona tiene más riesgo en la zonificación?
  • Compará el vigor de este año con el promedio histórico.
The dashboard chat and the Telegram bot share the same RAG engine (src/rag/core.py::consultar_agente()). A question asked in the dashboard and the same question sent to the bot will produce equivalent answers.

Data administration

The sidebar includes a collapsible Administración de datos panel for managing database contents during testing or before a demo:
  • Delete a specific lot — select the lot from a dropdown, confirm the checkbox, and click the delete button. The lot and all its historical records are removed via the FastAPI DELETE /lotes/{lote_id} endpoint.
  • Clear the entire database — a separate confirmation checkbox guards a full wipe of all lots and history via DELETE /lotes.
Database deletion through the administration panel is irreversible. Make sure the FastAPI service is running before attempting either delete operation, or the request will fail with a connection error.

Build docs developers (and LLMs) love