Back to prompt library
Build a Water Network District Metered Area Inflow Reconciler — implementation
Linked challenge: Build a Water Network District Metered Area Inflow Reconciler
Prompt source
implementation67 lines11 sectionsNo variables1 code block
## Build
Correlate supervisory flowmeter telemetry with minimum night flow benchmarks to identify hidden pipeline leaks. Generate prioritized acoustic sounding inspection orders for municipal water leak detection teams.
## User
Water Distribution Loss Control Specialist
## Workflow
1. Ingest hourly inflow telemetry and customer automated meter reading feeds for designated District Metered Areas (DMAs).
2. Compute Minimum Night Flow (MNF) between 02:00 and 04:00 to isolate legitimate baseline consumption.
3. Model expected hydraulic background losses using WNTR pressure-dependent demand calculations.
4. Synthesize field inspection work orders targeting pipe clusters where unexplained night flows exceed threshold tolerances.
## Interface
Time-series chart showing DMA inlet flows, night flow thresholds, and an inspection dispatch queue with map overlays.
## Data
Synthesize 15-minute resolution DMA flowmeter logs, meter billing sums, and EPANET/WNTR pipe models.
Starter examples below are synthetic. They are not downloaded records.
## Source
[Water Network Tool for Resilience](https://raw.githubusercontent.com/USEPA/WNTR/main/README.md)
Applies WNTR hydraulic analysis routines to calculate theoretical background leakage based on average operating pressure across the DMA.
## Tools
langfuse, wntr, scipy.
Langfuse provides observability and operational tracing for multi-step hydraulic anomaly detection and dispatch pipelines.
Local Python execution runtime with hosted LLM for structuring water loss inspection briefs.
## 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
- Calculates Net Night Flow by subtracting customer AMR night usage from bulk meter night inflow.
- Triggers leak inspection alerts when unexplained night loss exceeds 20% of minimum inflow.
- Outputs prioritized street inspection vectors with localized pressure monitoring points.
## Starter Examples
```json
[
{
"input": {
"dma_id": "DMA-DEIRA-02",
"bulk_night_flow_m3h": 68.5,
"customer_amr_night_m3h": 18.2,
"average_pressure_bar": 3.8,
"total_pipe_length_km": 14.5
},
"expected_output": {
"net_night_loss_m3h": 50.3,
"allowable_background_loss_m3h": 12.4,
"unexplained_loss_m3h": 37.9,
"leak_alert": true,
"recommended_action": "Deploy acoustic correlators along sector mains A and B"
}
},
{
"input": {
"dma_id": "DMA-DEIRA-05",
"bulk_night_flow_m3h": 22,
"customer_amr_night_m3h": 14.5,
"average_pressure_bar": 3.2,
"total_pipe_length_km": 8
},
"expected_output": {
"net_night_loss_m3h": 7.5,
"allowable_background_loss_m3h": 6.8,
"unexplained_loss_m3h": 0.7,
"leak_alert": false,
"recommended_action": "Routine monitoring, no immediate dispatch required"
}
}
]
```
## Safety
Leak detection dispatches are diagnostic surveys; no valve operations or system pressure adjustments should be executed without utility authorization.
Use mock external writes. Require human review before any real deployment.