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 a Port Congestion Aware Green Drayage Route Planner
Format
Code-aware
Lines
71
Sections
11
Linked challenge
Build a Port Congestion Aware Green Drayage Route Planner
Prompt source
Original prompt text with formatting preserved for inspection.
71 lines
11 sections
No variables
1 code block
## Build
Correlate Singapore real-time traffic camera and road incident data with electric and diesel heavy prime mover fleets. Optimize container hauling routes to minimize carbon emissions during port corridor congestion.
## User
Green logistics fleet coordinator
## Workflow
1. Ingest Singapore Expressway camera images and real-time congestion incidents via open data APIs.
2. Extract speed bottlenecks on primary freight arteries including AYE and West Coast Highway.
3. Calculate vehicle emissions differentials between electric haulers and diesel trucks idling in queues.
4. Synthesize dynamic route adjustments and output emission reduction audit logs for corporate ESG reports.
## Interface
Live fleet dispatch console displaying arterial speed estimates, hauler powertrain types, and rerouting prompts.
## Data
Use mock traffic incident payloads conforming to data.gov.sg real-time traffic condition datasets.
Starter examples below are synthetic. They are not downloaded records.
## Source
[Singapore open data API](https://guide.data.gov.sg/developer-guide/api-overview)
Leverages the data.gov.sg real-time API specifications for traffic conditions and speed bands along Singapore port expressways.
## Tools
dspy, httpx, pydantic.
DSPy compiles robust prompt pipelines that optimize emission factor evaluations and route trade-off reasoning.
Instruction-tuned model evaluated with DSPy teleprompters for zero-shot route selection accuracy.
## 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
- Processes real-time expressway congestion metrics structured according to data.gov.sg schemas.
- Reroutes diesel vehicles when bottleneck delay exceeds 30 minutes to reduce idling carbon footprint.
- Outputs an ESG-compliant trip record quantifying estimated CO2 savings in kilograms.
## Starter Examples
```json
[
{
"input": {
"trip_id": "TRIP-EV-881",
"vehicle_type": "DIESEL_EURO_6",
"origin": "Jurong_Island",
"destination": "Tanjong_Pagar_Distripark",
"corridor": "AYE",
"corridor_speed_kmh": 12,
"normal_speed_kmh": 60,
"distance_km": 18
},
"expected_output": {
"reroute_recommended": true,
"alternate_corridor": "WEST_COAST_HIGHWAY",
"estimated_time_saving_minutes": 22,
"avoided_idling_co2_kg": 4.8
}
},
{
"input": {
"trip_id": "TRIP-EV-882",
"vehicle_type": "BATTERY_ELECTRIC",
"origin": "Tuas_South",
"destination": "Pasir_Panjang",
"corridor": "AYE",
"corridor_speed_kmh": 55,
"normal_speed_kmh": 60,
"distance_km": 25
},
"expected_output": {
"reroute_recommended": false,
"alternate_corridor": null,
"estimated_time_saving_minutes": 0,
"avoided_idling_co2_kg": 0
}
}
]
```
## Safety
Outputs routing recommendations strictly as suggestions for fleet dispatchers; vehicle steering is not automated.
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.