<reponame>BenTopping/lighthouse
from datetime import datetime

from lighthouse.constants.fields import (
    FIELD_COG_BARCODE,
    FIELD_RESULT,
    FIELD_RNA_ID,
    FIELD_ROOT_SAMPLE_ID,
    MLWH_LH_SAMPLE_RESULT,
    MLWH_LH_SAMPLE_RNA_ID,
    MLWH_LH_SAMPLE_ROOT_SAMPLE_ID,
)

COG_UK_IDS = ["cog_1", "cog_2", "cog_3", "cog_4", "cog_5"]

SAMPLES_FOR_MLWH_UPDATE = [
    {
        FIELD_ROOT_SAMPLE_ID: "sample_001",
        FIELD_RNA_ID: "rna_1",
        FIELD_RESULT: "Positive",
        FIELD_COG_BARCODE: COG_UK_IDS[0],
    },
    {
        FIELD_ROOT_SAMPLE_ID: "sample_002",
        FIELD_RNA_ID: "rna_2",
        FIELD_RESULT: "Positive",
        FIELD_COG_BARCODE: COG_UK_IDS[1],
    },
    {
        FIELD_ROOT_SAMPLE_ID: "sample_001",
        FIELD_RNA_ID: "rna_3",
        FIELD_RESULT: "Positive",
        FIELD_COG_BARCODE: COG_UK_IDS[2],
    },
    {
        FIELD_ROOT_SAMPLE_ID: "sample_004",
        FIELD_RNA_ID: "rna_4",
        FIELD_RESULT: "Positive",
        FIELD_COG_BARCODE: COG_UK_IDS[3],
    },
    {
        FIELD_ROOT_SAMPLE_ID: "sample_005",
        FIELD_RNA_ID: "rna_5",
        FIELD_RESULT: "Positive",
        FIELD_COG_BARCODE: COG_UK_IDS[4],
    },
]

# this matches samples which meet the fit to pick rules
MLWH_LH_SAMPLES = [
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_001",
        MLWH_LH_SAMPLE_RNA_ID: "rna_1",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_002",
        MLWH_LH_SAMPLE_RNA_ID: "rna_2",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_a",
        MLWH_LH_SAMPLE_RNA_ID: "rna_a",
        MLWH_LH_SAMPLE_RESULT: "Negative",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_101",
        MLWH_LH_SAMPLE_RNA_ID: "rna_6",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_003",
        MLWH_LH_SAMPLE_RNA_ID: "rna_3",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_004",
        MLWH_LH_SAMPLE_RNA_ID: "rna_4",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_005",
        MLWH_LH_SAMPLE_RNA_ID: "rna_5",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
]

# more complex scenario for the mlwh-related tests
# two of the samples share a root sample id and result
MLWH_LH_SAMPLES_MULTIPLE = [
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_001",
        MLWH_LH_SAMPLE_RNA_ID: "rna_1",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_002",
        MLWH_LH_SAMPLE_RNA_ID: "rna_2",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_001",
        MLWH_LH_SAMPLE_RNA_ID: "rna_3",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_004",
        MLWH_LH_SAMPLE_RNA_ID: "rna_4",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
    {
        MLWH_LH_SAMPLE_ROOT_SAMPLE_ID: "sample_005",
        MLWH_LH_SAMPLE_RNA_ID: "rna_5",
        MLWH_LH_SAMPLE_RESULT: "Positive",
    },
]


