





















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






const Organizations = db.organizations;

const Locations = db.locations;

const RoleAssignments = db.role_assignments;

const Payers = db.payers;

const PayerPlans = db.payer_plans;

const ProcedureFamilies = db.procedure_families;

const CptCodes = db.cpt_codes;

const Patients = db.patients;

const AuthorizationCases = db.authorization_cases;

const CaseDocuments = db.case_documents;

const Submissions = db.submissions;

const SubmissionEvents = db.submission_events;

const Tasks = db.tasks;

const Denials = db.denials;

const Appeals = db.appeals;

const Templates = db.templates;

const PayerRules = db.payer_rules;

const RuleRequirements = db.rule_requirements;

const AiJobs = db.ai_jobs;

const AiOutputs = db.ai_outputs;

const ReviewActions = db.review_actions;

const AuditLogs = db.audit_logs;

const IntegrationEndpoints = db.integration_endpoints;

const Contacts = db.contacts;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Northstar Imaging Partners",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Summit Radiology Group",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Metro Diagnostic Imaging",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Pinecrest Outpatient Imaging",
            
        
    
    },
    
];



const LocationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Northstar Downtown Center",
            
        
    
        
        
            
                "market": "Chicago",
            
        
    
        
        
            
                "timezone": "America/Chicago",
            
        
    
        
        
            
                "address_line_1": "200 W Madison St",
            
        
    
        
        
            
                "city": "Chicago",
            
        
    
        
        
            
                "state": "IL",
            
        
    
        
        
            
                "postal_code": "60606",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Northstar North Clinic",
            
        
    
        
        
            
                "market": "Chicago North",
            
        
    
        
        
            
                "timezone": "America/Chicago",
            
        
    
        
        
            
                "address_line_1": "5100 N Lincoln Ave",
            
        
    
        
        
            
                "city": "Chicago",
            
        
    
        
        
            
                "state": "IL",
            
        
    
        
        
            
                "postal_code": "60625",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Summit Main Campus",
            
        
    
        
        
            
                "market": "Denver",
            
        
    
        
        
            
                "timezone": "America/Denver",
            
        
    
        
        
            
                "address_line_1": "900 17th St",
            
        
    
        
        
            
                "city": "Denver",
            
        
    
        
        
            
                "state": "CO",
            
        
    
        
        
            
                "postal_code": "80202",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Metro West Imaging",
            
        
    
        
        
            
                "market": "Phoenix West",
            
        
    
        
        
            
                "timezone": "America/Phoenix",
            
        
    
        
        
            
                "address_line_1": "3200 W Camelback Rd",
            
        
    
        
        
            
                "city": "Phoenix",
            
        
    
        
        
            
                "state": "AZ",
            
        
    
        
        
            
                "postal_code": "85017",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];



const RoleAssignmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role_name": "practice_administrator",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "scope_notes": "Org-wide operations oversight for Northstar",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role_name": "denial_specialist",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "scope_notes": "Handles prior auth submissions for North Clinic",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role_name": "authorization_specialist",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "scope_notes": "Market coverage for Chicago Downtown",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role_name": "practice_administrator",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "scope_notes": "Practice admin for Summit Main Campus",
            
        
    
    },
    
];



