How dma-teams/nasa-app-api works
This is a Go crop-rotation recommendation API backed by a separately run data-loading pipeline. ETL gathers climate, soil, forecast, and boundary data into versioned Redis datasets; API requests locate a municipality, retrieve its prepared data, simulate and score crop rotations, and return structured recommendations. The README also documents crop and administrative listings, health and API documentation endpoints, and a calibration workflow. Relationships below follow excerpts, SOURCE INDEX references, or README statements; unsampled internals are not assumed to have unshown calls.
Main entry points: store.go Versioned datasets · handlers.go HTTP handlers · service.go Plan service · build.go Dataset builder
Components 22
Data ingestion
- ETL command
cmd/etl/main.go - Dataset builder
internal/etl/build.go - Soil processing
internal/etl/soil.go - Forecast loading
internal/etl/forecast.go - Source clients
internal/sources
Agronomy and geography
- Rotation engine
internal/agro/engine.go - Scoring and evaluation
internal/agro/evaluator.go - Site profiles
internal/agro/profile.go - Crop catalog
internal/catalog/crops_data.go - Municipal geography
internal/geo/geo.go
Recommendation API
- API startup
cmd/api/main.go - HTTP handlers
internal/httpapi/handlers.go - Plan service
internal/plan/service.go - Department plans
internal/plan/department.go
Redis storage
- Versioned datasets
internal/store/store.go - Climate codec
internal/store/codec.go
Calibration
- Calibration command
cmd/calibrate/main.go - IMERG downloader
cmd/calibrate/imerg.go - Canícula analysis
cmd/calibrate/canicula.go
Other components
- Redis
- API user
- Climate and soil providers
Connections 25
- ETL command → Dataset builder: runs build
cmd/etl/main.go - ETL command → Source clients: configures clients
cmd/etl/main.go - ETL command → Versioned datasets: configures storage
cmd/etl/main.go - Dataset builder → Source clients: fetches inputs
internal/etl/build.go - Dataset builder → Versioned datasets: writes datasets
internal/etl/build.go - Dataset builder → Site profiles: builds profiles
internal/etl/build.go - Soil processing → Source clients: gets soil data
internal/etl/soil.go - Forecast loading → Source clients: gets forecasts
internal/etl/forecast.go - Forecast loading → Versioned datasets: writes forecasts
- Versioned datasets → Redis: reads and writes
internal/store/store.go - Versioned datasets → Climate codec: encodes climate
internal/store/codec.go - API user → HTTP handlers: requests plan
README.md - API startup → Versioned datasets: loads datasets
cmd/api/main.go - API startup → Plan service: wires service
cmd/api/main.go - API startup → HTTP handlers: starts API
cmd/api/main.go - HTTP handlers → Municipal geography: locates municipality
internal/httpapi/handlers.go - HTTP handlers → Plan service: requests plan
internal/httpapi/handlers.go - HTTP handlers → Crop catalog: serves crop listing
- Plan service → Rotation engine: evaluates rotation
internal/plan/service.go - Rotation engine → Scoring and evaluation: scores candidates
internal/agro/engine.go - Plan service → Versioned datasets: loads prepared data
README.md - Plan service → Department plans: aggregates departments
- Calibration command → IMERG downloader: runs download
cmd/calibrate/main.go - Calibration command → Canícula analysis: runs analysis
cmd/calibrate/main.go - IMERG downloader → Climate and soil providers: downloads IMERG