System Diagram

The Council Workshop data model, mapped — 42 models, 120 relationships

🔍 For serious exploration, open the Interactive Diagram Viewer — pan, mouse-wheel zoom, fit-to-screen, full-screen, per-module tabs, the full 120-relationship ERD, and a focus mode that draws one model and its neighbours at a chosen depth. Person (35 links) and Attachment (3) fan out to nearly everything, so the viewer hides those links by default — a toggle brings them back. The diagrams below are the readable, static summary of the principal links only.


Architecture Overview

Nine areas mirror the sidebar menu. Every arrow means "one row of the left model is referenced by many rows of the right model".

flowchart LR
    subgraph ORG["🏢 Organisation & people"]
        Organisation --> CouncilSite --> Depot
        Organisation --> CostCentre
        Person
        Supplier
    end

    subgraph FLEET["🚜 Fleet & asset register"]
        AssetClass --> Asset
        Asset --> AssetAssignment
        Asset --> MeterReading
    end

    subgraph MAINT["🗓️ Maintenance planning"]
        MaintenanceTemplate --> MaintenanceTemplateTask
        MaintenanceTemplate --> AssetMaintenancePlan
    end

    subgraph INSP["📋 Inspections & defects"]
        InspectionTemplate --> InspectionTemplateItem
        AssetInspection --> InspectionResponse
        AssetInspection --> Defect
    end

    subgraph WORK["🔧 Workshop & work orders"]
        WorkRequest --> WorkOrder
        WorkOrder --> WorkOrderTask
        WorkOrder --> WorkOrderLabour
    end

    subgraph STORE["📦 Stores & inventory"]
        Store --> StoreStock
        InventoryItem --> StoreStock
        Store --> InventoryTransaction
        WorkOrder --> WorkOrderPart
    end

    subgraph PURCH["🛒 Purchasing"]
        PurchaseRequisition --> PurchaseRequisitionLine
        PurchaseRequisition --> PurchaseOrder
        PurchaseOrder --> PurchaseOrderLine
        PurchaseOrder --> GoodsReceipt --> GoodsReceiptLine
    end

    subgraph FUEL["⛽ Fuel & tyres"]
        FuelFacility --> FuelTransaction
        Tyre --> TyreFitment
    end

    subgraph LIFE["📈 Budget, renewal & incidents"]
        AssetIncident
        Budget
        RenewalAssessment --> Disposal
    end

    Depot --> Asset
    Asset --> AssetInspection
    Defect --> WorkRequest
    Asset --> AssetMaintenancePlan
    Asset --> FuelTransaction
    Asset --> TyreFitment
    Asset --> AssetIncident
    Asset --> RenewalAssessment
    CostCentre --> Budget

The Defect-to-Repair Spine

Pre-start → failed response → defect → work request → work order → delivery.

erDiagram
    InspectionTemplate ||--o{ InspectionTemplateItem : "inspection_template_id"
    InspectionTemplate ||--o{ AssetInspection : "inspection_template_id"
    Asset ||--o{ AssetInspection : "asset_id"
    AssetInspection ||--o{ InspectionResponse : "asset_inspection_id"
    InspectionTemplateItem ||--o{ InspectionResponse : "inspection_template_item_id"
    AssetInspection ||--o{ Defect : "asset_inspection_id"
    Asset ||--o{ Defect : "asset_id"
    Defect ||--o{ WorkRequest : "defect_id"
    WorkRequest ||--o{ WorkOrder : "work_request_id"
    WorkOrder ||--o{ WorkOrderTask : "work_order_id"
    WorkOrder ||--o{ WorkOrderLabour : "work_order_id"
    WorkOrder ||--o{ WorkOrderPart : "work_order_id"

Maintenance Planning: Templates → Due Forecasting

erDiagram
    AssetClass ||--o{ Asset : "asset_class_id"
    AssetClass ||--o{ MaintenanceTemplate : "asset_class_id"
    MaintenanceTemplate ||--o{ MaintenanceTemplateTask : "maintenance_template_id"
    MaintenanceTemplate ||--o{ AssetMaintenancePlan : "maintenance_template_id"
    Asset ||--o{ AssetMaintenancePlan : "asset_id"
    Asset ||--o{ MeterReading : "asset_id"
    MaintenanceTemplate ||--o{ WorkOrder : "maintenance_template_id"

Stores and Purchasing: Shortage → Receipt

erDiagram
    Depot ||--o{ Store : "depot_id"
    Store ||--o{ StoreStock : "store_id"
    InventoryItem ||--o{ StoreStock : "inventory_item_id"
    WorkOrder ||--o{ PurchaseRequisition : "work_order_id"
    PurchaseRequisition ||--o{ PurchaseRequisitionLine : "purchase_requisition_id"
    PurchaseRequisition ||--o{ PurchaseOrder : "purchase_requisition_id"
    Supplier ||--o{ PurchaseOrder : "supplier_id"
    PurchaseOrder ||--o{ PurchaseOrderLine : "purchase_order_id"
    PurchaseOrder ||--o{ GoodsReceipt : "purchase_order_id"
    GoodsReceipt ||--o{ GoodsReceiptLine : "goods_receipt_id"
    PurchaseOrderLine ||--o{ GoodsReceiptLine : "purchase_order_line_id"
    PurchaseOrderLine ||--o{ InventoryTransaction : "purchase_order_line_id"
    InventoryTransaction ||--o{ WorkOrderPart : "issue_transaction_id"
    InventoryItem ||--o{ WorkOrderPart : "inventory_item_id"

Whole-of-Life: Fuel, Tyres, Renewal, Disposal

erDiagram
    CouncilSite ||--o{ FuelFacility : "council_site_id"
    FuelFacility ||--o{ FuelTransaction : "fuel_facility_id"
    Asset ||--o{ FuelTransaction : "asset_id"
    Tyre ||--o{ TyreFitment : "tyre_id"
    Asset ||--o{ TyreFitment : "asset_id"
    Asset ||--o{ AssetIncident : "asset_id"
    WorkRequest ||--o{ AssetIncident : "work_request_id"
    CostCentre ||--o{ Budget : "cost_centre_id"
    Asset ||--o{ RenewalAssessment : "asset_id"
    RenewalAssessment ||--o{ Disposal : "renewal_assessment_id"
    Asset ||--o{ Disposal : "asset_id"

Reading the Diagrams

  • A ||--o{ B means one row of A is referenced by many rows of B (the label is the foreign-key column on B).
  • These static diagrams show principal links only — cross-cutting references (person_id roles on almost every model, attachment_id evidence links, site/depot/cost-centre scoping) are omitted for readability. The interactive viewer's Full ERD shows all 120, with the people/attachment noise toggleable.
  • Asset is the hub of the domain — the viewer's Focus mode defaults to it.

Diagrams are derived from the generated schema metadata (apps/cworkshop/generated/json/cworkshop_relationship_metadata.json). If the DSL schema changes, regenerate the metadata (python -m codegen.cli all cworkshop) and update this page and the viewer's embedded data.