Skip to main content
Loading navigation
Back to prompt library

Build a Water Network Leak Inspection Route Planner — implementation

Linked challenge: Build a Water Network Leak Inspection Route Planner

Prompt source

implementation122 lines11 sectionsNo variables1 code block
## Build
Analyze hydraulic pressure drops and simulated pipe break indicators to prioritize acoustic leak inspection routes. Compile field surveyor itineraries targeting high-probability water loss corridors across municipal utility networks.

## User
Municipal Water Network Operations Engineer

## Workflow
1. Ingest water distribution network topology, pipe roughness coefficients, and nodal pressure telemetry.
2. Simulate pressure-dependent leak discharges across pipeline segments using the WNTR simulation library.
3. Cluster pipeline nodes exhibiting abnormal head loss into contiguous physical inspection sectors.
4. Formulate an optimized technician routing itinerary balancing acoustic survey coverage and critical transit corridors.

## Interface
Geospatial map display overlaying pipe pressure anomalies, leak probability contours, and sequenced inspection route waypoints.

## Data
Utilize synthetic EPANET-style water distribution network files (.inp format) representative of urban district supply sectors.
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)
Leverages WNTR network modeling and pressure-dependent demand simulation routines to compute hydraulic head losses caused by pipe leaks.

## Tools
langgraph, wntr, networkx.
LangGraph manages stateful routing workflows between hydraulic simulation analysis, clustering nodes, and technician dispatch generation.
Local Python execution runtime with hosted Claude API for synthesizing daily crew briefing instructions.

## 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
- Identifies pipe segments with simulated leak discharges above 1.5 liters per second.
- Generates an ordered inspection route visiting top-ranked leak clusters within an 8-hour shift constraint.
- Produces step-by-step navigation waypoints and expected pressure sensor checks.

## Starter Examples
```json
[
  {
    "input": {
      "sector_id": "DMA-04",
      "nodes": [
        {
          "node_id": "N1",
          "pressure_psi": 52,
          "base_demand_lps": 4.5
        },
        {
          "node_id": "N2",
          "pressure_psi": 31,
          "base_demand_lps": 4
        },
        {
          "node_id": "N3",
          "pressure_psi": 28.5,
          "base_demand_lps": 3.8
        }
      ],
      "pipes": [
        {
          "pipe_id": "P101",
          "start": "N1",
          "end": "N2",
          "length_m": 450
        },
        {
          "pipe_id": "P102",
          "start": "N2",
          "end": "N3",
          "length_m": 320
        }
      ],
      "crew_available_hours": 8
    },
    "expected_output": {
      "suspect_pipes": [
        "P101",
        "P102"
      ],
      "priority_order": [
        "P102",
        "P101"
      ],
      "estimated_survey_time_hours": 5.2,
      "route_waypoints": [
        "N3",
        "N2",
        "N1"
      ],
      "expected_leak_rate_lps": 3.2
    }
  },
  {
    "input": {
      "sector_id": "DMA-09",
      "nodes": [
        {
          "node_id": "N10",
          "pressure_psi": 58,
          "base_demand_lps": 2
        },
        {
          "node_id": "N11",
          "pressure_psi": 57.5,
          "base_demand_lps": 2.1
        }
      ],
      "pipes": [
        {
          "pipe_id": "P201",
          "start": "N10",
          "end": "N11",
          "length_m": 200
        }
      ],
      "crew_available_hours": 4
    },
    "expected_output": {
      "suspect_pipes": [],
      "priority_order": [],
      "estimated_survey_time_hours": 0,
      "route_waypoints": [],
      "expected_leak_rate_lps": 0
    }
  }
]
```

## Safety
Leak route plans are purely investigative; water main valve closures and excavation work require certified utility operations permits.
Use mock external writes. Require human review before any real deployment.