SmartTap turns plain-English questions about Oregon agricultural and weather data into charts, summaries, and inspectable evidence.
The retained product surface is one shared pipeline used by the Streamlit UI and CLI:
parse -> validate -> fetch -> visualize -> explain
SmartTap is an evidence system, not a final-answer engine. Its job is to return the right data, chart, and metadata package so the next reviewer can verify what the query actually shows.
- Time-series evidence views
- Statistical summaries
- Crop ranking and crop-distribution summaries
- Coordinated OpenET + AgriMet evidence packages
- Deterministic confirmation, clarification, validation, and explanation flows
Data sources:
- OpenET field and crop data from local parquet runtime artifacts
- AgriMet weather data from local CSVs, with optional API fallback for unsupported local variables
core/,llm/,smarttap_service.py,smarttap_ui.py,smarttap.py: runtime codereference/: tracked small reference assets used by code and handoff docsdata/: local-only heavy datasets and acquisition notesartifacts/qa/: tracked workbook QA bundleartifacts/examples/partner_queries/: tracked sample evidence runsdocs/: current docs for onboarding, architecture, and handoffdocs/archive/: historical planning and legacy reference docsscripts/: active utilitiesscripts/archive/: legacy utilities kept for reference onlytests/: retained automated test suite
More detail is in docs/REPO_HANDOFF.md.
- Create a virtual environment and install dependencies.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt- Make sure Ollama is available for natural-language parsing.
ollama pull gemma3:latest
ollama serve- Download the required local data into
data/.
See data/README.md.
- Run the legacy Streamlit UI.
./run_ui.shThe UI starts at http://localhost:8501.
SmartTap now also includes a React frontend backed by a FastAPI service.
Start the API:
./run_api.shThe API starts at http://localhost:8000.
Start the React app in a second terminal:
./run_web.shThe React app starts at http://localhost:5173 and proxies /api/* requests to the local FastAPI backend.
Available API routes:
GET /api/healthPOST /api/queryPOST /api/followupPOST /api/confirmation/editPOST /api/confirmation/confirm
python smarttap.py "Show temperature in Corvallis for July 2024"Tracked reference assets now live in reference/:
reference/agrimet_stations_full_metadata.csvreference/CDL_Crop_Codes_Oregon.csvreference/openet_variable_keywords.jsonreference/crop_name_keywords.json
Required local data lives in data/:
data/agrimet/*.csvdata/openet/field_index.parquetdata/openet/annual/*.parquetdata/openet/monthly/*/*.parquet
Optional:
AGRIMET_USE_API=1to prefer the AgriMet API when local CSV coverage is insufficientdata/field_points.gpkganddata/preliminary_or_field_geopackage.gpkgas offline source files for parquet materializationdata/openet/field_combined_long.csvanddata/openet/huc_combined_long.csvonly for legacy explicit non-location field/HUC fetch modes
The current statewide location-query path is parquet-backed.
- Acquire the source GeoPackages:
data/field_points.gpkgdata/preliminary_or_field_geopackage.gpkg
- Materialize the runtime parquet store:
python scripts/materialize_openet_parquet.pyRuntime OpenET queries then read only from data/openet/. The GeoPackages are offline source inputs for materialization and are not used by the active location-query runtime.
Run the retained suite with:
python -m pytest -qThe lightweight wrapper below runs the same suite:
python tests/run_tests.pyFrontend tests and build:
cd web
npm test
npm run buildTesting/reporting helpers:
python scripts/run_regression_suite.py --output evaluation_results/regression_suite_latest
python scripts/export_qa_bundle.py --output-dir artifacts/qa --clean
python scripts/evaluate_prompts.py --output evaluation_results/prompt_benchmark_latest --prompt-dir prompts/variants --repeats 3
python scripts/build_testing_report.py --regression-report evaluation_results/regression_suite_latest --qa-run-summary artifacts/qa/run_summary.json --workbook-eval evaluation_results/workbook_evaluation_20260415_071203.json --output evaluation_results/testing_story_latestNotes:
scripts/evaluate_prompts.pybenchmarksprompts/interpretation.txtand prompt variants against retained, stretch, and adversarial parser fixtures.- Prompt benchmarking needs a reachable local Ollama server at
OLLAMA_HOSTand the configured model, such asgemma3:latest.