System Diagram

The Tailings data model, mapped — 50 models, 143 relationships

🔍 For serious exploration, open the Interactive Diagram Viewer — pan, mouse-wheel zoom, fit-to-screen, full-screen, per-module tabs, the full 143-relationship ERD, and a focus mode that draws one model and its neighbours at a chosen depth. Person (36 links), Position (11) and Organisation (10) are role columns that 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

Ten 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 FAC["🏗️ Facilities & design"]
        TailingsFacility --> FacilityComponent
        TailingsFacility --> DesignBasis --> DesignParameter
        TailingsFacility --> ConstructionStage --> ConstructionQualityRecord
        TailingsFacility --> Nonconformance
    end

    subgraph INS["📋 Inspections & defects"]
        InspectionTemplate --> InspectionQuestion
        InspectionSchedule --> InspectionEvent --> InspectionResponse
        InspectionEvent --> Defect
    end

    subgraph MON["📈 Instrumentation & monitoring"]
        Instrument --> InstrumentCalibration
        Instrument --> MonitoringReading --> MonitoringCurrent
        ThresholdSet --> ThresholdRule
    end

    subgraph TRP["🚨 Events & TARP response"]
        FacilityEvent --> TarpActivation --> TarpActionExecution
        TarpPlan --> TarpActionDefinition
    end

    subgraph OPS["💧 Deposition & environment"]
        DepositionRecord
        WaterBalancePeriod
        EnvironmentalSample --> SampleResult
    end

    subgraph ACT["🔧 Corrective work"]
        CorrectiveAction --> WorkOrder
    end

    subgraph ASR["✅ Assurance & compliance"]
        ReviewRecord --> ReviewFinding
        EmergencyPlan --> EmergencyExercise
        Publication --> Requirement --> RequirementApplicability
        ControlledDocument
    end

    subgraph CLO["🌱 Rehabilitation & closure"]
        ClosurePlan --> ClosureCriterion --> ClosureMonitoringResult
    end

    TailingsFacility --> Instrument
    TailingsFacility --> ThresholdSet
    TailingsFacility --> TarpPlan
    TailingsFacility --> FacilityEvent
    Defect --> CorrectiveAction
    ThresholdRule --> TarpActivation
    InspectionTemplate --> InspectionSchedule

The Facility Spine

Site → facility → design, construction and components.

erDiagram
    Organisation ||--o{ MineSite : "organisation_id"
    MineSite ||--o{ TailingsFacility : "mine_site_id"
    TailingsFacility ||--o{ FacilityComponent : "tailings_facility_id"
    FacilityComponent ||--o{ FacilityComponent : "parent_component_id"
    TailingsFacility ||--o{ DesignBasis : "tailings_facility_id"
    DesignBasis ||--o{ DesignParameter : "design_basis_id"
    TailingsFacility ||--o{ ConstructionStage : "tailings_facility_id"
    ConstructionStage ||--o{ ConstructionQualityRecord : "construction_stage_id"
    ConstructionStage ||--o{ Nonconformance : "construction_stage_id"
    TailingsFacility ||--o{ ControlledDocument : "tailings_facility_id"

Inspection, Instrumentation and TARP

Checklists and instruments feed thresholds; a breach drives the TARP.

erDiagram
    InspectionTemplate ||--o{ InspectionQuestion : "inspection_template_id"
    InspectionTemplate ||--o{ InspectionSchedule : "inspection_template_id"
    InspectionSchedule ||--o{ InspectionEvent : "inspection_schedule_id"
    InspectionEvent ||--o{ InspectionResponse : "inspection_event_id"
    InspectionQuestion ||--o{ InspectionResponse : "inspection_question_id"
    Instrument ||--o{ InstrumentCalibration : "instrument_id"
    Instrument ||--o{ MonitoringReading : "instrument_id"
    MonitoringReading ||--o{ MonitoringCurrent : "latest_reading_id"
    Instrument ||--o{ ThresholdSet : "instrument_id"
    ThresholdSet ||--o{ ThresholdRule : "threshold_set_id"
    TarpPlan ||--o{ TarpActionDefinition : "tarp_plan_id"
    TarpPlan ||--o{ TarpActivation : "tarp_plan_id"
    ThresholdRule ||--o{ TarpActivation : "threshold_rule_id"
    MonitoringReading ||--o{ TarpActivation : "monitoring_reading_id"
    FacilityEvent ||--o{ TarpActivation : "event_id"
    TarpActivation ||--o{ TarpActionExecution : "tarp_activation_id"
    TarpActionDefinition ||--o{ TarpActionExecution : "tarp_action_definition_id"

Events, Defects and Corrective Work

Inspections and events raise defects; defects, events and findings become work.

erDiagram
    InspectionEvent ||--o{ Defect : "inspection_event_id"
    FacilityEvent ||--o{ Defect : "facility_event_id"
    Defect ||--o{ CorrectiveAction : "defect_id"
    FacilityEvent ||--o{ CorrectiveAction : "facility_event_id"
    CorrectiveAction ||--o{ WorkOrder : "corrective_action_id"
    CorrectiveAction ||--o{ Nonconformance : "corrective_action_id"
    ReviewRecord ||--o{ ReviewFinding : "review_record_id"
    CorrectiveAction ||--o{ ReviewFinding : "corrective_action_id"
    InspectionEvent ||--o{ Nonconformance : "inspection_event_id"

Environment, Assurance and Closure

Water balance and sampling; reviews, emergency readiness and closure evidence.

erDiagram
    TailingsFacility ||--o{ DepositionRecord : "tailings_facility_id"
    TailingsFacility ||--o{ WaterBalancePeriod : "tailings_facility_id"
    TailingsFacility ||--o{ EnvironmentalSample : "tailings_facility_id"
    EnvironmentalSample ||--o{ SampleResult : "environmental_sample_id"
    TailingsFacility ||--o{ ReviewRecord : "tailings_facility_id"
    TailingsFacility ||--o{ EmergencyPlan : "tailings_facility_id"
    EmergencyPlan ||--o{ EmergencyExercise : "emergency_plan_id"
    TailingsFacility ||--o{ ClosurePlan : "tailings_facility_id"
    ClosurePlan ||--o{ ClosureCriterion : "closure_plan_id"
    ClosureCriterion ||--o{ ClosureMonitoringResult : "closure_criterion_id"
    PublicationAuthority ||--o{ Publication : "authority_id"
    Publication ||--o{ Requirement : "publication_id"
    Requirement ||--o{ RequirementApplicability : "requirement_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 — the role columns that appear on nearly every model (*_person_id, *_position_id, *_organisation_id) are omitted for readability. The interactive viewer's Full ERD shows all 143, with the person/position/organisation noise toggleable.
  • TailingsFacility is the hub of the domain (23 direct children) — the viewer's Focus mode defaults to it.
  • One FK was dropped in translation to break a true cycle: the proforma's CorrectiveAction → ReviewFinding link is not modelled (the ReviewFinding → CorrectiveAction direction is kept).

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