Skip to main content
Loading navigation
Back to prompt library

Build a STAC Agricultural Drought Biomass Loss Indexer — implementation

Linked challenge: Build a STAC Agricultural Drought Biomass Loss Indexer

Prompt source

implementation105 lines11 sectionsNo variables1 code block
## Build
Process agricultural STAC Item asset references alongside simplified synthetic app records for crop stress to streamline claim preparation. Evaluate parcel-level vegetation anomaly flags against regional drought periods.

## User
Agricultural Claims Specialist

## Workflow
1. Query public STAC Item catalogs over farm bounding boxes across the growing season.
2. Extract multispectral asset references and ingest simplified synthetic app records containing normalized vegetation anomaly values for the parcels.
3. Correlate biomass deficit time series against regional drought emergency records.
4. Generate a structured crop loss assessment dossier for agronomist review.

## Interface
Streamlit parcel search console displaying satellite asset links, vegetation degradation curves, and drought period markers.

## Data
Use public Earth Search STAC API endpoints and local JSON files acting as simplified synthetic app records for parcel polygons and NDVI values.
Starter examples below are synthetic. They are not downloaded records.

## Source
[STAC specification](https://raw.githubusercontent.com/radiantearth/stac-spec/master/README.md)
Extract STAC Item assets, bbox boundaries, and datetime properties defined in STAC Item specification.

## Tools
llamaindex, shapely, fastapi, pandas.
LlamaIndex indexes temporal metadata and asset links from parsed STAC Items and synthetic crop stress records for fast retrieval.
Hosted LLM with tool calling for structured claim dossier generation and evidence compilation.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- STAC Item geometry overlaps parcel boundaries exactly.
- Computes vegetation deficit percentile relative to baseline within 5% tolerance using ingested synthetic records.
- Outputs structured JSON dossier with asset URIs and anomaly flags.

## Starter Examples
```json
[
  {
    "input": {
      "parcel_id": "PARCEL-IA-882",
      "bbox": [
        -93.5,
        41.5,
        -93.4,
        41.6
      ],
      "stac_items": [
        {
          "id": "S2A_20230715",
          "properties": {
            "datetime": "2023-07-15T10:30:00Z",
            "eo:cloud_cover": 2.1
          },
          "assets": {
            "ndvi": {
              "href": "https://storage.example.org/ndvi_20230715.tif"
            }
          }
        }
      ],
      "baseline_ndvi": 0.78,
      "observed_ndvi": 0.42
    },
    "expected_output": {
      "parcel_id": "PARCEL-IA-882",
      "anomaly_ratio": -0.46,
      "drought_stress_detected": true,
      "evidence_item_ids": [
        "S2A_20230715"
      ],
      "dossier_status": "READY_FOR_ADJUSTER"
    }
  },
  {
    "input": {
      "parcel_id": "PARCEL-NE-104",
      "bbox": [
        -98.1,
        40.8,
        -98,
        40.9
      ],
      "stac_items": [
        {
          "id": "S2B_20230801",
          "properties": {
            "datetime": "2023-08-01T10:30:00Z",
            "eo:cloud_cover": 85
          },
          "assets": {
            "visual": {
              "href": "https://storage.example.org/rgb_cloudy.tif"
            }
          }
        }
      ],
      "baseline_ndvi": 0.72,
      "observed_ndvi": null
    },
    "expected_output": {
      "parcel_id": "PARCEL-NE-104",
      "anomaly_ratio": null,
      "drought_stress_detected": false,
      "evidence_item_ids": [],
      "dossier_status": "INSUFFICIENT_CLEAR_SCENES"
    }
  }
]
```

## Safety
Emphasizes that crop biomass indices serve as claim evidence preparation rather than automatic adjustment.
Use mock external writes. Require human review before any real deployment.