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 OpenFEMA Repeat Declaration Exposure Scorer

Format
Code-aware
Lines
79
Sections
11
Linked challenge
Build an OpenFEMA Repeat Declaration Exposure Scorer

Prompt source

Original prompt text with formatting preserved for inspection.

79 lines
11 sections
No variables
1 code block
## Build
Aggregate historical county disaster records from OpenFEMA to score municipal declaration frequency. Map compounding declared flood and storm events to assist regional adaptation grant planning.

## User
Municipal Adaptation Planner

## Workflow
1. Call OpenFEMA DisasterDeclarationsSummaries endpoint filtered by state and decade.
2. Group declared disaster incidents by county FIPS and incident categorization.
3. Compute cumulative disaster declaration indices and unique incident type counts.
4. Formulate prioritized adaptation grant proposal packages for frequently-declared jurisdictions.

## Interface
County vulnerability map interface showing historical disaster declaration breakdowns and grant prioritization tables.

## Data
Query OpenFEMA API endpoint /v2/DisasterDeclarationsSummaries using $filter and $select query parameters.
Starter examples below are synthetic. They are not downloaded records.

## Source
[FEMA OpenFEMA](https://www.fema.gov/about/openfema/api)
Extracts disasterNumber, incidentType, and declarationDate fields via OpenFEMA $filter queries like state eq 'FL'.

## Tools
mastra-ai, httpx, pandas.
Orchestrates multi-step agentic workflows that ingest disaster datasets and synthesize structured municipal grant plans based on historical declaration counts.
TypeScript/Node.js or Python runtime with LLM agent orchestration support.

## 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
- Queries OpenFEMA endpoint using valid OData filter syntax to retrieve records.
- Calculates county-level administrative disaster declaration frequencies across multiple hazard types.
- Produces valid adaptation grant proposal schemas for municipal submission planning.

## Starter Examples
```json
[
  {
    "input": {
      "county_fips": "12086",
      "county_name": "Miami-Dade",
      "disaster_declarations": [
        {
          "incidentType": "Hurricane",
          "year": 2017
        },
        {
          "incidentType": "Flood",
          "year": 2020
        },
        {
          "incidentType": "Hurricane",
          "year": 2022
        }
      ]
    },
    "expected_output": {
      "county_fips": "12086",
      "total_declared_events": 3,
      "unique_incident_types": 2,
      "_schema_note": "Simplified synthetic app records, not complete official schema files."
    }
  },
  {
    "input": {
      "county_fips": "12001",
      "county_name": "Alachua",
      "disaster_declarations": [
        {
          "incidentType": "Severe Storm",
          "year": 2019
        }
      ]
    },
    "expected_output": {
      "county_fips": "12001",
      "total_declared_events": 1,
      "unique_incident_types": 1,
      "_schema_note": "Simplified synthetic app records, not complete official schema files."
    }
  }
]
```

## Safety
Outputs advisory municipal adaptation grant templates; does not approve federal funding or guarantee actual physical hazard probabilities.
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.