MLWH_SAMPLE_STOCK_RESOURCE = {
    "sample": [
        {
            "id_sample_tmp": "1",
            "id_sample_lims": "1",
            "description": "root_1",
            "supplier_name": "cog_uk_id_1",
            "phenotype": "positive",
            "sanger_sample_id": "ss1",
            "id_lims": "SQSCP",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "uuid_sample_lims": "1",
        },
        {
            "id_sample_tmp": "2",
            "id_sample_lims": "2",
            "description": "root_2",
            "supplier_name": "cog_uk_id_2",
            "phenotype": "positive",
            "sanger_sample_id": "ss2",
            "id_lims": "SQSCP",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "uuid_sample_lims": "2",
        },
        {
            "id_sample_tmp": "3",
            "id_sample_lims": "3",
            "description": "root_1",
            "supplier_name": "cog_uk_id_3",
            "phenotype": "positive",
            "sanger_sample_id": "ss3",
            "id_lims": "SQSCP",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "uuid_sample_lims": "3",
        },
        {
            "id_sample_tmp": "4",
            "id_sample_lims": "4",
            "description": "root_3",
            "supplier_name": "cog_uk_id_4",
            "phenotype": "positive",
            "sanger_sample_id": "ss4",
            "id_lims": "SQSCP",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "uuid_sample_lims": "4",
        },
    ],
    "stock_resource": [
        {
            "id_stock_resource_tmp": "1",
            "id_sample_tmp": "1",
            "labware_human_barcode": "pb_1",
            "labware_machine_barcode": "pb_1",
            "labware_coordinate": "A1",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "id_study_tmp": "1",
            "id_lims": "SQSCP",
            "id_stock_resource_lims": "1",
            "labware_type": "well",
        },
        {
            "id_stock_resource_tmp": "2",
            "id_sample_tmp": "2",
            "labware_human_barcode": "pb_2",
            "labware_machine_barcode": "pb_2",
            "labware_coordinate": "A1",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "id_study_tmp": "1",
            "id_lims": "SQSCP",
            "id_stock_resource_lims": "2",
            "labware_type": "well",
        },
        {
            "id_stock_resource_tmp": "3",
            "id_sample_tmp": "3",
            "labware_human_barcode": "pb_3",
            "labware_machine_barcode": "pb_3",
            "labware_coordinate": "A1",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "id_study_tmp": "1",
            "id_lims": "SQSCP",
            "id_stock_resource_lims": "3",
            "labware_type": "well",
        },
        {
            "id_stock_resource_tmp": "4",
            "id_sample_tmp": "4",
            "labware_human_barcode": "pb_3",
            "labware_machine_barcode": "pb_3",
            "labware_coordinate": "A1",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "id_study_tmp": "1",
            "id_lims": "SQSCP",
            "id_stock_resource_lims": "4",
            "labware_type": "well",
        },
    ],
    "study": [
        {
            "id_study_tmp": "1",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "id_study_lims": "1",
            "id_lims": "SQSCP",
        }
    ],
}

date_tested = datetime(2020, 10, 24, 22, 30, 22)
MLWH_SAMPLE_LIGHTHOUSE_SAMPLE = {
    "sample": [
        {
            "id_sample_tmp": "5",
            "id_sample_lims": "5",
            "description": "root_4",
            "supplier_name": "cog_uk_id_5",
            "phenotype": "positive",
            "sanger_sample_id": "beck-ss1",
            "id_lims": "SQSCP",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "uuid_sample_lims": "35000000000000000000000000000000",
        },
        {
            "id_sample_tmp": "6",
            "id_sample_lims": "6",
            "description": "root_5",
            "supplier_name": "cog_uk_id_6",
            "phenotype": "positive",
            "sanger_sample_id": "beck-ss2",
            "id_lims": "SQSCP",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "uuid_sample_lims": "36000000000000000000000000000000",
        },
        {
            "id_sample_tmp": "7",
            "id_sample_lims": "7",
            "description": "root_4",
            "supplier_name": "cog_uk_id_7",
            "phenotype": "positive",
            "sanger_sample_id": "beck-ss3",
            "id_lims": "SQSCP",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "uuid_sample_lims": "37000000000000000000000000000000",
        },
        {
            "id_sample_tmp": "8",
            "id_sample_lims": "8",
            "description": "root_3",
            "supplier_name": "cog_uk_id_8",
            "phenotype": "positive",
            "sanger_sample_id": "beck-ss4",
            "id_lims": "SQSCP",
            "last_updated": "2015-11-25 11:35:30",
            "recorded_at": "2015-11-25 11:35:30",
            "created": "2015-11-25 11:35:30",
            "uuid_sample_lims": "38000000000000000000000000000000",
        },
    ],
    "lighthouse_sample": [
        {
            "mongodb_id": "1",
            "root_sample_id": "root_4",
            "rna_id": "pb_4_A01",
            "plate_barcode": "pb_4",
            "coordinate": "A1",
            "result": "Positive",
            "date_tested": date_tested,
            "source": "test centre",
            "lab_id": "TC",
            "lh_sample_uuid": "35000000000000000000000000000000",
        },
        {
            "mongodb_id": "2",
            "root_sample_id": "root_5",
            "rna_id": "pb_5_A01",
            "plate_barcode": "pb_5",
            "coordinate": "A1",
            "result": "Positive",
            "date_tested": date_tested,
            "source": "test centre",
            "lab_id": "TC",
            "lh_sample_uuid": "36000000000000000000000000000000",
        },
        {
            "mongodb_id": "3",
            "root_sample_id": "root_4",
            "rna_id": "pb_6_A01",
            "plate_barcode": "pb_6",
            "coordinate": "A1",
            "result": "Positive",
            "date_tested": date_tested,
            "source": "test centre",
            "lab_id": "TC",
            "lh_sample_uuid": "37000000000000000000000000000000",
        },
        {
            "mongodb_id": "4",
            "root_sample_id": "root_3",
            "rna_id": "pb_3_A01",
            "plate_barcode": "pb_3",
            "coordinate": "A1",
            "result": "Positive",
            "date_tested": date_tested,
            "source": "test centre",
            "lab_id": "TC",
            "lh_sample_uuid": "38000000000000000000000000000000",
        },
    ],
}
