





















const db = require('../models');
const Users = db.users;






const Organizations = db.organizations;

const Projects = db.projects;

const ProjectPhases = db.project_phases;

const Milestones = db.milestones;

const OreBodies = db.ore_bodies;

const Samples = db.samples;

const ChainOfCustodyEvents = db.chain_of_custody_events;

const Laboratories = db.laboratories;

const TestTypeSchemas = db.test_type_schemas;

const MetallurgicalTests = db.metallurgical_tests;

const TestResultPoints = db.test_result_points;

const Flowsheets = db.flowsheets;

const EquipmentItems = db.equipment_items;

const FlowsheetNodes = db.flowsheet_nodes;

const FlowsheetStreams = db.flowsheet_streams;

const DesignCriteriaItems = db.design_criteria_items;

const EconomicModels = db.economic_models;

const CapexItems = db.capex_items;

const OpexItems = db.opex_items;

const MonteCarloRuns = db.monte_carlo_runs;

const Documents = db.documents;

const EntityLinks = db.entity_links;

const Comments = db.comments;

const Tasks = db.tasks;

const Notifications = db.notifications;

const AuditLogs = db.audit_logs;

const Integrations = db.integrations;

const OfflineSyncBatches = db.offline_sync_batches;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Aurora Mining Group",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Boreal Metals Ltd",
            
        
    
    },
    
    {
    
        
        
            
                "name": "NorthShield Resources",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Valdor Exploration Partners",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Cedar Ridge Processing",
            
        
    
    },
    
];



const ProjectsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Malartic Gold Expansion",
            
        
    
        
        
            
                "project_code": "AMG-MAL-2026",
            
        
    
        
        
            
                "location_name": "Malartic, Quebec",
            
        
    
        
        
            
                "latitude": 48.1419,
            
        
    
        
        
            
                "longitude": -78.1321,
            
        
    
        
        
            
                "commodity": "gold",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "start_date": new Date('2025-09-15T00:00:00Z'),
            
        
    
        
        
            
                "target_completion_date": new Date('2026-12-15T00:00:00Z'),
            
        
    
        
        
            
                "description": "Expansion study focused on improved recovery and throughput for the existing operation.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Val dOr East PFS",
            
        
    
        
        
            
                "project_code": "BML-VDO-2026",
            
        
    
        
        
            
                "location_name": "Val dOr, Quebec",
            
        
    
        
        
            
                "latitude": 48.0976,
            
        
    
        
        
            
                "longitude": -77.7974,
            
        
    
        
        
            
                "commodity": "silver",
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                "start_date": new Date('2025-10-01T00:00:00Z'),
            
        
    
        
        
            
                "target_completion_date": new Date('2026-08-30T00:00:00Z'),
            
        
    
        
        
            
                "description": "Pre-feasibility metallurgy and economics for a new open pit and CIL plant.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Rouyn Gold Scoping",
            
        
    
        
        
            
                "project_code": "NSR-ROU-2026",
            
        
    
        
        
            
                "location_name": "Rouyn Noranda, Quebec",
            
        
    
        
        
            
                "latitude": 48.2366,
            
        
    
        
        
            
                "longitude": -79.0193,
            
        
    
        
        
            
                "commodity": "other",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "start_date": new Date('2026-01-05T00:00:00Z'),
            
        
    
        
        
            
                "target_completion_date": new Date('2026-06-30T00:00:00Z'),
            
        
    
        
        
            
                "description": "Early-stage scoping program to screen processing routes and key risks.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "James Bay Discovery Program",
            
        
    
        
        
            
                "project_code": "VEP-JB-2026",
            
        
    
        
        
            
                "location_name": "James Bay, Quebec",
            
        
    
        
        
            
                "latitude": 53.792,
            
        
    
        
        
            
                "longitude": -76.328,
            
        
    
        
        
            
                "commodity": "polymetallic",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "start_date": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "target_completion_date": new Date('2026-10-31T00:00:00Z'),
            
        
    
        
        
            
                "description": "Exploration and scoping metallurgy for new targets with limited drill data.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Cedar Ridge Commissioning Support",
            
        
    
        
        
            
                "project_code": "CRP-COMM-2026",
            
        
    
        
        
            
                "location_name": "Ontario, Canada",
            
        
    
        
        
            
                "latitude": 49.85,
            
        
    
        
        
            
                "longitude": -83.22,
            
        
    
        
        
            
                "commodity": "silver",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "start_date": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "target_completion_date": new Date('2026-09-30T00:00:00Z'),
            
        
    
        
        
            
                "description": "Commissioning tracking, ramp-up metrics, and test reconciliation for a new plant.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const ProjectPhasesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "phase_type": "commissioning",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "start_date": new Date('2025-11-01T00:00:00Z'),
            
        
    
        
        
            
                "target_date": new Date('2026-04-30T00:00:00Z'),
            
        
    
        
        
            
                "approved_at": new Date('2025-11-05T15:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "gate_notes": "FS phase initiated with focus on gravity plus CIL route and variability program.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "phase_type": "commissioning",
            
        
    
        
        
            
                "status": "not_started",
            
        
    
        
        
            
                "start_date": new Date('2026-05-01T00:00:00Z'),
            
        
    
        
        
            
                "target_date": new Date('2026-09-30T00:00:00Z'),
            
        
    
        
        
            
                "approved_at": new Date('2026-04-30T18:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "gate_notes": "DE gated pending final locked-cycle results and vendor quotes.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "phase_type": "pre_feasibility",
            
        
    
        
        
            
                "status": "not_started",
            
        
    
        
        
            
                "start_date": new Date('2025-10-15T00:00:00Z'),
            
        
    
        
        
            
                "target_date": new Date('2026-05-31T00:00:00Z'),
            
        
    
        
        
            
                "approved_at": new Date('2025-10-20T13:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "gate_notes": "PFS started; confirm grind size and leach kinetics across domains.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "phase_type": "exploration_scoping",
            
        
    
        
        
            
                "status": "on_hold",
            
        
    
        
        
            
                "start_date": new Date('2026-01-10T00:00:00Z'),
            
        
    
        
        
            
                "target_date": new Date('2026-04-15T00:00:00Z'),
            
        
    
        
        
            
                "approved_at": new Date('2026-01-12T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "gate_notes": "Scoping includes bottle rolls, GRG screening, and mineralogy to flag refractory risk.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "phase_type": "pre_feasibility",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "start_date": new Date('2026-03-05T00:00:00Z'),
            
        
    
        
        
            
                "target_date": new Date('2026-08-31T00:00:00Z'),
            
        
    
        
        
            
                "approved_at": new Date('2026-03-06T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "gate_notes": "Commissioning support started; align daily metallurgical accounting and ramp-up plan.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MilestonesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Complete variability composite selection",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "due_date": new Date('2025-12-05T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2025-12-03T17:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "details": "Composite list finalized for domains A through D and shipped to lab.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Finish locked-cycle flotation tests",
            
        
    
        
        
            
                "status": "blocked",
            
        
    
        
        
            
                "due_date": new Date('2026-03-25T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-15T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "details": "Four cycles completed; final mass pull reconciliation pending.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Draft process design criteria table",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "due_date": new Date('2026-04-10T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-05-20T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "details": "Populate criteria with leach kinetics and comminution indices as they finalize.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "GRG screening summary issued",
            
        
    
        
        
            
                "status": "planned",
            
        
    
        
        
            
                "due_date": new Date('2026-03-28T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-02T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "details": "Screen GRG response at three grind sizes and provide recommendation.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "First gold pour readiness review",
            
        
    
        
        
            
                "status": "blocked",
            
        
    
        
        
            
                "due_date": new Date('2026-04-30T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-05-02T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "details": "Confirm elution, electrowinning and smelting commissioning checklists complete.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const OreBodiesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "North Zone",
            
        
    
        
        
            
                "classification": "unknown",
            
        
    
        
        
            
                "ore_type": "fresh",
            
        
    
        
        
            
                "head_grade_au_gpt": 1.35,
            
        
    
        
        
            
                "tonnage_mt": 48.0,
            
        
    
        
        
            
                "mineralogy_json": "{sulfidesPct:2.1,arsenicPpm:120,dominantMinerals:[quartz,pyrite,carbonate]}",
            
        
    
        
        
            
                "notes": "Low sulfide fresh ore with consistent leach performance in historic data.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "D Zone",
            
        
    
        
        
            
                "classification": "inferred",
            
        
    
        
        
            
                "ore_type": "preg_robbing",
            
        
    
        
        
            
                "head_grade_au_gpt": 1.05,
            
        
    
        
        
            
                "tonnage_mt": 22.5,
            
        
    
        
        
            
                "mineralogy_json": "{carbonaceousPct:0.35,sulfidesPct:3.8,dominantMinerals:[quartz,pyrite,graphitic_matter]}",
            
        
    
        
        
            
                "notes": "Potential preg-robbing; require diagnostic leach and carbon management strategy.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "East Pit",
            
        
    
        
        
            
                "classification": "unknown",
            
        
    
        
        
            
                "ore_type": "oxide",
            
        
    
        
        
            
                "head_grade_au_gpt": 1.9,
            
        
    
        
        
            
                "tonnage_mt": 18.2,
            
        
    
        
        
            
                "mineralogy_json": "{oxidePct:35,sulfidesPct:1.6,dominantMinerals:[quartz,chlorite,pyrite]}",
            
        
    
        
        
            
                "notes": "Transition ore; monitor clay impact on thickening and filtration.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Rouyn Main",
            
        
    
        
        
            
                "classification": "inferred",
            
        
    
        
        
            
                "ore_type": "high_clay",
            
        
    
        
        
            
                "head_grade_au_gpt": 2.4,
            
        
    
        
        
            
                "tonnage_mt": 6.8,
            
        
    
        
        
            
                "mineralogy_json": "{sulfidesPct:6.5,arsenicPpm:850,dominantMinerals:[pyrite,arsenopyrite,quartz]}",
            
        
    
        
        
            
                "notes": "Suspected refractory behavior; consider oxidation options after initial screening.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "JB Target A",
            
        
    
        
        
            
                "classification": "unknown",
            
        
    
        
        
            
                "ore_type": "refractory",
            
        
    
        
        
            
                "head_grade_au_gpt": 0.85,
            
        
    
        
        
            
                "tonnage_mt": 3.1,
            
        
    
        
        
            
                "mineralogy_json": "{oxidePct:70,dominantMinerals:[quartz,hematite,carbonate]}",
            
        
    
        
        
            
                "notes": "Early indication of oxide dominance; confirm with assays and mineralogy.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SamplesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sample_code": "MAL-NZ-VC-001",
            
        
    
        
        
            
                "sample_type": "metallurgical",
            
        
    
        
        
            
                "drillhole_id": "MAL-25-112",
            
        
    
        
        
            
                "depth_from_m": 120.5,
            
        
    
        
        
            
                "depth_to_m": 134.0,
            
        
    
        
        
            
                "collection_date": new Date('2025-11-18T00:00:00Z'),
            
        
    
        
        
            
                "lithology": "Altered volcanic with minor sulfides",
            
        
    
        
        
            
                "alteration": "Sericite carbonate",
            
        
    
        
        
            
                "geomet_domain": "NZ-FRESH",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "prep_protocol": "Crush 80 percent passing 2 mm then riffle split for tests",
            
        
    
        
        
            
                "qaqc_type": "none",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sample_code": "MAL-DZ-VC-014",
            
        
    
        
        
            
                "sample_type": "drill_core",
            
        
    
        
        
            
                "drillhole_id": "MAL-25-141",
            
        
    
        
        
            
                "depth_from_m": 255.0,
            
        
    
        
        
            
                "depth_to_m": 269.5,
            
        
    
        
        
            
                "collection_date": new Date('2025-11-22T00:00:00Z'),
            
        
    
        
        
            
                "lithology": "Sheared volcanic with carbonaceous seams",
            
        
    
        
        
            
                "alteration": "Silica sericite",
            
        
    
        
        
            
                "geomet_domain": "DZ-CARB",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "prep_protocol": "Crush to 2 mm then stage grind splits and retain coarse reject",
            
        
    
        
        
            
                "qaqc_type": "duplicate",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sample_code": "VDO-EP-COMP-003",
            
        
    
        
        
            
                "sample_type": "composite",
            
        
    
        
        
            
                "drillhole_id": "VDO-24-088",
            
        
    
        
        
            
                "depth_from_m": 35.0,
            
        
    
        
        
            
                "depth_to_m": 82.0,
            
        
    
        
        
            
                "collection_date": new Date('2025-10-28T00:00:00Z'),
            
        
    
        
        
            
                "lithology": "Mixed transition volcanics",
            
        
    
        
        
            
                "alteration": "Chlorite carbonate",
            
        
    
        
        
            
                "geomet_domain": "EP-TRANS",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "prep_protocol": "Composite by weight then crush to 2 mm and pulverize for assays",
            
        
    
        
        
            
                "qaqc_type": "none",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sample_code": "ROU-RM-SCR-007",
            
        
    
        
        
            
                "sample_type": "drill_core",
            
        
    
        
        
            
                "drillhole_id": "ROU-25-019",
            
        
    
        
        
            
                "depth_from_m": 410.0,
            
        
    
        
        
            
                "depth_to_m": 428.0,
            
        
    
        
        
            
                "collection_date": new Date('2026-01-25T00:00:00Z'),
            
        
    
        
        
            
                "lithology": "Sulfidic quartz vein breccia",
            
        
    
        
        
            
                "alteration": "Silica pyrite",
            
        
    
        
        
            
                "geomet_domain": "RM-REF",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "prep_protocol": "Crush to 3 mm then split for bottle roll and mineralogy",
            
        
    
        
        
            
                "qaqc_type": "none",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sample_code": "JB-TA-BULK-001",
            
        
    
        
        
            
                "sample_type": "drill_core",
            
        
    
        
        
            
                "drillhole_id": "JB-25-003",
            
        
    
        
        
            
                "depth_from_m": 15.0,
            
        
    
        
        
            
                "depth_to_m": 45.0,
            
        
    
        
        
            
                "collection_date": new Date('2026-02-10T00:00:00Z'),
            
        
    
        
        
            
                "lithology": "Oxidized volcanics with limonite",
            
        
    
        
        
            
                "alteration": "Oxide hematite",
            
        
    
        
        
            
                "geomet_domain": "TA-OX",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "prep_protocol": "Bulk sample homogenized then split for comminution and leach screening",
            
        
    
        
        
            
                "qaqc_type": "blank",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ChainOfCustodyEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_time": new Date('2025-11-18T15:30:00Z'),
            
        
    
        
        
            
                "event_type": "disposed",
            
        
    
        
        
            
                "from_party": "Malartic Core Shed",
            
        
    
        
        
            
                "to_party": "Aurora Field Team",
            
        
    
        
        
            
                "location": "Malartic, Quebec",
            
        
    
        
        
            
                "shipping_reference": "SHIP-MAL-00021",
            
        
    
        
        
            
                "notes": "Sample bag sealed and labeled with barcode",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_time": new Date('2025-11-23T09:10:00Z'),
            
        
    
        
        
            
                "event_type": "stored",
            
        
    
        
        
            
                "from_party": "Aurora Field Team",
            
        
    
        
        
            
                "to_party": "SGS Lakefield",
            
        
    
        
        
            
                "location": "Malartic, Quebec",
            
        
    
        
        
            
                "shipping_reference": "AWB-78451236",
            
        
    
        
        
            
                "notes": "Courier pickup with tamper-evident seals verified",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_time": new Date('2025-11-01T13:45:00Z'),
            
        
    
        
        
            
                "event_type": "received",
            
        
    
        
        
            
                "from_party": "Boreal Metals Logistics",
            
        
    
        
        
            
                "to_party": "ALS Vancouver",
            
        
    
        
        
            
                "location": "Vancouver, BC",
            
        
    
        
        
            
                "shipping_reference": "AWB-22991380",
            
        
    
        
        
            
                "notes": "Received intact; photos taken of seals",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_time": new Date('2026-02-02T10:20:00Z'),
            
        
    
        
        
            
                "event_type": "disposed",
            
        
    
        
        
            
                "from_party": "Bureau Veritas Prep",
            
        
    
        
        
            
                "to_party": "Bureau Veritas Analytical",
            
        
    
        
        
            
                "location": "Quebec City, QC",
            
        
    
        
        
            
                "shipping_reference": "BV-INT-33021",
            
        
    
        
        
            
                "notes": "Crushed and split; retained coarse reject in storage",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_time": new Date('2026-02-18T08:55:00Z'),
            
        
    
        
        
            
                "event_type": "disposed",
            
        
    
        
        
            
                "from_party": "SGS Lakefield",
            
        
    
        
        
            
                "to_party": "Valdor Exploration Partners",
            
        
    
        
        
            
                "location": "Lakefield, ON",
            
        
    
        
        
            
                "shipping_reference": "LAB-REF-TA-001",
            
        
    
        
        
            
                "notes": "Initial assays complete; awaiting bottle roll results",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LaboratoriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "SGS Lakefield",
            
        
    
        
        
            
                "country": "Canada",
            
        
    
        
        
            
                "city": "Lakefield",
            
        
    
        
        
            
                "contact_email": "lakefield.met@sgs.com",
            
        
    
        
        
            
                "contact_phone": "+1 705 652 2200",
            
        
    
        
        
            
                "notes": "Primary metallurgical testwork lab for comminution and leaching.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "ALS Vancouver",
            
        
    
        
        
            
                "country": "Canada",
            
        
    
        
        
            
                "city": "Vancouver",
            
        
    
        
        
            
                "contact_email": "metallurgy.van@alsglobal.com",
            
        
    
        
        
            
                "contact_phone": "+1 604 888 8330",
            
        
    
        
        
            
                "notes": "Used for flotation and thickening test programs.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Bureau Veritas Quebec",
            
        
    
        
        
            
                "country": "Canada",
            
        
    
        
        
            
                "city": "Quebec City",
            
        
    
        
        
            
                "contact_email": "qc.met@bureauveritas.com",
            
        
    
        
        
            
                "contact_phone": "+1 418 555 0199",
            
        
    
        
        
            
                "notes": "Preferred for mineralogy and diagnostic leach support.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Actlabs Ancaster",
            
        
    
        
        
            
                "country": "Canada",
            
        
    
        
        
            
                "city": "Ancaster",
            
        
    
        
        
            
                "contact_email": "sales@actlabs.com",
            
        
    
        
        
            
                "contact_phone": "+1 905 648 9611",
            
        
    
        
        
            
                "notes": "Assays and umpire check assays for QAQC.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Sepro Labs",
            
        
    
        
        
            
                "country": "Canada",
            
        
    
        
        
            
                "city": "Vancouver",
            
        
    
        
        
            
                "contact_email": "support@seprolabs.com",
            
        
    
        
        
            
                "contact_phone": "+1 604 324 9777",
            
        
    
        
        
            
                "notes": "Vendor-associated testwork for gravity concentrator trials.",
            
        
    
    },
    
];



const TestTypeSchemasData = [
    
    {
    
        
        
            
                "test_category": "leaching",
            
        
    
        
        
            
                "test_type": "bond_ball_mill_wi",
            
        
    
        
        
            
                "display_name_en": "Bond Ball Mill Work Index",
            
        
    
        
        
            
                "display_name_fr": "Indice de broyabilite Bond boulets",
            
        
    
        
        
            
                "parameters_schema_json": "{required:[closing_screen_um,feed_size_p80_um],properties:{closing_screen_um:{type:number},feed_size_p80_um:{type:number}}}",
            
        
    
        
        
            
                "results_schema_json": "{required:[work_index_kwh_t,product_p80_um],properties:{work_index_kwh_t:{type:number},product_p80_um:{type:number}}}",
            
        
    
        
        
            
                "calculation_rules_json": "{derived:[hardness_class],rules:{hardness_class:if wi<12 then SOFT else if wi<16 then MEDIUM else HARD}}",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "test_category": "gravity",
            
        
    
        
        
            
                "test_type": "gravity_recoverable_gold",
            
        
    
        
        
            
                "display_name_en": "Gravity Recoverable Gold GRG",
            
        
    
        
        
            
                "display_name_fr": "Or recuperable par gravite GRG",
            
        
    
        
        
            
                "parameters_schema_json": "{required:[stages],properties:{stages:{type:array}}}",
            
        
    
        
        
            
                "results_schema_json": "{required:[total_grg_pct],properties:{total_grg_pct:{type:number},classification:{type:string}}}",
            
        
    
        
        
            
                "calculation_rules_json": "{derived:[classification],rules:{classification:if grg>70 then HIGH else if grg>40 then MODERATE else LOW}}",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "test_category": "rheology",
            
        
    
        
        
            
                "test_type": "cil_bottle_roll",
            
        
    
        
        
            
                "display_name_en": "CIL Bottle Roll",
            
        
    
        
        
            
                "display_name_fr": "Essai en bouteille CIL",
            
        
    
        
        
            
                "parameters_schema_json": "{required:[na_cn_kg_t,lime_kg_t,time_hours],properties:{na_cn_kg_t:{type:number},lime_kg_t:{type:number},time_hours:{type:number}}}",
            
        
    
        
        
            
                "results_schema_json": "{required:[recovery_pct],properties:{recovery_pct:{type:number},residue_au_gpt:{type:number}}}",
            
        
    
        
        
            
                "calculation_rules_json": "{derived:[consumption_na_cn],rules:{consumption_na_cn:from titration data}}",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "test_category": "gravity",
            
        
    
        
        
            
                "test_type": "rougher_kinetics",
            
        
    
        
        
            
                "display_name_en": "Rougher Flotation Kinetics",
            
        
    
        
        
            
                "display_name_fr": "Cinetique de flottation ebauchage",
            
        
    
        
        
            
                "parameters_schema_json": "{required:[collector_g_t,frother_g_t],properties:{collector_g_t:{type:number},frother_g_t:{type:number}}}",
            
        
    
        
        
            
                "results_schema_json": "{required:[rate_constant],properties:{rate_constant:{type:number},ultimate_recovery_pct:{type:number}}}",
            
        
    
        
        
            
                "calculation_rules_json": "{derived:[kelsall_fit],rules:{kelsall_fit:fit two component model}}",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "test_category": "rheology",
            
        
    
        
        
            
                "test_type": "qemscan_mla",
            
        
    
        
        
            
                "display_name_en": "QEMSCAN MLA",
            
        
    
        
        
            
                "display_name_fr": "QEMSCAN MLA",
            
        
    
        
        
            
                "parameters_schema_json": "{required:[fraction],properties:{fraction:{type:string}}}",
            
        
    
        
        
            
                "results_schema_json": "{required:[mineral_abundance],properties:{mineral_abundance:{type:object},gold_deportment:{type:object}}}",
            
        
    
        
        
            
                "calculation_rules_json": "{derived:[sulfide_pct],rules:{sulfide_pct:sum of sulfide minerals}}",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MetallurgicalTestsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lab_reference": "SGS-MAL-LEACH-0047",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "date_submitted": new Date('2025-12-02T00:00:00Z'),
            
        
    
        
        
            
                "date_completed": new Date('2025-12-20T00:00:00Z'),
            
        
    
        
        
            
                "data_source": "api",
            
        
    
        
        
            
                "parameters_json": "{na_cn_kg_t:0.8,lime_kg_t:1.5,time_hours:48,p80_um:75}",
            
        
    
        
        
            
                "results_json": "{recovery_pct:94.2,residue_au_gpt:0.08,na_cn_consumption_kg_t:0.6}",
            
        
    
        
        
            
                "qaqc_status": "needs_review",
            
        
    
        
        
            
                "qaqc_notes": "Checks within expected range and blanks clean",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reviewed_at": new Date('2025-12-22T14:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2025-12-23T10:00:00Z'),
            
        
    
        
        
            
                "is_deleted": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lab_reference": "BV-MAL-MIN-012",
            
        
    
        
        
            
                "status": "reviewed",
            
        
    
        
        
            
                "date_submitted": new Date('2025-12-05T00:00:00Z'),
            
        
    
        
        
            
                "date_completed": new Date('2025-12-28T00:00:00Z'),
            
        
    
        
        
            
                "data_source": "lims_import",
            
        
    
        
        
            
                "parameters_json": "{fraction:head}",
            
        
    
        
        
            
                "results_json": "{mineral_abundance:{pyrite:3.1,arsenopyrite:0.6,quartz:62.0},gold_deportment:{free:35,sulfide_assoc:50,carbon_assoc:15}}",
            
        
    
        
        
            
                "qaqc_status": "passed",
            
        
    
        
        
            
                "qaqc_notes": "Carbon association elevated; recommend diagnostic leach follow-up",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reviewed_at": new Date('2026-01-04T15:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-01-06T09:00:00Z'),
            
        
    
        
        
            
                "is_deleted": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lab_reference": "ALS-VDO-COMM-0031",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "date_submitted": new Date('2025-11-10T00:00:00Z'),
            
        
    
        
        
            
                "date_completed": new Date('2025-11-25T00:00:00Z'),
            
        
    
        
        
            
                "data_source": "manual",
            
        
    
        
        
            
                "parameters_json": "{closing_screen_um:150,feed_size_p80_um:2500}",
            
        
    
        
        
            
                "results_json": "{work_index_kwh_t:14.8,product_p80_um:155}",
            
        
    
        
        
            
                "qaqc_status": "passed",
            
        
    
        
        
            
                "qaqc_notes": "Repeat run within 3 percent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reviewed_at": new Date('2025-11-26T13:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2025-11-26T16:00:00Z'),
            
        
    
        
        
            
                "is_deleted": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lab_reference": "SGS-ROU-GRG-0009",
            
        
    
        
        
            
                "status": "rejected",
            
        
    
        
        
            
                "date_submitted": new Date('2026-02-05T00:00:00Z'),
            
        
    
        
        
            
                "date_completed": new Date('2026-02-18T00:00:00Z'),
            
        
    
        
        
            
                "data_source": "csv_import",
            
        
    
        
        
            
                "parameters_json": "{stages:[{stage:1,p80_um:850},{stage:2,p80_um:150},{stage:3,p80_um:75}]}",
            
        
    
        
        
            
                "results_json": "{total_grg_pct:28.4,classification:LOW}",
            
        
    
        
        
            
                "qaqc_status": "needs_review",
            
        
    
        
        
            
                "qaqc_notes": "Stage mass pulls consistent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reviewed_at": new Date('2026-02-20T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-02-20T12:15:00Z'),
            
        
    
        
        
            
                "is_deleted": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "lab_reference": "SEP-CRP-FLOT-002",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "date_submitted": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                "date_completed": new Date('2026-03-12T00:00:00Z'),
            
        
    
        
        
            
                "data_source": "api",
            
        
    
        
        
            
                "parameters_json": "{collector_g_t:45,frother_g_t:18,ph:10.2}",
            
        
    
        
        
            
                "results_json": "{rate_constant:0.62,ultimate_recovery_pct:86.5}",
            
        
    
        
        
            
                "qaqc_status": "pending",
            
        
    
        
        
            
                "qaqc_notes": "Bench kinetics used for early tuning only",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reviewed_at": new Date('2026-03-13T14:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-03-14T09:30:00Z'),
            
        
    
        
        
            
                "is_deleted": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TestResultPointsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_at": new Date('2025-12-20T10:00:00Z'),
            
        
    
        
        
            
                "parameter_name": "recovery_6h_pct",
            
        
    
        
        
            
                "value": 78.6,
            
        
    
        
        
            
                "unit": "pct",
            
        
    
        
        
            
                "confidence_level": 0.9,
            
        
    
        
        
            
                "notes": "Interpolated from timed aliquots",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_at": new Date('2025-12-20T14:00:00Z'),
            
        
    
        
        
            
                "parameter_name": "recovery_24h_pct",
            
        
    
        
        
            
                "value": 91.4,
            
        
    
        
        
            
                "unit": "pct",
            
        
    
        
        
            
                "confidence_level": 0.95,
            
        
    
        
        
            
                "notes": "Stable after 24 hours",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_at": new Date('2025-12-20T18:00:00Z'),
            
        
    
        
        
            
                "parameter_name": "recovery_48h_pct",
            
        
    
        
        
            
                "value": 94.2,
            
        
    
        
        
            
                "unit": "pct",
            
        
    
        
        
            
                "confidence_level": 0.97,
            
        
    
        
        
            
                "notes": "Final reported recovery",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_at": new Date('2025-11-25T12:00:00Z'),
            
        
    
        
        
            
                "parameter_name": "work_index_kwh_t",
            
        
    
        
        
            
                "value": 14.8,
            
        
    
        
        
            
                "unit": "kWh/t",
            
        
    
        
        
            
                "confidence_level": 0.93,
            
        
    
        
        
            
                "notes": "Closing screen 150 um",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "measured_at": new Date('2026-02-18T15:30:00Z'),
            
        
    
        
        
            
                "parameter_name": "total_grg_pct",
            
        
    
        
        
            
                "value": 28.4,
            
        
    
        
        
            
                "unit": "pct",
            
        
    
        
        
            
                "confidence_level": 0.9,
            
        
    
        
        
            
                "notes": "Cumulative across three stages",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const FlowsheetsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "FS CIL with Gravity v3",
            
        
    
        
        
            
                "version_number": 3,
            
        
    
        
        
            
                "status": "superseded",
            
        
    
        
        
            
                "description": "Gravity circuit ahead of CIL; evaluate carbon management for D Zone.",
            
        
    
        
        
            
                "layout_json": "{nodes:12,edges:14,viewport:{x:0,y:0,zoom:0.9}}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-03-01T16:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "PFS Base Case v1",
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "description": "Conventional crushing and grinding with CIL; thickening and filtration study ongoing.",
            
        
    
        
        
            
                "layout_json": "{nodes:9,edges:10,viewport:{x:20,y:10,zoom:1}}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-02-15T14:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Scoping Options v2",
            
        
    
        
        
            
                "version_number": 2,
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "description": "Compare direct leach vs flotation then oxidation screening path.",
            
        
    
        
        
            
                "layout_json": "{nodes:7,edges:6,viewport:{x:-10,y:5,zoom:1.1}}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-02-28T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Commissioning As Built v1",
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                "status": "in_review",
            
        
    
        
        
            
                "description": "As built flowsheet used for reconciliation during ramp-up.",
            
        
    
        
        
            
                "layout_json": "{nodes:15,edges:18,viewport:{x:0,y:0,zoom:0.8}}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-03-08T11:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Discovery Screening v1",
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                "status": "superseded",
            
        
    
        
        
            
                "description": "Simple grind and bottle roll screening for oxide target.",
            
        
    
        
        
            
                "layout_json": "{nodes:5,edges:4,viewport:{x:0,y:0,zoom:1}}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "approved_at": new Date('2026-03-05T13:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EquipmentItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "equipment_type": "elution",
            
        
    
        
        
            
                "manufacturer": "Metso",
            
        
    
        
        
            
                "model": "Vertimill VTM-800",
            
        
    
        
        
            
                "capacity": 80,
            
        
    
        
        
            
                "capacity_unit": "tph",
            
        
    
        
        
            
                "power_kw": 800,
            
        
    
        
        
            
                "base_capex_usd": 4200000,
            
        
    
        
        
            
                "install_factor": 1.25,
            
        
    
        
        
            
                "opex_per_unit": 3.6,
            
        
    
        
        
            
                "opex_unit": "USD/t",
            
        
    
        
        
            
                "vendor_quote_reference": "Q-METSO-2026-118",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "equipment_type": "classifier",
            
        
    
        
        
            
                "manufacturer": "Sepro",
            
        
    
        
        
            
                "model": "Falcon C400",
            
        
    
        
        
            
                "capacity": 60,
            
        
    
        
        
            
                "capacity_unit": "tph",
            
        
    
        
        
            
                "power_kw": 110,
            
        
    
        
        
            
                "base_capex_usd": 650000,
            
        
    
        
        
            
                "install_factor": 1.2,
            
        
    
        
        
            
                "opex_per_unit": 0.25,
            
        
    
        
        
            
                "opex_unit": "USD/t",
            
        
    
        
        
            
                "vendor_quote_reference": "Q-SEPRO-CR-044",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "equipment_type": "thickener",
            
        
    
        
        
            
                "manufacturer": "FLSmidth",
            
        
    
        
        
            
                "model": "E-Duc 20m",
            
        
    
        
        
            
                "capacity": 1200,
            
        
    
        
        
            
                "capacity_unit": "m3/h",
            
        
    
        
        
            
                "power_kw": 45,
            
        
    
        
        
            
                "base_capex_usd": 2100000,
            
        
    
        
        
            
                "install_factor": 1.3,
            
        
    
        
        
            
                "opex_per_unit": 0.12,
            
        
    
        
        
            
                "opex_unit": "USD/t",
            
        
    
        
        
            
                "vendor_quote_reference": "Q-FLS-TH-2025-77",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "equipment_type": "grinder",
            
        
    
        
        
            
                "manufacturer": "Andritz",
            
        
    
        
        
            
                "model": "AFP IV 1200",
            
        
    
        
        
            
                "capacity": 45,
            
        
    
        
        
            
                "capacity_unit": "tph",
            
        
    
        
        
            
                "power_kw": 160,
            
        
    
        
        
            
                "base_capex_usd": 1550000,
            
        
    
        
        
            
                "install_factor": 1.35,
            
        
    
        
        
            
                "opex_per_unit": 0.55,
            
        
    
        
        
            
                "opex_unit": "USD/t",
            
        
    
        
        
            
                "vendor_quote_reference": "Q-AND-2026-09",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "equipment_type": "grinder",
            
        
    
        
        
            
                "manufacturer": "Sandvik",
            
        
    
        
        
            
                "model": "CJ412",
            
        
    
        
        
            
                "capacity": 200,
            
        
    
        
        
            
                "capacity_unit": "tph",
            
        
    
        
        
            
                "power_kw": 160,
            
        
    
        
        
            
                "base_capex_usd": 980000,
            
        
    
        
        
            
                "install_factor": 1.2,
            
        
    
        
        
            
                "opex_per_unit": 0.18,
            
        
    
        
        
            
                "opex_unit": "USD/t",
            
        
    
        
        
            
                "vendor_quote_reference": "Q-SAND-ROU-12",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const FlowsheetNodesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "node_key": "N1",
            
        
    
        
        
            
                "node_type": "unit_operation",
            
        
    
        
        
            
                "unit_operation": "adsorption",
            
        
    
        
        
            
                "name": "ROM Feed",
            
        
    
        
        
            
                "position_x": 50,
            
        
    
        
        
            
                "position_y": 100,
            
        
    
        
        
            
                "parameters_json": "{throughput_tph:250}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "node_key": "N2",
            
        
    
        
        
            
                "node_type": "sink",
            
        
    
        
        
            
                "unit_operation": "cyclone",
            
        
    
        
        
            
                "name": "SAG Mill",
            
        
    
        
        
            
                "position_x": 220,
            
        
    
        
        
            
                "position_y": 100,
            
        
    
        
        
            
                "parameters_json": "{target_p80_um:1500}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "node_key": "N3",
            
        
    
        
        
            
                "node_type": "annotation",
            
        
    
        
        
            
                "unit_operation": "cil",
            
        
    
        
        
            
                "name": "Cyclone Cluster",
            
        
    
        
        
            
                "position_x": 380,
            
        
    
        
        
            
                "position_y": 100,
            
        
    
        
        
            
                "parameters_json": "{cut_size_um:150}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "node_key": "N4",
            
        
    
        
        
            
                "node_type": "sink",
            
        
    
        
        
            
                "unit_operation": "sag_mill",
            
        
    
        
        
            
                "name": "Gravity Circuit",
            
        
    
        
        
            
                "position_x": 540,
            
        
    
        
        
            
                "position_y": 60,
            
        
    
        
        
            
                "parameters_json": "{grg_target_pct:30}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "node_key": "N5",
            
        
    
        
        
            
                "node_type": "sink",
            
        
    
        
        
            
                "unit_operation": "screen",
            
        
    
        
        
            
                "name": "CIL Tanks",
            
        
    
        
        
            
                "position_x": 540,
            
        
    
        
        
            
                "position_y": 140,
            
        
    
        
        
            
                "parameters_json": "{residence_time_h:24,na_cn_kg_t:0.8}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const FlowsheetStreamsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "stream_type": "solution",
            
        
    
        
        
            
                "mass_flow_tph": 250,
            
        
    
        
        
            
                "water_flow_m3h": 0,
            
        
    
        
        
            
                "solids_pct": 100,
            
        
    
        
        
            
                "au_grade_gpt": 1.35,
            
        
    
        
        
            
                "au_recovery_pct": 0,
            
        
    
        
        
            
                "components_json": "{solids:ore}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "stream_type": "solution",
            
        
    
        
        
            
                "mass_flow_tph": 250,
            
        
    
        
        
            
                "water_flow_m3h": 420,
            
        
    
        
        
            
                "solids_pct": 38,
            
        
    
        
        
            
                "au_grade_gpt": 1.33,
            
        
    
        
        
            
                "au_recovery_pct": 0,
            
        
    
        
        
            
                "components_json": "{solids:ground_ore,water:process_water}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "stream_type": "solution",
            
        
    
        
        
            
                "mass_flow_tph": 65,
            
        
    
        
        
            
                "water_flow_m3h": 90,
            
        
    
        
        
            
                "solids_pct": 42,
            
        
    
        
        
            
                "au_grade_gpt": 1.8,
            
        
    
        
        
            
                "au_recovery_pct": 0,
            
        
    
        
        
            
                "components_json": "{split:coarse_fraction}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "stream_type": "solution",
            
        
    
        
        
            
                "mass_flow_tph": 185,
            
        
    
        
        
            
                "water_flow_m3h": 330,
            
        
    
        
        
            
                "solids_pct": 36,
            
        
    
        
        
            
                "au_grade_gpt": 1.2,
            
        
    
        
        
            
                "au_recovery_pct": 0,
            
        
    
        
        
            
                "components_json": "{split:fine_fraction}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "stream_type": "solids",
            
        
    
        
        
            
                "mass_flow_tph": 63,
            
        
    
        
        
            
                "water_flow_m3h": 85,
            
        
    
        
        
            
                "solids_pct": 43,
            
        
    
        
        
            
                "au_grade_gpt": 1.3,
            
        
    
        
        
            
                "au_recovery_pct": 0,
            
        
    
        
        
            
                "components_json": "{recycle:gravity_tail}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DesignCriteriaItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "parameter": "Target grind P80",
            
        
    
        
        
            
                "value": 75,
            
        
    
        
        
            
                "unit": "um",
            
        
    
        
        
            
                "confidence": "low",
            
        
    
        
        
            
                "basis_notes": "Based on bottle roll recovery plateau and historical plant performance.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "parameter": "CIL residence time",
            
        
    
        
        
            
                "value": 24,
            
        
    
        
        
            
                "unit": "h",
            
        
    
        
        
            
                "confidence": "low",
            
        
    
        
        
            
                "basis_notes": "Kinetics indicate most recovery reached by 24 hours; confirm with D Zone tests.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "parameter": "Bond ball mill work index",
            
        
    
        
        
            
                "value": 14.8,
            
        
    
        
        
            
                "unit": "kWh/t",
            
        
    
        
        
            
                "confidence": "high",
            
        
    
        
        
            
                "basis_notes": "Single composite with repeatability check passed.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "parameter": "GRG classification",
            
        
    
        
        
            
                "value": 28.4,
            
        
    
        
        
            
                "unit": "pct",
            
        
    
        
        
            
                "confidence": "medium",
            
        
    
        
        
            
                "basis_notes": "Low gravity recoverable gold; prioritize leach and oxidation screening.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "parameter": "Carbon association in gold deportment",
            
        
    
        
        
            
                "value": 15,
            
        
    
        
        
            
                "unit": "pct",
            
        
    
        
        
            
                "confidence": "medium",
            
        
    
        
        
            
                "basis_notes": "Mineralogy suggests carbon association; evaluate pre-adsorption and kerosene options.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EconomicModelsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "FS Base Case 2026",
            
        
    
        
        
            
                "currency": "ZAR",
            
        
    
        
        
            
                "gold_price": 2100,
            
        
    
        
        
            
                "discount_rate_pct": 5,
            
        
    
        
        
            
                "throughput_tpd": 6000,
            
        
    
        
        
            
                "recovery_pct": 94.2,
            
        
    
        
        
            
                "mine_life_years": 12,
            
        
    
        
        
            
                "capex_total": 615000000,
            
        
    
        
        
            
                "opex_per_tonne": 42.5,
            
        
    
        
        
            
                "npv": 412000000,
            
        
    
        
        
            
                "irr_pct": 28.3,
            
        
    
        
        
            
                "payback_years": 3.2,
            
        
    
        
        
            
                "assumptions_json": "{royaltyPct:2.0,taxRatePct:26.5,usdCad:1.35}",
            
        
    
        
        
            
                "sensitivity_json": "{variables:[gold_price,grade,recovery,capex,opex],rangesPct:20}",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "PFS Base Case",
            
        
    
        
        
            
                "currency": "AUD",
            
        
    
        
        
            
                "gold_price": 2850,
            
        
    
        
        
            
                "discount_rate_pct": 5,
            
        
    
        
        
            
                "throughput_tpd": 3500,
            
        
    
        
        
            
                "recovery_pct": 92.0,
            
        
    
        
        
            
                "mine_life_years": 9,
            
        
    
        
        
            
                "capex_total": 420000000,
            
        
    
        
        
            
                "opex_per_tonne": 55.0,
            
        
    
        
        
            
                "npv": 185000000,
            
        
    
        
        
            
                "irr_pct": 22.1,
            
        
    
        
        
            
                "payback_years": 3.8,
            
        
    
        
        
            
                "assumptions_json": "{royaltyPct:1.5,taxRatePct:26.5,cadUsd:0.74}",
            
        
    
        
        
            
                "sensitivity_json": "{variables:[gold_price,capex,opex],rangesPct:25}",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Scoping Screening",
            
        
    
        
        
            
                "currency": "EUR",
            
        
    
        
        
            
                "gold_price": 2050,
            
        
    
        
        
            
                "discount_rate_pct": 8,
            
        
    
        
        
            
                "throughput_tpd": 1500,
            
        
    
        
        
            
                "recovery_pct": 88.0,
            
        
    
        
        
            
                "mine_life_years": 6,
            
        
    
        
        
            
                "capex_total": 185000000,
            
        
    
        
        
            
                "opex_per_tonne": 68.0,
            
        
    
        
        
            
                "npv": 25000000,
            
        
    
        
        
            
                "irr_pct": 13.4,
            
        
    
        
        
            
                "payback_years": 4.9,
            
        
    
        
        
            
                "assumptions_json": "{class5Estimate:true,contingencyPct:30}",
            
        
    
        
        
            
                "sensitivity_json": "{variables:[recovery,capex,gold_price],rangesPct:30}",
            
        
    
        
        
            
                "status": "in_review",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Ramp Up Forecast",
            
        
    
        
        
            
                "currency": "AUD",
            
        
    
        
        
            
                "gold_price": 2150,
            
        
    
        
        
            
                "discount_rate_pct": 5,
            
        
    
        
        
            
                "throughput_tpd": 5000,
            
        
    
        
        
            
                "recovery_pct": 91.0,
            
        
    
        
        
            
                "mine_life_years": 10,
            
        
    
        
        
            
                "capex_total": 0,
            
        
    
        
        
            
                "opex_per_tonne": 45.5,
            
        
    
        
        
            
                "npv": 0,
            
        
    
        
        
            
                "irr_pct": 0,
            
        
    
        
        
            
                "payback_years": 0,
            
        
    
        
        
            
                "assumptions_json": "{purpose:operational,usesActuals:true}",
            
        
    
        
        
            
                "sensitivity_json": "{variables:[recovery,availability],rangesPct:10}",
            
        
    
        
        
            
                "status": "in_review",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Discovery Early Economics",
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "gold_price": 2800,
            
        
    
        
        
            
                "discount_rate_pct": 10,
            
        
    
        
        
            
                "throughput_tpd": 800,
            
        
    
        
        
            
                "recovery_pct": 90.0,
            
        
    
        
        
            
                "mine_life_years": 4,
            
        
    
        
        
            
                "capex_total": 65000000,
            
        
    
        
        
            
                "opex_per_tonne": 72.0,
            
        
    
        
        
            
                "npv": 12000000,
            
        
    
        
        
            
                "irr_pct": 15.2,
            
        
    
        
        
            
                "payback_years": 3.5,
            
        
    
        
        
            
                "assumptions_json": "{smallScale:true,logisticsPremiumPct:15}",
            
        
    
        
        
            
                "sensitivity_json": "{variables:[capex,opex,gold_price],rangesPct:35}",
            
        
    
        
        
            
                "status": "in_review",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CapexItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_category": "Grinding",
            
        
    
        
        
            
                "description": "Additional fine grinding capacity including drives and controls",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_cost": 4200000,
            
        
    
        
        
            
                "install_factor": 1.25,
            
        
    
        
        
            
                "total_cost": 5250000,
            
        
    
        
        
            
                "estimate_class": "class_5",
            
        
    
        
        
            
                "basis_notes": "Budget quote with regional install factor.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_category": "Gravity",
            
        
    
        
        
            
                "description": "Gravity concentrator package with surge and pumping",
            
        
    
        
        
            
                "quantity": 2,
            
        
    
        
        
            
                "unit_cost": 650000,
            
        
    
        
        
            
                "install_factor": 1.2,
            
        
    
        
        
            
                "total_cost": 1560000,
            
        
    
        
        
            
                "estimate_class": "class_1",
            
        
    
        
        
            
                "basis_notes": "Two units sized for partial cyclone underflow split.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_category": "Thickening",
            
        
    
        
        
            
                "description": "High rate thickener and feedwell package",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_cost": 2100000,
            
        
    
        
        
            
                "install_factor": 1.3,
            
        
    
        
        
            
                "total_cost": 2730000,
            
        
    
        
        
            
                "estimate_class": "class_5",
            
        
    
        
        
            
                "basis_notes": "Factored from vendor budget estimate.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_category": "Crushing",
            
        
    
        
        
            
                "description": "Primary crusher package for scoping plant",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_cost": 980000,
            
        
    
        
        
            
                "install_factor": 1.2,
            
        
    
        
        
            
                "total_cost": 1176000,
            
        
    
        
        
            
                "estimate_class": "class_1",
            
        
    
        
        
            
                "basis_notes": "Class 5 estimate; adjust at PFS.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "cost_category": "Filtration",
            
        
    
        
        
            
                "description": "Tailings filtration for small-scale dry stack concept",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_cost": 1550000,
            
        
    
        
        
            
                "install_factor": 1.35,
            
        
    
        
        
            
                "total_cost": 2092500,
            
        
    
        
        
            
                "estimate_class": "class_3",
            
        
    
        
        
            
                "basis_notes": "Concept screening only; confirm with vendor.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const OpexItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opex_type": "maintenance",
            
        
    
        
        
            
                "description": "Sodium cyanide consumption",
            
        
    
        
        
            
                "rate": 0.6,
            
        
    
        
        
            
                "rate_unit": "kg/t",
            
        
    
        
        
            
                "unit_cost": 2.8,
            
        
    
        
        
            
                "cost_unit": "USD/kg",
            
        
    
        
        
            
                "annual_cost": 3679200,
            
        
    
        
        
            
                "basis_notes": "From bottle roll and historic plant performance.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opex_type": "maintenance",
            
        
    
        
        
            
                "description": "Comminution and plant power consumption",
            
        
    
        
        
            
                "rate": 18.5,
            
        
    
        
        
            
                "rate_unit": "kWh/t",
            
        
    
        
        
            
                "unit_cost": 0.11,
            
        
    
        
        
            
                "cost_unit": "USD/kWh",
            
        
    
        
        
            
                "annual_cost": 4458300,
            
        
    
        
        
            
                "basis_notes": "Based on equipment power draw and utility tariff assumptions.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opex_type": "labour",
            
        
    
        
        
            
                "description": "Processing plant operating labour",
            
        
    
        
        
            
                "rate": 1,
            
        
    
        
        
            
                "rate_unit": "lump_sum",
            
        
    
        
        
            
                "unit_cost": 9800000,
            
        
    
        
        
            
                "cost_unit": "CAD/yr",
            
        
    
        
        
            
                "annual_cost": 9800000,
            
        
    
        
        
            
                "basis_notes": "PFS staffing model with 4 shift rotation.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opex_type": "tailings",
            
        
    
        
        
            
                "description": "Maintenance as percent of installed CAPEX",
            
        
    
        
        
            
                "rate": 4.0,
            
        
    
        
        
            
                "rate_unit": "pct_of_capex",
            
        
    
        
        
            
                "unit_cost": 185000000,
            
        
    
        
        
            
                "cost_unit": "USD",
            
        
    
        
        
            
                "annual_cost": 7400000,
            
        
    
        
        
            
                "basis_notes": "Scoping assumption; refine at PFS.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "opex_type": "power",
            
        
    
        
        
            
                "description": "Grinding media and liners",
            
        
    
        
        
            
                "rate": 0.65,
            
        
    
        
        
            
                "rate_unit": "kg/t",
            
        
    
        
        
            
                "unit_cost": 2.2,
            
        
    
        
        
            
                "cost_unit": "CAD/kg",
            
        
    
        
        
            
                "annual_cost": 418000,
            
        
    
        
        
            
                "basis_notes": "Early screening estimate for small-scale milling.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const MonteCarloRunsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date('2026-03-02T09:00:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-03-02T09:18:00Z'),
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "iterations": 10000,
            
        
    
        
        
            
                "inputs_json": "{gold_price:{dist:triangular,min:1700,mode:2100,max:2500},capex:{dist:pert,min:550000000,mode:615000000,max:720000000}}",
            
        
    
        
        
            
                "results_json": "{p10:245000000,p50:412000000,p90:580000000,probability_positive:0.94}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date('2026-03-05T13:00:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-03-05T13:22:00Z'),
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "iterations": 8000,
            
        
    
        
        
            
                "inputs_json": "{gold_price:{dist:normal,mean:2850,std:250},opex:{dist:uniform,min:48,max:62}}",
            
        
    
        
        
            
                "results_json": "{p10:92000000,p50:185000000,p90:275000000,probability_positive:0.88}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date('2026-03-06T10:15:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-03-06T10:17:00Z'),
            
        
    
        
        
            
                "status": "queued",
            
        
    
        
        
            
                "iterations": 5000,
            
        
    
        
        
            
                "inputs_json": "{recovery:{dist:uniform,min:82,max:90}}",
            
        
    
        
        
            
                "results_json": "{error:solver_diverged}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date('2026-03-08T08:00:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-03-08T08:09:00Z'),
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "iterations": 6000,
            
        
    
        
        
            
                "inputs_json": "{capex:{dist:triangular,min:50000000,mode:65000000,max:90000000}}",
            
        
    
        
        
            
                "results_json": "{p10:-2000000,p50:12000000,p90:26000000,probability_positive:0.61}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "started_at": new Date('2026-03-10T12:30:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-03-10T12:55:00Z'),
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "iterations": 12000,
            
        
    
        
        
            
                "inputs_json": "{grade:{dist:normal,mean:1.35,std:0.12},recovery:{dist:normal,mean:94.2,std:1.0}}",
            
        
    
        
        
            
                "results_json": "{p10:290000000,p50:420000000,p90:565000000,probability_positive:0.95}",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DocumentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "doc_type": "meeting_minutes",
            
        
    
        
        
            
                "title": "Malartic Metallurgy NI 43 101 Draft",
            
        
    
        
        
            
                "version_number": 2,
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "tags": "ni43-101, metallurgy, feasibility",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-03-01T17:30:00Z'),
            
        
    
        
        
            
                "description": "Draft metallurgical section for feasibility study with updated leach and mineralogy results.",
            
        
    
        
        
            
                "watermark_enabled": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "doc_type": "technical_memo",
            
        
    
        
        
            
                "title": "Metso Grinding Budget Quote",
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                "status": "in_review",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "tags": "vendor, metso, grinding, capex",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-02-20T12:10:00Z'),
            
        
    
        
        
            
                "description": "Budgetary quote for fine grinding equipment and auxiliaries.",
            
        
    
        
        
            
                "watermark_enabled": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "doc_type": "photo",
            
        
    
        
        
            
                "title": "Val dOr East Metallurgy Update Memo",
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "tags": "metallurgy, pfs, memo",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-02-12T09:40:00Z'),
            
        
    
        
        
            
                "description": "Summary of comminution and leach results and next test recommendations.",
            
        
    
        
        
            
                "watermark_enabled": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "doc_type": "test_package",
            
        
    
        
        
            
                "title": "Commissioning Coordination Minutes 2026-03-08",
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "tags": "commissioning, minutes",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-03-08T18:15:00Z'),
            
        
    
        
        
            
                "description": "Actions and decisions from commissioning coordination meeting.",
            
        
    
        
        
            
                "watermark_enabled": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "doc_type": "ni_43_101_report",
            
        
    
        
        
            
                "title": "Rouyn Scoping Test Package GRG and Bottle Rolls",
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                "status": "superseded",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "tags": "scoping, grg, leach, results",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-03-01T10:05:00Z'),
            
        
    
        
        
            
                "description": "Compiled lab reports and summary tables for screening tests.",
            
        
    
        
        
            
                "watermark_enabled": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EntityLinksData = [
    
    {
    
        
        
            
                "source_entity_type": "ore_body",
            
        
    
        
        
            
                "source_entity_key": "Malartic Metallurgy NI 43 101 Draft",
            
        
    
        
        
            
                "target_entity_type": "ore_body",
            
        
    
        
        
            
                "target_entity_key": "FS CIL with Gravity v3",
            
        
    
        
        
            
                "link_notes": "Flowsheet figure exported and referenced in process description section.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "source_entity_type": "sample",
            
        
    
        
        
            
                "source_entity_key": "Metso Grinding Budget Quote",
            
        
    
        
        
            
                "target_entity_type": "ore_body",
            
        
    
        
        
            
                "target_entity_key": "FS Base Case 2026",
            
        
    
        
        
            
                "link_notes": "Quote used as basis for grinding CAPEX line item.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "source_entity_type": "flowsheet",
            
        
    
        
        
            
                "source_entity_key": "SGS-MAL-LEACH-0047",
            
        
    
        
        
            
                "target_entity_type": "document",
            
        
    
        
        
            
                "target_entity_key": "Target grind P80",
            
        
    
        
        
            
                "link_notes": "Recovery plateau supports selected grind size and residence time.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "source_entity_type": "project_phase",
            
        
    
        
        
            
                "source_entity_key": "BV-MAL-MIN-012",
            
        
    
        
        
            
                "target_entity_type": "document",
            
        
    
        
        
            
                "target_entity_key": "feasibility",
            
        
    
        
        
            
                "link_notes": "Carbon association flagged for phase gate risk register.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "source_entity_type": "ore_body",
            
        
    
        
        
            
                "source_entity_key": "Rouyn Scoping Test Package GRG and Bottle Rolls",
            
        
    
        
        
            
                "target_entity_type": "flowsheet_node",
            
        
    
        
        
            
                "target_entity_key": "Rouyn Gold Scoping",
            
        
    
        
        
            
                "link_notes": "Package provided for early stakeholder review and screening decision.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CommentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "milestone",
            
        
    
        
        
            
                "entity_key": "SGS-MAL-LEACH-0047",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "body": "Results look consistent with prior campaigns. Please confirm cyanide consumption basis and head grade reconciliation.",
            
        
    
        
        
            
                "posted_at": new Date('2025-12-22T14:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_resolved": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "flowsheet",
            
        
    
        
        
            
                "entity_key": "FS CIL with Gravity v3",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "body": "Added gravity tail recycle to CIL. Next step is to validate split fraction against GRG protocol data.",
            
        
    
        
        
            
                "posted_at": new Date('2026-02-28T16:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_resolved": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "flowsheet_node",
            
        
    
        
        
            
                "entity_key": "PFS Base Case",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "body": "NPV sensitive to power tariff assumption. Recommend adding alternate power price case for remote grid connection.",
            
        
    
        
        
            
                "posted_at": new Date('2026-03-03T11:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_resolved": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "milestone",
            
        
    
        
        
            
                "entity_key": "ROU-RM-SCR-007",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "body": "Please prioritize diagnostic leach if arsenic remains above 700 ppm and recovery stays below 90 percent.",
            
        
    
        
        
            
                "posted_at": new Date('2026-02-21T09:45:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_resolved": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "document",
            
        
    
        
        
            
                "entity_key": "Commissioning Coordination Minutes 2026-03-08",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "body": "Action owners assigned; track closure in tasks list before next readiness review.",
            
        
    
        
        
            
                "posted_at": new Date('2026-03-08T18:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_resolved": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TasksData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Prepare diagnostic leach plan for D Zone",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "priority": "medium",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-22T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-05T00:00:00Z'),
            
        
    
        
        
            
                "description": "Scope diagnostic leach to quantify preg-robbing and sulfide locked gold; include carbon pre-treatment options.",
            
        
    
        
        
            
                "entity_type": "document",
            
        
    
        
        
            
                "entity_key": "D Zone",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Finalize vendor quote comparisons for grinding",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-28T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-12T00:00:00Z'),
            
        
    
        
        
            
                "description": "Collect budget quotes and normalize to same scope for CAPEX update.",
            
        
    
        
        
            
                "entity_type": "metallurgical_test",
            
        
    
        
        
            
                "entity_key": "Metso Grinding Budget Quote",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Update economic model with revised throughput case",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-30T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-04-20T00:00:00Z'),
            
        
    
        
        
            
                "description": "Run 3200 and 4000 tpd cases and refresh tornado chart.",
            
        
    
        
        
            
                "entity_type": "document",
            
        
    
        
        
            
                "entity_key": "PFS Base Case",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Issue GRG screening summary and recommendation",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-28T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-27T17:00:00Z'),
            
        
    
        
        
            
                "description": "Summarize GRG response and impact on flowsheet selection.",
            
        
    
        
        
            
                "entity_type": "economic_model",
            
        
    
        
        
            
                "entity_key": "SGS-ROU-GRG-0009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Daily reconciliation dashboard setup",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "priority": "urgent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-20T00:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-25T00:00:00Z'),
            
        
    
        
        
            
                "description": "Configure mass balance KPIs, recovery tracking and variance alerts for ramp-up.",
            
        
    
        
        
            
                "entity_type": "sample",
            
        
    
        
        
            
                "entity_key": "Commissioning As Built v1",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const NotificationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "in_app",
            
        
    
        
        
            
                "notification_type": "test_completed",
            
        
    
        
        
            
                "title": "Task assigned: Diagnostic leach plan",
            
        
    
        
        
            
                "message": "You have been assigned the task Prepare diagnostic leach plan for D Zone with due date 2026-03-22.",
            
        
    
        
        
            
                "sent_at": new Date('2026-03-12T09:10:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-03-12T09:12:00Z'),
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                "entity_type": "project_phase",
            
        
    
        
        
            
                "entity_key": "Prepare diagnostic leach plan for D Zone",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "notification_type": "comment_replied",
            
        
    
        
        
            
                "title": "Flowsheet ready for review",
            
        
    
        
        
            
                "message": "FS CIL with Gravity v3 moved to in review and is awaiting your approval.",
            
        
    
        
        
            
                "sent_at": new Date('2026-03-01T16:05:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-03-01T16:10:00Z'),
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                "entity_type": "metallurgical_test",
            
        
    
        
        
            
                "entity_key": "FS CIL with Gravity v3",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "notification_type": "phase_approval_requested",
            
        
    
        
        
            
                "title": "New document uploaded",
            
        
    
        
        
            
                "message": "Val dOr East Metallurgy Update Memo uploaded to Documents.",
            
        
    
        
        
            
                "sent_at": new Date('2026-02-12T09:41:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-02-12T10:00:00Z'),
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                "entity_type": "comment",
            
        
    
        
        
            
                "entity_key": "Val dOr East Metallurgy Update Memo",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "notification_type": "mention",
            
        
    
        
        
            
                "title": "Test completed: GRG screening",
            
        
    
        
        
            
                "message": "SGS-ROU-GRG-0009 is completed and ready for review.",
            
        
    
        
        
            
                "sent_at": new Date('2026-02-18T18:05:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-02-19T08:10:00Z'),
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                "entity_type": "flowsheet",
            
        
    
        
        
            
                "entity_key": "SGS-ROU-GRG-0009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "notification_type": "test_review_requested",
            
        
    
        
        
            
                "title": "Mentioned in comment",
            
        
    
        
        
            
                "message": "Sarah Chen mentioned you in a comment on Malartic Metallurgy NI 43 101 Draft.",
            
        
    
        
        
            
                "sent_at": new Date('2026-03-01T18:00:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-03-01T18:04:00Z'),
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                "entity_type": "task",
            
        
    
        
        
            
                "entity_key": "Malartic Metallurgy NI 43 101 Draft",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AuditLogsData = [
    
    {
    
        
        
            
                "event_time": new Date('2026-03-01T17:30:10Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "import",
            
        
    
        
        
            
                "entity_type": "document",
            
        
    
        
        
            
                "entity_key": "Malartic Metallurgy NI 43 101 Draft",
            
        
    
        
        
            
                "old_value_json": "{}",
            
        
    
        
        
            
                "new_value_json": "{status:in_review,version_number:2}",
            
        
    
        
        
            
                "change_summary": "Created NI 43 101 draft report document record",
            
        
    
        
        
            
                "ip_address": "192.0.2.10",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 Chrome",
            
        
    
        
        
            
                "session_key": "sess_9c1a2",
            
        
    
        
        
            
                "checksum": "a0b3c2d1e4f5",
            
        
    
        
        
            
                "previous_checksum": "000000000000",
            
        
    
    },
    
    {
    
        
        
            
                "event_time": new Date('2026-03-01T16:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "download",
            
        
    
        
        
            
                "entity_type": "flowsheet",
            
        
    
        
        
            
                "entity_key": "FS CIL with Gravity v3",
            
        
    
        
        
            
                "old_value_json": "{status:draft}",
            
        
    
        
        
            
                "new_value_json": "{status:in_review}",
            
        
    
        
        
            
                "change_summary": "Moved flowsheet to in review",
            
        
    
        
        
            
                "ip_address": "192.0.2.11",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 Chrome",
            
        
    
        
        
            
                "session_key": "sess_88bb1",
            
        
    
        
        
            
                "checksum": "b1c2d3e4f5a6",
            
        
    
        
        
            
                "previous_checksum": "a0b3c2d1e4f5",
            
        
    
    },
    
    {
    
        
        
            
                "event_time": new Date('2026-02-20T12:10:05Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "create",
            
        
    
        
        
            
                "entity_type": "document",
            
        
    
        
        
            
                "entity_key": "Metso Grinding Budget Quote",
            
        
    
        
        
            
                "old_value_json": "{}",
            
        
    
        
        
            
                "new_value_json": "{status:approved}",
            
        
    
        
        
            
                "change_summary": "Uploaded vendor quote for grinding package",
            
        
    
        
        
            
                "ip_address": "192.0.2.10",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 Chrome",
            
        
    
        
        
            
                "session_key": "sess_77aa3",
            
        
    
        
        
            
                "checksum": "c2d3e4f5a6b7",
            
        
    
        
        
            
                "previous_checksum": "b1c2d3e4f5a6",
            
        
    
    },
    
    {
    
        
        
            
                "event_time": new Date('2026-02-18T18:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "download",
            
        
    
        
        
            
                "entity_type": "metallurgical_test",
            
        
    
        
        
            
                "entity_key": "SGS-ROU-GRG-0009",
            
        
    
        
        
            
                "old_value_json": "{status:in_progress}",
            
        
    
        
        
            
                "new_value_json": "{status:completed}",
            
        
    
        
        
            
                "change_summary": "Marked GRG test as completed",
            
        
    
        
        
            
                "ip_address": "192.0.2.55",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 Safari",
            
        
    
        
        
            
                "session_key": "sess_31dd9",
            
        
    
        
        
            
                "checksum": "d3e4f5a6b7c8",
            
        
    
        
        
            
                "previous_checksum": "c2d3e4f5a6b7",
            
        
    
    },
    
    {
    
        
        
            
                "event_time": new Date('2026-03-12T09:12:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "create",
            
        
    
        
        
            
                "entity_type": "user",
            
        
    
        
        
            
                "entity_key": "julien.dupont@auroramining.com",
            
        
    
        
        
            
                "old_value_json": "{}",
            
        
    
        
        
            
                "new_value_json": "{mfa:true}",
            
        
    
        
        
            
                "change_summary": "User login with MFA",
            
        
    
        
        
            
                "ip_address": "192.0.2.11",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 Chrome",
            
        
    
        
        
            
                "session_key": "sess_88bb1",
            
        
    
        
        
            
                "checksum": "e4f5a6b7c8d9",
            
        
    
        
        
            
                "previous_checksum": "d3e4f5a6b7c8",
            
        
    
    },
    
];



const IntegrationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "webhook",
            
        
    
        
        
            
                "name": "SGS LIMS Connector",
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "config_json": "{baseUrl:https://api.sgs.example,syncIntervalMinutes:30}",
            
        
    
        
        
            
                "last_sync_at": new Date('2026-03-12T08:30:00Z'),
            
        
    
        
        
            
                "last_error": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "webhook",
            
        
    
        
        
            
                "name": "Project Status Webhook",
            
        
    
        
        
            
                "status": "enabled",
            
        
    
        
        
            
                "config_json": "{url:https://hooks.example.com/boreal/status,secretRef:webhook_secret_1}",
            
        
    
        
        
            
                "last_sync_at": new Date('2026-03-11T22:00:00Z'),
            
        
    
        
        
            
                "last_error": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "sso",
            
        
    
        
        
            
                "name": "Azure AD SSO",
            
        
    
        
        
            
                "status": "enabled",
            
        
    
        
        
            
                "config_json": "{issuer:https://login.microsoftonline.com/tenant,audience:goldtrace}",
            
        
    
        
        
            
                "last_sync_at": new Date('2026-03-10T12:00:00Z'),
            
        
    
        
        
            
                "last_error": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "lims",
            
        
    
        
        
            
                "name": "Leapfrog Export Import",
            
        
    
        
        
            
                "status": "enabled",
            
        
    
        
        
            
                "config_json": "{format:csv,mappingVersion:1}",
            
        
    
        
        
            
                "last_sync_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "last_error": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "webhook",
            
        
    
        
        
            
                "name": "ALS Results Import",
            
        
    
        
        
            
                "status": "enabled",
            
        
    
        
        
            
                "config_json": "{sftpHost:sftp.als.example,folder:/exports}",
            
        
    
        
        
            
                "last_sync_at": new Date('2026-03-09T06:00:00Z'),
            
        
    
        
        
            
                "last_error": "Authentication failed for SFTP key",
            
        
    
    },
    
];



const OfflineSyncBatchesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "created_at_local": new Date('2026-03-10T07:55:00Z'),
            
        
    
        
        
            
                "synced_at": new Date('2026-03-10T12:15:00Z'),
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "items_count": 18,
            
        
    
        
        
            
                "payload_json": "{entity:samples,action:update,count:18}",
            
        
    
        
        
            
                "error_details": "",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "created_at_local": new Date('2026-03-11T06:40:00Z'),
            
        
    
        
        
            
                "synced_at": new Date('2026-03-11T14:05:00Z'),
            
        
    
        
        
            
                "status": "syncing",
            
        
    
        
        
            
                "items_count": 6,
            
        
    
        
        
            
                "payload_json": "{entity:documents,action:create,count:2,entityLinks:4}",
            
        
    
        
        
            
                "error_details": "",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "created_at_local": new Date('2026-03-02T18:10:00Z'),
            
        
    
        
        
            
                "synced_at": new Date('2026-03-03T01:00:00Z'),
            
        
    
        
        
            
                "status": "synced",
            
        
    
        
        
            
                "items_count": 9,
            
        
    
        
        
            
                "payload_json": "{entity:metallurgical_tests,action:create,count:1,results:8}",
            
        
    
        
        
            
                "error_details": "Network timeout during upload; retry suggested",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "created_at_local": new Date('2026-03-08T09:05:00Z'),
            
        
    
        
        
            
                "synced_at": new Date('2026-03-08T10:20:00Z'),
            
        
    
        
        
            
                "status": "syncing",
            
        
    
        
        
            
                "items_count": 12,
            
        
    
        
        
            
                "payload_json": "{entity:economic_models,action:update,count:1,opexItems:11}",
            
        
    
        
        
            
                "error_details": "",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "created_at_local": new Date('2026-03-12T05:50:00Z'),
            
        
    
        
        
            
                "synced_at": new Date('2026-03-12T12:45:00Z'),
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "items_count": 25,
            
        
    
        
        
            
                "payload_json": "{entity:flowsheet_streams,action:update,count:25}",
            
        
    
        
        
            
                "error_details": "",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateUserWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User0 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (User0?.setOrganization)
                {
                    await
                    User0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User1 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (User1?.setOrganization)
                {
                    await
                    User1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User2 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (User2?.setOrganization)
                {
                    await
                    User2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User3 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (User3?.setOrganization)
                {
                    await
                    User3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User4 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (User4?.setOrganization)
                {
                    await
                    User4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
            
            async function associateProjectWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project0 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Project0?.setOrganization)
                {
                    await
                    Project0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project1 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Project1?.setOrganization)
                {
                    await
                    Project1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project2 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Project2?.setOrganization)
                {
                    await
                    Project2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project3 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Project3?.setOrganization)
                {
                    await
                    Project3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project4 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Project4?.setOrganization)
                {
                    await
                    Project4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateProjectPhasWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const ProjectPhas0 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProjectPhas0?.setProject)
                {
                    await
                    ProjectPhas0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const ProjectPhas1 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProjectPhas1?.setProject)
                {
                    await
                    ProjectPhas1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const ProjectPhas2 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProjectPhas2?.setProject)
                {
                    await
                    ProjectPhas2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const ProjectPhas3 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProjectPhas3?.setProject)
                {
                    await
                    ProjectPhas3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const ProjectPhas4 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProjectPhas4?.setProject)
                {
                    await
                    ProjectPhas4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProjectPhasWithApproved_by() {
            
                const relatedApproved_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProjectPhas0 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProjectPhas0?.setApproved_by)
                {
                    await
                    ProjectPhas0.
                    setApproved_by(relatedApproved_by0);
                }
            
                const relatedApproved_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProjectPhas1 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProjectPhas1?.setApproved_by)
                {
                    await
                    ProjectPhas1.
                    setApproved_by(relatedApproved_by1);
                }
            
                const relatedApproved_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProjectPhas2 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProjectPhas2?.setApproved_by)
                {
                    await
                    ProjectPhas2.
                    setApproved_by(relatedApproved_by2);
                }
            
                const relatedApproved_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProjectPhas3 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProjectPhas3?.setApproved_by)
                {
                    await
                    ProjectPhas3.
                    setApproved_by(relatedApproved_by3);
                }
            
                const relatedApproved_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ProjectPhas4 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProjectPhas4?.setApproved_by)
                {
                    await
                    ProjectPhas4.
                    setApproved_by(relatedApproved_by4);
                }
            
        }
        
    
        
    
        
            
            async function associateProjectPhasWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProjectPhas0 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProjectPhas0?.setOrganization)
                {
                    await
                    ProjectPhas0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProjectPhas1 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProjectPhas1?.setOrganization)
                {
                    await
                    ProjectPhas1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProjectPhas2 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProjectPhas2?.setOrganization)
                {
                    await
                    ProjectPhas2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProjectPhas3 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProjectPhas3?.setOrganization)
                {
                    await
                    ProjectPhas3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProjectPhas4 = await ProjectPhases.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ProjectPhas4?.setOrganization)
                {
                    await
                    ProjectPhas4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateMilestoneWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Milestone0 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Milestone0?.setProject)
                {
                    await
                    Milestone0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Milestone1 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Milestone1?.setProject)
                {
                    await
                    Milestone1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Milestone2 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Milestone2?.setProject)
                {
                    await
                    Milestone2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Milestone3 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Milestone3?.setProject)
                {
                    await
                    Milestone3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Milestone4 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Milestone4?.setProject)
                {
                    await
                    Milestone4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateMilestoneWithPhase() {
            
                const relatedPhase0 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Milestone0 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Milestone0?.setPhase)
                {
                    await
                    Milestone0.
                    setPhase(relatedPhase0);
                }
            
                const relatedPhase1 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Milestone1 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Milestone1?.setPhase)
                {
                    await
                    Milestone1.
                    setPhase(relatedPhase1);
                }
            
                const relatedPhase2 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Milestone2 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Milestone2?.setPhase)
                {
                    await
                    Milestone2.
                    setPhase(relatedPhase2);
                }
            
                const relatedPhase3 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Milestone3 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Milestone3?.setPhase)
                {
                    await
                    Milestone3.
                    setPhase(relatedPhase3);
                }
            
                const relatedPhase4 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Milestone4 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Milestone4?.setPhase)
                {
                    await
                    Milestone4.
                    setPhase(relatedPhase4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMilestoneWithOwner() {
            
                const relatedOwner0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Milestone0 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Milestone0?.setOwner)
                {
                    await
                    Milestone0.
                    setOwner(relatedOwner0);
                }
            
                const relatedOwner1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Milestone1 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Milestone1?.setOwner)
                {
                    await
                    Milestone1.
                    setOwner(relatedOwner1);
                }
            
                const relatedOwner2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Milestone2 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Milestone2?.setOwner)
                {
                    await
                    Milestone2.
                    setOwner(relatedOwner2);
                }
            
                const relatedOwner3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Milestone3 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Milestone3?.setOwner)
                {
                    await
                    Milestone3.
                    setOwner(relatedOwner3);
                }
            
                const relatedOwner4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Milestone4 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Milestone4?.setOwner)
                {
                    await
                    Milestone4.
                    setOwner(relatedOwner4);
                }
            
        }
        
    
        
    
        
            
            async function associateMilestoneWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Milestone0 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Milestone0?.setOrganization)
                {
                    await
                    Milestone0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Milestone1 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Milestone1?.setOrganization)
                {
                    await
                    Milestone1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Milestone2 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Milestone2?.setOrganization)
                {
                    await
                    Milestone2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Milestone3 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Milestone3?.setOrganization)
                {
                    await
                    Milestone3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Milestone4 = await Milestones.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Milestone4?.setOrganization)
                {
                    await
                    Milestone4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateOreBodyWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OreBody0 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OreBody0?.setProject)
                {
                    await
                    OreBody0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OreBody1 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OreBody1?.setProject)
                {
                    await
                    OreBody1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OreBody2 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OreBody2?.setProject)
                {
                    await
                    OreBody2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OreBody3 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OreBody3?.setProject)
                {
                    await
                    OreBody3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OreBody4 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (OreBody4?.setProject)
                {
                    await
                    OreBody4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateOreBodyWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OreBody0 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OreBody0?.setOrganization)
                {
                    await
                    OreBody0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OreBody1 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OreBody1?.setOrganization)
                {
                    await
                    OreBody1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OreBody2 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OreBody2?.setOrganization)
                {
                    await
                    OreBody2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OreBody3 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OreBody3?.setOrganization)
                {
                    await
                    OreBody3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OreBody4 = await OreBodies.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (OreBody4?.setOrganization)
                {
                    await
                    OreBody4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSampleWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Sample0 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Sample0?.setProject)
                {
                    await
                    Sample0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Sample1 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Sample1?.setProject)
                {
                    await
                    Sample1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Sample2 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Sample2?.setProject)
                {
                    await
                    Sample2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Sample3 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Sample3?.setProject)
                {
                    await
                    Sample3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Sample4 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Sample4?.setProject)
                {
                    await
                    Sample4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateSampleWithOre_body() {
            
                const relatedOre_body0 = await OreBodies.findOne({
                    offset: Math.floor(Math.random() * (await OreBodies.count())),
                });
                const Sample0 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Sample0?.setOre_body)
                {
                    await
                    Sample0.
                    setOre_body(relatedOre_body0);
                }
            
                const relatedOre_body1 = await OreBodies.findOne({
                    offset: Math.floor(Math.random() * (await OreBodies.count())),
                });
                const Sample1 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Sample1?.setOre_body)
                {
                    await
                    Sample1.
                    setOre_body(relatedOre_body1);
                }
            
                const relatedOre_body2 = await OreBodies.findOne({
                    offset: Math.floor(Math.random() * (await OreBodies.count())),
                });
                const Sample2 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Sample2?.setOre_body)
                {
                    await
                    Sample2.
                    setOre_body(relatedOre_body2);
                }
            
                const relatedOre_body3 = await OreBodies.findOne({
                    offset: Math.floor(Math.random() * (await OreBodies.count())),
                });
                const Sample3 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Sample3?.setOre_body)
                {
                    await
                    Sample3.
                    setOre_body(relatedOre_body3);
                }
            
                const relatedOre_body4 = await OreBodies.findOne({
                    offset: Math.floor(Math.random() * (await OreBodies.count())),
                });
                const Sample4 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Sample4?.setOre_body)
                {
                    await
                    Sample4.
                    setOre_body(relatedOre_body4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSampleWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Sample0 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Sample0?.setOrganization)
                {
                    await
                    Sample0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Sample1 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Sample1?.setOrganization)
                {
                    await
                    Sample1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Sample2 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Sample2?.setOrganization)
                {
                    await
                    Sample2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Sample3 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Sample3?.setOrganization)
                {
                    await
                    Sample3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Sample4 = await Samples.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Sample4?.setOrganization)
                {
                    await
                    Sample4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateChainOfCustodyEventWithSample() {
            
                const relatedSample0 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const ChainOfCustodyEvent0 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChainOfCustodyEvent0?.setSample)
                {
                    await
                    ChainOfCustodyEvent0.
                    setSample(relatedSample0);
                }
            
                const relatedSample1 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const ChainOfCustodyEvent1 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChainOfCustodyEvent1?.setSample)
                {
                    await
                    ChainOfCustodyEvent1.
                    setSample(relatedSample1);
                }
            
                const relatedSample2 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const ChainOfCustodyEvent2 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChainOfCustodyEvent2?.setSample)
                {
                    await
                    ChainOfCustodyEvent2.
                    setSample(relatedSample2);
                }
            
                const relatedSample3 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const ChainOfCustodyEvent3 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ChainOfCustodyEvent3?.setSample)
                {
                    await
                    ChainOfCustodyEvent3.
                    setSample(relatedSample3);
                }
            
                const relatedSample4 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const ChainOfCustodyEvent4 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ChainOfCustodyEvent4?.setSample)
                {
                    await
                    ChainOfCustodyEvent4.
                    setSample(relatedSample4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateChainOfCustodyEventWithRecorded_by() {
            
                const relatedRecorded_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ChainOfCustodyEvent0 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChainOfCustodyEvent0?.setRecorded_by)
                {
                    await
                    ChainOfCustodyEvent0.
                    setRecorded_by(relatedRecorded_by0);
                }
            
                const relatedRecorded_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ChainOfCustodyEvent1 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChainOfCustodyEvent1?.setRecorded_by)
                {
                    await
                    ChainOfCustodyEvent1.
                    setRecorded_by(relatedRecorded_by1);
                }
            
                const relatedRecorded_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ChainOfCustodyEvent2 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChainOfCustodyEvent2?.setRecorded_by)
                {
                    await
                    ChainOfCustodyEvent2.
                    setRecorded_by(relatedRecorded_by2);
                }
            
                const relatedRecorded_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ChainOfCustodyEvent3 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ChainOfCustodyEvent3?.setRecorded_by)
                {
                    await
                    ChainOfCustodyEvent3.
                    setRecorded_by(relatedRecorded_by3);
                }
            
                const relatedRecorded_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ChainOfCustodyEvent4 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ChainOfCustodyEvent4?.setRecorded_by)
                {
                    await
                    ChainOfCustodyEvent4.
                    setRecorded_by(relatedRecorded_by4);
                }
            
        }
        
    
        
            
            async function associateChainOfCustodyEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChainOfCustodyEvent0 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChainOfCustodyEvent0?.setOrganization)
                {
                    await
                    ChainOfCustodyEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChainOfCustodyEvent1 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChainOfCustodyEvent1?.setOrganization)
                {
                    await
                    ChainOfCustodyEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChainOfCustodyEvent2 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChainOfCustodyEvent2?.setOrganization)
                {
                    await
                    ChainOfCustodyEvent2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChainOfCustodyEvent3 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ChainOfCustodyEvent3?.setOrganization)
                {
                    await
                    ChainOfCustodyEvent3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChainOfCustodyEvent4 = await ChainOfCustodyEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ChainOfCustodyEvent4?.setOrganization)
                {
                    await
                    ChainOfCustodyEvent4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateLaboratoryWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Laboratory0 = await Laboratories.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Laboratory0?.setOrganization)
                {
                    await
                    Laboratory0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Laboratory1 = await Laboratories.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Laboratory1?.setOrganization)
                {
                    await
                    Laboratory1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Laboratory2 = await Laboratories.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Laboratory2?.setOrganization)
                {
                    await
                    Laboratory2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Laboratory3 = await Laboratories.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Laboratory3?.setOrganization)
                {
                    await
                    Laboratory3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Laboratory4 = await Laboratories.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Laboratory4?.setOrganization)
                {
                    await
                    Laboratory4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTestTypeSchemaWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestTypeSchema0 = await TestTypeSchemas.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TestTypeSchema0?.setOrganization)
                {
                    await
                    TestTypeSchema0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestTypeSchema1 = await TestTypeSchemas.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TestTypeSchema1?.setOrganization)
                {
                    await
                    TestTypeSchema1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestTypeSchema2 = await TestTypeSchemas.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TestTypeSchema2?.setOrganization)
                {
                    await
                    TestTypeSchema2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestTypeSchema3 = await TestTypeSchemas.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TestTypeSchema3?.setOrganization)
                {
                    await
                    TestTypeSchema3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestTypeSchema4 = await TestTypeSchemas.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TestTypeSchema4?.setOrganization)
                {
                    await
                    TestTypeSchema4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateMetallurgicalTestWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const MetallurgicalTest0 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MetallurgicalTest0?.setProject)
                {
                    await
                    MetallurgicalTest0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const MetallurgicalTest1 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MetallurgicalTest1?.setProject)
                {
                    await
                    MetallurgicalTest1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const MetallurgicalTest2 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MetallurgicalTest2?.setProject)
                {
                    await
                    MetallurgicalTest2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const MetallurgicalTest3 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MetallurgicalTest3?.setProject)
                {
                    await
                    MetallurgicalTest3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const MetallurgicalTest4 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MetallurgicalTest4?.setProject)
                {
                    await
                    MetallurgicalTest4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateMetallurgicalTestWithPhase() {
            
                const relatedPhase0 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const MetallurgicalTest0 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MetallurgicalTest0?.setPhase)
                {
                    await
                    MetallurgicalTest0.
                    setPhase(relatedPhase0);
                }
            
                const relatedPhase1 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const MetallurgicalTest1 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MetallurgicalTest1?.setPhase)
                {
                    await
                    MetallurgicalTest1.
                    setPhase(relatedPhase1);
                }
            
                const relatedPhase2 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const MetallurgicalTest2 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MetallurgicalTest2?.setPhase)
                {
                    await
                    MetallurgicalTest2.
                    setPhase(relatedPhase2);
                }
            
                const relatedPhase3 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const MetallurgicalTest3 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MetallurgicalTest3?.setPhase)
                {
                    await
                    MetallurgicalTest3.
                    setPhase(relatedPhase3);
                }
            
                const relatedPhase4 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const MetallurgicalTest4 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MetallurgicalTest4?.setPhase)
                {
                    await
                    MetallurgicalTest4.
                    setPhase(relatedPhase4);
                }
            
        }
        
    
        
            
            async function associateMetallurgicalTestWithSample() {
            
                const relatedSample0 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const MetallurgicalTest0 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MetallurgicalTest0?.setSample)
                {
                    await
                    MetallurgicalTest0.
                    setSample(relatedSample0);
                }
            
                const relatedSample1 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const MetallurgicalTest1 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MetallurgicalTest1?.setSample)
                {
                    await
                    MetallurgicalTest1.
                    setSample(relatedSample1);
                }
            
                const relatedSample2 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const MetallurgicalTest2 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MetallurgicalTest2?.setSample)
                {
                    await
                    MetallurgicalTest2.
                    setSample(relatedSample2);
                }
            
                const relatedSample3 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const MetallurgicalTest3 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MetallurgicalTest3?.setSample)
                {
                    await
                    MetallurgicalTest3.
                    setSample(relatedSample3);
                }
            
                const relatedSample4 = await Samples.findOne({
                    offset: Math.floor(Math.random() * (await Samples.count())),
                });
                const MetallurgicalTest4 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MetallurgicalTest4?.setSample)
                {
                    await
                    MetallurgicalTest4.
                    setSample(relatedSample4);
                }
            
        }
        
    
        
            
            async function associateMetallurgicalTestWithLaboratory() {
            
                const relatedLaboratory0 = await Laboratories.findOne({
                    offset: Math.floor(Math.random() * (await Laboratories.count())),
                });
                const MetallurgicalTest0 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MetallurgicalTest0?.setLaboratory)
                {
                    await
                    MetallurgicalTest0.
                    setLaboratory(relatedLaboratory0);
                }
            
                const relatedLaboratory1 = await Laboratories.findOne({
                    offset: Math.floor(Math.random() * (await Laboratories.count())),
                });
                const MetallurgicalTest1 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MetallurgicalTest1?.setLaboratory)
                {
                    await
                    MetallurgicalTest1.
                    setLaboratory(relatedLaboratory1);
                }
            
                const relatedLaboratory2 = await Laboratories.findOne({
                    offset: Math.floor(Math.random() * (await Laboratories.count())),
                });
                const MetallurgicalTest2 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MetallurgicalTest2?.setLaboratory)
                {
                    await
                    MetallurgicalTest2.
                    setLaboratory(relatedLaboratory2);
                }
            
                const relatedLaboratory3 = await Laboratories.findOne({
                    offset: Math.floor(Math.random() * (await Laboratories.count())),
                });
                const MetallurgicalTest3 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MetallurgicalTest3?.setLaboratory)
                {
                    await
                    MetallurgicalTest3.
                    setLaboratory(relatedLaboratory3);
                }
            
                const relatedLaboratory4 = await Laboratories.findOne({
                    offset: Math.floor(Math.random() * (await Laboratories.count())),
                });
                const MetallurgicalTest4 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MetallurgicalTest4?.setLaboratory)
                {
                    await
                    MetallurgicalTest4.
                    setLaboratory(relatedLaboratory4);
                }
            
        }
        
    
        
            
            async function associateMetallurgicalTestWithTest_type_schema() {
            
                const relatedTest_type_schema0 = await TestTypeSchemas.findOne({
                    offset: Math.floor(Math.random() * (await TestTypeSchemas.count())),
                });
                const MetallurgicalTest0 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MetallurgicalTest0?.setTest_type_schema)
                {
                    await
                    MetallurgicalTest0.
                    setTest_type_schema(relatedTest_type_schema0);
                }
            
                const relatedTest_type_schema1 = await TestTypeSchemas.findOne({
                    offset: Math.floor(Math.random() * (await TestTypeSchemas.count())),
                });
                const MetallurgicalTest1 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MetallurgicalTest1?.setTest_type_schema)
                {
                    await
                    MetallurgicalTest1.
                    setTest_type_schema(relatedTest_type_schema1);
                }
            
                const relatedTest_type_schema2 = await TestTypeSchemas.findOne({
                    offset: Math.floor(Math.random() * (await TestTypeSchemas.count())),
                });
                const MetallurgicalTest2 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MetallurgicalTest2?.setTest_type_schema)
                {
                    await
                    MetallurgicalTest2.
                    setTest_type_schema(relatedTest_type_schema2);
                }
            
                const relatedTest_type_schema3 = await TestTypeSchemas.findOne({
                    offset: Math.floor(Math.random() * (await TestTypeSchemas.count())),
                });
                const MetallurgicalTest3 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MetallurgicalTest3?.setTest_type_schema)
                {
                    await
                    MetallurgicalTest3.
                    setTest_type_schema(relatedTest_type_schema3);
                }
            
                const relatedTest_type_schema4 = await TestTypeSchemas.findOne({
                    offset: Math.floor(Math.random() * (await TestTypeSchemas.count())),
                });
                const MetallurgicalTest4 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MetallurgicalTest4?.setTest_type_schema)
                {
                    await
                    MetallurgicalTest4.
                    setTest_type_schema(relatedTest_type_schema4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMetallurgicalTestWithEntered_by() {
            
                const relatedEntered_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest0 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MetallurgicalTest0?.setEntered_by)
                {
                    await
                    MetallurgicalTest0.
                    setEntered_by(relatedEntered_by0);
                }
            
                const relatedEntered_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest1 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MetallurgicalTest1?.setEntered_by)
                {
                    await
                    MetallurgicalTest1.
                    setEntered_by(relatedEntered_by1);
                }
            
                const relatedEntered_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest2 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MetallurgicalTest2?.setEntered_by)
                {
                    await
                    MetallurgicalTest2.
                    setEntered_by(relatedEntered_by2);
                }
            
                const relatedEntered_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest3 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MetallurgicalTest3?.setEntered_by)
                {
                    await
                    MetallurgicalTest3.
                    setEntered_by(relatedEntered_by3);
                }
            
                const relatedEntered_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest4 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MetallurgicalTest4?.setEntered_by)
                {
                    await
                    MetallurgicalTest4.
                    setEntered_by(relatedEntered_by4);
                }
            
        }
        
    
        
            
            async function associateMetallurgicalTestWithReviewed_by() {
            
                const relatedReviewed_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest0 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MetallurgicalTest0?.setReviewed_by)
                {
                    await
                    MetallurgicalTest0.
                    setReviewed_by(relatedReviewed_by0);
                }
            
                const relatedReviewed_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest1 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MetallurgicalTest1?.setReviewed_by)
                {
                    await
                    MetallurgicalTest1.
                    setReviewed_by(relatedReviewed_by1);
                }
            
                const relatedReviewed_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest2 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MetallurgicalTest2?.setReviewed_by)
                {
                    await
                    MetallurgicalTest2.
                    setReviewed_by(relatedReviewed_by2);
                }
            
                const relatedReviewed_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest3 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MetallurgicalTest3?.setReviewed_by)
                {
                    await
                    MetallurgicalTest3.
                    setReviewed_by(relatedReviewed_by3);
                }
            
                const relatedReviewed_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest4 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MetallurgicalTest4?.setReviewed_by)
                {
                    await
                    MetallurgicalTest4.
                    setReviewed_by(relatedReviewed_by4);
                }
            
        }
        
    
        
    
        
            
            async function associateMetallurgicalTestWithApproved_by() {
            
                const relatedApproved_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest0 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MetallurgicalTest0?.setApproved_by)
                {
                    await
                    MetallurgicalTest0.
                    setApproved_by(relatedApproved_by0);
                }
            
                const relatedApproved_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest1 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MetallurgicalTest1?.setApproved_by)
                {
                    await
                    MetallurgicalTest1.
                    setApproved_by(relatedApproved_by1);
                }
            
                const relatedApproved_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest2 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MetallurgicalTest2?.setApproved_by)
                {
                    await
                    MetallurgicalTest2.
                    setApproved_by(relatedApproved_by2);
                }
            
                const relatedApproved_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest3 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MetallurgicalTest3?.setApproved_by)
                {
                    await
                    MetallurgicalTest3.
                    setApproved_by(relatedApproved_by3);
                }
            
                const relatedApproved_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MetallurgicalTest4 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MetallurgicalTest4?.setApproved_by)
                {
                    await
                    MetallurgicalTest4.
                    setApproved_by(relatedApproved_by4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateMetallurgicalTestWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MetallurgicalTest0 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MetallurgicalTest0?.setOrganization)
                {
                    await
                    MetallurgicalTest0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MetallurgicalTest1 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MetallurgicalTest1?.setOrganization)
                {
                    await
                    MetallurgicalTest1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MetallurgicalTest2 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MetallurgicalTest2?.setOrganization)
                {
                    await
                    MetallurgicalTest2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MetallurgicalTest3 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MetallurgicalTest3?.setOrganization)
                {
                    await
                    MetallurgicalTest3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MetallurgicalTest4 = await MetallurgicalTests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MetallurgicalTest4?.setOrganization)
                {
                    await
                    MetallurgicalTest4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateTestResultPointWithMetallurgical_test() {
            
                const relatedMetallurgical_test0 = await MetallurgicalTests.findOne({
                    offset: Math.floor(Math.random() * (await MetallurgicalTests.count())),
                });
                const TestResultPoint0 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TestResultPoint0?.setMetallurgical_test)
                {
                    await
                    TestResultPoint0.
                    setMetallurgical_test(relatedMetallurgical_test0);
                }
            
                const relatedMetallurgical_test1 = await MetallurgicalTests.findOne({
                    offset: Math.floor(Math.random() * (await MetallurgicalTests.count())),
                });
                const TestResultPoint1 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TestResultPoint1?.setMetallurgical_test)
                {
                    await
                    TestResultPoint1.
                    setMetallurgical_test(relatedMetallurgical_test1);
                }
            
                const relatedMetallurgical_test2 = await MetallurgicalTests.findOne({
                    offset: Math.floor(Math.random() * (await MetallurgicalTests.count())),
                });
                const TestResultPoint2 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TestResultPoint2?.setMetallurgical_test)
                {
                    await
                    TestResultPoint2.
                    setMetallurgical_test(relatedMetallurgical_test2);
                }
            
                const relatedMetallurgical_test3 = await MetallurgicalTests.findOne({
                    offset: Math.floor(Math.random() * (await MetallurgicalTests.count())),
                });
                const TestResultPoint3 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TestResultPoint3?.setMetallurgical_test)
                {
                    await
                    TestResultPoint3.
                    setMetallurgical_test(relatedMetallurgical_test3);
                }
            
                const relatedMetallurgical_test4 = await MetallurgicalTests.findOne({
                    offset: Math.floor(Math.random() * (await MetallurgicalTests.count())),
                });
                const TestResultPoint4 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TestResultPoint4?.setMetallurgical_test)
                {
                    await
                    TestResultPoint4.
                    setMetallurgical_test(relatedMetallurgical_test4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTestResultPointWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestResultPoint0 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TestResultPoint0?.setOrganization)
                {
                    await
                    TestResultPoint0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestResultPoint1 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TestResultPoint1?.setOrganization)
                {
                    await
                    TestResultPoint1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestResultPoint2 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TestResultPoint2?.setOrganization)
                {
                    await
                    TestResultPoint2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestResultPoint3 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TestResultPoint3?.setOrganization)
                {
                    await
                    TestResultPoint3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TestResultPoint4 = await TestResultPoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TestResultPoint4?.setOrganization)
                {
                    await
                    TestResultPoint4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateFlowsheetWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Flowsheet0 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Flowsheet0?.setProject)
                {
                    await
                    Flowsheet0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Flowsheet1 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Flowsheet1?.setProject)
                {
                    await
                    Flowsheet1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Flowsheet2 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Flowsheet2?.setProject)
                {
                    await
                    Flowsheet2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Flowsheet3 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Flowsheet3?.setProject)
                {
                    await
                    Flowsheet3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Flowsheet4 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Flowsheet4?.setProject)
                {
                    await
                    Flowsheet4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateFlowsheetWithPhase() {
            
                const relatedPhase0 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Flowsheet0 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Flowsheet0?.setPhase)
                {
                    await
                    Flowsheet0.
                    setPhase(relatedPhase0);
                }
            
                const relatedPhase1 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Flowsheet1 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Flowsheet1?.setPhase)
                {
                    await
                    Flowsheet1.
                    setPhase(relatedPhase1);
                }
            
                const relatedPhase2 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Flowsheet2 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Flowsheet2?.setPhase)
                {
                    await
                    Flowsheet2.
                    setPhase(relatedPhase2);
                }
            
                const relatedPhase3 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Flowsheet3 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Flowsheet3?.setPhase)
                {
                    await
                    Flowsheet3.
                    setPhase(relatedPhase3);
                }
            
                const relatedPhase4 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Flowsheet4 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Flowsheet4?.setPhase)
                {
                    await
                    Flowsheet4.
                    setPhase(relatedPhase4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateFlowsheetWithApproved_by() {
            
                const relatedApproved_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Flowsheet0 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Flowsheet0?.setApproved_by)
                {
                    await
                    Flowsheet0.
                    setApproved_by(relatedApproved_by0);
                }
            
                const relatedApproved_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Flowsheet1 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Flowsheet1?.setApproved_by)
                {
                    await
                    Flowsheet1.
                    setApproved_by(relatedApproved_by1);
                }
            
                const relatedApproved_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Flowsheet2 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Flowsheet2?.setApproved_by)
                {
                    await
                    Flowsheet2.
                    setApproved_by(relatedApproved_by2);
                }
            
                const relatedApproved_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Flowsheet3 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Flowsheet3?.setApproved_by)
                {
                    await
                    Flowsheet3.
                    setApproved_by(relatedApproved_by3);
                }
            
                const relatedApproved_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Flowsheet4 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Flowsheet4?.setApproved_by)
                {
                    await
                    Flowsheet4.
                    setApproved_by(relatedApproved_by4);
                }
            
        }
        
    
        
    
        
            
            async function associateFlowsheetWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Flowsheet0 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Flowsheet0?.setOrganization)
                {
                    await
                    Flowsheet0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Flowsheet1 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Flowsheet1?.setOrganization)
                {
                    await
                    Flowsheet1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Flowsheet2 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Flowsheet2?.setOrganization)
                {
                    await
                    Flowsheet2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Flowsheet3 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Flowsheet3?.setOrganization)
                {
                    await
                    Flowsheet3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Flowsheet4 = await Flowsheets.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Flowsheet4?.setOrganization)
                {
                    await
                    Flowsheet4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateEquipmentItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EquipmentItem0 = await EquipmentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EquipmentItem0?.setOrganization)
                {
                    await
                    EquipmentItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EquipmentItem1 = await EquipmentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EquipmentItem1?.setOrganization)
                {
                    await
                    EquipmentItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EquipmentItem2 = await EquipmentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EquipmentItem2?.setOrganization)
                {
                    await
                    EquipmentItem2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EquipmentItem3 = await EquipmentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EquipmentItem3?.setOrganization)
                {
                    await
                    EquipmentItem3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EquipmentItem4 = await EquipmentItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EquipmentItem4?.setOrganization)
                {
                    await
                    EquipmentItem4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateFlowsheetNodeWithFlowsheet() {
            
                const relatedFlowsheet0 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetNode0 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (FlowsheetNode0?.setFlowsheet)
                {
                    await
                    FlowsheetNode0.
                    setFlowsheet(relatedFlowsheet0);
                }
            
                const relatedFlowsheet1 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetNode1 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (FlowsheetNode1?.setFlowsheet)
                {
                    await
                    FlowsheetNode1.
                    setFlowsheet(relatedFlowsheet1);
                }
            
                const relatedFlowsheet2 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetNode2 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (FlowsheetNode2?.setFlowsheet)
                {
                    await
                    FlowsheetNode2.
                    setFlowsheet(relatedFlowsheet2);
                }
            
                const relatedFlowsheet3 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetNode3 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (FlowsheetNode3?.setFlowsheet)
                {
                    await
                    FlowsheetNode3.
                    setFlowsheet(relatedFlowsheet3);
                }
            
                const relatedFlowsheet4 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetNode4 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (FlowsheetNode4?.setFlowsheet)
                {
                    await
                    FlowsheetNode4.
                    setFlowsheet(relatedFlowsheet4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateFlowsheetNodeWithEquipment_item() {
            
                const relatedEquipment_item0 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const FlowsheetNode0 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (FlowsheetNode0?.setEquipment_item)
                {
                    await
                    FlowsheetNode0.
                    setEquipment_item(relatedEquipment_item0);
                }
            
                const relatedEquipment_item1 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const FlowsheetNode1 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (FlowsheetNode1?.setEquipment_item)
                {
                    await
                    FlowsheetNode1.
                    setEquipment_item(relatedEquipment_item1);
                }
            
                const relatedEquipment_item2 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const FlowsheetNode2 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (FlowsheetNode2?.setEquipment_item)
                {
                    await
                    FlowsheetNode2.
                    setEquipment_item(relatedEquipment_item2);
                }
            
                const relatedEquipment_item3 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const FlowsheetNode3 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (FlowsheetNode3?.setEquipment_item)
                {
                    await
                    FlowsheetNode3.
                    setEquipment_item(relatedEquipment_item3);
                }
            
                const relatedEquipment_item4 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const FlowsheetNode4 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (FlowsheetNode4?.setEquipment_item)
                {
                    await
                    FlowsheetNode4.
                    setEquipment_item(relatedEquipment_item4);
                }
            
        }
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateFlowsheetNodeWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetNode0 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (FlowsheetNode0?.setOrganization)
                {
                    await
                    FlowsheetNode0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetNode1 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (FlowsheetNode1?.setOrganization)
                {
                    await
                    FlowsheetNode1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetNode2 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (FlowsheetNode2?.setOrganization)
                {
                    await
                    FlowsheetNode2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetNode3 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (FlowsheetNode3?.setOrganization)
                {
                    await
                    FlowsheetNode3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetNode4 = await FlowsheetNodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (FlowsheetNode4?.setOrganization)
                {
                    await
                    FlowsheetNode4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateFlowsheetStreamWithFlowsheet() {
            
                const relatedFlowsheet0 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetStream0 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (FlowsheetStream0?.setFlowsheet)
                {
                    await
                    FlowsheetStream0.
                    setFlowsheet(relatedFlowsheet0);
                }
            
                const relatedFlowsheet1 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetStream1 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (FlowsheetStream1?.setFlowsheet)
                {
                    await
                    FlowsheetStream1.
                    setFlowsheet(relatedFlowsheet1);
                }
            
                const relatedFlowsheet2 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetStream2 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (FlowsheetStream2?.setFlowsheet)
                {
                    await
                    FlowsheetStream2.
                    setFlowsheet(relatedFlowsheet2);
                }
            
                const relatedFlowsheet3 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetStream3 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (FlowsheetStream3?.setFlowsheet)
                {
                    await
                    FlowsheetStream3.
                    setFlowsheet(relatedFlowsheet3);
                }
            
                const relatedFlowsheet4 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const FlowsheetStream4 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (FlowsheetStream4?.setFlowsheet)
                {
                    await
                    FlowsheetStream4.
                    setFlowsheet(relatedFlowsheet4);
                }
            
        }
        
    
        
            
            async function associateFlowsheetStreamWithSource_node() {
            
                const relatedSource_node0 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream0 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (FlowsheetStream0?.setSource_node)
                {
                    await
                    FlowsheetStream0.
                    setSource_node(relatedSource_node0);
                }
            
                const relatedSource_node1 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream1 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (FlowsheetStream1?.setSource_node)
                {
                    await
                    FlowsheetStream1.
                    setSource_node(relatedSource_node1);
                }
            
                const relatedSource_node2 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream2 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (FlowsheetStream2?.setSource_node)
                {
                    await
                    FlowsheetStream2.
                    setSource_node(relatedSource_node2);
                }
            
                const relatedSource_node3 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream3 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (FlowsheetStream3?.setSource_node)
                {
                    await
                    FlowsheetStream3.
                    setSource_node(relatedSource_node3);
                }
            
                const relatedSource_node4 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream4 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (FlowsheetStream4?.setSource_node)
                {
                    await
                    FlowsheetStream4.
                    setSource_node(relatedSource_node4);
                }
            
        }
        
    
        
            
            async function associateFlowsheetStreamWithTarget_node() {
            
                const relatedTarget_node0 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream0 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (FlowsheetStream0?.setTarget_node)
                {
                    await
                    FlowsheetStream0.
                    setTarget_node(relatedTarget_node0);
                }
            
                const relatedTarget_node1 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream1 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (FlowsheetStream1?.setTarget_node)
                {
                    await
                    FlowsheetStream1.
                    setTarget_node(relatedTarget_node1);
                }
            
                const relatedTarget_node2 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream2 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (FlowsheetStream2?.setTarget_node)
                {
                    await
                    FlowsheetStream2.
                    setTarget_node(relatedTarget_node2);
                }
            
                const relatedTarget_node3 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream3 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (FlowsheetStream3?.setTarget_node)
                {
                    await
                    FlowsheetStream3.
                    setTarget_node(relatedTarget_node3);
                }
            
                const relatedTarget_node4 = await FlowsheetNodes.findOne({
                    offset: Math.floor(Math.random() * (await FlowsheetNodes.count())),
                });
                const FlowsheetStream4 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (FlowsheetStream4?.setTarget_node)
                {
                    await
                    FlowsheetStream4.
                    setTarget_node(relatedTarget_node4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateFlowsheetStreamWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetStream0 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (FlowsheetStream0?.setOrganization)
                {
                    await
                    FlowsheetStream0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetStream1 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (FlowsheetStream1?.setOrganization)
                {
                    await
                    FlowsheetStream1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetStream2 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (FlowsheetStream2?.setOrganization)
                {
                    await
                    FlowsheetStream2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetStream3 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (FlowsheetStream3?.setOrganization)
                {
                    await
                    FlowsheetStream3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const FlowsheetStream4 = await FlowsheetStreams.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (FlowsheetStream4?.setOrganization)
                {
                    await
                    FlowsheetStream4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDesignCriteriaItemWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const DesignCriteriaItem0 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DesignCriteriaItem0?.setProject)
                {
                    await
                    DesignCriteriaItem0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const DesignCriteriaItem1 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DesignCriteriaItem1?.setProject)
                {
                    await
                    DesignCriteriaItem1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const DesignCriteriaItem2 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DesignCriteriaItem2?.setProject)
                {
                    await
                    DesignCriteriaItem2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const DesignCriteriaItem3 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DesignCriteriaItem3?.setProject)
                {
                    await
                    DesignCriteriaItem3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const DesignCriteriaItem4 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (DesignCriteriaItem4?.setProject)
                {
                    await
                    DesignCriteriaItem4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateDesignCriteriaItemWithPhase() {
            
                const relatedPhase0 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const DesignCriteriaItem0 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DesignCriteriaItem0?.setPhase)
                {
                    await
                    DesignCriteriaItem0.
                    setPhase(relatedPhase0);
                }
            
                const relatedPhase1 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const DesignCriteriaItem1 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DesignCriteriaItem1?.setPhase)
                {
                    await
                    DesignCriteriaItem1.
                    setPhase(relatedPhase1);
                }
            
                const relatedPhase2 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const DesignCriteriaItem2 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DesignCriteriaItem2?.setPhase)
                {
                    await
                    DesignCriteriaItem2.
                    setPhase(relatedPhase2);
                }
            
                const relatedPhase3 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const DesignCriteriaItem3 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DesignCriteriaItem3?.setPhase)
                {
                    await
                    DesignCriteriaItem3.
                    setPhase(relatedPhase3);
                }
            
                const relatedPhase4 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const DesignCriteriaItem4 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (DesignCriteriaItem4?.setPhase)
                {
                    await
                    DesignCriteriaItem4.
                    setPhase(relatedPhase4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateDesignCriteriaItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DesignCriteriaItem0 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DesignCriteriaItem0?.setOrganization)
                {
                    await
                    DesignCriteriaItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DesignCriteriaItem1 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DesignCriteriaItem1?.setOrganization)
                {
                    await
                    DesignCriteriaItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DesignCriteriaItem2 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DesignCriteriaItem2?.setOrganization)
                {
                    await
                    DesignCriteriaItem2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DesignCriteriaItem3 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (DesignCriteriaItem3?.setOrganization)
                {
                    await
                    DesignCriteriaItem3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DesignCriteriaItem4 = await DesignCriteriaItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (DesignCriteriaItem4?.setOrganization)
                {
                    await
                    DesignCriteriaItem4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateEconomicModelWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const EconomicModel0 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EconomicModel0?.setProject)
                {
                    await
                    EconomicModel0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const EconomicModel1 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EconomicModel1?.setProject)
                {
                    await
                    EconomicModel1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const EconomicModel2 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EconomicModel2?.setProject)
                {
                    await
                    EconomicModel2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const EconomicModel3 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EconomicModel3?.setProject)
                {
                    await
                    EconomicModel3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const EconomicModel4 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EconomicModel4?.setProject)
                {
                    await
                    EconomicModel4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateEconomicModelWithPhase() {
            
                const relatedPhase0 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const EconomicModel0 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EconomicModel0?.setPhase)
                {
                    await
                    EconomicModel0.
                    setPhase(relatedPhase0);
                }
            
                const relatedPhase1 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const EconomicModel1 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EconomicModel1?.setPhase)
                {
                    await
                    EconomicModel1.
                    setPhase(relatedPhase1);
                }
            
                const relatedPhase2 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const EconomicModel2 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EconomicModel2?.setPhase)
                {
                    await
                    EconomicModel2.
                    setPhase(relatedPhase2);
                }
            
                const relatedPhase3 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const EconomicModel3 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EconomicModel3?.setPhase)
                {
                    await
                    EconomicModel3.
                    setPhase(relatedPhase3);
                }
            
                const relatedPhase4 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const EconomicModel4 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EconomicModel4?.setPhase)
                {
                    await
                    EconomicModel4.
                    setPhase(relatedPhase4);
                }
            
        }
        
    
        
            
            async function associateEconomicModelWithFlowsheet() {
            
                const relatedFlowsheet0 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const EconomicModel0 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EconomicModel0?.setFlowsheet)
                {
                    await
                    EconomicModel0.
                    setFlowsheet(relatedFlowsheet0);
                }
            
                const relatedFlowsheet1 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const EconomicModel1 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EconomicModel1?.setFlowsheet)
                {
                    await
                    EconomicModel1.
                    setFlowsheet(relatedFlowsheet1);
                }
            
                const relatedFlowsheet2 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const EconomicModel2 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EconomicModel2?.setFlowsheet)
                {
                    await
                    EconomicModel2.
                    setFlowsheet(relatedFlowsheet2);
                }
            
                const relatedFlowsheet3 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const EconomicModel3 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EconomicModel3?.setFlowsheet)
                {
                    await
                    EconomicModel3.
                    setFlowsheet(relatedFlowsheet3);
                }
            
                const relatedFlowsheet4 = await Flowsheets.findOne({
                    offset: Math.floor(Math.random() * (await Flowsheets.count())),
                });
                const EconomicModel4 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EconomicModel4?.setFlowsheet)
                {
                    await
                    EconomicModel4.
                    setFlowsheet(relatedFlowsheet4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEconomicModelWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EconomicModel0 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EconomicModel0?.setOrganization)
                {
                    await
                    EconomicModel0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EconomicModel1 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EconomicModel1?.setOrganization)
                {
                    await
                    EconomicModel1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EconomicModel2 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EconomicModel2?.setOrganization)
                {
                    await
                    EconomicModel2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EconomicModel3 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EconomicModel3?.setOrganization)
                {
                    await
                    EconomicModel3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EconomicModel4 = await EconomicModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EconomicModel4?.setOrganization)
                {
                    await
                    EconomicModel4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCapexItemWithEconomic_model() {
            
                const relatedEconomic_model0 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const CapexItem0 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CapexItem0?.setEconomic_model)
                {
                    await
                    CapexItem0.
                    setEconomic_model(relatedEconomic_model0);
                }
            
                const relatedEconomic_model1 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const CapexItem1 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CapexItem1?.setEconomic_model)
                {
                    await
                    CapexItem1.
                    setEconomic_model(relatedEconomic_model1);
                }
            
                const relatedEconomic_model2 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const CapexItem2 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CapexItem2?.setEconomic_model)
                {
                    await
                    CapexItem2.
                    setEconomic_model(relatedEconomic_model2);
                }
            
                const relatedEconomic_model3 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const CapexItem3 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CapexItem3?.setEconomic_model)
                {
                    await
                    CapexItem3.
                    setEconomic_model(relatedEconomic_model3);
                }
            
                const relatedEconomic_model4 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const CapexItem4 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (CapexItem4?.setEconomic_model)
                {
                    await
                    CapexItem4.
                    setEconomic_model(relatedEconomic_model4);
                }
            
        }
        
    
        
            
            async function associateCapexItemWithEquipment_item() {
            
                const relatedEquipment_item0 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const CapexItem0 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CapexItem0?.setEquipment_item)
                {
                    await
                    CapexItem0.
                    setEquipment_item(relatedEquipment_item0);
                }
            
                const relatedEquipment_item1 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const CapexItem1 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CapexItem1?.setEquipment_item)
                {
                    await
                    CapexItem1.
                    setEquipment_item(relatedEquipment_item1);
                }
            
                const relatedEquipment_item2 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const CapexItem2 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CapexItem2?.setEquipment_item)
                {
                    await
                    CapexItem2.
                    setEquipment_item(relatedEquipment_item2);
                }
            
                const relatedEquipment_item3 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const CapexItem3 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CapexItem3?.setEquipment_item)
                {
                    await
                    CapexItem3.
                    setEquipment_item(relatedEquipment_item3);
                }
            
                const relatedEquipment_item4 = await EquipmentItems.findOne({
                    offset: Math.floor(Math.random() * (await EquipmentItems.count())),
                });
                const CapexItem4 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (CapexItem4?.setEquipment_item)
                {
                    await
                    CapexItem4.
                    setEquipment_item(relatedEquipment_item4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCapexItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapexItem0 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CapexItem0?.setOrganization)
                {
                    await
                    CapexItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapexItem1 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CapexItem1?.setOrganization)
                {
                    await
                    CapexItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapexItem2 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CapexItem2?.setOrganization)
                {
                    await
                    CapexItem2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapexItem3 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CapexItem3?.setOrganization)
                {
                    await
                    CapexItem3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CapexItem4 = await CapexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (CapexItem4?.setOrganization)
                {
                    await
                    CapexItem4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateOpexItemWithEconomic_model() {
            
                const relatedEconomic_model0 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const OpexItem0 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OpexItem0?.setEconomic_model)
                {
                    await
                    OpexItem0.
                    setEconomic_model(relatedEconomic_model0);
                }
            
                const relatedEconomic_model1 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const OpexItem1 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OpexItem1?.setEconomic_model)
                {
                    await
                    OpexItem1.
                    setEconomic_model(relatedEconomic_model1);
                }
            
                const relatedEconomic_model2 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const OpexItem2 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OpexItem2?.setEconomic_model)
                {
                    await
                    OpexItem2.
                    setEconomic_model(relatedEconomic_model2);
                }
            
                const relatedEconomic_model3 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const OpexItem3 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OpexItem3?.setEconomic_model)
                {
                    await
                    OpexItem3.
                    setEconomic_model(relatedEconomic_model3);
                }
            
                const relatedEconomic_model4 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const OpexItem4 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (OpexItem4?.setEconomic_model)
                {
                    await
                    OpexItem4.
                    setEconomic_model(relatedEconomic_model4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateOpexItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OpexItem0 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OpexItem0?.setOrganization)
                {
                    await
                    OpexItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OpexItem1 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OpexItem1?.setOrganization)
                {
                    await
                    OpexItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OpexItem2 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OpexItem2?.setOrganization)
                {
                    await
                    OpexItem2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OpexItem3 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OpexItem3?.setOrganization)
                {
                    await
                    OpexItem3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OpexItem4 = await OpexItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (OpexItem4?.setOrganization)
                {
                    await
                    OpexItem4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateMonteCarloRunWithEconomic_model() {
            
                const relatedEconomic_model0 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const MonteCarloRun0 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MonteCarloRun0?.setEconomic_model)
                {
                    await
                    MonteCarloRun0.
                    setEconomic_model(relatedEconomic_model0);
                }
            
                const relatedEconomic_model1 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const MonteCarloRun1 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MonteCarloRun1?.setEconomic_model)
                {
                    await
                    MonteCarloRun1.
                    setEconomic_model(relatedEconomic_model1);
                }
            
                const relatedEconomic_model2 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const MonteCarloRun2 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MonteCarloRun2?.setEconomic_model)
                {
                    await
                    MonteCarloRun2.
                    setEconomic_model(relatedEconomic_model2);
                }
            
                const relatedEconomic_model3 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const MonteCarloRun3 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MonteCarloRun3?.setEconomic_model)
                {
                    await
                    MonteCarloRun3.
                    setEconomic_model(relatedEconomic_model3);
                }
            
                const relatedEconomic_model4 = await EconomicModels.findOne({
                    offset: Math.floor(Math.random() * (await EconomicModels.count())),
                });
                const MonteCarloRun4 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MonteCarloRun4?.setEconomic_model)
                {
                    await
                    MonteCarloRun4.
                    setEconomic_model(relatedEconomic_model4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateMonteCarloRunWithTriggered_by() {
            
                const relatedTriggered_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MonteCarloRun0 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MonteCarloRun0?.setTriggered_by)
                {
                    await
                    MonteCarloRun0.
                    setTriggered_by(relatedTriggered_by0);
                }
            
                const relatedTriggered_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MonteCarloRun1 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MonteCarloRun1?.setTriggered_by)
                {
                    await
                    MonteCarloRun1.
                    setTriggered_by(relatedTriggered_by1);
                }
            
                const relatedTriggered_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MonteCarloRun2 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MonteCarloRun2?.setTriggered_by)
                {
                    await
                    MonteCarloRun2.
                    setTriggered_by(relatedTriggered_by2);
                }
            
                const relatedTriggered_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MonteCarloRun3 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MonteCarloRun3?.setTriggered_by)
                {
                    await
                    MonteCarloRun3.
                    setTriggered_by(relatedTriggered_by3);
                }
            
                const relatedTriggered_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const MonteCarloRun4 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MonteCarloRun4?.setTriggered_by)
                {
                    await
                    MonteCarloRun4.
                    setTriggered_by(relatedTriggered_by4);
                }
            
        }
        
    
        
            
            async function associateMonteCarloRunWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MonteCarloRun0 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (MonteCarloRun0?.setOrganization)
                {
                    await
                    MonteCarloRun0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MonteCarloRun1 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (MonteCarloRun1?.setOrganization)
                {
                    await
                    MonteCarloRun1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MonteCarloRun2 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (MonteCarloRun2?.setOrganization)
                {
                    await
                    MonteCarloRun2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MonteCarloRun3 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (MonteCarloRun3?.setOrganization)
                {
                    await
                    MonteCarloRun3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const MonteCarloRun4 = await MonteCarloRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (MonteCarloRun4?.setOrganization)
                {
                    await
                    MonteCarloRun4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDocumentWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setProject)
                {
                    await
                    Document0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setProject)
                {
                    await
                    Document1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setProject)
                {
                    await
                    Document2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Document3 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Document3?.setProject)
                {
                    await
                    Document3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Document4 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Document4?.setProject)
                {
                    await
                    Document4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateDocumentWithPhase() {
            
                const relatedPhase0 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setPhase)
                {
                    await
                    Document0.
                    setPhase(relatedPhase0);
                }
            
                const relatedPhase1 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setPhase)
                {
                    await
                    Document1.
                    setPhase(relatedPhase1);
                }
            
                const relatedPhase2 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setPhase)
                {
                    await
                    Document2.
                    setPhase(relatedPhase2);
                }
            
                const relatedPhase3 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Document3 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Document3?.setPhase)
                {
                    await
                    Document3.
                    setPhase(relatedPhase3);
                }
            
                const relatedPhase4 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Document4 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Document4?.setPhase)
                {
                    await
                    Document4.
                    setPhase(relatedPhase4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDocumentWithUploaded_by() {
            
                const relatedUploaded_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setUploaded_by)
                {
                    await
                    Document0.
                    setUploaded_by(relatedUploaded_by0);
                }
            
                const relatedUploaded_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setUploaded_by)
                {
                    await
                    Document1.
                    setUploaded_by(relatedUploaded_by1);
                }
            
                const relatedUploaded_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setUploaded_by)
                {
                    await
                    Document2.
                    setUploaded_by(relatedUploaded_by2);
                }
            
                const relatedUploaded_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document3 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Document3?.setUploaded_by)
                {
                    await
                    Document3.
                    setUploaded_by(relatedUploaded_by3);
                }
            
                const relatedUploaded_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document4 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Document4?.setUploaded_by)
                {
                    await
                    Document4.
                    setUploaded_by(relatedUploaded_by4);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateDocumentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setOrganization)
                {
                    await
                    Document0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setOrganization)
                {
                    await
                    Document1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setOrganization)
                {
                    await
                    Document2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document3 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Document3?.setOrganization)
                {
                    await
                    Document3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document4 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Document4?.setOrganization)
                {
                    await
                    Document4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEntityLinkWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EntityLink0 = await EntityLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EntityLink0?.setOrganization)
                {
                    await
                    EntityLink0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EntityLink1 = await EntityLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EntityLink1?.setOrganization)
                {
                    await
                    EntityLink1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EntityLink2 = await EntityLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EntityLink2?.setOrganization)
                {
                    await
                    EntityLink2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EntityLink3 = await EntityLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EntityLink3?.setOrganization)
                {
                    await
                    EntityLink3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EntityLink4 = await EntityLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EntityLink4?.setOrganization)
                {
                    await
                    EntityLink4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCommentWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Comment0 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Comment0?.setProject)
                {
                    await
                    Comment0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Comment1 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Comment1?.setProject)
                {
                    await
                    Comment1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Comment2 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Comment2?.setProject)
                {
                    await
                    Comment2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Comment3 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Comment3?.setProject)
                {
                    await
                    Comment3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Comment4 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Comment4?.setProject)
                {
                    await
                    Comment4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateCommentWithAuthor() {
            
                const relatedAuthor0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Comment0 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Comment0?.setAuthor)
                {
                    await
                    Comment0.
                    setAuthor(relatedAuthor0);
                }
            
                const relatedAuthor1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Comment1 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Comment1?.setAuthor)
                {
                    await
                    Comment1.
                    setAuthor(relatedAuthor1);
                }
            
                const relatedAuthor2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Comment2 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Comment2?.setAuthor)
                {
                    await
                    Comment2.
                    setAuthor(relatedAuthor2);
                }
            
                const relatedAuthor3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Comment3 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Comment3?.setAuthor)
                {
                    await
                    Comment3.
                    setAuthor(relatedAuthor3);
                }
            
                const relatedAuthor4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Comment4 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Comment4?.setAuthor)
                {
                    await
                    Comment4.
                    setAuthor(relatedAuthor4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateCommentWithParent_comment() {
            
                const relatedParent_comment0 = await Comments.findOne({
                    offset: Math.floor(Math.random() * (await Comments.count())),
                });
                const Comment0 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Comment0?.setParent_comment)
                {
                    await
                    Comment0.
                    setParent_comment(relatedParent_comment0);
                }
            
                const relatedParent_comment1 = await Comments.findOne({
                    offset: Math.floor(Math.random() * (await Comments.count())),
                });
                const Comment1 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Comment1?.setParent_comment)
                {
                    await
                    Comment1.
                    setParent_comment(relatedParent_comment1);
                }
            
                const relatedParent_comment2 = await Comments.findOne({
                    offset: Math.floor(Math.random() * (await Comments.count())),
                });
                const Comment2 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Comment2?.setParent_comment)
                {
                    await
                    Comment2.
                    setParent_comment(relatedParent_comment2);
                }
            
                const relatedParent_comment3 = await Comments.findOne({
                    offset: Math.floor(Math.random() * (await Comments.count())),
                });
                const Comment3 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Comment3?.setParent_comment)
                {
                    await
                    Comment3.
                    setParent_comment(relatedParent_comment3);
                }
            
                const relatedParent_comment4 = await Comments.findOne({
                    offset: Math.floor(Math.random() * (await Comments.count())),
                });
                const Comment4 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Comment4?.setParent_comment)
                {
                    await
                    Comment4.
                    setParent_comment(relatedParent_comment4);
                }
            
        }
        
    
        
    
        
            
            async function associateCommentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Comment0 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Comment0?.setOrganization)
                {
                    await
                    Comment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Comment1 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Comment1?.setOrganization)
                {
                    await
                    Comment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Comment2 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Comment2?.setOrganization)
                {
                    await
                    Comment2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Comment3 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Comment3?.setOrganization)
                {
                    await
                    Comment3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Comment4 = await Comments.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Comment4?.setOrganization)
                {
                    await
                    Comment4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateTaskWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setProject)
                {
                    await
                    Task0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setProject)
                {
                    await
                    Task1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setProject)
                {
                    await
                    Task2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setProject)
                {
                    await
                    Task3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task4 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Task4?.setProject)
                {
                    await
                    Task4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateTaskWithPhase() {
            
                const relatedPhase0 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setPhase)
                {
                    await
                    Task0.
                    setPhase(relatedPhase0);
                }
            
                const relatedPhase1 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setPhase)
                {
                    await
                    Task1.
                    setPhase(relatedPhase1);
                }
            
                const relatedPhase2 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setPhase)
                {
                    await
                    Task2.
                    setPhase(relatedPhase2);
                }
            
                const relatedPhase3 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setPhase)
                {
                    await
                    Task3.
                    setPhase(relatedPhase3);
                }
            
                const relatedPhase4 = await ProjectPhases.findOne({
                    offset: Math.floor(Math.random() * (await ProjectPhases.count())),
                });
                const Task4 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Task4?.setPhase)
                {
                    await
                    Task4.
                    setPhase(relatedPhase4);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateTaskWithAssignee() {
            
                const relatedAssignee0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setAssignee)
                {
                    await
                    Task0.
                    setAssignee(relatedAssignee0);
                }
            
                const relatedAssignee1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setAssignee)
                {
                    await
                    Task1.
                    setAssignee(relatedAssignee1);
                }
            
                const relatedAssignee2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setAssignee)
                {
                    await
                    Task2.
                    setAssignee(relatedAssignee2);
                }
            
                const relatedAssignee3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setAssignee)
                {
                    await
                    Task3.
                    setAssignee(relatedAssignee3);
                }
            
                const relatedAssignee4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task4 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Task4?.setAssignee)
                {
                    await
                    Task4.
                    setAssignee(relatedAssignee4);
                }
            
        }
        
    
        
            
            async function associateTaskWithReporter() {
            
                const relatedReporter0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setReporter)
                {
                    await
                    Task0.
                    setReporter(relatedReporter0);
                }
            
                const relatedReporter1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setReporter)
                {
                    await
                    Task1.
                    setReporter(relatedReporter1);
                }
            
                const relatedReporter2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setReporter)
                {
                    await
                    Task2.
                    setReporter(relatedReporter2);
                }
            
                const relatedReporter3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setReporter)
                {
                    await
                    Task3.
                    setReporter(relatedReporter3);
                }
            
                const relatedReporter4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task4 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Task4?.setReporter)
                {
                    await
                    Task4.
                    setReporter(relatedReporter4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTaskWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setOrganization)
                {
                    await
                    Task0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setOrganization)
                {
                    await
                    Task1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setOrganization)
                {
                    await
                    Task2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setOrganization)
                {
                    await
                    Task3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task4 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Task4?.setOrganization)
                {
                    await
                    Task4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateNotificationWithRecipient() {
            
                const relatedRecipient0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification0 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Notification0?.setRecipient)
                {
                    await
                    Notification0.
                    setRecipient(relatedRecipient0);
                }
            
                const relatedRecipient1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification1 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Notification1?.setRecipient)
                {
                    await
                    Notification1.
                    setRecipient(relatedRecipient1);
                }
            
                const relatedRecipient2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification2 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Notification2?.setRecipient)
                {
                    await
                    Notification2.
                    setRecipient(relatedRecipient2);
                }
            
                const relatedRecipient3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification3 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Notification3?.setRecipient)
                {
                    await
                    Notification3.
                    setRecipient(relatedRecipient3);
                }
            
                const relatedRecipient4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification4 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Notification4?.setRecipient)
                {
                    await
                    Notification4.
                    setRecipient(relatedRecipient4);
                }
            
        }
        
    
        
            
            async function associateNotificationWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Notification0 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Notification0?.setProject)
                {
                    await
                    Notification0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Notification1 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Notification1?.setProject)
                {
                    await
                    Notification1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Notification2 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Notification2?.setProject)
                {
                    await
                    Notification2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Notification3 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Notification3?.setProject)
                {
                    await
                    Notification3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Notification4 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Notification4?.setProject)
                {
                    await
                    Notification4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateNotificationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification0 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Notification0?.setOrganization)
                {
                    await
                    Notification0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification1 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Notification1?.setOrganization)
                {
                    await
                    Notification1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification2 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Notification2?.setOrganization)
                {
                    await
                    Notification2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification3 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Notification3?.setOrganization)
                {
                    await
                    Notification3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification4 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Notification4?.setOrganization)
                {
                    await
                    Notification4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateAuditLogWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setOrganization)
                {
                    await
                    AuditLog0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setOrganization)
                {
                    await
                    AuditLog1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setOrganization)
                {
                    await
                    AuditLog2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog3 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditLog3?.setOrganization)
                {
                    await
                    AuditLog3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog4 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (AuditLog4?.setOrganization)
                {
                    await
                    AuditLog4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateAuditLogWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setProject)
                {
                    await
                    AuditLog0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setProject)
                {
                    await
                    AuditLog1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setProject)
                {
                    await
                    AuditLog2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const AuditLog3 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditLog3?.setProject)
                {
                    await
                    AuditLog3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const AuditLog4 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (AuditLog4?.setProject)
                {
                    await
                    AuditLog4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateAuditLogWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setUser)
                {
                    await
                    AuditLog0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setUser)
                {
                    await
                    AuditLog1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setUser)
                {
                    await
                    AuditLog2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog3 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditLog3?.setUser)
                {
                    await
                    AuditLog3.
                    setUser(relatedUser3);
                }
            
                const relatedUser4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog4 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (AuditLog4?.setUser)
                {
                    await
                    AuditLog4.
                    setUser(relatedUser4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateIntegrationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration0 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Integration0?.setOrganization)
                {
                    await
                    Integration0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration1 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Integration1?.setOrganization)
                {
                    await
                    Integration1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration2 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Integration2?.setOrganization)
                {
                    await
                    Integration2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration3 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Integration3?.setOrganization)
                {
                    await
                    Integration3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration4 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Integration4?.setOrganization)
                {
                    await
                    Integration4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateOfflineSyncBatcheWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const OfflineSyncBatche0 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OfflineSyncBatche0?.setUser)
                {
                    await
                    OfflineSyncBatche0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const OfflineSyncBatche1 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OfflineSyncBatche1?.setUser)
                {
                    await
                    OfflineSyncBatche1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const OfflineSyncBatche2 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OfflineSyncBatche2?.setUser)
                {
                    await
                    OfflineSyncBatche2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const OfflineSyncBatche3 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OfflineSyncBatche3?.setUser)
                {
                    await
                    OfflineSyncBatche3.
                    setUser(relatedUser3);
                }
            
                const relatedUser4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const OfflineSyncBatche4 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (OfflineSyncBatche4?.setUser)
                {
                    await
                    OfflineSyncBatche4.
                    setUser(relatedUser4);
                }
            
        }
        
    
        
            
            async function associateOfflineSyncBatcheWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OfflineSyncBatche0 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OfflineSyncBatche0?.setProject)
                {
                    await
                    OfflineSyncBatche0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OfflineSyncBatche1 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OfflineSyncBatche1?.setProject)
                {
                    await
                    OfflineSyncBatche1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OfflineSyncBatche2 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OfflineSyncBatche2?.setProject)
                {
                    await
                    OfflineSyncBatche2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OfflineSyncBatche3 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OfflineSyncBatche3?.setProject)
                {
                    await
                    OfflineSyncBatche3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const OfflineSyncBatche4 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (OfflineSyncBatche4?.setProject)
                {
                    await
                    OfflineSyncBatche4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateOfflineSyncBatcheWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OfflineSyncBatche0 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OfflineSyncBatche0?.setOrganization)
                {
                    await
                    OfflineSyncBatche0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OfflineSyncBatche1 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OfflineSyncBatche1?.setOrganization)
                {
                    await
                    OfflineSyncBatche1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OfflineSyncBatche2 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OfflineSyncBatche2?.setOrganization)
                {
                    await
                    OfflineSyncBatche2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OfflineSyncBatche3 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OfflineSyncBatche3?.setOrganization)
                {
                    await
                    OfflineSyncBatche3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OfflineSyncBatche4 = await OfflineSyncBatches.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (OfflineSyncBatche4?.setOrganization)
                {
                    await
                    OfflineSyncBatche4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Projects.bulkCreate(ProjectsData);
                
            
            
                
                await ProjectPhases.bulkCreate(ProjectPhasesData);
                
            
            
                
                await Milestones.bulkCreate(MilestonesData);
                
            
            
                
                await OreBodies.bulkCreate(OreBodiesData);
                
            
            
                
                await Samples.bulkCreate(SamplesData);
                
            
            
                
                await ChainOfCustodyEvents.bulkCreate(ChainOfCustodyEventsData);
                
            
            
                
                await Laboratories.bulkCreate(LaboratoriesData);
                
            
            
                
                await TestTypeSchemas.bulkCreate(TestTypeSchemasData);
                
            
            
                
                await MetallurgicalTests.bulkCreate(MetallurgicalTestsData);
                
            
            
                
                await TestResultPoints.bulkCreate(TestResultPointsData);
                
            
            
                
                await Flowsheets.bulkCreate(FlowsheetsData);
                
            
            
                
                await EquipmentItems.bulkCreate(EquipmentItemsData);
                
            
            
                
                await FlowsheetNodes.bulkCreate(FlowsheetNodesData);
                
            
            
                
                await FlowsheetStreams.bulkCreate(FlowsheetStreamsData);
                
            
            
                
                await DesignCriteriaItems.bulkCreate(DesignCriteriaItemsData);
                
            
            
                
                await EconomicModels.bulkCreate(EconomicModelsData);
                
            
            
                
                await CapexItems.bulkCreate(CapexItemsData);
                
            
            
                
                await OpexItems.bulkCreate(OpexItemsData);
                
            
            
                
                await MonteCarloRuns.bulkCreate(MonteCarloRunsData);
                
            
            
                
                await Documents.bulkCreate(DocumentsData);
                
            
            
                
                await EntityLinks.bulkCreate(EntityLinksData);
                
            
            
                
                await Comments.bulkCreate(CommentsData);
                
            
            
                
                await Tasks.bulkCreate(TasksData);
                
            
            
                
                await Notifications.bulkCreate(NotificationsData);
                
            
            
                
                await AuditLogs.bulkCreate(AuditLogsData);
                
            
            
                
                await Integrations.bulkCreate(IntegrationsData);
                
            
            
                
                await OfflineSyncBatches.bulkCreate(OfflineSyncBatchesData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                        
                        await associateProjectWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateProjectPhasWithProject(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProjectPhasWithApproved_by(),
                    
                
                    
                
                    
                        
                        await associateProjectPhasWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateMilestoneWithProject(),
                    
                
                    
                        
                        await associateMilestoneWithPhase(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMilestoneWithOwner(),
                    
                
                    
                
                    
                        
                        await associateMilestoneWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateOreBodyWithProject(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateOreBodyWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSampleWithProject(),
                    
                
                    
                        
                        await associateSampleWithOre_body(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSampleWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateChainOfCustodyEventWithSample(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateChainOfCustodyEventWithRecorded_by(),
                    
                
                    
                        
                        await associateChainOfCustodyEventWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateLaboratoryWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTestTypeSchemaWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateMetallurgicalTestWithProject(),
                    
                
                    
                        
                        await associateMetallurgicalTestWithPhase(),
                    
                
                    
                        
                        await associateMetallurgicalTestWithSample(),
                    
                
                    
                        
                        await associateMetallurgicalTestWithLaboratory(),
                    
                
                    
                        
                        await associateMetallurgicalTestWithTest_type_schema(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMetallurgicalTestWithEntered_by(),
                    
                
                    
                        
                        await associateMetallurgicalTestWithReviewed_by(),
                    
                
                    
                
                    
                        
                        await associateMetallurgicalTestWithApproved_by(),
                    
                
                    
                
                    
                
                    
                        
                        await associateMetallurgicalTestWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTestResultPointWithMetallurgical_test(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTestResultPointWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateFlowsheetWithProject(),
                    
                
                    
                        
                        await associateFlowsheetWithPhase(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateFlowsheetWithApproved_by(),
                    
                
                    
                
                    
                        
                        await associateFlowsheetWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateEquipmentItemWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateFlowsheetNodeWithFlowsheet(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateFlowsheetNodeWithEquipment_item(),
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateFlowsheetNodeWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateFlowsheetStreamWithFlowsheet(),
                    
                
                    
                        
                        await associateFlowsheetStreamWithSource_node(),
                    
                
                    
                        
                        await associateFlowsheetStreamWithTarget_node(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateFlowsheetStreamWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDesignCriteriaItemWithProject(),
                    
                
                    
                        
                        await associateDesignCriteriaItemWithPhase(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateDesignCriteriaItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateEconomicModelWithProject(),
                    
                
                    
                        
                        await associateEconomicModelWithPhase(),
                    
                
                    
                        
                        await associateEconomicModelWithFlowsheet(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEconomicModelWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCapexItemWithEconomic_model(),
                    
                
                    
                        
                        await associateCapexItemWithEquipment_item(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCapexItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateOpexItemWithEconomic_model(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateOpexItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateMonteCarloRunWithEconomic_model(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateMonteCarloRunWithTriggered_by(),
                    
                
                    
                        
                        await associateMonteCarloRunWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDocumentWithProject(),
                    
                
                    
                        
                        await associateDocumentWithPhase(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDocumentWithUploaded_by(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDocumentWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEntityLinkWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCommentWithProject(),
                    
                
                    
                
                    
                
                    
                        
                        await associateCommentWithAuthor(),
                    
                
                    
                
                    
                
                    
                        
                        await associateCommentWithParent_comment(),
                    
                
                    
                
                    
                        
                        await associateCommentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTaskWithProject(),
                    
                
                    
                        
                        await associateTaskWithPhase(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTaskWithAssignee(),
                    
                
                    
                        
                        await associateTaskWithReporter(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTaskWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateNotificationWithRecipient(),
                    
                
                    
                        
                        await associateNotificationWithProject(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNotificationWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateAuditLogWithOrganization(),
                    
                
                    
                        
                        await associateAuditLogWithProject(),
                    
                
                    
                        
                        await associateAuditLogWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateIntegrationWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateOfflineSyncBatcheWithUser(),
                    
                
                    
                        
                        await associateOfflineSyncBatcheWithProject(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateOfflineSyncBatcheWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('projects', null, {});
            
            
            await queryInterface.bulkDelete('project_phases', null, {});
            
            
            await queryInterface.bulkDelete('milestones', null, {});
            
            
            await queryInterface.bulkDelete('ore_bodies', null, {});
            
            
            await queryInterface.bulkDelete('samples', null, {});
            
            
            await queryInterface.bulkDelete('chain_of_custody_events', null, {});
            
            
            await queryInterface.bulkDelete('laboratories', null, {});
            
            
            await queryInterface.bulkDelete('test_type_schemas', null, {});
            
            
            await queryInterface.bulkDelete('metallurgical_tests', null, {});
            
            
            await queryInterface.bulkDelete('test_result_points', null, {});
            
            
            await queryInterface.bulkDelete('flowsheets', null, {});
            
            
            await queryInterface.bulkDelete('equipment_items', null, {});
            
            
            await queryInterface.bulkDelete('flowsheet_nodes', null, {});
            
            
            await queryInterface.bulkDelete('flowsheet_streams', null, {});
            
            
            await queryInterface.bulkDelete('design_criteria_items', null, {});
            
            
            await queryInterface.bulkDelete('economic_models', null, {});
            
            
            await queryInterface.bulkDelete('capex_items', null, {});
            
            
            await queryInterface.bulkDelete('opex_items', null, {});
            
            
            await queryInterface.bulkDelete('monte_carlo_runs', null, {});
            
            
            await queryInterface.bulkDelete('documents', null, {});
            
            
            await queryInterface.bulkDelete('entity_links', null, {});
            
            
            await queryInterface.bulkDelete('comments', null, {});
            
            
            await queryInterface.bulkDelete('tasks', null, {});
            
            
            await queryInterface.bulkDelete('notifications', null, {});
            
            
            await queryInterface.bulkDelete('audit_logs', null, {});
            
            
            await queryInterface.bulkDelete('integrations', null, {});
            
            
            await queryInterface.bulkDelete('offline_sync_batches', null, {});
            
        
    },
};