Engineering and Project Management
 

Predicting Port State Control Deficiencies Before Inspectors Arrive

Port State Control (PSC) inspections can shut down a vessel for days. A single detention costs between $50,000 and $500,000 in delays, fuel, and reputation damage. Fleet managers spend weeks preparing for inspections using spreadsheets and gut feelings — but nobody actually runs the regulations against the ship’s real state.

What It Does

PSC Readiness is a compliance prediction platform that evaluates every MARPOL, SOLAS, and MLC requirement against a vessel’s actual design data, certificate status, and operational records — before inspectors arrive.

The app takes a vessel’s technical data and runs it through 265+ encoded regulatory rules and it produces:

  • PSC Readiness Score — a single number indicating how clean the vessel is
  • Predicted Deficiencies — specific items inspectors will flag, ranked by severity
  • Risk Level — statistical prediction of detention probability
  • Remediation Guidance — exactly what to fix and how


The Architecture

Ship Design Data (YAML/JSON)
        │
        ▼
┌───────────────────────────────────────┐
│  Engineering Document Pipeline        │
│  P&ID Parser → Spreadsheet → Certs    │
└───────────────────────────────────────┘
        │
        ▼
┌───────────────────────────────────────┐
│  Rule Engine (265+ rules)             │
│  MARPOL Annex I, IV, V, VI            │
│  BWM, SOLAS, MLC                      │
└───────────────────────────────────────┘
        │
        ▼
┌───────────────────────────────────────┐
│  PSC Deficiency Mapper                │
│  Maps rule findings → Paris MoU codes │
└───────────────────────────────────────┘
        │
        ▼
   PSC Readiness Report

Key Features

1. Multi-Regime PSC Support
  • Paris MoU (26 European states) — full mapping
  • Tokyo MoU (18 Asia-Pacific states) — full mapping
  • USCG — secondary mapping
  • Each regime has different checklist items and deficiency codes
2. 265 Rules Across 5 Domains
DomainRulesCoverage
Sewage (MARPOL Annex IV)40STP sizing, holding tanks, discharge
Bilge/Oil (MARPOL Annex I)34OWS, ORB, SOPEP, slop tanks
Ballast (BWMC)30BWTS, exchange, record book
Garbage (MARPOL Annex V)25Garbage record, segregation, discharge
Thermal/Air (MEPC 244/259)35Incinerators, scrubbers, SOx/NOx
3. Engineering Document Pipeline

Converts raw engineering documents into validated machine-readable format:

# Parse P&ID, spreadsheet, and certificate data
python3 convert/pid_parser.py input.pid
python3 convert/spreadsheet_parser.py specs.xlsx
python3 convert/cert_parser.py certificates.pdf

Conflict resolution: Certificates > P&IDs > Spreadsheets

4. Risk Prediction Model

Uses historical Paris MoU detention data to predict:

# Risk factors
flag_risk = "white" | "grey" | "black"
risk_level = predict_detention_risk(score, deficiencies, flag_risk)
# Returns: probability, risk_level, factors
5. Rule Profiles

Pre-configured compliance profiles for different vessel types:

--profile cruise_ship      # MLC-heavy, passengers
--profile tanker_minimal    # Annex I focused
--profile baltic_special   # Baltic Sea SECA rules
--profile dnv_class        # DNV GL class requirements
6. Web UI + REST API
python3 scripts/api.py --port 5178
# Endpoints: /health, /rules, /check, /check-file

Web UI includes YAML editor with live validation, Mermaid diagrams for rule flow, and severity filtering.


Example Output

{
  "psc_readiness_score": 73.2,
  "risk_level": "medium",
  "detention_probability": 0.18,
  "findings": [
    {
      "rule_id": "BILGE-I-05",
      "severity": "CRITICAL",
      "deficiency_code": "22A",
      "message": "Oil Record Book Part I missing",
      "remediation": "Obtain and properly fill ORB Part I"
    },
    {
      "rule_id": "BALLAST-BWM-08",
      "severity": "MAJOR",
      "deficiency_code": "32A",
      "message": "BWTS calibration overdue",
      "remediation": "Schedule BWTS service within 30 days"
    }
  ]
}

Design File Format

Vessels are described in simple YAML:

ship:
  gt: 12000
  crew: 24
  area: Baltic
  ship_type: crude_oil_tanker
  commissioning_date: "2019-06-15"

ballast_system:
  bwmp_approved: true
  ballast_water_record_book: true
  treatment_standard: D-2

bwts:
  type_approval_imo_g8: true
  bwts_operational: true

Comparison to Existing Tools

FeaturePSC ReadinessTraditional ChecklistsGeneral Compliance Dashboards
Runs actual regulations
Predicts specific deficiencies
Maps to PSC codes
Multi-regime support
Risk prediction
Engineering doc parsing

The Rule Engine

Underpinning PSC Readiness is a rule engine with:

  • Thread-safe rule loading with caching
  • Multi-format output: text, JSON, YAML, XML, HTML
  • Rule validation with field reference checking
  • Conflict detection between rules
  • Dependency tracking for rule ordering
  • Extensible constraint types: presence, threshold, parametric, list, range, cross-reference, conditional