02 — System Diagram

🔍 Open the Interactive Diagram Viewer — pan, mouse-wheel zoom, fit-to-screen, full-screen, per-area tabs, the full ERD, and a focus mode that draws one model and its neighbours at a chosen depth. PortServiceType and PortServiceProvider fan out to many tables, so their links can be hidden to declutter the overview.

Regenerate the viewer after any DSL, menu_config.yaml or diagram_config.yaml change: python scripts/build_diagram_viewer.py coast_08_portcosts.

Orders & Evidence

flowchart LR
  POR0[PortServiceOrder] --> POR1[PortServicePerformance]
  POR0[PortServiceOrder] --> POR2[PortCostEstimate]

Supplier Invoices

flowchart LR
  POR3[PortSupplierInvoice] --> POR4[PortSupplierInvoiceLine]
  POR4[PortSupplierInvoiceLine] --> POR5[PortCostDispute]

Approved Costs & Allocation

flowchart LR
  POR6[PortApprovedCost] --> POR7[PortCostAllocation]

Services & Rates

flowchart LR
  POR8[PortServiceType] --> POR9[PortSupplierRate]
  POR10[PortServiceProvider] --> POR9[PortSupplierRate]

From the Network

flowchart LR
  POR11[PortCostVoyageProjection]
  POR12[PortCostCallProjection]
  POR13[PortCostAppointmentProjection]
  POR14[PortCostActivityFact]

Audit & Exceptions

flowchart LR
  POR15[PortCostAudit]
  POR16[PortCostException]
flowchart LR
  POR8[PortServiceType] --> POR0[PortServiceOrder]
  POR10[PortServiceProvider] --> POR0[PortServiceOrder]
  POR9[PortSupplierRate] --> POR2[PortCostEstimate]
  POR10[PortServiceProvider] --> POR3[PortSupplierInvoice]
  POR0[PortServiceOrder] --> POR4[PortSupplierInvoiceLine]
  POR1[PortServicePerformance] --> POR4[PortSupplierInvoiceLine]
  POR2[PortCostEstimate] --> POR4[PortSupplierInvoiceLine]
  POR4[PortSupplierInvoiceLine] --> POR6[PortApprovedCost]
  POR0[PortServiceOrder] --> POR15[PortCostAudit]
  POR3[PortSupplierInvoice] --> POR15[PortCostAudit]
  POR6[PortApprovedCost] --> POR15[PortCostAudit]
  POR1[PortServicePerformance] --> POR14[PortCostActivityFact]

No shared tables and no foreign keys: sibling applications are linked by canonical_ref strings and by messages.

flowchart LR
  subgraph coast_08_portcosts
    ORD[PortServiceOrder]
    COST[PortApprovedCost]
    ALLOC[PortCostAllocation]
    EXC[PortCostException]
    PROJ[Projections and ActivityFact]
  end
  subgraph coast_06_voyage
    CALL[VoyagePortCall]
    ACT[CallActivity]
  end
  subgraph coast_07_accounts
    APPT[Agent appointment]
    ACC[Agent account]
  end
  subgraph coast_16_assurance
    CASE[AssuranceCase]
  end
  subgraph coast_02_manifest
    LINE[ManifestLine]
  end
  CALL -. "voyage.portcall_snapshot" .-> PROJ
  ACT -. "voyage.activity_verified" .-> PROJ
  APPT -. "accounts.appointment_changed" .-> PROJ
  COST -. "portcost.cost_approved (AGENT payer)" .-> ACC
  COST -. "portcost.cost_approved" .-> CASE
  EXC -. "portcost.exception_raised" .-> CASE
  ALLOC -. "manifest_line_ref" .-> LINE