Skip to main content
Loading navigation

Build a Port Congestion Demurrage and Detention Evidence Compiler — implementation

Prompt source

implementation76 lines11 sectionsNo variables1 code block
## Build
Process electronic container gate-in timestamps and terminal queue notifications to verify detention fee liabilities. Formulate structured demurrage dispute packages with tamper-proof delivery proof attestations.

## User
Import logistics operational manager

## Workflow
1. Ingest carrier demurrage invoices, free-time contractual terms, and terminal container movement logs.
2. Identify gate congestion events and terminal handling hold-ups outside the importer's direct control.
3. Recalculate billable detention days by subtracting documented port disruption intervals.
4. Assemble structured dispute dossiers with verifiable OpenAttestation proof-of-delivery attachments.

## Interface
Dispute timeline viewer showing allowable free days, carrier asserted charges, adjusted billable hours, and evidence links.

## Data
Mock dataset of carrier detention invoices, terminal interchange receipts, and terminal congestion incident logs.
Starter examples below are synthetic. They are not downloaded records.

## Source
[TradeTrust](https://raw.githubusercontent.com/TradeTrust/tradetrust-website/master/README.md)
Implements TradeTrust document verification UI principles and CLI document handling patterns for dispute evidence.

## Tools
haystack, pydantic, open-attestation.
Haystack provides document extraction and retrieval pipelines that cross-reference shipping clauses against operational terminal logs.
API-based model capable of contractual clause extraction and drafting formal dispute justification letters.

## 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
- Accurately extracts contracted container free-time allowances from simulated ocean carrier bills.
- Calculates net billable demurrage hours after deducting documented terminal system outages.
- Formats disputable amounts into itemized cost schedules with attached cryptographic proofs.
- Stores dispute drafts in an internal queue for operational sign-off without transmitting live carrier claims.

## Starter Examples
```json
[
  {
    "input": {
      "container_number": "MSKU7654321",
      "carrier_name": "Pacific Line",
      "free_time_days": 5,
      "discharged_at": "2025-01-01T08:00:00Z",
      "gated_out_at": "2025-01-09T18:00:00Z",
      "documented_terminal_closure_hours": 36,
      "daily_rate_usd": 120
    },
    "expected_output": {
      "gross_days_on_dock": 8.42,
      "adjusted_days_on_dock": 6.92,
      "billable_demurrage_days": 1.92,
      "carrier_invoiced_usd": 410.4,
      "adjusted_liability_usd": 230.4,
      "disputed_amount_usd": 180,
      "dispute_recommendation": "SUBMIT_PARTIAL_CONTESTATION"
    }
  },
  {
    "input": {
      "container_number": "TGHU1234567",
      "carrier_name": "Ocean Carrier Co",
      "free_time_days": 7,
      "discharged_at": "2025-01-10T10:00:00Z",
      "gated_out_at": "2025-01-15T12:00:00Z",
      "documented_terminal_closure_hours": 0,
      "daily_rate_usd": 150
    },
    "expected_output": {
      "gross_days_on_dock": 5.08,
      "adjusted_days_on_dock": 5.08,
      "billable_demurrage_days": 0,
      "carrier_invoiced_usd": 0,
      "adjusted_liability_usd": 0,
      "disputed_amount_usd": 0,
      "dispute_recommendation": "NO_DISPUTE_CLEAR"
    }
  }
]
```

## Safety
Generates internal claim prep dossiers only; no binding automated dispute submissions to ocean shipping carriers.
Use mock external writes. Require human review before any real deployment.