Build a Disaster Declaration County Portfolio Tracker — implementation
Linked challenge: Build a Disaster Declaration County Portfolio Tracker
Prompt source
implementation67 lines11 sectionsNo variables1 code block
## Build
Cross-reference municipal commercial building inventories against historical OpenFEMA disaster declarations to track portfolio inclusion in county-level disaster events. Generate administrative asset dossiers highlighting declared hazard history.
## User
Municipal Climate Resilience Officer
## Workflow
1. Fetch county disaster history using OpenFEMA DisasterDeclarationsSummaries endpoint filters.
2. Ingest municipal commercial asset locations and map to corresponding county administrative boundaries.
3. Tally historical county-level flood declarations during the lifespan of each asset.
4. Synthesize structured portfolio inclusion profiles and export administrative review dossiers.
## Interface
CLI tool that ingests asset CSVs and outputs a Markdown administrative dossier.
## Data
Download public DisasterDeclarationsSummaries from OpenFEMA API endpoint `https://www.fema.gov/api/open/v2/DisasterDeclarationsSummaries` with `$filter=state eq 'VA'` and local synthetic municipal asset county mappings.
Starter examples below are synthetic. They are not downloaded records.
## Source
[FEMA OpenFEMA](https://www.fema.gov/about/openfema/api)
Queries the OpenFEMA API endpoint v2/DisasterDeclarationsSummaries using `$filter` with state and incidentType parameters.
## Tools
pydantic-ai, requests, pandas.
Pydantic AI enforces type-safe parsing of FEMA records and structured administrative portfolio exports.
Fast hosted model or local small model with reliable structured JSON output 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
- Filters OpenFEMA records for matching state, county, and disaster type correctly.
- Calculates county declaration inclusion count strictly from matched historical records.
- Outputs valid structured JSON containing asset identifier and county declaration tally.
## Starter Examples
```json
[
{
"input": {
"county": "Fairfax (County)",
"state": "VA",
"asset_id": "COMM-001",
"fema_records": [
{
"disasterNumber": 4042,
"incidentType": "Flood",
"designatedArea": "Fairfax (County)"
}
]
},
"expected_output": {
"asset_id": "COMM-001",
"county_exposure_count": 1,
"record_type": "simplified synthetic app record"
}
},
{
"input": {
"county": "UnknownCounty",
"state": "VA",
"asset_id": "COMM-002",
"fema_records": []
},
"expected_output": {
"asset_id": "COMM-002",
"county_exposure_count": 0,
"record_type": "simplified synthetic app record"
}
}
]
```
## Safety
Simulates administrative hazard inclusion scores; produces no real property underwriting or legally binding coverage assessments.
Use mock external writes. Require human review before any real deployment.