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 a Coastal Flood Declaration and DEM Link Correlator

Format
Code-aware
Lines
63
Sections
11
Linked challenge
Build a Coastal Flood Declaration and DEM Link Correlator

Prompt source

Original prompt text with formatting preserved for inspection.

63 lines
11 sections
No variables
1 code block
## Build
Correlate historical OpenFEMA coastal disaster declarations with STAC metadata referencing digital elevation models. Compile asset administrative histories and retrieve elevation metadata links to support subsequent manual engineering reviews.

## User
Coastal Risk Analyst

## Workflow
1. Query OpenFEMA API for historical county-level coastal storm disaster declarations.
2. Retrieve corresponding STAC Items referencing coastal elevation datasets for impacted counties.
3. Extract valid elevation asset URLs from STAC metadata intersecting the asset location bounding box.
4. Generate a coastal administrative history table and data compilation report for engineering review.

## Interface
Web table view displaying coastal assets, county disaster declaration counts, and DEM STAC reference links.

## Data
Query OpenFEMA v2/DisasterDeclarationsSummaries filtering by coastal state/county, and fetch DEM STAC Item metadata from mock SpatioTemporal Asset Catalog files.
Starter examples below are synthetic. They are not downloaded records.

## Source
[FEMA OpenFEMA](https://www.fema.gov/about/openfema/api)
Applies OpenFEMA $select, $filter, and $orderby parameters to isolate coastal storm declarations by county.

## Tools
dspy, requests, pystac, fastapi.
DSPy compiles robust prompt pipelines to extract accurate metadata links and map disaster summaries to asset locations.
Hosted or local model supporting DSPy signature compilation for text and JSON metadata extraction.

## 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
- Fetches disaster declarations filtering by coastal storm incident types and specified counties.
- Extracts valid asset URLs from STAC metadata intersecting the requested asset bounding box.
- Flags compiled records for manual engineering assessment based on non-zero declaration counts.

## Starter Examples
```json
[
  {
    "input": {
      "asset_id": "PORT-DOCK-12",
      "county": "CoastalCounty",
      "fema_incident_type": "Coastal Storm"
    },
    "expected_output": {
      "asset_id": "PORT-DOCK-12",
      "county_declarations": 1,
      "dem_stac_href": "https://example.com/dem/12.tif",
      "requires_engineering_review": true,
      "_record_type": "Simplified synthetic app record, not a complete official schema file"
    }
  },
  {
    "input": {
      "asset_id": "PORT-WHARF-03",
      "county": "InlandCounty",
      "fema_incident_type": "Coastal Storm"
    },
    "expected_output": {
      "asset_id": "PORT-WHARF-03",
      "county_declarations": 0,
      "dem_stac_href": null,
      "requires_engineering_review": false,
      "_record_type": "Simplified synthetic app record, not a complete official schema file"
    }
  }
]
```

## Safety
Analysis serves planning studies only; external actions and engineering assessments remain mock or human-reviewed.
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.