Skip to main content
Loading navigation

Build a Data.gov.sg Heavy Vehicle Parking Staging Pass Generator — implementation

Prompt source

implementation74 lines11 sectionsNo variables1 code block
## Build
Query public heavy vehicle parking availability datasets from data.gov.sg to manage inbound container hauler schedules. Generate verifiable driver parking reservation passes with timestamps for marshalling yard marshals.

## User
Marshalling yard supervisor

## Workflow
1. Query public heavy vehicle parking availability datasets from the data.gov.sg API.
2. Ingest container hauler arrival schedules and evaluate staging dwell times.
3. Match heavy vehicles to available parking staging areas based on slot capacity.
4. Generate structured staging reservation passes with verifiable identifier payloads for marshals.

## Interface
Staging pass generation portal with inbound truck logs, availability tables, and a pass preview component.

## Data
Heavy vehicle parking availability dataset from data.gov.sg API; synthetic inbound hauler schedule JSON logs.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Singapore open data API](https://guide.data.gov.sg/developer-guide/api-overview)
Queries public dataset APIs for real-time geospatial heavy vehicle parking facility locations and availability metadata.

## Tools
langgraph, fastapi, pydantic, requests.
LangGraph orchestrates the multi-step retrieval, availability filtering, and stateful pass generation workflow dynamically.
Instruction-tuned model capable of executing structured JSON function calls for staging pass schema generation.

## 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 dataset APIs for heavy vehicle parking locations and extracts available slot counts without schema errors.
- Calculates dwell time in minutes from the difference between hauler ETA and the terminal slot.
- Assigns staging parking locations only if the lot has at least 1 available heavy slot and dwell time exceeds 30 minutes.
- Formulates a JSON-structured staging pass with a designated pass_id and allocated park ID.

## Starter Examples
```json
[
  {
    "input": {
      "truck_id": "TRK-1",
      "hauler_eta": "10:00",
      "terminal_slot": "11:30",
      "parks_data": [
        {
          "park_id": "PK-A",
          "available_slots": 4
        }
      ]
    },
    "expected_output": {
      "dwell_time_minutes": 90,
      "allocated_park_id": "PK-A",
      "staging_pass_id": "PASS-TRK-1",
      "status": "APPROVED"
    }
  },
  {
    "input": {
      "truck_id": "TRK-2",
      "hauler_eta": "14:00",
      "terminal_slot": "14:15",
      "parks_data": [
        {
          "park_id": "PK-B",
          "available_slots": 10
        }
      ]
    },
    "expected_output": {
      "dwell_time_minutes": 15,
      "allocated_park_id": "DIRECT_TO_TERMINAL",
      "staging_pass_id": "N/A",
      "status": "BYPASS"
    }
  }
]
```

## Safety
Staging passes are purely simplified synthetic application records. No real parking spaces are blocked and no official Singapore government permits are issued.
Use mock external writes. Require human review before any real deployment.