Skip to main content
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 Freight Emissions Assumptions and Shipper Comparison Report Engine

Format
Code-aware
Lines
102
Sections
11
Linked challenge
Build a Freight Emissions Assumptions and Shipper Comparison Report Engine

Prompt source

Original prompt text with formatting preserved for inspection.

102 lines
11 sections
No variables
1 code block
## Build
Calculate Scope 3 freight emissions for Singapore drayage routes and feeder transport legs. Benchmark carrier operational sustainability against open transport indices, helping shippers optimize logistics network efficiency.

## User
Logistics Sustainability Analyst

## Workflow
1. Ingest consignment shipment routes, gross cargo weights, transport modes, and carrier operational logs.
2. Retrieve standardized distance and emission factor baselines matching Singapore road and maritime corridors.
3. Calculate well-to-wheel and tank-to-wheel carbon intensities across comparing transport operators.
4. Produce an interactive comparison report with carrier rankings and actionable decarbonization proposals.

## Interface
A comparative analytical dashboard showing per-TEU carbon emissions, route efficiency breakdowns, carrier sustainability ratings, and PDF export previews.

## Data
Create synthetic drayage trips between PSA terminals and Jurong industrial hubs, accompanied by simulated feeder barge legs to regional ports.
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 real-time and collection API patterns from data.gov.sg to query public road network and port coordinate endpoints.

## Tools
mastra-ai, pydantic, pandas, fastapi.
Mastra AI orchestrates step-based calculation workflows and handles multi-carrier data transformation with built-in auditability.
Standard reasoning LLM via local Ollama instance or Anthropic API for generating comparative narrative summaries.

## 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
- Applies deterministic emission calculation factors across heavy drayage trucks and feeder vessels.
- Accurately scores and ranks multi-carrier consignment scenarios by total kilogram CO2 equivalent per metric ton-kilometer.
- Flags incomplete route records or zero-weight cargo inputs with descriptive validation warnings.
- Synthesizes an itemized shipper comparison report detailing alternative low-carbon corridor choices.

## Starter Examples
```json
[
  {
    "input": {
      "shipment_id": "SHP-SG-7890",
      "cargo_tonnes": 18.5,
      "origin": "PSA Pasir Panjang Terminal",
      "destination": "Tuas South Industrial Park",
      "road_distance_km": 28.4,
      "carrier_quotes": [
        {
          "carrier_id": "CARRIER-A",
          "fleet_type": "Euro 6 Diesel Prime Mover",
          "emission_factor_gco2e_tkm": 92.5,
          "empty_return_rate": 0.3
        },
        {
          "carrier_id": "CARRIER-B",
          "fleet_type": "Electric Heavy Truck",
          "emission_factor_gco2e_tkm": 34,
          "empty_return_rate": 0.1
        }
      ]
    },
    "expected_output": {
      "_note": "These are simplified synthetic app records, not complete official schema files.",
      "shipment_id": "SHP-SG-7890",
      "total_cargo_tkm": 525.4,
      "comparison": [
        {
          "carrier_id": "CARRIER-A",
          "gross_emissions_kg_co2e": 63.18,
          "efficiency_rating": "AVERAGE"
        },
        {
          "carrier_id": "CARRIER-B",
          "gross_emissions_kg_co2e": 19.65,
          "efficiency_rating": "SUPERIOR"
        }
      ],
      "carbon_reduction_delta_kg": 43.53,
      "recommended_carrier": "CARRIER-B"
    }
  },
  {
    "input": {
      "shipment_id": "SHP-SG-7891",
      "cargo_tonnes": 0,
      "origin": "Jurong Island Checkpoint",
      "destination": "Keppel Distripark",
      "road_distance_km": 22,
      "carrier_quotes": [
        {
          "carrier_id": "CARRIER-C",
          "fleet_type": "Euro 5 Diesel",
          "emission_factor_gco2e_tkm": 110,
          "empty_return_rate": 0.5
        }
      ]
    },
    "expected_output": {
      "_note": "These are simplified synthetic app records, not complete official schema files.",
      "shipment_id": "SHP-SG-7891",
      "error": "INVALID_CARGO_WEIGHT",
      "message": "Cargo weight must be greater than zero to compute freight carbon intensity.",
      "comparison": []
    }
  }
]
```

## Safety
Calculates freight emissions strictly for benchmarking and reporting without issuing enforceable compliance fines or carrier penalties.
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.