Skip to main content
Back to Prompt Library
implementation

Build the application

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Build an Agricultural Drought Parametric Index Simulator

Format
Code-aware
Lines
67
Sections
11
Linked challenge
Build an Agricultural Drought Parametric Index Simulator

Prompt source

Original prompt text with formatting preserved for inspection.

67 lines
11 sections
No variables
1 code block
## Build
Simulate parametric drought contract settlement thresholds using ECMWF ERA5 reanalysis precipitation datasets. Model historical payout triggers and calculate contract basis risk for regional crop cooperatives.

## User
Agricultural Risk Analyst

## Workflow
1. Ingest ERA5 daily total precipitation grids via Copernicus CDS client.
2. Compute cumulative rainfall deficit indices against seasonal historical baselines.
3. Simulate parametric threshold breach scenarios across multi-year intervals.
4. Generate basis risk reports contrasting simulated triggers with crop stress logs.

## Interface
Multi-year simulation dashboard plotting cumulative precipitation curves, trigger thresholds, and parametric settlement timelines.

## Data
Use cdsapi client to pull monthly or daily ERA5 reanalysis single levels for localized coordinates, or replay local mock NetCDF/GRIB fixtures.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Copernicus Climate Data Store client](https://raw.githubusercontent.com/ecmwf/cdsapi/master/README.rst)
Uses cdsapi.Client retrieve interface targeting reanalysis-era5 single levels with variable parameter 'total_precipitation'.

## Tools
mlflow, cdsapi, xarray, numpy.
Tracks parametric trigger simulation parameters, threshold variations, and basis risk metrics across runs.
Local Python analytics runtime paired with hosted Claude or OpenAI API for synthetic report summarization.

## 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
- cdsapi retrieve query parameters match valid CDS API syntax.
- Simulation accurately detects cumulative rainfall breach points.
- Logs all contract runs and trigger metrics to MLflow experiment tracking.

## Starter Examples
```json
[
  {
    "input": {
      "contract_id": "AGRI-PARAM-DROUGHT-01",
      "region": "CornBelt-West",
      "trigger_threshold_mm": 120,
      "season_total_precip_mm": 88.5,
      "historical_mean_mm": 210
    },
    "expected_output": {
      "contract_id": "AGRI-PARAM-DROUGHT-01",
      "trigger_breached": true,
      "deficit_severity": "SEVERE",
      "simulated_payout_ratio": 1,
      "basis_risk_indicator": "LOW"
    }
  },
  {
    "input": {
      "contract_id": "AGRI-PARAM-DROUGHT-02",
      "region": "CornBelt-East",
      "trigger_threshold_mm": 120,
      "season_total_precip_mm": 135.2,
      "historical_mean_mm": 205
    },
    "expected_output": {
      "contract_id": "AGRI-PARAM-DROUGHT-02",
      "trigger_breached": false,
      "deficit_severity": "MILD",
      "simulated_payout_ratio": 0,
      "basis_risk_indicator": "MODERATE"
    }
  }
]
```

## Safety
Outputs simulated parametric settlement indicators; executes no actual financial transfers or legal underwriting binds.
Use mock external writes. Require human review before any real deployment.

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Hold the task contract and output shape stable so generated implementations remain comparable.

Tune next

Update libraries, interfaces, and environment assumptions to match the stack you actually run.

Verify after

Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.