const PayersData = [
    
    {
    
        
        
            
                "name": "BlueCross BlueShield of Illinois",
            
        
    
        
        
            
                "payer_type": "medicaid",
            
        
    
        
        
            
                "phone": "800-555-1200",
            
        
    
        
        
            
                "website_url": "https://www.bcbsil.com",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "UnitedHealthcare",
            
        
    
        
        
            
                "payer_type": "medicare",
            
        
    
        
        
            
                "phone": "877-555-2200",
            
        
    
        
        
            
                "website_url": "https://www.uhc.com",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Aetna",
            
        
    
        
        
            
                "payer_type": "other",
            
        
    
        
        
            
                "phone": "800-555-3300",
            
        
    
        
        
            
                "website_url": "https://www.aetna.com",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Medicare",
            
        
    
        
        
            
                "payer_type": "commercial",
            
        
    
        
        
            
                "phone": "800-633-4227",
            
        
    
        
        
            
                "website_url": "https://www.medicare.gov",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PayerPlansData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "BCBSIL PPO Choice",
            
        
    
        
        
            
                "plan_code": "BCBSIL-PPO-CHOICE",
            
        
    
        
        
            
                "network_type": "hmo",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "notes": "Common commercial plan for Chicago market",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "BCBSIL HMO BlueAdvantage",
            
        
    
        
        
            
                "plan_code": "BCBSIL-HMO-BA",
            
        
    
        
        
            
                "network_type": "ppo",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "notes": "Requires PCP referrals for many services",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "UHC Choice Plus",
            
        
    
        
        
            
                "plan_code": "UHC-CP",
            
        
    
        
        
            
                "network_type": "medicare_advantage",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "notes": "Portal submission supported in many regions",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Aetna Open Access",
            
        
    
        
        
            
                "plan_code": "AET-OA",
            
        
    
        
        
            
                "network_type": "hmo",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "notes": "Prior auth varies by procedure family",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ProcedureFamiliesData = [
    
    {
    
        
        
            
                "name": "MRI Brain",
            
        
    
        
        
            
                "modality": "MRI",
            
        
    
        
        
            
                "body_region": "Head",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "MRI Spine",
            
        
    
        
        
            
                "modality": "MRI",
            
        
    
        
        
            
                "body_region": "Spine",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "CT Abdomen Pelvis",
            
        
    
        
        
            
                "modality": "CT",
            
        
    
        
        
            
                "body_region": "Abdomen",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ultrasound OB",
            
        
    
        
        
            
                "modality": "Ultrasound",
            
        
    
        
        
            
                "body_region": "Pelvis",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CptCodesData = [
    
    {
    
        
        
            
                "code": "70551",
            
        
    
        
        
            
                "short_description": "MRI brain without contrast",
            
        
    
        
        
            
                "long_description": "Magnetic resonance imaging of brain without contrast material",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "code": "72148",
            
        
    
        
        
            
                "short_description": "MRI lumbar spine without contrast",
            
        
    
        
        
            
                "long_description": "Magnetic resonance imaging of lumbar spine without contrast material",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "code": "74177",
            
        
    
        
        
            
                "short_description": "CT abdomen pelvis with contrast",
            
        
    
        
        
            
                "long_description": "Computed tomography of abdomen and pelvis with contrast material",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "code": "76805",
            
        
    
        
        
            
                "short_description": "Ultrasound pregnant uterus",
            
        
    
        
        
            
                "long_description": "Ultrasound of pregnant uterus real time with image documentation",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PatientsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_name": "Jordan",
            
        
    
        
        
            
                "last_name": "Taylor",
            
        
    
        
        
            
                "date_of_birth": new Date('1987-04-12T00:00:00Z'),
            
        
    
        
        
            
                "sex": "other",
            
        
    
        
        
            
                "mrn": "NS-100245",
            
        
    
        
        
            
                "phone": "312-555-0188",
            
        
    
        
        
            
                "email": "jordan.taylor@example.com",
            
        
    
        
        
            
                "address_line_1": "1450 W Jackson Blvd",
            
        
    
        
        
            
                "city": "Chicago",
            
        
    
        
        
            
                "state": "IL",
            
        
    
        
        
            
                "postal_code": "60607",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_name": "Casey",
            
        
    
        
        
            
                "last_name": "Nguyen",
            
        
    
        
        
            
                "date_of_birth": new Date('1992-09-30T00:00:00Z'),
            
        
    
        
        
            
                "sex": "unknown",
            
        
    
        
        
            
                "mrn": "NS-100310",
            
        
    
        
        
            
                "phone": "773-555-0144",
            
        
    
        
        
            
                "email": "casey.nguyen@example.com",
            
        
    
        
        
            
                "address_line_1": "2200 N Halsted St",
            
        
    
        
        
            
                "city": "Chicago",
            
        
    
        
        
            
                "state": "IL",
            
        
    
        
        
            
                "postal_code": "60614",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_name": "Riley",
            
        
    
        
        
            
                "last_name": "Morgan",
            
        
    
        
        
            
                "date_of_birth": new Date('1976-01-18T00:00:00Z'),
            
        
    
        
        
            
                "sex": "other",
            
        
    
        
        
            
                "mrn": "SUM-22019",
            
        
    
        
        
            
                "phone": "303-555-0122",
            
        
    
        
        
            
                "email": "riley.morgan@example.com",
            
        
    
        
        
            
                "address_line_1": "980 Lincoln St",
            
        
    
        
        
            
                "city": "Denver",
            
        
    
        
        
            
                "state": "CO",
            
        
    
        
        
            
                "postal_code": "80203",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_name": "Alex",
            
        
    
        
        
            
                "last_name": "Rivera",
            
        
    
        
        
            
                "date_of_birth": new Date('1981-07-05T00:00:00Z'),
            
        
    
        
        
            
                "sex": "other",
            
        
    
        
        
            
                "mrn": "MET-77812",
            
        
    
        
        
            
                "phone": "602-555-0199",
            
        
    
        
        
            
                "email": "alex.rivera@example.com",
            
        
    
        
        
            
                "address_line_1": "4100 N 7th Ave",
            
        
    
        
        
            
                "city": "Phoenix",
            
        
    
        
        
            
                "state": "AZ",
            
        
    
        
        
            
                "postal_code": "85013",
            
        
    
    },
    
];



const AuthorizationCasesData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "stage": "appeal_in_progress",
            
        
    
        
        
            
                "urgency": "routine",
            
        
    
        
        
            
                "ordering_provider_name": "Dr Emma Collins",
            
        
    
        
        
            
                "rendering_provider_name": "Dr Samuel Price",
            
        
    
        
        
            
                "site_of_service": "Northstar Downtown Center",
            
        
    
        
        
            
                "scheduled_date": new Date('2026-03-29T15:00:00Z'),
            
        
    
        
        
            
                "dollars_at_risk": 1250.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-27T17:00:00Z'),
            
        
    
        
        
            
                "sla_state": "on_track",
            
        
    
        
        
            
                "internal_notes": "Need latest neuro consult note and headache duration details",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "stage": "ready_to_submit",
            
        
    
        
        
            
                "urgency": "stat",
            
        
    
        
        
            
                "ordering_provider_name": "Dr Lila Grant",
            
        
    
        
        
            
                "rendering_provider_name": "Dr Samuel Price",
            
        
    
        
        
            
                "site_of_service": "Northstar North Clinic",
            
        
    
        
        
            
                "scheduled_date": new Date('2026-03-28T10:30:00Z'),
            
        
    
        
        
            
                "dollars_at_risk": 980.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-26T17:00:00Z'),
            
        
    
        
        
            
                "sla_state": "on_track",
            
        
    
        
        
            
                "internal_notes": "Missing PT trial documentation and red flag symptoms checklist",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "stage": "pending_decision",
            
        
    
        
        
            
                "urgency": "stat",
            
        
    
        
        
            
                "ordering_provider_name": "Dr Henry Shaw",
            
        
    
        
        
            
                "rendering_provider_name": "Dr Priya Nair",
            
        
    
        
        
            
                "site_of_service": "Summit Main Campus",
            
        
    
        
        
            
                "scheduled_date": new Date('2026-04-02T09:00:00Z'),
            
        
    
        
        
            
                "dollars_at_risk": 1420.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-30T17:00:00Z'),
            
        
    
        
        
            
                "sla_state": "on_track",
            
        
    
        
        
            
                "internal_notes": "Submitted via portal with clinical notes attached",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "stage": "submitted",
            
        
    
        
        
            
                "urgency": "urgent",
            
        
    
        
        
            
                "ordering_provider_name": "Dr Olivia Stern",
            
        
    
        
        
            
                "rendering_provider_name": "Dr Naveen Iyer",
            
        
    
        
        
            
                "site_of_service": "Metro West Imaging",
            
        
    
        
        
            
                "scheduled_date": new Date('2026-03-31T13:00:00Z'),
            
        
    
        
        
            
                "dollars_at_risk": 3200.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-29T17:00:00Z'),
            
        
    
        
        
            
                "sla_state": "due_soon",
            
        
    
        
        
            
                "internal_notes": "Confirm prior oncology notes and staging documentation",
            
        
    
    },
    
];



const CaseDocumentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "clinical_notes",
            
        
    
        
        
            
                "source_channel": "email",
            
        
    
        
        
            
                "storage_key": "org1/case1/order_v1.pdf",
            
        
    
        
        
            
                "original_filename": "MRI_Brain_Order_Taylor.pdf",
            
        
    
        
        
            
                "checksum": "a1b2c3d4e5",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-03-22T15:10:00Z'),
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "order",
            
        
    
        
        
            
                "source_channel": "upload",
            
        
    
        
        
            
                "storage_key": "org1/case1/clinic_notes_v1.pdf",
            
        
    
        
        
            
                "original_filename": "Neuro_Visit_Notes_Taylor.pdf",
            
        
    
        
        
            
                "checksum": "b2c3d4e5f6",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-03-22T15:14:00Z'),
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "other",
            
        
    
        
        
            
                "source_channel": "other",
            
        
    
        
        
            
                "storage_key": "org1/case2/fax_notes_v1.pdf",
            
        
    
        
        
            
                "original_filename": "Lumbar_Spine_Notes_Nguyen.pdf",
            
        
    
        
        
            
                "checksum": "c3d4e5f6g7",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-03-23T09:02:00Z'),
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "labs",
            
        
    
        
        
            
                "source_channel": "upload",
            
        
    
        
        
            
                "storage_key": "org2/case3/pa_form_v1.pdf",
            
        
    
        
        
            
                "original_filename": "UHC_PA_Form_Morgan.pdf",
            
        
    
        
        
            
                "checksum": "d4e5f6g7h8",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-03-20T11:33:00Z'),
            
        
    
        
        
            
                "version_number": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SubmissionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "submission_channel": "payer_portal",
            
        
    
        
        
            
                "reference_number": "BCBSIL-REF-903114",
            
        
    
        
        
            
                "status": "withdrawn",
            
        
    
        
        
            
                "submitted_at": new Date('2026-03-25T00:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-03-27T17:00:00Z'),
            
        
    
        
        
            
                "decision_at": new Date('2026-03-28T00:00:00Z'),
            
        
    
        
        
            
                "decision_type": "pended",
            
        
    
        
        
            
                "notes": "Draft created; awaiting final evidence attachment",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "submission_channel": "other",
            
        
    
        
        
            
                "reference_number": "FAX-NS-55219",
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "submitted_at": new Date('2026-03-20T18:20:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-03-26T17:00:00Z'),
            
        
    
        
        
            
                "decision_at": new Date('2026-03-23T14:10:00Z'),
            
        
    
        
        
            
                "decision_type": "pended",
            
        
    
        
        
            
                "notes": "Payer requested PT history and conservative management dates",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "submission_channel": "email",
            
        
    
        
        
            
                "reference_number": "UHC-REF-771020",
            
        
    
        
        
            
                "status": "additional_info_requested",
            
        
    
        
        
            
                "submitted_at": new Date('2026-03-19T16:05:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-03-30T17:00:00Z'),
            
        
    
        
        
            
                "decision_at": new Date('2026-03-21T00:00:00Z'),
            
        
    
        
        
            
                "decision_type": "approved",
            
        
    
        
        
            
                "notes": "Portal submission complete; monitoring for decision",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "submission_channel": "fax",
            
        
    
        
        
            
                "reference_number": "MCR-CALL-21877",
            
        
    
        
        
            
                "status": "withdrawn",
            
        
    
        
        
            
                "submitted_at": new Date('2026-03-20T13:55:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-03-29T17:00:00Z'),
            
        
    
        
        
            
                "decision_at": new Date('2026-03-22T00:00:00Z'),
            
        
    
        
        
            
                "decision_type": "denied",
            
        
    
        
        
            
                "notes": "Phone intake completed; rep advised 5-7 business days",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SubmissionEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "decision_received",
            
        
    
        
        
            
                "event_at": new Date('2026-03-25T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Submission draft created",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "info_sent",
            
        
    
        
        
            
                "event_at": new Date('2026-03-20T18:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Fax sent with cover sheet and notes",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "info_requested",
            
        
    
        
        
            
                "event_at": new Date('2026-03-23T14:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Payer requested PT trial details",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "decision_received",
            
        
    
        
        
            
                "event_at": new Date('2026-03-19T16:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notes": "Submitted through portal; confirmation saved",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TasksData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "task_type": "intake",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "priority": "normal",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-26T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-27T00:00:00Z'),
            
        
    
        
        
            
                "title": "Attach neuro consult note",
            
        
    
        
        
            
                "description": "Add latest consult note and symptom duration to packet",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "task_type": "intake",
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "priority": "urgent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-25T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-26T00:00:00Z'),
            
        
    
        
        
            
                "title": "Compile PT trial history",
            
        
    
        
        
            
                "description": "Document conservative management dates and outcomes",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "task_type": "follow_up",
            
        
    
        
        
            
                "status": "blocked",
            
        
    
        
        
            
                "priority": "urgent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-28T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-29T00:00:00Z'),
            
        
    
        
        
            
                "title": "Portal status check",
            
        
    
        
        
            
                "description": "Check UHC portal for decision updates and log event",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "task_type": "clinical_review",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "priority": "urgent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-03-27T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-03-28T00:00:00Z'),
            
        
    
        
        
            
                "title": "Review extraction for oncology history",
            
        
    
        
        
            
                "description": "Validate extracted staging details and correct if needed",
            
        
    
    },
    
];



const DenialsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "denial_at": new Date('2026-03-24T10:15:00Z'),
            
        
    
        
        
            
                "denial_type": "eligibility",
            
        
    
        
        
            
                "denial_reason_text": "Insufficient documentation of conservative therapy prior to MRI of lumbar spine.",
            
        
    
        
        
            
                "denial_code": "MN-THERAPY-DOC",
            
        
    
        
        
            
                "dollars_denied": 980.0,
            
        
    
        
        
            
                "status": "closed",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "denial_at": new Date('2026-03-22T09:40:00Z'),
            
        
    
        
        
            
                "denial_type": "coding",
            
        
    
        
        
            
                "denial_reason_text": "Missing ordering provider NPI on submission.",
            
        
    
        
        
            
                "denial_code": "ADM-NPI-MISSING",
            
        
    
        
        
            
                "dollars_denied": 1420.0,
            
        
    
        
        
            
                "status": "overturned",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "denial_at": new Date('2026-03-23T11:05:00Z'),
            
        
    
        
        
            
                "denial_type": "duplicate",
            
        
    
        
        
            
                "denial_reason_text": "Coverage could not be verified for date of service.",
            
        
    
        
        
            
                "denial_code": "ELIG-NOT-VERIFIED",
            
        
    
        
        
            
                "dollars_denied": 3200.0,
            
        
    
        
        
            
                "status": "overturned",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "denial_at": new Date('2026-03-26T15:30:00Z'),
            
        
    
        
        
            
                "denial_type": "medical_necessity",
            
        
    
        
        
            
                "denial_reason_text": "Procedure code mismatch with requested modality.",
            
        
    
        
        
            
                "denial_code": "COD-CPT-MISMATCH",
            
        
    
        
        
            
                "dollars_denied": 1250.0,
            
        
    
        
        
            
                "status": "overturned",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AppealsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "appeal_level": "second_level",
            
        
    
        
        
            
                "status": "denied",
            
        
    
        
        
            
                "due_at": new Date('2026-04-01T17:00:00Z'),
            
        
    
        
        
            
                "submitted_at": new Date('2026-03-28T00:00:00Z'),
            
        
    
        
        
            
                "decision_at": new Date('2026-04-05T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reviewed_at": new Date('2026-03-27T16:10:00Z'),
            
        
    
        
        
            
                "appeal_summary": "Request reconsideration with PT trial documentation and red flag review attached.",
            
        
    
        
        
            
                "export_artifact_key": "org1/appeals/appeal1_packet.pdf",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "appeal_level": "second_level",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "due_at": new Date('2026-03-29T17:00:00Z'),
            
        
    
        
        
            
                "submitted_at": new Date('2026-03-26T00:00:00Z'),
            
        
    
        
        
            
                "decision_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reviewed_at": new Date('2026-03-25T10:05:00Z'),
            
        
    
        
        
            
                "appeal_summary": "Corrected ordering provider NPI and resubmitted documentation.",
            
        
    
        
        
            
                "export_artifact_key": "org2/appeals/appeal2_packet.pdf",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "appeal_level": "other",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "due_at": new Date('2026-03-31T17:00:00Z'),
            
        
    
        
        
            
                "submitted_at": new Date('2026-03-29T00:00:00Z'),
            
        
    
        
        
            
                "decision_at": new Date('2026-04-03T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reviewed_at": new Date('2026-03-28T09:30:00Z'),
            
        
    
        
        
            
                "appeal_summary": "Peer to peer requested with eligibility verification and updated insurance details.",
            
        
    
        
        
            
                "export_artifact_key": "org3/appeals/appeal3_packet.pdf",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "appeal_level": "first_level",
            
        
    
        
        
            
                "status": "submitted",
            
        
    
        
        
            
                "due_at": new Date('2026-04-02T17:00:00Z'),
            
        
    
        
        
            
                "submitted_at": new Date('2026-03-29T13:15:00Z'),
            
        
    
        
        
            
                "decision_at": new Date('2026-04-06T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reviewed_at": new Date('2026-03-29T09:10:00Z'),
            
        
    
        
        
            
                "appeal_summary": "Clarified correct CPT and modality with updated order and supporting notes.",
            
        
    
        
        
            
                "export_artifact_key": "org1/appeals/appeal4_packet.pdf",
            
        
    
    },
    
];



const TemplatesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "template_type": "payer_fax_sheet",
            
        
    
        
        
            
                "name": "Medical Necessity Appeal Letter MRI",
            
        
    
        
        
            
                "version_label": "v1.0",
            
        
    
        
        
            
                "version_status": "draft",
            
        
    
        
        
            
                "content": "Standard medical necessity appeal with sections for clinical summary, guideline alignment, and exhibits list.",
            
        
    
        
        
            
                "effective_from": new Date('2025-10-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-10-01T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "template_type": "appeal_letter",
            
        
    
        
        
            
                "name": "UHC Fax Cover Sheet",
            
        
    
        
        
            
                "version_label": "v2.1",
            
        
    
        
        
            
                "version_status": "active",
            
        
    
        
        
            
                "content": "Cover sheet including reference number, patient identifiers, and contact callback details.",
            
        
    
        
        
            
                "effective_from": new Date('2025-06-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-06-01T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "template_type": "checklist",
            
        
    
        
        
            
                "name": "Eligibility Reconsideration Letter",
            
        
    
        
        
            
                "version_label": "v1.2",
            
        
    
        
        
            
                "version_status": "active",
            
        
    
        
        
            
                "content": "Template for eligibility disputes with enrollment proof and corrected subscriber details.",
            
        
    
        
        
            
                "effective_from": new Date('2025-08-15T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-08-15T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "template_type": "payer_fax_sheet",
            
        
    
        
        
            
                "name": "Medicaid Demographics Checklist",
            
        
    
        
        
            
                "version_label": "v1.0",
            
        
    
        
        
            
                "version_status": "archived",
            
        
    
        
        
            
                "content": "Checklist for demographic completeness and required fields for Medicaid submissions.",
            
        
    
        
        
            
                "effective_from": new Date('2025-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2027-01-01T00:00:00Z'),
            
        
    
    },
    
];



const PayerRulesData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "version_label": "BCBSIL MRI Brain v2026.01",
            
        
    
        
        
            
                "version_status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T23:59:59Z'),
            
        
    
        
        
            
                "notes": "Requires recent neuro exam and prior conservative treatment details when applicable",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "version_label": "UHC CT A/P v2025.10",
            
        
    
        
        
            
                "version_status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2025-10-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-09-30T23:59:59Z'),
            
        
    
        
        
            
                "notes": "Minimum clinical indication required; labs may be needed for contrast",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "version_label": "Medicare PET CT v2025.07",
            
        
    
        
        
            
                "version_status": "archived",
            
        
    
        
        
            
                "effective_from": new Date('2025-07-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-06-30T23:59:59Z'),
            
        
    
        
        
            
                "notes": "Oncology indication and staging documentation required",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "version_label": "Aetna MRI Spine v2025.09",
            
        
    
        
        
            
                "version_status": "active",
            
        
    
        
        
            
                "effective_from": new Date('2025-09-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-08-31T23:59:59Z'),
            
        
    
        
        
            
                "notes": "Requires conservative therapy duration unless red flags present",
            
        
    
    },
    
];



const RuleRequirementsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requirement_type": "other",
            
        
    
        
        
            
                "requirement_label": "Neuro exam within 30 days",
            
        
    
        
        
            
                "evidence_needed": "Include neuro exam note within 30 days and symptom duration.",
            
        
    
        
        
            
                "severity": "info",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requirement_type": "questionnaire",
            
        
    
        
        
            
                "requirement_label": "Ordering provider signed order",
            
        
    
        
        
            
                "evidence_needed": "Signed order with diagnosis and requested exam details.",
            
        
    
        
        
            
                "severity": "blocking",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requirement_type": "other",
            
        
    
        
        
            
                "requirement_label": "Recent creatinine for contrast",
            
        
    
        
        
            
                "evidence_needed": "Lab result within 30 days if contrast planned and risk factors present.",
            
        
    
        
        
            
                "severity": "info",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requirement_type": "questionnaire",
            
        
    
        
        
            
                "requirement_label": "Conservative therapy trial",
            
        
    
        
        
            
                "evidence_needed": "PT or conservative therapy dates, duration, and outcomes.",
            
        
    
        
        
            
                "severity": "warning",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AiJobsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_type": "field_extraction",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "prompt_text": "Extract key clinical indications and prior treatments from the note.",
            
        
    
        
        
            
                "model_ref": "gpt-4.1-mini",
            
        
    
        
        
            
                "input_json": "{document:Neuro_Visit_Notes_Taylor.pdf}",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-22T15:20:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-03-22T15:21:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-03-22T15:22:10Z'),
            
        
    
        
        
            
                "error_message": "None",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_type": "denial_reason_extraction",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "prompt_text": "Extract denial reason and required next steps from payer message.",
            
        
    
        
        
            
                "model_ref": "gpt-4.1-mini",
            
        
    
        
        
            
                "input_json": "{document:Lumbar_Spine_Notes_Nguyen.pdf}",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-23T09:05:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-03-23T09:06:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-03-23T09:07:20Z'),
            
        
    
        
        
            
                "error_message": "None",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_type": "field_extraction",
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "prompt_text": "Classify the document type and detect missing fields.",
            
        
    
        
        
            
                "model_ref": "gpt-4.1-mini",
            
        
    
        
        
            
                "input_json": "{document:UHC_PA_Form_Morgan.pdf}",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-20T11:40:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-03-20T11:41:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-03-20T11:41:55Z'),
            
        
    
        
        
            
                "error_message": "None",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_type": "document_classification",
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "prompt_text": "Extract oncology diagnosis, staging, and prior treatments.",
            
        
    
        
        
            
                "model_ref": "gpt-4.1-mini",
            
        
    
        
        
            
                "input_json": "{document:Prior_PET_Report_Rivera.pdf}",
            
        
    
        
        
            
                "queued_at": new Date('2026-03-21T16:50:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-03-21T16:51:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-03-22T00:00:00Z'),
            
        
    
        
        
            
                "error_message": "None",
            
        
    
    },
    
];



const AiOutputsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "output_type": "appeal_draft",
            
        
    
        
        
            
                "output_json": "{indication:Headaches with neurologic symptoms,duration:6 weeks,prior_treatments:[NSAIDs],red_flags:[new neurologic deficit]}",
            
        
    
        
        
            
                "confidence_score": 0.86,
            
        
    
        
        
            
                "citations_json": "[{page:2,snippet:Headaches for 6 weeks}]",
            
        
    
        
        
            
                "model_ref": "gpt-4.1-mini",
            
        
    
        
        
            
                "prompt_text": "Extract key clinical indications and prior treatments from the note.",
            
        
    
        
        
            
                "generated_at": new Date('2026-03-22T15:22:10Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "output_type": "other",
            
        
    
        
        
            
                "output_json": "{denial_reason:Insufficient PT documentation,requested_items:[PT dates,conservative management outcomes]}",
            
        
    
        
        
            
                "confidence_score": 0.91,
            
        
    
        
        
            
                "citations_json": "[{page:1,snippet:Provide PT history}]",
            
        
    
        
        
            
                "model_ref": "gpt-4.1-mini",
            
        
    
        
        
            
                "prompt_text": "Extract denial reason and required next steps from payer message.",
            
        
    
        
        
            
                "generated_at": new Date('2026-03-23T09:07:20Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "output_type": "summary",
            
        
    
        
        
            
                "output_json": "{document_type:prior_auth_form,missing_fields:[ordering_provider_npi]}",
            
        
    
        
        
            
                "confidence_score": 0.88,
            
        
    
        
        
            
                "citations_json": "[{page:1,snippet:NPI field blank}]",
            
        
    
        
        
            
                "model_ref": "gpt-4.1-mini",
            
        
    
        
        
            
                "prompt_text": "Classify the document type and detect missing fields.",
            
        
    
        
        
            
                "generated_at": new Date('2026-03-20T11:41:55Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "output_type": "summary",
            
        
    
        
        
            
                "output_json": "{diagnosis:Suspected lymphoma,staging:Pending,prior_treatments:[]}",
            
        
    
        
        
            
                "confidence_score": 0.62,
            
        
    
        
        
            
                "citations_json": "[{page:1,snippet:rule out lymphoma}]",
            
        
    
        
        
            
                "model_ref": "gpt-4.1-mini",
            
        
    
        
        
            
                "prompt_text": "Extract oncology diagnosis, staging, and prior treatments.",
            
        
    
        
        
            
                "generated_at": new Date('2026-03-21T16:55:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ReviewActionsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "action_type": "rejected",
            
        
    
        
        
            
                "correction_json": "{}",
            
        
    
        
        
            
                "notes": "Extraction aligns with note content.",
            
        
    
        
        
            
                "action_at": new Date('2026-03-22T16:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "action_type": "needs_more_info",
            
        
    
        
        
            
                "correction_json": "{}",
            
        
    
        
        
            
                "notes": "Denial reason captured correctly.",
            
        
    
        
        
            
                "action_at": new Date('2026-03-23T10:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "action_type": "needs_more_info",
            
        
    
        
        
            
                "correction_json": "{missing_fields:[ordering_provider_npi,ordering_provider_phone]}",
            
        
    
        
        
            
                "notes": "Also missing provider phone on form.",
            
        
    
        
        
            
                "action_at": new Date('2026-03-20T12:15:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "action_type": "approved",
            
        
    
        
        
            
                "correction_json": "{}",
            
        
    
        
        
            
                "notes": "Low confidence; request additional oncology note for staging.",
            
        
    
        
        
            
                "action_at": new Date('2026-03-21T17:20:00Z'),
            
        
    
    },
    
];



const AuditLogsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "create",
            
        
    
        
        
            
                "entity_name": "authorization_cases",
            
        
    
        
        
            
                "entity_key": "CASE-0001",
            
        
    
        
        
            
                "changes_json": "{stage:ready_to_submit}",
            
        
    
        
        
            
                "ip_address": "198.51.100.10",
            
        
    
        
        
            
                "user_agent": "Chrome 122 on macOS",
            
        
    
        
        
            
                "occurred_at": new Date('2026-03-22T15:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "export",
            
        
    
        
        
            
                "entity_name": "submissions",
            
        
    
        
        
            
                "entity_key": "SUB-0002",
            
        
    
        
        
            
                "changes_json": "{status:additional_info_requested}",
            
        
    
        
        
            
                "ip_address": "198.51.100.10",
            
        
    
        
        
            
                "user_agent": "Chrome 122 on macOS",
            
        
    
        
        
            
                "occurred_at": new Date('2026-03-23T14:11:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "other",
            
        
    
        
        
            
                "entity_name": "case_documents",
            
        
    
        
        
            
                "entity_key": "DOC-0004",
            
        
    
        
        
            
                "changes_json": "{document_type:prior_auth_form}",
            
        
    
        
        
            
                "ip_address": "203.0.113.44",
            
        
    
        
        
            
                "user_agent": "Edge 121 on Windows",
            
        
    
        
        
            
                "occurred_at": new Date('2026-03-20T11:35:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "other",
            
        
    
        
        
            
                "entity_name": "ai_outputs",
            
        
    
        
        
            
                "entity_key": "AIO-0004",
            
        
    
        
        
            
                "changes_json": "{review:opened}",
            
        
    
        
        
            
                "ip_address": "203.0.113.88",
            
        
    
        
        
            
                "user_agent": "Chrome 122 on Windows",
            
        
    
        
        
            
                "occurred_at": new Date('2026-03-21T17:18:00Z'),
            
        
    
    },
    
];



const IntegrationEndpointsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "fax",
            
        
    
        
        
            
                "name": "Northstar Fax Gateway",
            
        
    
        
        
            
                "base_url": "https://fax.example-integration.com",
            
        
    
        
        
            
                "auth_type": "api_key",
            
        
    
        
        
            
                "config_json": "{sender_id:NS-CHICAGO}",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "last_success_at": new Date('2026-03-22T18:10:00Z'),
            
        
    
        
        
            
                "last_failure_at": new Date('2026-03-10T08:40:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "custom",
            
        
    
        
        
            
                "name": "Summit PA Intake Inbox",
            
        
    
        
        
            
                "base_url": "imaps://mail.summitradiology.com",
            
        
    
        
        
            
                "auth_type": "basic",
            
        
    
        
        
            
                "config_json": "{mailbox:pa-intake}",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "last_success_at": new Date('2026-03-21T07:15:00Z'),
            
        
    
        
        
            
                "last_failure_at": new Date('2026-02-12T06:55:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "custom",
            
        
    
        
        
            
                "name": "Metro Status Webhook",
            
        
    
        
        
            
                "base_url": "https://api.metrodiagnostic.com/hooks/auth-status",
            
        
    
        
        
            
                "auth_type": "bearer",
            
        
    
        
        
            
                "config_json": "{events:[submission.status_changed,denial.created]}",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "last_success_at": new Date('2026-03-20T12:05:00Z'),
            
        
    
        
        
            
                "last_failure_at": new Date('2026-03-01T10:02:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "webhook",
            
        
    
        
        
            
                "name": "Lakeside Document Drop",
            
        
    
        
        
            
                "base_url": "sftp://sftp.lakesideradiology.com/inbound",
            
        
    
        
        
            
                "auth_type": "ssh_key",
            
        
    
        
        
            
                "config_json": "{folder:/inbound/prior-auth}",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                "last_success_at": new Date('2026-01-05T15:30:00Z'),
            
        
    
        
        
            
                "last_failure_at": new Date('2026-03-15T09:10:00Z'),
            
        
    
    },
    
];



const ContactsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "contact_type": "facility",
            
        
    
        
        
            
                "name": "BCBSIL Provider Services",
            
        
    
        
        
            
                "role_title": "Prior Auth Support",
            
        
    
        
        
            
                "phone": "800-555-1200",
            
        
    
        
        
            
                "email": "providerservices@bcbsil.example.com",
            
        
    
        
        
            
                "fax": "800-555-1201",
            
        
    
        
        
            
                "notes": "Use portal when available; fax only for exceptions.",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "contact_type": "patient",
            
        
    
        
        
            
                "name": "UHC Imaging Prior Auth Desk",
            
        
    
        
        
            
                "role_title": "Imaging Support",
            
        
    
        
        
            
                "phone": "877-555-2200",
            
        
    
        
        
            
                "email": "imagingauth@uhc.example.com",
            
        
    
        
        
            
                "fax": "877-555-2201",
            
        
    
        
        
            
                "notes": "Document reference number after every call.",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "contact_type": "patient",
            
        
    
        
        
            
                "name": "Aetna PA Line",
            
        
    
        
        
            
                "role_title": "Utilization Management",
            
        
    
        
        
            
                "phone": "800-555-3300",
            
        
    
        
        
            
                "email": "um@aetna.example.com",
            
        
    
        
        
            
                "fax": "800-555-3301",
            
        
    
        
        
            
                "notes": "Include ordering NPI and callback number.",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "contact_type": "provider",
            
        
    
        
        
            
                "name": "Medicare Inquiry Line",
            
        
    
        
        
            
                "role_title": "General Support",
            
        
    
        
        
            
                "phone": "800-633-4227",
            
        
    
        
        
            
                "email": "medicare@cms.example.com",
            
        
    
        
        
            
                "fax": "800-633-4228",
            
        
    
        
        
            
                "notes": "Coverage verification may require additional identifiers.",
            
        
    
        
        
            
                "active": true,
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // 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);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
            
            async function associateLocationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location0 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Location0?.setOrganization)
                {
                    await
                    Location0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location1 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Location1?.setOrganization)
                {
                    await
                    Location1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location2 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Location2?.setOrganization)
                {
                    await
                    Location2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Location3 = await Locations.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Location3?.setOrganization)
                {
                    await
                    Location3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateRoleAssignmentWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RoleAssignment0 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoleAssignment0?.setUser)
                {
                    await
                    RoleAssignment0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RoleAssignment1 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoleAssignment1?.setUser)
                {
                    await
                    RoleAssignment1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RoleAssignment2 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoleAssignment2?.setUser)
                {
                    await
                    RoleAssignment2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RoleAssignment3 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoleAssignment3?.setUser)
                {
                    await
                    RoleAssignment3.
                    setUser(relatedUser3);
                }
            
        }
        
    
        
            
            async function associateRoleAssignmentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoleAssignment0 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoleAssignment0?.setOrganization)
                {
                    await
                    RoleAssignment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoleAssignment1 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoleAssignment1?.setOrganization)
                {
                    await
                    RoleAssignment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoleAssignment2 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoleAssignment2?.setOrganization)
                {
                    await
                    RoleAssignment2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RoleAssignment3 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoleAssignment3?.setOrganization)
                {
                    await
                    RoleAssignment3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
            
            async function associateRoleAssignmentWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const RoleAssignment0 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RoleAssignment0?.setLocation)
                {
                    await
                    RoleAssignment0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const RoleAssignment1 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RoleAssignment1?.setLocation)
                {
                    await
                    RoleAssignment1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const RoleAssignment2 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RoleAssignment2?.setLocation)
                {
                    await
                    RoleAssignment2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const RoleAssignment3 = await RoleAssignments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RoleAssignment3?.setLocation)
                {
                    await
                    RoleAssignment3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePayerWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payer0 = await Payers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payer0?.setOrganization)
                {
                    await
                    Payer0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payer1 = await Payers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payer1?.setOrganization)
                {
                    await
                    Payer1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payer2 = await Payers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payer2?.setOrganization)
                {
                    await
                    Payer2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payer3 = await Payers.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payer3?.setOrganization)
                {
                    await
                    Payer3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePayerPlanWithPayer() {
            
                const relatedPayer0 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const PayerPlan0 = await PayerPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PayerPlan0?.setPayer)
                {
                    await
                    PayerPlan0.
                    setPayer(relatedPayer0);
                }
            
                const relatedPayer1 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const PayerPlan1 = await PayerPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PayerPlan1?.setPayer)
                {
                    await
                    PayerPlan1.
                    setPayer(relatedPayer1);
                }
            
                const relatedPayer2 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const PayerPlan2 = await PayerPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PayerPlan2?.setPayer)
                {
                    await
                    PayerPlan2.
                    setPayer(relatedPayer2);
                }
            
                const relatedPayer3 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const PayerPlan3 = await PayerPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PayerPlan3?.setPayer)
                {
                    await
                    PayerPlan3.
                    setPayer(relatedPayer3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePayerPlanWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PayerPlan0 = await PayerPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PayerPlan0?.setOrganization)
                {
                    await
                    PayerPlan0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PayerPlan1 = await PayerPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PayerPlan1?.setOrganization)
                {
                    await
                    PayerPlan1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PayerPlan2 = await PayerPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PayerPlan2?.setOrganization)
                {
                    await
                    PayerPlan2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PayerPlan3 = await PayerPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PayerPlan3?.setOrganization)
                {
                    await
                    PayerPlan3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateProcedureFamilyWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProcedureFamily0 = await ProcedureFamilies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ProcedureFamily0?.setOrganization)
                {
                    await
                    ProcedureFamily0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProcedureFamily1 = await ProcedureFamilies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ProcedureFamily1?.setOrganization)
                {
                    await
                    ProcedureFamily1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProcedureFamily2 = await ProcedureFamilies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ProcedureFamily2?.setOrganization)
                {
                    await
                    ProcedureFamily2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ProcedureFamily3 = await ProcedureFamilies.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ProcedureFamily3?.setOrganization)
                {
                    await
                    ProcedureFamily3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateCptCodeWithProcedure_family() {
            
                const relatedProcedure_family0 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const CptCode0 = await CptCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CptCode0?.setProcedure_family)
                {
                    await
                    CptCode0.
                    setProcedure_family(relatedProcedure_family0);
                }
            
                const relatedProcedure_family1 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const CptCode1 = await CptCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CptCode1?.setProcedure_family)
                {
                    await
                    CptCode1.
                    setProcedure_family(relatedProcedure_family1);
                }
            
                const relatedProcedure_family2 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const CptCode2 = await CptCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CptCode2?.setProcedure_family)
                {
                    await
                    CptCode2.
                    setProcedure_family(relatedProcedure_family2);
                }
            
                const relatedProcedure_family3 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const CptCode3 = await CptCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CptCode3?.setProcedure_family)
                {
                    await
                    CptCode3.
                    setProcedure_family(relatedProcedure_family3);
                }
            
        }
        
    
        
    
        
            
            async function associateCptCodeWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CptCode0 = await CptCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CptCode0?.setOrganization)
                {
                    await
                    CptCode0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CptCode1 = await CptCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CptCode1?.setOrganization)
                {
                    await
                    CptCode1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CptCode2 = await CptCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CptCode2?.setOrganization)
                {
                    await
                    CptCode2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CptCode3 = await CptCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CptCode3?.setOrganization)
                {
                    await
                    CptCode3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePatientWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Patient0 = await Patients.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Patient0?.setOrganization)
                {
                    await
                    Patient0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Patient1 = await Patients.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Patient1?.setOrganization)
                {
                    await
                    Patient1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Patient2 = await Patients.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Patient2?.setOrganization)
                {
                    await
                    Patient2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Patient3 = await Patients.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Patient3?.setOrganization)
                {
                    await
                    Patient3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAuthorizationCasWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuthorizationCas0 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuthorizationCas0?.setOrganization)
                {
                    await
                    AuthorizationCas0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuthorizationCas1 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuthorizationCas1?.setOrganization)
                {
                    await
                    AuthorizationCas1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuthorizationCas2 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuthorizationCas2?.setOrganization)
                {
                    await
                    AuthorizationCas2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuthorizationCas3 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuthorizationCas3?.setOrganization)
                {
                    await
                    AuthorizationCas3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
            
            async function associateAuthorizationCasWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const AuthorizationCas0 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuthorizationCas0?.setLocation)
                {
                    await
                    AuthorizationCas0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const AuthorizationCas1 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuthorizationCas1?.setLocation)
                {
                    await
                    AuthorizationCas1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const AuthorizationCas2 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuthorizationCas2?.setLocation)
                {
                    await
                    AuthorizationCas2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const AuthorizationCas3 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuthorizationCas3?.setLocation)
                {
                    await
                    AuthorizationCas3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
            
            async function associateAuthorizationCasWithPatient() {
            
                const relatedPatient0 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const AuthorizationCas0 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuthorizationCas0?.setPatient)
                {
                    await
                    AuthorizationCas0.
                    setPatient(relatedPatient0);
                }
            
                const relatedPatient1 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const AuthorizationCas1 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuthorizationCas1?.setPatient)
                {
                    await
                    AuthorizationCas1.
                    setPatient(relatedPatient1);
                }
            
                const relatedPatient2 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const AuthorizationCas2 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuthorizationCas2?.setPatient)
                {
                    await
                    AuthorizationCas2.
                    setPatient(relatedPatient2);
                }
            
                const relatedPatient3 = await Patients.findOne({
                    offset: Math.floor(Math.random() * (await Patients.count())),
                });
                const AuthorizationCas3 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuthorizationCas3?.setPatient)
                {
                    await
                    AuthorizationCas3.
                    setPatient(relatedPatient3);
                }
            
        }
        
    
        
            
            async function associateAuthorizationCasWithPayer_plan() {
            
                const relatedPayer_plan0 = await PayerPlans.findOne({
                    offset: Math.floor(Math.random() * (await PayerPlans.count())),
                });
                const AuthorizationCas0 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuthorizationCas0?.setPayer_plan)
                {
                    await
                    AuthorizationCas0.
                    setPayer_plan(relatedPayer_plan0);
                }
            
                const relatedPayer_plan1 = await PayerPlans.findOne({
                    offset: Math.floor(Math.random() * (await PayerPlans.count())),
                });
                const AuthorizationCas1 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuthorizationCas1?.setPayer_plan)
                {
                    await
                    AuthorizationCas1.
                    setPayer_plan(relatedPayer_plan1);
                }
            
                const relatedPayer_plan2 = await PayerPlans.findOne({
                    offset: Math.floor(Math.random() * (await PayerPlans.count())),
                });
                const AuthorizationCas2 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuthorizationCas2?.setPayer_plan)
                {
                    await
                    AuthorizationCas2.
                    setPayer_plan(relatedPayer_plan2);
                }
            
                const relatedPayer_plan3 = await PayerPlans.findOne({
                    offset: Math.floor(Math.random() * (await PayerPlans.count())),
                });
                const AuthorizationCas3 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuthorizationCas3?.setPayer_plan)
                {
                    await
                    AuthorizationCas3.
                    setPayer_plan(relatedPayer_plan3);
                }
            
        }
        
    
        
            
            async function associateAuthorizationCasWithCpt_code() {
            
                const relatedCpt_code0 = await CptCodes.findOne({
                    offset: Math.floor(Math.random() * (await CptCodes.count())),
                });
                const AuthorizationCas0 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuthorizationCas0?.setCpt_code)
                {
                    await
                    AuthorizationCas0.
                    setCpt_code(relatedCpt_code0);
                }
            
                const relatedCpt_code1 = await CptCodes.findOne({
                    offset: Math.floor(Math.random() * (await CptCodes.count())),
                });
                const AuthorizationCas1 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuthorizationCas1?.setCpt_code)
                {
                    await
                    AuthorizationCas1.
                    setCpt_code(relatedCpt_code1);
                }
            
                const relatedCpt_code2 = await CptCodes.findOne({
                    offset: Math.floor(Math.random() * (await CptCodes.count())),
                });
                const AuthorizationCas2 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuthorizationCas2?.setCpt_code)
                {
                    await
                    AuthorizationCas2.
                    setCpt_code(relatedCpt_code2);
                }
            
                const relatedCpt_code3 = await CptCodes.findOne({
                    offset: Math.floor(Math.random() * (await CptCodes.count())),
                });
                const AuthorizationCas3 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuthorizationCas3?.setCpt_code)
                {
                    await
                    AuthorizationCas3.
                    setCpt_code(relatedCpt_code3);
                }
            
        }
        
    
        
            
            async function associateAuthorizationCasWithProcedure_family() {
            
                const relatedProcedure_family0 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const AuthorizationCas0 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuthorizationCas0?.setProcedure_family)
                {
                    await
                    AuthorizationCas0.
                    setProcedure_family(relatedProcedure_family0);
                }
            
                const relatedProcedure_family1 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const AuthorizationCas1 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuthorizationCas1?.setProcedure_family)
                {
                    await
                    AuthorizationCas1.
                    setProcedure_family(relatedProcedure_family1);
                }
            
                const relatedProcedure_family2 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const AuthorizationCas2 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuthorizationCas2?.setProcedure_family)
                {
                    await
                    AuthorizationCas2.
                    setProcedure_family(relatedProcedure_family2);
                }
            
                const relatedProcedure_family3 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const AuthorizationCas3 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuthorizationCas3?.setProcedure_family)
                {
                    await
                    AuthorizationCas3.
                    setProcedure_family(relatedProcedure_family3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAuthorizationCasWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuthorizationCas0 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuthorizationCas0?.setOwner_user)
                {
                    await
                    AuthorizationCas0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuthorizationCas1 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuthorizationCas1?.setOwner_user)
                {
                    await
                    AuthorizationCas1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuthorizationCas2 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuthorizationCas2?.setOwner_user)
                {
                    await
                    AuthorizationCas2.
                    setOwner_user(relatedOwner_user2);
                }
            
                const relatedOwner_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuthorizationCas3 = await AuthorizationCases.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuthorizationCas3?.setOwner_user)
                {
                    await
                    AuthorizationCas3.
                    setOwner_user(relatedOwner_user3);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateCaseDocumentWithAuthorization_case() {
            
                const relatedAuthorization_case0 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const CaseDocument0 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CaseDocument0?.setAuthorization_case)
                {
                    await
                    CaseDocument0.
                    setAuthorization_case(relatedAuthorization_case0);
                }
            
                const relatedAuthorization_case1 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const CaseDocument1 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CaseDocument1?.setAuthorization_case)
                {
                    await
                    CaseDocument1.
                    setAuthorization_case(relatedAuthorization_case1);
                }
            
                const relatedAuthorization_case2 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const CaseDocument2 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CaseDocument2?.setAuthorization_case)
                {
                    await
                    CaseDocument2.
                    setAuthorization_case(relatedAuthorization_case2);
                }
            
                const relatedAuthorization_case3 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const CaseDocument3 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CaseDocument3?.setAuthorization_case)
                {
                    await
                    CaseDocument3.
                    setAuthorization_case(relatedAuthorization_case3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCaseDocumentWithUploaded_by_user() {
            
                const relatedUploaded_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CaseDocument0 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CaseDocument0?.setUploaded_by_user)
                {
                    await
                    CaseDocument0.
                    setUploaded_by_user(relatedUploaded_by_user0);
                }
            
                const relatedUploaded_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CaseDocument1 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CaseDocument1?.setUploaded_by_user)
                {
                    await
                    CaseDocument1.
                    setUploaded_by_user(relatedUploaded_by_user1);
                }
            
                const relatedUploaded_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CaseDocument2 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CaseDocument2?.setUploaded_by_user)
                {
                    await
                    CaseDocument2.
                    setUploaded_by_user(relatedUploaded_by_user2);
                }
            
                const relatedUploaded_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CaseDocument3 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CaseDocument3?.setUploaded_by_user)
                {
                    await
                    CaseDocument3.
                    setUploaded_by_user(relatedUploaded_by_user3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateCaseDocumentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CaseDocument0 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CaseDocument0?.setOrganization)
                {
                    await
                    CaseDocument0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CaseDocument1 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CaseDocument1?.setOrganization)
                {
                    await
                    CaseDocument1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CaseDocument2 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CaseDocument2?.setOrganization)
                {
                    await
                    CaseDocument2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CaseDocument3 = await CaseDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CaseDocument3?.setOrganization)
                {
                    await
                    CaseDocument3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSubmissionWithAuthorization_case() {
            
                const relatedAuthorization_case0 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Submission0 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Submission0?.setAuthorization_case)
                {
                    await
                    Submission0.
                    setAuthorization_case(relatedAuthorization_case0);
                }
            
                const relatedAuthorization_case1 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Submission1 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Submission1?.setAuthorization_case)
                {
                    await
                    Submission1.
                    setAuthorization_case(relatedAuthorization_case1);
                }
            
                const relatedAuthorization_case2 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Submission2 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Submission2?.setAuthorization_case)
                {
                    await
                    Submission2.
                    setAuthorization_case(relatedAuthorization_case2);
                }
            
                const relatedAuthorization_case3 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Submission3 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Submission3?.setAuthorization_case)
                {
                    await
                    Submission3.
                    setAuthorization_case(relatedAuthorization_case3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSubmissionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Submission0 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Submission0?.setOrganization)
                {
                    await
                    Submission0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Submission1 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Submission1?.setOrganization)
                {
                    await
                    Submission1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Submission2 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Submission2?.setOrganization)
                {
                    await
                    Submission2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Submission3 = await Submissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Submission3?.setOrganization)
                {
                    await
                    Submission3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSubmissionEventWithSubmission() {
            
                const relatedSubmission0 = await Submissions.findOne({
                    offset: Math.floor(Math.random() * (await Submissions.count())),
                });
                const SubmissionEvent0 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SubmissionEvent0?.setSubmission)
                {
                    await
                    SubmissionEvent0.
                    setSubmission(relatedSubmission0);
                }
            
                const relatedSubmission1 = await Submissions.findOne({
                    offset: Math.floor(Math.random() * (await Submissions.count())),
                });
                const SubmissionEvent1 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SubmissionEvent1?.setSubmission)
                {
                    await
                    SubmissionEvent1.
                    setSubmission(relatedSubmission1);
                }
            
                const relatedSubmission2 = await Submissions.findOne({
                    offset: Math.floor(Math.random() * (await Submissions.count())),
                });
                const SubmissionEvent2 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SubmissionEvent2?.setSubmission)
                {
                    await
                    SubmissionEvent2.
                    setSubmission(relatedSubmission2);
                }
            
                const relatedSubmission3 = await Submissions.findOne({
                    offset: Math.floor(Math.random() * (await Submissions.count())),
                });
                const SubmissionEvent3 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SubmissionEvent3?.setSubmission)
                {
                    await
                    SubmissionEvent3.
                    setSubmission(relatedSubmission3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateSubmissionEventWithActor_user() {
            
                const relatedActor_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SubmissionEvent0 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SubmissionEvent0?.setActor_user)
                {
                    await
                    SubmissionEvent0.
                    setActor_user(relatedActor_user0);
                }
            
                const relatedActor_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SubmissionEvent1 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SubmissionEvent1?.setActor_user)
                {
                    await
                    SubmissionEvent1.
                    setActor_user(relatedActor_user1);
                }
            
                const relatedActor_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SubmissionEvent2 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SubmissionEvent2?.setActor_user)
                {
                    await
                    SubmissionEvent2.
                    setActor_user(relatedActor_user2);
                }
            
                const relatedActor_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SubmissionEvent3 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SubmissionEvent3?.setActor_user)
                {
                    await
                    SubmissionEvent3.
                    setActor_user(relatedActor_user3);
                }
            
        }
        
    
        
    
        
            
            async function associateSubmissionEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SubmissionEvent0 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SubmissionEvent0?.setOrganization)
                {
                    await
                    SubmissionEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SubmissionEvent1 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SubmissionEvent1?.setOrganization)
                {
                    await
                    SubmissionEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SubmissionEvent2 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SubmissionEvent2?.setOrganization)
                {
                    await
                    SubmissionEvent2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SubmissionEvent3 = await SubmissionEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SubmissionEvent3?.setOrganization)
                {
                    await
                    SubmissionEvent3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            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);
                }
            
        }
        
    
        
            
            async function associateTaskWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setLocation)
                {
                    await
                    Task0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setLocation)
                {
                    await
                    Task1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setLocation)
                {
                    await
                    Task2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setLocation)
                {
                    await
                    Task3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
            
            async function associateTaskWithAuthorization_case() {
            
                const relatedAuthorization_case0 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setAuthorization_case)
                {
                    await
                    Task0.
                    setAuthorization_case(relatedAuthorization_case0);
                }
            
                const relatedAuthorization_case1 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setAuthorization_case)
                {
                    await
                    Task1.
                    setAuthorization_case(relatedAuthorization_case1);
                }
            
                const relatedAuthorization_case2 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setAuthorization_case)
                {
                    await
                    Task2.
                    setAuthorization_case(relatedAuthorization_case2);
                }
            
                const relatedAuthorization_case3 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setAuthorization_case)
                {
                    await
                    Task3.
                    setAuthorization_case(relatedAuthorization_case3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateTaskWithAssigned_to_user() {
            
                const relatedAssigned_to_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setAssigned_to_user)
                {
                    await
                    Task0.
                    setAssigned_to_user(relatedAssigned_to_user0);
                }
            
                const relatedAssigned_to_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setAssigned_to_user)
                {
                    await
                    Task1.
                    setAssigned_to_user(relatedAssigned_to_user1);
                }
            
                const relatedAssigned_to_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setAssigned_to_user)
                {
                    await
                    Task2.
                    setAssigned_to_user(relatedAssigned_to_user2);
                }
            
                const relatedAssigned_to_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setAssigned_to_user)
                {
                    await
                    Task3.
                    setAssigned_to_user(relatedAssigned_to_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateDenialWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Denial0 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Denial0?.setOrganization)
                {
                    await
                    Denial0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Denial1 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Denial1?.setOrganization)
                {
                    await
                    Denial1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Denial2 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Denial2?.setOrganization)
                {
                    await
                    Denial2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Denial3 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Denial3?.setOrganization)
                {
                    await
                    Denial3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
            
            async function associateDenialWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Denial0 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Denial0?.setLocation)
                {
                    await
                    Denial0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Denial1 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Denial1?.setLocation)
                {
                    await
                    Denial1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Denial2 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Denial2?.setLocation)
                {
                    await
                    Denial2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Denial3 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Denial3?.setLocation)
                {
                    await
                    Denial3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
            
            async function associateDenialWithAuthorization_case() {
            
                const relatedAuthorization_case0 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Denial0 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Denial0?.setAuthorization_case)
                {
                    await
                    Denial0.
                    setAuthorization_case(relatedAuthorization_case0);
                }
            
                const relatedAuthorization_case1 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Denial1 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Denial1?.setAuthorization_case)
                {
                    await
                    Denial1.
                    setAuthorization_case(relatedAuthorization_case1);
                }
            
                const relatedAuthorization_case2 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Denial2 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Denial2?.setAuthorization_case)
                {
                    await
                    Denial2.
                    setAuthorization_case(relatedAuthorization_case2);
                }
            
                const relatedAuthorization_case3 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const Denial3 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Denial3?.setAuthorization_case)
                {
                    await
                    Denial3.
                    setAuthorization_case(relatedAuthorization_case3);
                }
            
        }
        
    
        
            
            async function associateDenialWithSubmission() {
            
                const relatedSubmission0 = await Submissions.findOne({
                    offset: Math.floor(Math.random() * (await Submissions.count())),
                });
                const Denial0 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Denial0?.setSubmission)
                {
                    await
                    Denial0.
                    setSubmission(relatedSubmission0);
                }
            
                const relatedSubmission1 = await Submissions.findOne({
                    offset: Math.floor(Math.random() * (await Submissions.count())),
                });
                const Denial1 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Denial1?.setSubmission)
                {
                    await
                    Denial1.
                    setSubmission(relatedSubmission1);
                }
            
                const relatedSubmission2 = await Submissions.findOne({
                    offset: Math.floor(Math.random() * (await Submissions.count())),
                });
                const Denial2 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Denial2?.setSubmission)
                {
                    await
                    Denial2.
                    setSubmission(relatedSubmission2);
                }
            
                const relatedSubmission3 = await Submissions.findOne({
                    offset: Math.floor(Math.random() * (await Submissions.count())),
                });
                const Denial3 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Denial3?.setSubmission)
                {
                    await
                    Denial3.
                    setSubmission(relatedSubmission3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDenialWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Denial0 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Denial0?.setOwner_user)
                {
                    await
                    Denial0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Denial1 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Denial1?.setOwner_user)
                {
                    await
                    Denial1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Denial2 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Denial2?.setOwner_user)
                {
                    await
                    Denial2.
                    setOwner_user(relatedOwner_user2);
                }
            
                const relatedOwner_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Denial3 = await Denials.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Denial3?.setOwner_user)
                {
                    await
                    Denial3.
                    setOwner_user(relatedOwner_user3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAppealWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Appeal0 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Appeal0?.setOrganization)
                {
                    await
                    Appeal0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Appeal1 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Appeal1?.setOrganization)
                {
                    await
                    Appeal1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Appeal2 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Appeal2?.setOrganization)
                {
                    await
                    Appeal2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Appeal3 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Appeal3?.setOrganization)
                {
                    await
                    Appeal3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
            
            async function associateAppealWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Appeal0 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Appeal0?.setLocation)
                {
                    await
                    Appeal0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Appeal1 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Appeal1?.setLocation)
                {
                    await
                    Appeal1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Appeal2 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Appeal2?.setLocation)
                {
                    await
                    Appeal2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Appeal3 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Appeal3?.setLocation)
                {
                    await
                    Appeal3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
            
            async function associateAppealWithDenial() {
            
                const relatedDenial0 = await Denials.findOne({
                    offset: Math.floor(Math.random() * (await Denials.count())),
                });
                const Appeal0 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Appeal0?.setDenial)
                {
                    await
                    Appeal0.
                    setDenial(relatedDenial0);
                }
            
                const relatedDenial1 = await Denials.findOne({
                    offset: Math.floor(Math.random() * (await Denials.count())),
                });
                const Appeal1 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Appeal1?.setDenial)
                {
                    await
                    Appeal1.
                    setDenial(relatedDenial1);
                }
            
                const relatedDenial2 = await Denials.findOne({
                    offset: Math.floor(Math.random() * (await Denials.count())),
                });
                const Appeal2 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Appeal2?.setDenial)
                {
                    await
                    Appeal2.
                    setDenial(relatedDenial2);
                }
            
                const relatedDenial3 = await Denials.findOne({
                    offset: Math.floor(Math.random() * (await Denials.count())),
                });
                const Appeal3 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Appeal3?.setDenial)
                {
                    await
                    Appeal3.
                    setDenial(relatedDenial3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAppealWithTemplate() {
            
                const relatedTemplate0 = await Templates.findOne({
                    offset: Math.floor(Math.random() * (await Templates.count())),
                });
                const Appeal0 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Appeal0?.setTemplate)
                {
                    await
                    Appeal0.
                    setTemplate(relatedTemplate0);
                }
            
                const relatedTemplate1 = await Templates.findOne({
                    offset: Math.floor(Math.random() * (await Templates.count())),
                });
                const Appeal1 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Appeal1?.setTemplate)
                {
                    await
                    Appeal1.
                    setTemplate(relatedTemplate1);
                }
            
                const relatedTemplate2 = await Templates.findOne({
                    offset: Math.floor(Math.random() * (await Templates.count())),
                });
                const Appeal2 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Appeal2?.setTemplate)
                {
                    await
                    Appeal2.
                    setTemplate(relatedTemplate2);
                }
            
                const relatedTemplate3 = await Templates.findOne({
                    offset: Math.floor(Math.random() * (await Templates.count())),
                });
                const Appeal3 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Appeal3?.setTemplate)
                {
                    await
                    Appeal3.
                    setTemplate(relatedTemplate3);
                }
            
        }
        
    
        
            
            async function associateAppealWithReviewed_by_user() {
            
                const relatedReviewed_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Appeal0 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Appeal0?.setReviewed_by_user)
                {
                    await
                    Appeal0.
                    setReviewed_by_user(relatedReviewed_by_user0);
                }
            
                const relatedReviewed_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Appeal1 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Appeal1?.setReviewed_by_user)
                {
                    await
                    Appeal1.
                    setReviewed_by_user(relatedReviewed_by_user1);
                }
            
                const relatedReviewed_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Appeal2 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Appeal2?.setReviewed_by_user)
                {
                    await
                    Appeal2.
                    setReviewed_by_user(relatedReviewed_by_user2);
                }
            
                const relatedReviewed_by_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Appeal3 = await Appeals.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Appeal3?.setReviewed_by_user)
                {
                    await
                    Appeal3.
                    setReviewed_by_user(relatedReviewed_by_user3);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTemplateWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Template0 = await Templates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Template0?.setOrganization)
                {
                    await
                    Template0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Template1 = await Templates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Template1?.setOrganization)
                {
                    await
                    Template1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Template2 = await Templates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Template2?.setOrganization)
                {
                    await
                    Template2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Template3 = await Templates.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Template3?.setOrganization)
                {
                    await
                    Template3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associatePayerRuleWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PayerRule0 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PayerRule0?.setOrganization)
                {
                    await
                    PayerRule0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PayerRule1 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PayerRule1?.setOrganization)
                {
                    await
                    PayerRule1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PayerRule2 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PayerRule2?.setOrganization)
                {
                    await
                    PayerRule2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PayerRule3 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PayerRule3?.setOrganization)
                {
                    await
                    PayerRule3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
            
            async function associatePayerRuleWithPayer() {
            
                const relatedPayer0 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const PayerRule0 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PayerRule0?.setPayer)
                {
                    await
                    PayerRule0.
                    setPayer(relatedPayer0);
                }
            
                const relatedPayer1 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const PayerRule1 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PayerRule1?.setPayer)
                {
                    await
                    PayerRule1.
                    setPayer(relatedPayer1);
                }
            
                const relatedPayer2 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const PayerRule2 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PayerRule2?.setPayer)
                {
                    await
                    PayerRule2.
                    setPayer(relatedPayer2);
                }
            
                const relatedPayer3 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const PayerRule3 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PayerRule3?.setPayer)
                {
                    await
                    PayerRule3.
                    setPayer(relatedPayer3);
                }
            
        }
        
    
        
            
            async function associatePayerRuleWithPayer_plan() {
            
                const relatedPayer_plan0 = await PayerPlans.findOne({
                    offset: Math.floor(Math.random() * (await PayerPlans.count())),
                });
                const PayerRule0 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PayerRule0?.setPayer_plan)
                {
                    await
                    PayerRule0.
                    setPayer_plan(relatedPayer_plan0);
                }
            
                const relatedPayer_plan1 = await PayerPlans.findOne({
                    offset: Math.floor(Math.random() * (await PayerPlans.count())),
                });
                const PayerRule1 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PayerRule1?.setPayer_plan)
                {
                    await
                    PayerRule1.
                    setPayer_plan(relatedPayer_plan1);
                }
            
                const relatedPayer_plan2 = await PayerPlans.findOne({
                    offset: Math.floor(Math.random() * (await PayerPlans.count())),
                });
                const PayerRule2 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PayerRule2?.setPayer_plan)
                {
                    await
                    PayerRule2.
                    setPayer_plan(relatedPayer_plan2);
                }
            
                const relatedPayer_plan3 = await PayerPlans.findOne({
                    offset: Math.floor(Math.random() * (await PayerPlans.count())),
                });
                const PayerRule3 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PayerRule3?.setPayer_plan)
                {
                    await
                    PayerRule3.
                    setPayer_plan(relatedPayer_plan3);
                }
            
        }
        
    
        
            
            async function associatePayerRuleWithProcedure_family() {
            
                const relatedProcedure_family0 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const PayerRule0 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PayerRule0?.setProcedure_family)
                {
                    await
                    PayerRule0.
                    setProcedure_family(relatedProcedure_family0);
                }
            
                const relatedProcedure_family1 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const PayerRule1 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PayerRule1?.setProcedure_family)
                {
                    await
                    PayerRule1.
                    setProcedure_family(relatedProcedure_family1);
                }
            
                const relatedProcedure_family2 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const PayerRule2 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PayerRule2?.setProcedure_family)
                {
                    await
                    PayerRule2.
                    setProcedure_family(relatedProcedure_family2);
                }
            
                const relatedProcedure_family3 = await ProcedureFamilies.findOne({
                    offset: Math.floor(Math.random() * (await ProcedureFamilies.count())),
                });
                const PayerRule3 = await PayerRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (PayerRule3?.setProcedure_family)
                {
                    await
                    PayerRule3.
                    setProcedure_family(relatedProcedure_family3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateRuleRequirementWithPayer_rule() {
            
                const relatedPayer_rule0 = await PayerRules.findOne({
                    offset: Math.floor(Math.random() * (await PayerRules.count())),
                });
                const RuleRequirement0 = await RuleRequirements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RuleRequirement0?.setPayer_rule)
                {
                    await
                    RuleRequirement0.
                    setPayer_rule(relatedPayer_rule0);
                }
            
                const relatedPayer_rule1 = await PayerRules.findOne({
                    offset: Math.floor(Math.random() * (await PayerRules.count())),
                });
                const RuleRequirement1 = await RuleRequirements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RuleRequirement1?.setPayer_rule)
                {
                    await
                    RuleRequirement1.
                    setPayer_rule(relatedPayer_rule1);
                }
            
                const relatedPayer_rule2 = await PayerRules.findOne({
                    offset: Math.floor(Math.random() * (await PayerRules.count())),
                });
                const RuleRequirement2 = await RuleRequirements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RuleRequirement2?.setPayer_rule)
                {
                    await
                    RuleRequirement2.
                    setPayer_rule(relatedPayer_rule2);
                }
            
                const relatedPayer_rule3 = await PayerRules.findOne({
                    offset: Math.floor(Math.random() * (await PayerRules.count())),
                });
                const RuleRequirement3 = await RuleRequirements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RuleRequirement3?.setPayer_rule)
                {
                    await
                    RuleRequirement3.
                    setPayer_rule(relatedPayer_rule3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateRuleRequirementWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RuleRequirement0 = await RuleRequirements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RuleRequirement0?.setOrganization)
                {
                    await
                    RuleRequirement0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RuleRequirement1 = await RuleRequirements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RuleRequirement1?.setOrganization)
                {
                    await
                    RuleRequirement1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RuleRequirement2 = await RuleRequirements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RuleRequirement2?.setOrganization)
                {
                    await
                    RuleRequirement2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RuleRequirement3 = await RuleRequirements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (RuleRequirement3?.setOrganization)
                {
                    await
                    RuleRequirement3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAiJobWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiJob0 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiJob0?.setOrganization)
                {
                    await
                    AiJob0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiJob1 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiJob1?.setOrganization)
                {
                    await
                    AiJob1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiJob2 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiJob2?.setOrganization)
                {
                    await
                    AiJob2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiJob3 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiJob3?.setOrganization)
                {
                    await
                    AiJob3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
            
            async function associateAiJobWithAuthorization_case() {
            
                const relatedAuthorization_case0 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const AiJob0 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiJob0?.setAuthorization_case)
                {
                    await
                    AiJob0.
                    setAuthorization_case(relatedAuthorization_case0);
                }
            
                const relatedAuthorization_case1 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const AiJob1 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiJob1?.setAuthorization_case)
                {
                    await
                    AiJob1.
                    setAuthorization_case(relatedAuthorization_case1);
                }
            
                const relatedAuthorization_case2 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const AiJob2 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiJob2?.setAuthorization_case)
                {
                    await
                    AiJob2.
                    setAuthorization_case(relatedAuthorization_case2);
                }
            
                const relatedAuthorization_case3 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const AiJob3 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiJob3?.setAuthorization_case)
                {
                    await
                    AiJob3.
                    setAuthorization_case(relatedAuthorization_case3);
                }
            
        }
        
    
        
            
            async function associateAiJobWithCase_document() {
            
                const relatedCase_document0 = await CaseDocuments.findOne({
                    offset: Math.floor(Math.random() * (await CaseDocuments.count())),
                });
                const AiJob0 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiJob0?.setCase_document)
                {
                    await
                    AiJob0.
                    setCase_document(relatedCase_document0);
                }
            
                const relatedCase_document1 = await CaseDocuments.findOne({
                    offset: Math.floor(Math.random() * (await CaseDocuments.count())),
                });
                const AiJob1 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiJob1?.setCase_document)
                {
                    await
                    AiJob1.
                    setCase_document(relatedCase_document1);
                }
            
                const relatedCase_document2 = await CaseDocuments.findOne({
                    offset: Math.floor(Math.random() * (await CaseDocuments.count())),
                });
                const AiJob2 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiJob2?.setCase_document)
                {
                    await
                    AiJob2.
                    setCase_document(relatedCase_document2);
                }
            
                const relatedCase_document3 = await CaseDocuments.findOne({
                    offset: Math.floor(Math.random() * (await CaseDocuments.count())),
                });
                const AiJob3 = await AiJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiJob3?.setCase_document)
                {
                    await
                    AiJob3.
                    setCase_document(relatedCase_document3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAiOutputWithAi_job() {
            
                const relatedAi_job0 = await AiJobs.findOne({
                    offset: Math.floor(Math.random() * (await AiJobs.count())),
                });
                const AiOutput0 = await AiOutputs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiOutput0?.setAi_job)
                {
                    await
                    AiOutput0.
                    setAi_job(relatedAi_job0);
                }
            
                const relatedAi_job1 = await AiJobs.findOne({
                    offset: Math.floor(Math.random() * (await AiJobs.count())),
                });
                const AiOutput1 = await AiOutputs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiOutput1?.setAi_job)
                {
                    await
                    AiOutput1.
                    setAi_job(relatedAi_job1);
                }
            
                const relatedAi_job2 = await AiJobs.findOne({
                    offset: Math.floor(Math.random() * (await AiJobs.count())),
                });
                const AiOutput2 = await AiOutputs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiOutput2?.setAi_job)
                {
                    await
                    AiOutput2.
                    setAi_job(relatedAi_job2);
                }
            
                const relatedAi_job3 = await AiJobs.findOne({
                    offset: Math.floor(Math.random() * (await AiJobs.count())),
                });
                const AiOutput3 = await AiOutputs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiOutput3?.setAi_job)
                {
                    await
                    AiOutput3.
                    setAi_job(relatedAi_job3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAiOutputWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiOutput0 = await AiOutputs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiOutput0?.setOrganization)
                {
                    await
                    AiOutput0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiOutput1 = await AiOutputs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiOutput1?.setOrganization)
                {
                    await
                    AiOutput1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiOutput2 = await AiOutputs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiOutput2?.setOrganization)
                {
                    await
                    AiOutput2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiOutput3 = await AiOutputs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiOutput3?.setOrganization)
                {
                    await
                    AiOutput3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateReviewActionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReviewAction0 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReviewAction0?.setOrganization)
                {
                    await
                    ReviewAction0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReviewAction1 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReviewAction1?.setOrganization)
                {
                    await
                    ReviewAction1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReviewAction2 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReviewAction2?.setOrganization)
                {
                    await
                    ReviewAction2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReviewAction3 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ReviewAction3?.setOrganization)
                {
                    await
                    ReviewAction3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
            
            async function associateReviewActionWithAuthorization_case() {
            
                const relatedAuthorization_case0 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const ReviewAction0 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReviewAction0?.setAuthorization_case)
                {
                    await
                    ReviewAction0.
                    setAuthorization_case(relatedAuthorization_case0);
                }
            
                const relatedAuthorization_case1 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const ReviewAction1 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReviewAction1?.setAuthorization_case)
                {
                    await
                    ReviewAction1.
                    setAuthorization_case(relatedAuthorization_case1);
                }
            
                const relatedAuthorization_case2 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const ReviewAction2 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReviewAction2?.setAuthorization_case)
                {
                    await
                    ReviewAction2.
                    setAuthorization_case(relatedAuthorization_case2);
                }
            
                const relatedAuthorization_case3 = await AuthorizationCases.findOne({
                    offset: Math.floor(Math.random() * (await AuthorizationCases.count())),
                });
                const ReviewAction3 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ReviewAction3?.setAuthorization_case)
                {
                    await
                    ReviewAction3.
                    setAuthorization_case(relatedAuthorization_case3);
                }
            
        }
        
    
        
            
            async function associateReviewActionWithAi_output() {
            
                const relatedAi_output0 = await AiOutputs.findOne({
                    offset: Math.floor(Math.random() * (await AiOutputs.count())),
                });
                const ReviewAction0 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReviewAction0?.setAi_output)
                {
                    await
                    ReviewAction0.
                    setAi_output(relatedAi_output0);
                }
            
                const relatedAi_output1 = await AiOutputs.findOne({
                    offset: Math.floor(Math.random() * (await AiOutputs.count())),
                });
                const ReviewAction1 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReviewAction1?.setAi_output)
                {
                    await
                    ReviewAction1.
                    setAi_output(relatedAi_output1);
                }
            
                const relatedAi_output2 = await AiOutputs.findOne({
                    offset: Math.floor(Math.random() * (await AiOutputs.count())),
                });
                const ReviewAction2 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReviewAction2?.setAi_output)
                {
                    await
                    ReviewAction2.
                    setAi_output(relatedAi_output2);
                }
            
                const relatedAi_output3 = await AiOutputs.findOne({
                    offset: Math.floor(Math.random() * (await AiOutputs.count())),
                });
                const ReviewAction3 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ReviewAction3?.setAi_output)
                {
                    await
                    ReviewAction3.
                    setAi_output(relatedAi_output3);
                }
            
        }
        
    
        
            
            async function associateReviewActionWithReviewer_user() {
            
                const relatedReviewer_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReviewAction0 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReviewAction0?.setReviewer_user)
                {
                    await
                    ReviewAction0.
                    setReviewer_user(relatedReviewer_user0);
                }
            
                const relatedReviewer_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReviewAction1 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReviewAction1?.setReviewer_user)
                {
                    await
                    ReviewAction1.
                    setReviewer_user(relatedReviewer_user1);
                }
            
                const relatedReviewer_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReviewAction2 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReviewAction2?.setReviewer_user)
                {
                    await
                    ReviewAction2.
                    setReviewer_user(relatedReviewer_user2);
                }
            
                const relatedReviewer_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReviewAction3 = await ReviewActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ReviewAction3?.setReviewer_user)
                {
                    await
                    ReviewAction3.
                    setReviewer_user(relatedReviewer_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            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);
                }
            
        }
        
    
        
            
            async function associateAuditLogWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setLocation)
                {
                    await
                    AuditLog0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setLocation)
                {
                    await
                    AuditLog1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setLocation)
                {
                    await
                    AuditLog2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const AuditLog3 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditLog3?.setLocation)
                {
                    await
                    AuditLog3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
            
            async function associateAuditLogWithActor_user() {
            
                const relatedActor_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setActor_user)
                {
                    await
                    AuditLog0.
                    setActor_user(relatedActor_user0);
                }
            
                const relatedActor_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setActor_user)
                {
                    await
                    AuditLog1.
                    setActor_user(relatedActor_user1);
                }
            
                const relatedActor_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setActor_user)
                {
                    await
                    AuditLog2.
                    setActor_user(relatedActor_user2);
                }
            
                const relatedActor_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog3 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditLog3?.setActor_user)
                {
                    await
                    AuditLog3.
                    setActor_user(relatedActor_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateIntegrationEndpointWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const IntegrationEndpoint0 = await IntegrationEndpoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (IntegrationEndpoint0?.setOrganization)
                {
                    await
                    IntegrationEndpoint0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const IntegrationEndpoint1 = await IntegrationEndpoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (IntegrationEndpoint1?.setOrganization)
                {
                    await
                    IntegrationEndpoint1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const IntegrationEndpoint2 = await IntegrationEndpoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (IntegrationEndpoint2?.setOrganization)
                {
                    await
                    IntegrationEndpoint2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const IntegrationEndpoint3 = await IntegrationEndpoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (IntegrationEndpoint3?.setOrganization)
                {
                    await
                    IntegrationEndpoint3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateContactWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact0 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Contact0?.setOrganization)
                {
                    await
                    Contact0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact1 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Contact1?.setOrganization)
                {
                    await
                    Contact1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact2 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Contact2?.setOrganization)
                {
                    await
                    Contact2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact3 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Contact3?.setOrganization)
                {
                    await
                    Contact3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    
        
            
            async function associateContactWithPayer() {
            
                const relatedPayer0 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const Contact0 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Contact0?.setPayer)
                {
                    await
                    Contact0.
                    setPayer(relatedPayer0);
                }
            
                const relatedPayer1 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const Contact1 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Contact1?.setPayer)
                {
                    await
                    Contact1.
                    setPayer(relatedPayer1);
                }
            
                const relatedPayer2 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const Contact2 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Contact2?.setPayer)
                {
                    await
                    Contact2.
                    setPayer(relatedPayer2);
                }
            
                const relatedPayer3 = await Payers.findOne({
                    offset: Math.floor(Math.random() * (await Payers.count())),
                });
                const Contact3 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Contact3?.setPayer)
                {
                    await
                    Contact3.
                    setPayer(relatedPayer3);
                }
            
        }
        
    
        
            
            async function associateContactWithLocation() {
            
                const relatedLocation0 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Contact0 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Contact0?.setLocation)
                {
                    await
                    Contact0.
                    setLocation(relatedLocation0);
                }
            
                const relatedLocation1 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Contact1 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Contact1?.setLocation)
                {
                    await
                    Contact1.
                    setLocation(relatedLocation1);
                }
            
                const relatedLocation2 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Contact2 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Contact2?.setLocation)
                {
                    await
                    Contact2.
                    setLocation(relatedLocation2);
                }
            
                const relatedLocation3 = await Locations.findOne({
                    offset: Math.floor(Math.random() * (await Locations.count())),
                });
                const Contact3 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Contact3?.setLocation)
                {
                    await
                    Contact3.
                    setLocation(relatedLocation3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Locations.bulkCreate(LocationsData);
                
            
            
                
                await RoleAssignments.bulkCreate(RoleAssignmentsData);
                
            
            
                
                await Payers.bulkCreate(PayersData);
                
            
            
                
                await PayerPlans.bulkCreate(PayerPlansData);
                
            
            
                
                await ProcedureFamilies.bulkCreate(ProcedureFamiliesData);
                
            
            
                
                await CptCodes.bulkCreate(CptCodesData);
                
            
            
                
                await Patients.bulkCreate(PatientsData);
                
            
            
                
                await AuthorizationCases.bulkCreate(AuthorizationCasesData);
                
            
            
                
                await CaseDocuments.bulkCreate(CaseDocumentsData);
                
            
            
                
                await Submissions.bulkCreate(SubmissionsData);
                
            
            
                
                await SubmissionEvents.bulkCreate(SubmissionEventsData);
                
            
            
                
                await Tasks.bulkCreate(TasksData);
                
            
            
                
                await Denials.bulkCreate(DenialsData);
                
            
            
                
                await Appeals.bulkCreate(AppealsData);
                
            
            
                
                await Templates.bulkCreate(TemplatesData);
                
            
            
                
                await PayerRules.bulkCreate(PayerRulesData);
                
            
            
                
                await RuleRequirements.bulkCreate(RuleRequirementsData);
                
            
            
                
                await AiJobs.bulkCreate(AiJobsData);
                
            
            
                
                await AiOutputs.bulkCreate(AiOutputsData);
                
            
            
                
                await ReviewActions.bulkCreate(ReviewActionsData);
                
            
            
                
                await AuditLogs.bulkCreate(AuditLogsData);
                
            
            
                
                await IntegrationEndpoints.bulkCreate(IntegrationEndpointsData);
                
            
            
                
                await Contacts.bulkCreate(ContactsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                        
                        await associateLocationWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateRoleAssignmentWithUser(),
                    
                
                    
                        
                        await associateRoleAssignmentWithOrganization(),
                    
                
                    
                        
                        await associateRoleAssignmentWithLocation(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePayerWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePayerPlanWithPayer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePayerPlanWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProcedureFamilyWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCptCodeWithProcedure_family(),
                    
                
                    
                
                    
                        
                        await associateCptCodeWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePatientWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAuthorizationCasWithOrganization(),
                    
                
                    
                        
                        await associateAuthorizationCasWithLocation(),
                    
                
                    
                        
                        await associateAuthorizationCasWithPatient(),
                    
                
                    
                        
                        await associateAuthorizationCasWithPayer_plan(),
                    
                
                    
                        
                        await associateAuthorizationCasWithCpt_code(),
                    
                
                    
                        
                        await associateAuthorizationCasWithProcedure_family(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAuthorizationCasWithOwner_user(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCaseDocumentWithAuthorization_case(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCaseDocumentWithUploaded_by_user(),
                    
                
                    
                
                    
                
                    
                        
                        await associateCaseDocumentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSubmissionWithAuthorization_case(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSubmissionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSubmissionEventWithSubmission(),
                    
                
                    
                
                    
                
                    
                        
                        await associateSubmissionEventWithActor_user(),
                    
                
                    
                
                    
                        
                        await associateSubmissionEventWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTaskWithOrganization(),
                    
                
                    
                        
                        await associateTaskWithLocation(),
                    
                
                    
                        
                        await associateTaskWithAuthorization_case(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTaskWithAssigned_to_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateDenialWithOrganization(),
                    
                
                    
                        
                        await associateDenialWithLocation(),
                    
                
                    
                        
                        await associateDenialWithAuthorization_case(),
                    
                
                    
                        
                        await associateDenialWithSubmission(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDenialWithOwner_user(),
                    
                
            
                
                
                    
                        
                        await associateAppealWithOrganization(),
                    
                
                    
                        
                        await associateAppealWithLocation(),
                    
                
                    
                        
                        await associateAppealWithDenial(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAppealWithTemplate(),
                    
                
                    
                        
                        await associateAppealWithReviewed_by_user(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTemplateWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associatePayerRuleWithOrganization(),
                    
                
                    
                        
                        await associatePayerRuleWithPayer(),
                    
                
                    
                        
                        await associatePayerRuleWithPayer_plan(),
                    
                
                    
                        
                        await associatePayerRuleWithProcedure_family(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateRuleRequirementWithPayer_rule(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRuleRequirementWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateAiJobWithOrganization(),
                    
                
                    
                        
                        await associateAiJobWithAuthorization_case(),
                    
                
                    
                        
                        await associateAiJobWithCase_document(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAiOutputWithAi_job(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAiOutputWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateReviewActionWithOrganization(),
                    
                
                    
                        
                        await associateReviewActionWithAuthorization_case(),
                    
                
                    
                        
                        await associateReviewActionWithAi_output(),
                    
                
                    
                        
                        await associateReviewActionWithReviewer_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAuditLogWithOrganization(),
                    
                
                    
                        
                        await associateAuditLogWithLocation(),
                    
                
                    
                        
                        await associateAuditLogWithActor_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateIntegrationEndpointWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateContactWithOrganization(),
                    
                
                    
                        
                        await associateContactWithPayer(),
                    
                
                    
                        
                        await associateContactWithLocation(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('locations', null, {});
            
            
            await queryInterface.bulkDelete('role_assignments', null, {});
            
            
            await queryInterface.bulkDelete('payers', null, {});
            
            
            await queryInterface.bulkDelete('payer_plans', null, {});
            
            
            await queryInterface.bulkDelete('procedure_families', null, {});
            
            
            await queryInterface.bulkDelete('cpt_codes', null, {});
            
            
            await queryInterface.bulkDelete('patients', null, {});
            
            
            await queryInterface.bulkDelete('authorization_cases', null, {});
            
            
            await queryInterface.bulkDelete('case_documents', null, {});
            
            
            await queryInterface.bulkDelete('submissions', null, {});
            
            
            await queryInterface.bulkDelete('submission_events', null, {});
            
            
            await queryInterface.bulkDelete('tasks', null, {});
            
            
            await queryInterface.bulkDelete('denials', null, {});
            
            
            await queryInterface.bulkDelete('appeals', null, {});
            
            
            await queryInterface.bulkDelete('templates', null, {});
            
            
            await queryInterface.bulkDelete('payer_rules', null, {});
            
            
            await queryInterface.bulkDelete('rule_requirements', null, {});
            
            
            await queryInterface.bulkDelete('ai_jobs', null, {});
            
            
            await queryInterface.bulkDelete('ai_outputs', null, {});
            
            
            await queryInterface.bulkDelete('review_actions', null, {});
            
            
            await queryInterface.bulkDelete('audit_logs', null, {});
            
            
            await queryInterface.bulkDelete('integration_endpoints', null, {});
            
            
            await queryInterface.bulkDelete('contacts', null, {});
            
        
    },
};