Skip to main content
Loading navigation
Back to prompt library

Build a Public Weather Assisted Port Delivery Route Planner — implementation

Linked challenge: Build a Public Weather Assisted Port Delivery Route Planner

Prompt source

implementation77 lines11 sectionsNo variables1 code block
## Build
Correlate Singapore open real-time weather readings with heavy vehicle delivery schedules across port corridors. Reschedule hauler dispatches around high-intensity rain events to prevent terminal roadway gridlock.

## User
Container drayage dispatch controller

## Workflow
1. Fetch real-time station rainfall data from the Singapore Open Data API.
2. Ingest scheduled container pickup itineraries between Jurong industrial hubs and PSA terminals.
3. Identify high-precipitation corridors exceeding heavy vehicle safety thresholds.
4. Reorder hauler dispatch sequences and output revised driver slot assignments.

## Interface
Map-based corridor dashboard displaying real-time rainfall overlays, truck queue estimates, and a schedule rebalancing queue.

## Data
Query public real-time rainfall endpoints on data.gov.sg or mock the endpoint using recorded monsoon season precipitation matrices.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Singapore open data API](https://guide.data.gov.sg/developer-guide/api-overview)
Consumes the data.gov.sg real-time weather API structure to query rainfall observations across Singapore monitoring stations.

## Tools
langgraph, httpx, fastapi.
LangGraph manages stateful routing decisions and loop-back verification when rescheduling drayage runs.
Efficient local or API LLM capable of evaluating route constraint graphs and generating driver itineraries.

## 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 data.gov.sg real-time rainfall data format and identifies stations with heavy rain (>20mm/h).
- Delays dispatch times for trucks traversing high-rainfall sectors by at least 45 minutes.
- Exports a rebalanced schedule preserving total daily terminal appointment quotas.

## Starter Examples
```json
[
  {
    "input": {
      "route_id": "R-PSA-JURONG-01",
      "truck_id": "XD1234A",
      "planned_departure": "2025-06-01T14:00:00Z",
      "station_readings": [
        {
          "station_id": "S44",
          "area": "Jurong West",
          "precipitation_mm": 35.5
        }
      ],
      "terminal_slot": "2025-06-01T15:00:00Z"
    },
    "expected_output": {
      "action": "RESCHEDULE_DEPARTURE",
      "revised_departure": "2025-06-01T14:45:00Z",
      "hazard_level": "HIGH_RAIN",
      "slot_adjusted": true
    }
  },
  {
    "input": {
      "route_id": "R-PSA-CHANGI-02",
      "truck_id": "XD5678B",
      "planned_departure": "2025-06-01T14:00:00Z",
      "station_readings": [
        {
          "station_id": "S107",
          "area": "East Coast",
          "precipitation_mm": 2
        }
      ],
      "terminal_slot": "2025-06-01T15:00:00Z"
    },
    "expected_output": {
      "action": "PROCEED_AS_PLANNED",
      "revised_departure": "2025-06-01T14:00:00Z",
      "hazard_level": "CLEAR",
      "slot_adjusted": false
    }
  }
]
```

## Safety
Does not control prime mover navigation hardware; provides advisory schedule recommendations to human controllers.
Use mock external writes. Require human review before any real deployment.