"""
DO NOT EDIT THIS FILE!!
This file is automatically generated by the process_schemas.py program
in the scripts directory. It is not intended to be edited directly. If
you need to update the GEL protocol classes, please run the script
on the appropriate schema version.
"""
from protocols.protocol import ProtocolElement
from protocols.protocol import SearchRequest
from protocols.protocol import SearchResponse
from protocols.protocol import avro_parse

import avro.schema

version = '1.2.0'


class AdoptedStatus(object):
    """
    adoptedin means adopted into the family     adoptedout means child
    belonged to the family and was adopted out
    """
    notadopted = "notadopted"
    adoptedin = "adoptedin"
    adoptedout = "adoptedout"

    def __hash__(self):
        return str(self).__hash__()


class AffectionStatus(object):
    """
    Affection Status
    """
    UNAFFECTED = "UNAFFECTED"
    AFFECTED = "AFFECTED"
    UNCERTAIN = "UNCERTAIN"

    def __hash__(self):
        return str(self).__hash__()


class AgeOfOnset(object):
    """
    No documentation
    """
    EMBRYONAL_ONSET = "EMBRYONAL_ONSET"
    FETAL_ONSET = "FETAL_ONSET"
    NEONATAL_ONSET = "NEONATAL_ONSET"
    INFANTILE_ONSET = "INFANTILE_ONSET"
    CHILDHOOD_ONSET = "CHILDHOOD_ONSET"
    JUVENILE_ONSET = "JUVENILE_ONSET"
    YOUNG_ADULT_ONSET = "YOUNG_ADULT_ONSET"
    LATE_ONSET = "LATE_ONSET"
    MIDDLE_AGE_ONSET = "MIDDLE_AGE_ONSET"

    def __hash__(self):
        return str(self).__hash__()


class AnalysisPanel(ProtocolElement):
    """
    An analysis panel
    """
    _schemaSource = """
{"type": "record", "name": "AnalysisPanel", "namespace": "org.gel.models.participant.avro", "doc":
"", "fields": [{"name": "specificDisease", "type": "string", "doc": ""}, {"name": "panelName",
"type": "string", "doc": ""}, {"name": "panelId", "type": ["null", "string"], "doc": ""}, {"name":
"panelVersion", "type": ["null", "string"], "doc": ""}, {"name": "reviewOutcome", "type": ["null",
"string"], "doc": ""}, {"name": "multipleGeneticOrigins", "type": ["null", "string"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "multipleGeneticOrigins",
        "panelId",
        "panelName",
        "panelVersion",
        "reviewOutcome",
        "specificDisease",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'multipleGeneticOrigins', 'panelId', 'panelName',
        'panelVersion', 'reviewOutcome', 'specificDisease'
    ]

    def __init__(self, **kwargs):
        self.multipleGeneticOrigins = kwargs.get(
            'multipleGeneticOrigins', None)
        self.panelId = kwargs.get(
            'panelId', None)
        self.panelName = kwargs.get(
            'panelName', None)
        self.panelVersion = kwargs.get(
            'panelVersion', None)
        self.reviewOutcome = kwargs.get(
            'reviewOutcome', None)
        self.specificDisease = kwargs.get(
            'specificDisease', None)


class Ancestries(ProtocolElement):
    """
    Ancestries, defined as Ethnic category(ies) and Chi-square test
    """
    _schemaSource = """
{"type": "record", "name": "Ancestries", "namespace": "org.gel.models.participant.avro", "doc": "",
"fields": [{"name": "mothersEthnicOrigin", "type": ["null", {"type": "enum", "name":
"EthnicCategory", "doc": "", "symbols": ["D", "E", "F", "G", "A", "B", "C", "L", "M", "N", "H", "J",
"K", "P", "S", "R", "Z"]}], "doc": ""}, {"name": "mothersOtherRelevantAncestry", "type": ["null",
"string"], "doc": ""}, {"name": "fathersEthnicOrigin", "type": ["null", "EthnicCategory"], "doc":
""}, {"name": "fathersOtherRelevantAncestry", "type": ["null", "string"], "doc": ""}, {"name":
"chiSquare1KGenomesPhase3Pop", "type": ["null", {"type": "array", "items": {"type": "record",
"name": "ChiSquare1KGenomesPhase3Pop", "doc": "", "fields": [{"name": "kgSuperPopCategory", "type":
{"type": "enum", "name": "KgSuperPopCategory", "doc": "", "symbols": ["AFR", "AMR", "EAS", "EUR",
"SAS"]}, "doc": ""}, {"name": "kgPopCategory", "type": ["null", {"type": "enum", "name":
"KgPopCategory", "doc": "", "symbols": ["ACB", "ASW", "BEB", "CDX", "CEU", "CHB", "CHS", "CLM",
"ESN", "FIN", "GBR", "GIH", "GWD", "IBS", "ITU", "JPT", "KHV", "LWK", "MSL", "MXL", "PEL", "PJL",
"PUR", "STU", "TSI", "YRI"]}], "doc": ""}, {"name": "chiSquare", "type": "double", "doc": ""}]}}],
"doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "chiSquare1KGenomesPhase3Pop",
        "fathersEthnicOrigin",
        "fathersOtherRelevantAncestry",
        "mothersEthnicOrigin",
        "mothersOtherRelevantAncestry",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'chiSquare1KGenomesPhase3Pop': ChiSquare1KGenomesPhase3Pop,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'chiSquare1KGenomesPhase3Pop': ChiSquare1KGenomesPhase3Pop,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'chiSquare1KGenomesPhase3Pop', 'fathersEthnicOrigin',
        'fathersOtherRelevantAncestry', 'mothersEthnicOrigin',
        'mothersOtherRelevantAncestry'
    ]

    def __init__(self, **kwargs):
        self.chiSquare1KGenomesPhase3Pop = kwargs.get(
            'chiSquare1KGenomesPhase3Pop', None)
        self.fathersEthnicOrigin = kwargs.get(
            'fathersEthnicOrigin', None)
        self.fathersOtherRelevantAncestry = kwargs.get(
            'fathersOtherRelevantAncestry', None)
        self.mothersEthnicOrigin = kwargs.get(
            'mothersEthnicOrigin', None)
        self.mothersOtherRelevantAncestry = kwargs.get(
            'mothersOtherRelevantAncestry', None)


class CancerParticipant(ProtocolElement):
    """
    This defines a Cancer Participant
    """
    _schemaSource = """
{"type": "record", "name": "CancerParticipant", "namespace": "org.gel.models.participant.avro",
"doc": "", "fields": [{"name": "yearOfBirth", "type": ["null", "int"], "doc": ""}, {"name":
"morphology", "type": ["null", {"type": "array", "items": "string"}], "doc": ""}, {"name":
"readyForAnalysis", "type": "boolean", "doc": ""}, {"name": "consentStatus", "type": ["null",
{"type": "record", "name": "ConsentStatus", "doc": "", "fields": [{"name": "programmeConsent",
"type": "boolean", "doc": "", "default": false}, {"name": "primaryFindingConsent", "type":
"boolean", "doc": "", "default": false}, {"name": "secondaryFindingConsent", "type": "boolean",
"doc": "", "default": false}, {"name": "carrierStatusConsent", "type": "boolean", "doc": "",
"default": false}]}], "doc": ""}, {"name": "testConsentStatus", "type": ["null", {"type": "record",
"name": "GmsConsentStatus", "doc": "", "fields": [{"name": "programmeConsent", "type": {"type":
"enum", "name": "GenericConsent", "doc": "", "symbols": ["yes", "no", "undefined",
"not_applicable"]}, "doc": ""}, {"name": "primaryFindingConsent", "type": "GenericConsent", "doc":
""}, {"name": "researchConsent", "type": "GenericConsent", "doc": ""}, {"name":
"healthRelatedFindingConsent", "type": "GenericConsent", "doc": ""}, {"name":
"carrierStatusConsent", "type": "GenericConsent", "doc": ""}, {"name":
"pharmacogenomicsFindingConsent", "type": "GenericConsent", "doc": ""}]}], "doc": ""}, {"name":
"center", "type": ["null", "string"], "doc": ""}, {"name": "individualId", "type": ["null",
"string"], "doc": ""}, {"name": "participantId", "type": ["null", "string"], "doc": ""}, {"name":
"primaryDiagnosisDisease", "type": ["null", {"type": "array", "items": "string"}], "doc": ""},
{"name": "primaryDiagnosisSubDisease", "type": ["null", {"type": "array", "items": "string"}],
"doc": ""}, {"name": "sex", "type": {"type": "enum", "name": "Sex", "doc": "", "symbols": ["MALE",
"FEMALE", "UNKNOWN"]}, "doc": ""}, {"name": "additionalInformation", "type": ["null", {"type":
"map", "values": "string"}], "doc": ""}, {"name": "assignedICD10", "type": ["null", {"type":
"array", "items": "string"}], "doc": ""}, {"name": "tumourSamples", "type": ["null", {"type":
"array", "items": {"type": "record", "name": "TumourSample", "doc": "", "fields": [{"name":
"sampleId", "type": "string", "doc": ""}, {"name": "labSampleId", "type": "int", "doc": ""},
{"name": "LDPCode", "type": ["null", "string"], "doc": ""}, {"name": "tumourId", "type": ["null",
"string"], "doc": ""}, {"name": "programmePhase", "type": ["null", "string"], "doc": ""}, {"name":
"diseaseType", "type": ["null", {"type": "enum", "name": "diseaseType", "symbols": ["ADULT_GLIOMA",
"BLADDER", "BREAST", "CARCINOMA_OF_UNKNOWN_PRIMARY", "CHILDHOOD", "COLORECTAL", "ENDOCRINE",
"ENDOMETRIAL_CARCINOMA", "HAEMONC", "HEPATOPANCREATOBILIARY", "LUNG", "MALIGNANT_MELANOMA",
"NASOPHARYNGEAL", "ORAL_OROPHARYNGEAL", "OVARIAN", "PROSTATE", "RENAL", "SARCOMA", "SINONASAL",
"TESTICULAR_GERM_CELL_TUMOURS", "UPPER_GASTROINTESTINAL", "OTHER",
"NON_HODGKINS_B_CELL_LYMPHOMA_LOW_MOD_GRADE", "CLASSICAL_HODGKINS",
"NODULAR_LYMPHOCYTE_PREDOMINANT_HODGKINS", "T_CELL_LYMPHOMA"]}], "doc": ""}, {"name":
"diseaseSubType", "type": ["null", "string"], "doc": ""}, {"name": "haematologicalCancer", "type":
["null", "boolean"], "doc": ""}, {"name": "haematologicalCancerLineage", "type": ["null", {"type":
"enum", "name": "HaematologicalCancerLineage", "symbols": ["MYELOID", "LYMPHOID", "UNKNOWN"]}],
"doc": ""}, {"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc": ""}, {"name":
"tumourType", "type": ["null", "string"], "doc": ""}, {"name": "tumourContent", "type": ["null",
{"type": "enum", "name": "TumourContent", "symbols": ["High", "Medium", "Low"]}], "doc": ""},
{"name": "tumourContentPercentage", "type": ["null", "float"], "doc": ""}, {"name": "source",
"type": ["null", {"type": "enum", "name": "SampleSource", "doc": "", "symbols": ["AMNIOTIC_FLUID",
"BLOOD", "BONE_MARROW", "BONE_MARROW_ASPIRATE_TUMOUR_CELLS",
"BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS", "BUCCAL_SWAB", "CHORIONIC_VILLUS_SAMPLE", "FIBROBLAST",
"FLUID", "FRESH_TISSUE_IN_CULTURE_MEDIUM", "OTHER", "SALIVA", "TISSUE", "TUMOUR", "URINE"]}], "doc":
""}, {"name": "preparationMethod", "type": ["null", {"type": "enum", "name": "PreparationMethod",
"doc": "", "symbols": ["ASPIRATE", "CD128_SORTED_CELLS", "CD138_SORTED_CELLS", "EDTA", "FF", "FFPE",
"LI_HEP", "ORAGENE"]}], "doc": ""}, {"name": "tissueSource", "type": ["null", "string"], "doc": ""},
{"name": "product", "type": ["null", {"type": "enum", "name": "Product", "symbols": ["DNA",
"RNA"]}], "doc": ""}, {"name": "sampleMorphologies", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "Morphology", "fields": [{"name": "id", "type": ["null", "string"],
"doc": ""}, {"name": "name", "type": ["null", "string"], "doc": ""}, {"name": "value", "type":
["null", "string"], "doc": ""}, {"name": "version", "type": ["null", "string"], "doc": ""}]}}],
"doc": ""}, {"name": "sampleTopographies", "type": ["null", {"type": "array", "items": {"type":
"record", "name": "Topography", "fields": [{"name": "id", "type": ["null", "string"], "doc": ""},
{"name": "name", "type": ["null", "string"], "doc": ""}, {"name": "value", "type": ["null",
"string"], "doc": ""}, {"name": "version", "type": ["null", "string"], "doc": ""}]}}], "doc": ""},
{"name": "sampleUid", "type": ["null", "string"], "doc": ""}, {"name": "participantId", "type":
["null", "string"], "doc": ""}, {"name": "participantUid", "type": ["null", "string"], "doc": ""},
{"name": "maskedPid", "type": ["null", "string"], "doc": ""}, {"name": "method", "type": ["null",
{"type": "enum", "name": "Method", "doc": "", "symbols": ["ASPIRATE", "BIOPSY", "NOT_APPLICABLE",
"RESECTION", "SORTED_OTHER", "UNKNOWN", "UNSORTED", "CD138_SORTED"]}], "doc": ""}, {"name":
"storageMedium", "type": ["null", {"type": "enum", "name": "StorageMedium", "doc": "", "symbols":
["EDTA", "FF", "LI_HEP", "ORAGENE", "FFPE"]}], "doc": ""}, {"name": "sampleType", "type": ["null",
"string"], "doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}}], "doc":
""}, {"name": "germlineSamples", "type": ["null", {"type": "array", "items": {"type": "record",
"name": "GermlineSample", "doc": "", "fields": [{"name": "sampleId", "type": "string", "doc": ""},
{"name": "labSampleId", "type": "int", "doc": ""}, {"name": "LDPCode", "type": ["null", "string"],
"doc": ""}, {"name": "source", "type": ["null", "SampleSource"], "doc": ""}, {"name": "product",
"type": ["null", "Product"], "doc": ""}, {"name": "preparationMethod", "type": ["null",
"PreparationMethod"], "doc": ""}, {"name": "programmePhase", "type": ["null", {"type": "enum",
"name": "ProgrammePhase", "symbols": ["CRUK", "OXFORD", "CLL", "IIP", "MAIN", "EXPT"]}], "doc": ""},
{"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc": ""}, {"name": "participantId",
"type": ["null", "string"]}, {"name": "participantUid", "type": ["null", "string"], "doc": ""},
{"name": "sampleUid", "type": ["null", "string"]}, {"name": "maskedPid", "type": ["null",
"string"]}, {"name": "method", "type": ["null", "Method"], "doc": ""}, {"name": "storageMedium",
"type": ["null", "StorageMedium"], "doc": ""}, {"name": "sampleType", "type": ["null", "string"],
"doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}}], "doc": ""}, {"name":
"versionControl", "type": ["null", {"type": "record", "name": "VersionControl", "fields": [{"name":
"GitVersionControl", "type": "string", "doc": "", "default": "1.2.0"}]}], "doc": ""}, {"name":
"participantUid", "type": ["null", "string"], "doc": ""}, {"name": "tumours", "type": ["null",
{"type": "array", "items": {"type": "record", "name": "Tumour", "fields": [{"name": "tumourId",
"type": "string", "doc": ""}, {"name": "tumourLocalId", "type": "string", "doc": ""}, {"name":
"tumourType", "type": {"type": "enum", "name": "TumourType", "doc": "", "symbols": ["BRAIN_TUMOUR",
"HAEMATOLOGICAL_MALIGNANCY_SOLID_SAMPLE", "HAEMATOLOGICAL_MALIGNANCY_LIQUID_SAMPLE",
"SOLID_TUMOUR_METASTATIC", "SOLID_TUMOUR_PRIMARY", "SOLID_TUMOUR", "UNKNOWN"]}, "doc": ""}, {"name":
"tumourParentId", "type": ["null", "string"], "doc": ""}, {"name": "tumourDiagnosisDate", "type":
["null", {"type": "record", "name": "Date", "doc": "", "fields": [{"name": "year", "type": "int",
"doc": ""}, {"name": "month", "type": ["null", "int"], "doc": ""}, {"name": "day", "type": ["null",
"int"], "doc": ""}]}], "doc": ""}, {"name": "tumourDescription", "type": ["null", "string"], "doc":
""}, {"name": "tumourMorphologies", "type": ["null", {"type": "array", "items": "Morphology"}],
"doc": ""}, {"name": "tumourTopographies", "type": ["null", {"type": "array", "items":
"Topography"}], "doc": ""}, {"name": "tumourPrimaryTopographies", "type": ["null", {"type": "array",
"items": "Topography"}], "doc": ""}, {"name": "tumourGrade", "type": ["null", "string"], "doc": ""},
{"name": "tumourStage", "type": ["null", "string"], "doc": ""}, {"name": "tumourPrognosticScore",
"type": ["null", "string"], "doc": ""}, {"name": "tumourPresentation", "type": ["null", {"type":
"enum", "name": "TumourPresentation", "symbols": ["FIRST_PRESENTATION", "RECURRENCE", "UNKNOWN"]}],
"doc": ""}, {"name": "primaryOrMetastatic", "type": ["null", {"type": "enum", "name":
"PrimaryOrMetastatic", "symbols": ["PRIMARY", "METASTATIC", "UNKNOWN", "NOT_APPLICABLE"]}], "doc":
""}]}}], "doc": ""}, {"name": "previousTreatment", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "PreviousTreatment", "doc": "", "fields": [{"name":
"previousTreatmentType", "type": ["null", "string"]}, {"name": "previousTreatmentName", "type":
["null", "string"]}, {"name": "previousTreatmentDate", "type": ["null", "Date"]}]}}], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "additionalInformation",
        "assignedICD10",
        "center",
        "consentStatus",
        "germlineSamples",
        "individualId",
        "morphology",
        "participantId",
        "participantUid",
        "previousTreatment",
        "primaryDiagnosisDisease",
        "primaryDiagnosisSubDisease",
        "readyForAnalysis",
        "sex",
        "testConsentStatus",
        "tumourSamples",
        "tumours",
        "versionControl",
        "yearOfBirth",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'consentStatus': ConsentStatus,
            'germlineSamples': GermlineSample,
            'previousTreatment': PreviousTreatment,
            'testConsentStatus': GmsConsentStatus,
            'tumourSamples': TumourSample,
            'tumours': Tumour,
            'versionControl': VersionControl,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'consentStatus': ConsentStatus,
            'germlineSamples': GermlineSample,
            'previousTreatment': PreviousTreatment,
            'testConsentStatus': GmsConsentStatus,
            'tumourSamples': TumourSample,
            'tumours': Tumour,
            'versionControl': VersionControl,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'additionalInformation', 'assignedICD10', 'center',
        'consentStatus', 'germlineSamples', 'individualId',
        'morphology', 'participantId', 'participantUid',
        'previousTreatment', 'primaryDiagnosisDisease',
        'primaryDiagnosisSubDisease', 'readyForAnalysis', 'sex',
        'testConsentStatus', 'tumourSamples', 'tumours',
        'versionControl', 'yearOfBirth'
    ]

    def __init__(self, **kwargs):
        self.additionalInformation = kwargs.get(
            'additionalInformation', None)
        self.assignedICD10 = kwargs.get(
            'assignedICD10', None)
        self.center = kwargs.get(
            'center', None)
        self.consentStatus = kwargs.get(
            'consentStatus', None)
        self.germlineSamples = kwargs.get(
            'germlineSamples', None)
        self.individualId = kwargs.get(
            'individualId', None)
        self.morphology = kwargs.get(
            'morphology', None)
        self.participantId = kwargs.get(
            'participantId', None)
        self.participantUid = kwargs.get(
            'participantUid', None)
        self.previousTreatment = kwargs.get(
            'previousTreatment', None)
        self.primaryDiagnosisDisease = kwargs.get(
            'primaryDiagnosisDisease', None)
        self.primaryDiagnosisSubDisease = kwargs.get(
            'primaryDiagnosisSubDisease', None)
        self.readyForAnalysis = kwargs.get(
            'readyForAnalysis', None)
        self.sex = kwargs.get(
            'sex', None)
        self.testConsentStatus = kwargs.get(
            'testConsentStatus', None)
        self.tumourSamples = kwargs.get(
            'tumourSamples', None)
        self.tumours = kwargs.get(
            'tumours', None)
        self.versionControl = kwargs.get(
            'versionControl', None)
        self.yearOfBirth = kwargs.get(
            'yearOfBirth', None)


class ChiSquare1KGenomesPhase3Pop(ProtocolElement):
    """
    Chi-square test for goodness of fit of this sample to 1000 Genomes
    Phase 3 populations
    """
    _schemaSource = """
{"type": "record", "name": "ChiSquare1KGenomesPhase3Pop", "namespace":
"org.gel.models.participant.avro", "doc": "", "fields": [{"name": "kgSuperPopCategory", "type":
{"type": "enum", "name": "KgSuperPopCategory", "doc": "", "symbols": ["AFR", "AMR", "EAS", "EUR",
"SAS"]}, "doc": ""}, {"name": "kgPopCategory", "type": ["null", {"type": "enum", "name":
"KgPopCategory", "doc": "", "symbols": ["ACB", "ASW", "BEB", "CDX", "CEU", "CHB", "CHS", "CLM",
"ESN", "FIN", "GBR", "GIH", "GWD", "IBS", "ITU", "JPT", "KHV", "LWK", "MSL", "MXL", "PEL", "PJL",
"PUR", "STU", "TSI", "YRI"]}], "doc": ""}, {"name": "chiSquare", "type": "double", "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "chiSquare",
        "kgPopCategory",
        "kgSuperPopCategory",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'chiSquare', 'kgPopCategory', 'kgSuperPopCategory'
    ]

    def __init__(self, **kwargs):
        self.chiSquare = kwargs.get(
            'chiSquare', None)
        self.kgPopCategory = kwargs.get(
            'kgPopCategory', None)
        self.kgSuperPopCategory = kwargs.get(
            'kgSuperPopCategory', None)


class ClinicalEthnicity(object):
    """
    * A     British, Mixed British     * B     Irish     * C     Any
    other White background     * C2    Northern Irish     * C3
    Other white, white unspecified     * CA    English     * CB
    Scottish     * CC    Welsh     * CD    Cornish     * CE    Cypriot
    (part not stated)     * CF    Greek     * CG    Greek Cypriot
    * CH    Turkish     * CJ    Turkish Cypriot     * CK    Italian
    * CL    Irish Traveller     * CM    Traveller     * CN
    Gypsy/Romany     * CP    Polish     * CQ    All republics which
    made up the former USSR     * CR    Kosovan     * CS    Albanian
    * CT    Bosnian     * CU    Croatian     * CV    Serbian     * CW
    Other republics which made up the former Yugoslavia     * CX
    Mixed white     * CY    Other white European, European
    unspecified, European mixed     * D     White and Black Caribbean
    * E     White and Black African     * F     White and Asian     *
    G     Any other mixed background     * GA    Black and Asian     *
    GB    Black and Chinese     * GC    Black and White     * GD
    Chinese and White     * GE    Asian and Chinese     * GF    Other
    Mixed, Mixed Unspecified     * H     Indian or British Indian
    * J     Pakistani or British Pakistani     * K     Bangladeshi or
    British Bangladeshi     * L     Any other Asian background     *
    LA    Mixed Asian     * LB    Punjabi     * LC    Kashmiri     *
    LD    East African Asian     * LE    Sri Lanka     * LF    Tamil
    * LG    Sinhalese     * LH    British Asian     * LJ    Caribbean
    Asian     * LK    Other Asian, Asian unspecified     * M
    Caribbean     * N     African     * P     Any other Black
    background     * PA    Somali     * PB    Mixed Black     * PC
    Nigerian     * PD    Black British     * PE    Other Black, Black
    unspecified     * R     Chinese     * S     Any other ethnic group
    * S1    Ashkenazi     * S2    Sephardi     * SA    Vietnamese
    * SB    Japanese     * SC    Filipino     * SD    Malaysian     *
    SE    Any Other Group     * Z     Not stated
    """
    A = "A"
    B = "B"
    C = "C"
    C2 = "C2"
    C3 = "C3"
    CA = "CA"
    CB = "CB"
    CC = "CC"
    CD = "CD"
    CE = "CE"
    CF = "CF"
    CG = "CG"
    CH = "CH"
    CJ = "CJ"
    CK = "CK"
    CL = "CL"
    CM = "CM"
    CN = "CN"
    CP = "CP"
    CQ = "CQ"
    CR = "CR"
    CS = "CS"
    CT = "CT"
    CU = "CU"
    CV = "CV"
    CW = "CW"
    CX = "CX"
    CY = "CY"
    D = "D"
    E = "E"
    F = "F"
    G = "G"
    GA = "GA"
    GB = "GB"
    GC = "GC"
    GD = "GD"
    GE = "GE"
    GF = "GF"
    H = "H"
    J = "J"
    K = "K"
    L = "L"
    LA = "LA"
    LB = "LB"
    LC = "LC"
    LD = "LD"
    LE = "LE"
    LF = "LF"
    LG = "LG"
    LH = "LH"
    LJ = "LJ"
    LK = "LK"
    M = "M"
    N = "N"
    P = "P"
    PA = "PA"
    PB = "PB"
    PC = "PC"
    PD = "PD"
    PE = "PE"
    R = "R"
    S = "S"
    S1 = "S1"
    S2 = "S2"
    SA = "SA"
    SB = "SB"
    SC = "SC"
    SD = "SD"
    SE = "SE"
    Z = "Z"

    def __hash__(self):
        return str(self).__hash__()


class ClinicalIndication(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "ClinicalIndication", "namespace": "org.gel.models.participant.avro",
"fields": [{"name": "clinicalIndicationUid", "type": "string", "doc": ""}, {"name":
"clinicalIndicationCode", "type": "string", "doc": ""}, {"name": "clinicalIndicationFullName",
"type": "string", "doc": ""}, {"name": "clinicalIndicationVersionNumber", "type": ["null",
"string"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "clinicalIndicationCode",
        "clinicalIndicationFullName",
        "clinicalIndicationUid",
        "clinicalIndicationVersionNumber",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'clinicalIndicationCode', 'clinicalIndicationFullName',
        'clinicalIndicationUid', 'clinicalIndicationVersionNumber'
    ]

    def __init__(self, **kwargs):
        self.clinicalIndicationCode = kwargs.get(
            'clinicalIndicationCode', None)
        self.clinicalIndicationFullName = kwargs.get(
            'clinicalIndicationFullName', None)
        self.clinicalIndicationUid = kwargs.get(
            'clinicalIndicationUid', None)
        self.clinicalIndicationVersionNumber = kwargs.get(
            'clinicalIndicationVersionNumber', None)


class ClinicalIndicationTest(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "ClinicalIndicationTest", "namespace": "org.gel.models.participant.avro",
"fields": [{"name": "clinicalIndicationTestTypeId", "type": "string", "doc": ""}, {"name":
"clinicalIndicationTestTypeCode", "type": "string", "doc": ""}, {"name": "testTypeId", "type":
"string", "doc": ""}, {"name": "testTypeName", "type": "string", "doc": ""}, {"name": "technology",
"type": {"type": "record", "name": "Technology", "fields": [{"name": "testTechnologyId", "type":
"string", "doc": ""}, {"name": "testTechnologyDescription", "type": "string", "doc": ""}]}, "doc":
""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "clinicalIndicationTestTypeCode",
        "clinicalIndicationTestTypeId",
        "technology",
        "testTypeId",
        "testTypeName",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'technology': Technology,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'technology': Technology,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'clinicalIndicationTestTypeCode',
        'clinicalIndicationTestTypeId', 'technology', 'testTypeId',
        'testTypeName'
    ]

    def __init__(self, **kwargs):
        self.clinicalIndicationTestTypeCode = kwargs.get(
            'clinicalIndicationTestTypeCode', None)
        self.clinicalIndicationTestTypeId = kwargs.get(
            'clinicalIndicationTestTypeId', None)
        self.technology = kwargs.get(
            'technology', Technology())
        self.testTypeId = kwargs.get(
            'testTypeId', None)
        self.testTypeName = kwargs.get(
            'testTypeName', None)


class ConsentStatus(ProtocolElement):
    """
    Consent Status for 100k program
    """
    _schemaSource = """
{"type": "record", "name": "ConsentStatus", "namespace": "org.gel.models.participant.avro", "doc":
"", "fields": [{"name": "programmeConsent", "type": "boolean", "doc": "", "default": false},
{"name": "primaryFindingConsent", "type": "boolean", "doc": "", "default": false}, {"name":
"secondaryFindingConsent", "type": "boolean", "doc": "", "default": false}, {"name":
"carrierStatusConsent", "type": "boolean", "doc": "", "default": false}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {}

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'carrierStatusConsent', 'primaryFindingConsent',
        'programmeConsent', 'secondaryFindingConsent'
    ]

    def __init__(self, **kwargs):
        self.carrierStatusConsent = kwargs.get(
            'carrierStatusConsent', False)
        self.primaryFindingConsent = kwargs.get(
            'primaryFindingConsent', False)
        self.programmeConsent = kwargs.get(
            'programmeConsent', False)
        self.secondaryFindingConsent = kwargs.get(
            'secondaryFindingConsent', False)


class Date(ProtocolElement):
    """
    This defines a date record
    """
    _schemaSource = """
{"type": "record", "name": "Date", "namespace": "org.gel.models.participant.avro", "doc": "",
"fields": [{"name": "year", "type": "int", "doc": ""}, {"name": "month", "type": ["null", "int"],
"doc": ""}, {"name": "day", "type": ["null", "int"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "day",
        "month",
        "year",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'day', 'month', 'year'
    ]

    def __init__(self, **kwargs):
        self.day = kwargs.get(
            'day', None)
        self.month = kwargs.get(
            'month', None)
        self.year = kwargs.get(
            'year', None)


class DiagnosticDetail(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "DiagnosticDetail", "namespace": "org.gel.models.participant.avro",
"fields": [{"name": "diagnosisCodingSystem", "type": "string", "doc": ""}, {"name":
"diagnosisCodingSystemVersion", "type": ["null", "string"], "doc": ""}, {"name": "diagnosisCode",
"type": "string", "doc": ""}, {"name": "diagnosisDescription", "type": ["null", "string"], "doc":
""}, {"name": "diagnosisCertainty", "type": ["null", "string"], "doc": ""}, {"name":
"ageAtOnsetInYears", "type": ["null", "float"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "ageAtOnsetInYears",
        "diagnosisCertainty",
        "diagnosisCode",
        "diagnosisCodingSystem",
        "diagnosisCodingSystemVersion",
        "diagnosisDescription",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'ageAtOnsetInYears', 'diagnosisCertainty', 'diagnosisCode',
        'diagnosisCodingSystem', 'diagnosisCodingSystemVersion',
        'diagnosisDescription'
    ]

    def __init__(self, **kwargs):
        self.ageAtOnsetInYears = kwargs.get(
            'ageAtOnsetInYears', None)
        self.diagnosisCertainty = kwargs.get(
            'diagnosisCertainty', None)
        self.diagnosisCode = kwargs.get(
            'diagnosisCode', None)
        self.diagnosisCodingSystem = kwargs.get(
            'diagnosisCodingSystem', None)
        self.diagnosisCodingSystemVersion = kwargs.get(
            'diagnosisCodingSystemVersion', None)
        self.diagnosisDescription = kwargs.get(
            'diagnosisDescription', None)


class DiseasePenetrance(ProtocolElement):
    """
    A disease penetrance definition
    """
    _schemaSource = """
{"type": "record", "name": "DiseasePenetrance", "namespace": "org.gel.models.participant.avro",
"doc": "", "fields": [{"name": "specificDisease", "type": "string", "doc": ""}, {"name":
"penetrance", "type": {"type": "enum", "name": "Penetrance", "doc": "", "symbols": ["complete",
"incomplete"]}, "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "penetrance",
        "specificDisease",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'penetrance', 'specificDisease'
    ]

    def __init__(self, **kwargs):
        self.penetrance = kwargs.get(
            'penetrance', None)
        self.specificDisease = kwargs.get(
            'specificDisease', None)


class Disorder(ProtocolElement):
    """
    This is quite GEL specific. This is the way is stored in
    ModelCatalogue and PanelApp.     Currently all specific disease
    titles are assigned to a disease subgroup so really only
    specificDisease needs to be     completed but we add the others
    for generality
    """
    _schemaSource = """
{"type": "record", "name": "Disorder", "namespace": "org.gel.models.participant.avro", "doc": "",
"fields": [{"name": "diseaseGroup", "type": ["null", "string"], "doc": ""}, {"name":
"diseaseSubGroup", "type": ["null", "string"], "doc": ""}, {"name": "specificDisease", "type":
["null", "string"], "doc": ""}, {"name": "ageOfOnset", "type": ["null", "float"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "ageOfOnset",
        "diseaseGroup",
        "diseaseSubGroup",
        "specificDisease",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'ageOfOnset', 'diseaseGroup', 'diseaseSubGroup',
        'specificDisease'
    ]

    def __init__(self, **kwargs):
        self.ageOfOnset = kwargs.get(
            'ageOfOnset', None)
        self.diseaseGroup = kwargs.get(
            'diseaseGroup', None)
        self.diseaseSubGroup = kwargs.get(
            'diseaseSubGroup', None)
        self.specificDisease = kwargs.get(
            'specificDisease', None)


class EthnicCategory(object):
    """
    This is the list of ethnicities in ONS16      * `D`:  Mixed: White
    and Black Caribbean     * `E`:  Mixed: White and Black African
    * `F`:  Mixed: White and Asian     * `G`:  Mixed: Any other mixed
    background     * `A`:  White: British     * `B`:  White: Irish
    * `C`:  White: Any other White background     * `L`:  Asian or
    Asian British: Any other Asian background     * `M`:  Black or
    Black British: Caribbean     * `N`:  Black or Black British:
    African     * `H`:  Asian or Asian British: Indian     * `J`:
    Asian or Asian British: Pakistani     * `K`:  Asian or Asian
    British: Bangladeshi     * `P`:  Black or Black British: Any other
    Black background     * `S`:  Other Ethnic Groups: Any other ethnic
    group     * `R`:  Other Ethnic Groups: Chinese     * `Z`:  Not
    stated
    """
    D = "D"
    E = "E"
    F = "F"
    G = "G"
    A = "A"
    B = "B"
    C = "C"
    L = "L"
    M = "M"
    N = "N"
    H = "H"
    J = "J"
    K = "K"
    P = "P"
    S = "S"
    R = "R"
    Z = "Z"

    def __hash__(self):
        return str(self).__hash__()


class FamiliarRelationship(object):
    """
    Familiar relationship from pedrigree
    """
    TwinsMonozygous = "TwinsMonozygous"
    TwinsDizygous = "TwinsDizygous"
    TwinsUnknown = "TwinsUnknown"
    FullSibling = "FullSibling"
    FullSiblingF = "FullSiblingF"
    FullSiblingM = "FullSiblingM"
    Mother = "Mother"
    Father = "Father"
    Son = "Son"
    Daughter = "Daughter"
    ChildOfUnknownSex = "ChildOfUnknownSex"
    MaternalAunt = "MaternalAunt"
    MaternalUncle = "MaternalUncle"
    MaternalUncleOrAunt = "MaternalUncleOrAunt"
    PaternalAunt = "PaternalAunt"
    PaternalUncle = "PaternalUncle"
    PaternalUncleOrAunt = "PaternalUncleOrAunt"
    MaternalGrandmother = "MaternalGrandmother"
    PaternalGrandmother = "PaternalGrandmother"
    MaternalGrandfather = "MaternalGrandfather"
    PaternalGrandfather = "PaternalGrandfather"
    DoubleFirstCousin = "DoubleFirstCousin"
    MaternalCousinSister = "MaternalCousinSister"
    PaternalCousinSister = "PaternalCousinSister"
    MaternalCousinBrother = "MaternalCousinBrother"
    PaternalCousinBrother = "PaternalCousinBrother"
    Cousin = "Cousin"
    Spouse = "Spouse"
    Other = "Other"
    RelationIsNotClear = "RelationIsNotClear"
    Unrelated = "Unrelated"
    Unknown = "Unknown"

    def __hash__(self):
        return str(self).__hash__()


class FamilyQCState(object):
    """
    FamilyQCState
    """
    noState = "noState"
    passedMedicalReviewReadyForInterpretation = "passedMedicalReviewReadyForInterpretation"
    passedMedicalReviewNotReadyForInterpretation = "passedMedicalReviewNotReadyForInterpretation"
    queryToGel = "queryToGel"
    queryToGMC = "queryToGMC"
    failed = "failed"

    def __hash__(self):
        return str(self).__hash__()


class GenericConsent(object):
    """
    clinicalEthnicities supersedes Ancestries in GMS
    """
    yes = "yes"
    no = "no"
    undefined = "undefined"
    not_applicable = "not_applicable"

    def __hash__(self):
        return str(self).__hash__()


class GermlineSample(ProtocolElement):
    """
    A germline sample
    """
    _schemaSource = """
{"type": "record", "name": "GermlineSample", "namespace": "org.gel.models.participant.avro", "doc":
"", "fields": [{"name": "sampleId", "type": "string", "doc": ""}, {"name": "labSampleId", "type":
"int", "doc": ""}, {"name": "LDPCode", "type": ["null", "string"], "doc": ""}, {"name": "source",
"type": ["null", {"type": "enum", "name": "SampleSource", "doc": "", "symbols": ["AMNIOTIC_FLUID",
"BLOOD", "BONE_MARROW", "BONE_MARROW_ASPIRATE_TUMOUR_CELLS",
"BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS", "BUCCAL_SWAB", "CHORIONIC_VILLUS_SAMPLE", "FIBROBLAST",
"FLUID", "FRESH_TISSUE_IN_CULTURE_MEDIUM", "OTHER", "SALIVA", "TISSUE", "TUMOUR", "URINE"]}], "doc":
""}, {"name": "product", "type": ["null", {"type": "enum", "name": "Product", "symbols": ["DNA",
"RNA"]}], "doc": ""}, {"name": "preparationMethod", "type": ["null", {"type": "enum", "name":
"PreparationMethod", "doc": "", "symbols": ["ASPIRATE", "CD128_SORTED_CELLS", "CD138_SORTED_CELLS",
"EDTA", "FF", "FFPE", "LI_HEP", "ORAGENE"]}], "doc": ""}, {"name": "programmePhase", "type":
["null", {"type": "enum", "name": "ProgrammePhase", "symbols": ["CRUK", "OXFORD", "CLL", "IIP",
"MAIN", "EXPT"]}], "doc": ""}, {"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc":
""}, {"name": "participantId", "type": ["null", "string"]}, {"name": "participantUid", "type":
["null", "string"], "doc": ""}, {"name": "sampleUid", "type": ["null", "string"]}, {"name":
"maskedPid", "type": ["null", "string"]}, {"name": "method", "type": ["null", {"type": "enum",
"name": "Method", "doc": "", "symbols": ["ASPIRATE", "BIOPSY", "NOT_APPLICABLE", "RESECTION",
"SORTED_OTHER", "UNKNOWN", "UNSORTED", "CD138_SORTED"]}], "doc": ""}, {"name": "storageMedium",
"type": ["null", {"type": "enum", "name": "StorageMedium", "doc": "", "symbols": ["EDTA", "FF",
"LI_HEP", "ORAGENE", "FFPE"]}], "doc": ""}, {"name": "sampleType", "type": ["null", "string"],
"doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "LDPCode",
        "clinicalSampleDateTime",
        "labSampleId",
        "maskedPid",
        "method",
        "participantId",
        "participantUid",
        "preparationMethod",
        "product",
        "programmePhase",
        "sampleId",
        "sampleState",
        "sampleType",
        "sampleUid",
        "source",
        "storageMedium",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'LDPCode', 'clinicalSampleDateTime', 'labSampleId',
        'maskedPid', 'method', 'participantId', 'participantUid',
        'preparationMethod', 'product', 'programmePhase', 'sampleId',
        'sampleState', 'sampleType', 'sampleUid', 'source',
        'storageMedium'
    ]

    def __init__(self, **kwargs):
        self.LDPCode = kwargs.get(
            'LDPCode', None)
        self.clinicalSampleDateTime = kwargs.get(
            'clinicalSampleDateTime', None)
        self.labSampleId = kwargs.get(
            'labSampleId', None)
        self.maskedPid = kwargs.get(
            'maskedPid', None)
        self.method = kwargs.get(
            'method', None)
        self.participantId = kwargs.get(
            'participantId', None)
        self.participantUid = kwargs.get(
            'participantUid', None)
        self.preparationMethod = kwargs.get(
            'preparationMethod', None)
        self.product = kwargs.get(
            'product', None)
        self.programmePhase = kwargs.get(
            'programmePhase', None)
        self.sampleId = kwargs.get(
            'sampleId', None)
        self.sampleState = kwargs.get(
            'sampleState', None)
        self.sampleType = kwargs.get(
            'sampleType', None)
        self.sampleUid = kwargs.get(
            'sampleUid', None)
        self.source = kwargs.get(
            'source', None)
        self.storageMedium = kwargs.get(
            'storageMedium', None)


class GmsConsentStatus(ProtocolElement):
    """
    Consent Status for GMS
    """
    _schemaSource = """
{"type": "record", "name": "GmsConsentStatus", "namespace": "org.gel.models.participant.avro",
"doc": "", "fields": [{"name": "programmeConsent", "type": {"type": "enum", "name":
"GenericConsent", "doc": "", "symbols": ["yes", "no", "undefined", "not_applicable"]}, "doc": ""},
{"name": "primaryFindingConsent", "type": "GenericConsent", "doc": ""}, {"name": "researchConsent",
"type": "GenericConsent", "doc": ""}, {"name": "healthRelatedFindingConsent", "type":
"GenericConsent", "doc": ""}, {"name": "carrierStatusConsent", "type": "GenericConsent", "doc": ""},
{"name": "pharmacogenomicsFindingConsent", "type": "GenericConsent", "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "carrierStatusConsent",
        "healthRelatedFindingConsent",
        "pharmacogenomicsFindingConsent",
        "primaryFindingConsent",
        "programmeConsent",
        "researchConsent",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'carrierStatusConsent', 'healthRelatedFindingConsent',
        'pharmacogenomicsFindingConsent', 'primaryFindingConsent',
        'programmeConsent', 'researchConsent'
    ]

    def __init__(self, **kwargs):
        self.carrierStatusConsent = kwargs.get(
            'carrierStatusConsent', None)
        self.healthRelatedFindingConsent = kwargs.get(
            'healthRelatedFindingConsent', None)
        self.pharmacogenomicsFindingConsent = kwargs.get(
            'pharmacogenomicsFindingConsent', None)
        self.primaryFindingConsent = kwargs.get(
            'primaryFindingConsent', None)
        self.programmeConsent = kwargs.get(
            'programmeConsent', None)
        self.researchConsent = kwargs.get(
            'researchConsent', None)


class HaematologicalCancerLineage(object):
    """
    No documentation
    """
    MYELOID = "MYELOID"
    LYMPHOID = "LYMPHOID"
    UNKNOWN = "UNKNOWN"

    def __hash__(self):
        return str(self).__hash__()


class HpoTerm(ProtocolElement):
    """
    This defines an HPO term and its modifiers (possibly multiple)
    If HPO term presence is unknown we don't have a entry on the list
    """
    _schemaSource = """
{"type": "record", "name": "HpoTerm", "namespace": "org.gel.models.participant.avro", "doc": "",
"fields": [{"name": "term", "type": "string", "doc": ""}, {"name": "termPresence", "type": ["null",
{"type": "enum", "name": "TernaryOption", "doc": "", "symbols": ["yes", "no", "unknown"]}], "doc":
""}, {"name": "hpoBuildNumber", "type": ["null", "string"], "doc": ""}, {"name": "modifiers",
"type": ["null", {"type": "array", "items": {"type": "record", "name": "HpoTermModifiers", "doc":
"", "fields": [{"name": "laterality", "type": ["null", {"type": "enum", "name": "Laterality",
"symbols": ["RIGHT", "UNILATERAL", "BILATERAL", "LEFT"]}]}, {"name": "progression", "type": ["null",
{"type": "enum", "name": "Progression", "symbols": ["PROGRESSIVE", "NONPROGRESSIVE"]}]}, {"name":
"severity", "type": ["null", {"type": "enum", "name": "Severity", "symbols": ["BORDERLINE", "MILD",
"MODERATE", "SEVERE", "PROFOUND"]}]}, {"name": "spatialPattern", "type": ["null", {"type": "enum",
"name": "SpatialPattern", "symbols": ["DISTAL", "GENERALIZED", "LOCALIZED", "PROXIMAL"]}]}, {"name":
"hpoModifierCode", "type": ["null", "string"]}, {"name": "hpoModifierVersion", "type": ["null",
"string"]}]}}], "doc": ""}, {"name": "ageOfOnset", "type": ["null", {"type": "enum", "name":
"AgeOfOnset", "symbols": ["EMBRYONAL_ONSET", "FETAL_ONSET", "NEONATAL_ONSET", "INFANTILE_ONSET",
"CHILDHOOD_ONSET", "JUVENILE_ONSET", "YOUNG_ADULT_ONSET", "LATE_ONSET", "MIDDLE_AGE_ONSET"]}],
"doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "ageOfOnset",
        "hpoBuildNumber",
        "modifiers",
        "term",
        "termPresence",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'modifiers': HpoTermModifiers,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'modifiers': HpoTermModifiers,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'ageOfOnset', 'hpoBuildNumber', 'modifiers', 'term',
        'termPresence'
    ]

    def __init__(self, **kwargs):
        self.ageOfOnset = kwargs.get(
            'ageOfOnset', None)
        self.hpoBuildNumber = kwargs.get(
            'hpoBuildNumber', None)
        self.modifiers = kwargs.get(
            'modifiers', None)
        self.term = kwargs.get(
            'term', None)
        self.termPresence = kwargs.get(
            'termPresence', None)


class HpoTermModifiers(ProtocolElement):
    """
    HPO Modifiers     For GMS, hpoModifierCode and hpoModifierVersion
    will be used
    """
    _schemaSource = """
{"type": "record", "name": "HpoTermModifiers", "namespace": "org.gel.models.participant.avro",
"doc": "", "fields": [{"name": "laterality", "type": ["null", {"type": "enum", "name": "Laterality",
"symbols": ["RIGHT", "UNILATERAL", "BILATERAL", "LEFT"]}]}, {"name": "progression", "type": ["null",
{"type": "enum", "name": "Progression", "symbols": ["PROGRESSIVE", "NONPROGRESSIVE"]}]}, {"name":
"severity", "type": ["null", {"type": "enum", "name": "Severity", "symbols": ["BORDERLINE", "MILD",
"MODERATE", "SEVERE", "PROFOUND"]}]}, {"name": "spatialPattern", "type": ["null", {"type": "enum",
"name": "SpatialPattern", "symbols": ["DISTAL", "GENERALIZED", "LOCALIZED", "PROXIMAL"]}]}, {"name":
"hpoModifierCode", "type": ["null", "string"]}, {"name": "hpoModifierVersion", "type": ["null",
"string"]}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "hpoModifierCode",
        "hpoModifierVersion",
        "laterality",
        "progression",
        "severity",
        "spatialPattern",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'hpoModifierCode', 'hpoModifierVersion', 'laterality',
        'progression', 'severity', 'spatialPattern'
    ]

    def __init__(self, **kwargs):
        self.hpoModifierCode = kwargs.get(
            'hpoModifierCode', None)
        self.hpoModifierVersion = kwargs.get(
            'hpoModifierVersion', None)
        self.laterality = kwargs.get(
            'laterality', None)
        self.progression = kwargs.get(
            'progression', None)
        self.severity = kwargs.get(
            'severity', None)
        self.spatialPattern = kwargs.get(
            'spatialPattern', None)


class InbreedingCoefficient(ProtocolElement):
    """
    Inbreeding coefficient
    """
    _schemaSource = """
{"type": "record", "name": "InbreedingCoefficient", "namespace": "org.gel.models.participant.avro",
"doc": "", "fields": [{"name": "sampleId", "type": "string", "doc": ""}, {"name": "program", "type":
"string", "doc": ""}, {"name": "version", "type": "string", "doc": ""}, {"name": "estimationMethod",
"type": "string", "doc": ""}, {"name": "coefficient", "type": "double", "doc": ""}, {"name":
"standardError", "type": ["null", "double"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "coefficient",
        "estimationMethod",
        "program",
        "sampleId",
        "standardError",
        "version",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'coefficient', 'estimationMethod', 'program', 'sampleId',
        'standardError', 'version'
    ]

    def __init__(self, **kwargs):
        self.coefficient = kwargs.get(
            'coefficient', None)
        self.estimationMethod = kwargs.get(
            'estimationMethod', None)
        self.program = kwargs.get(
            'program', None)
        self.sampleId = kwargs.get(
            'sampleId', None)
        self.standardError = kwargs.get(
            'standardError', None)
        self.version = kwargs.get(
            'version', None)


class KgPopCategory(object):
    """
    1K Genomes project populations
    """
    ACB = "ACB"
    ASW = "ASW"
    BEB = "BEB"
    CDX = "CDX"
    CEU = "CEU"
    CHB = "CHB"
    CHS = "CHS"
    CLM = "CLM"
    ESN = "ESN"
    FIN = "FIN"
    GBR = "GBR"
    GIH = "GIH"
    GWD = "GWD"
    IBS = "IBS"
    ITU = "ITU"
    JPT = "JPT"
    KHV = "KHV"
    LWK = "LWK"
    MSL = "MSL"
    MXL = "MXL"
    PEL = "PEL"
    PJL = "PJL"
    PUR = "PUR"
    STU = "STU"
    TSI = "TSI"
    YRI = "YRI"

    def __hash__(self):
        return str(self).__hash__()


class KgSuperPopCategory(object):
    """
    1K Genomes project super populations
    """
    AFR = "AFR"
    AMR = "AMR"
    EAS = "EAS"
    EUR = "EUR"
    SAS = "SAS"

    def __hash__(self):
        return str(self).__hash__()


class Laterality(object):
    """
    No documentation
    """
    RIGHT = "RIGHT"
    UNILATERAL = "UNILATERAL"
    BILATERAL = "BILATERAL"
    LEFT = "LEFT"

    def __hash__(self):
        return str(self).__hash__()


class LifeStatus(object):
    """
    Life Status
    """
    ALIVE = "ALIVE"
    ABORTED = "ABORTED"
    DECEASED = "DECEASED"
    UNBORN = "UNBORN"
    STILLBORN = "STILLBORN"
    MISCARRIAGE = "MISCARRIAGE"

    def __hash__(self):
        return str(self).__hash__()


class MatchedSamples(ProtocolElement):
    """
    This defines a pair of germline and tumor, this pair should/must
    be analyzed together
    """
    _schemaSource = """
{"type": "record", "name": "MatchedSamples", "namespace": "org.gel.models.participant.avro", "doc":
"", "fields": [{"name": "germlineSampleId", "type": ["null", "string"], "doc": ""}, {"name":
"tumourSampleId", "type": ["null", "string"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "germlineSampleId",
        "tumourSampleId",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'germlineSampleId', 'tumourSampleId'
    ]

    def __init__(self, **kwargs):
        self.germlineSampleId = kwargs.get(
            'germlineSampleId', None)
        self.tumourSampleId = kwargs.get(
            'tumourSampleId', None)


class Method(object):
    """
    In GMS, Method is defined as how the sample was taken directly
    from the patient
    """
    ASPIRATE = "ASPIRATE"
    BIOPSY = "BIOPSY"
    NOT_APPLICABLE = "NOT_APPLICABLE"
    RESECTION = "RESECTION"
    SORTED_OTHER = "SORTED_OTHER"
    UNKNOWN = "UNKNOWN"
    UNSORTED = "UNSORTED"
    CD138_SORTED = "CD138_SORTED"

    def __hash__(self):
        return str(self).__hash__()


class Morphology(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "Morphology", "namespace": "org.gel.models.participant.avro", "fields":
[{"name": "id", "type": ["null", "string"], "doc": ""}, {"name": "name", "type": ["null", "string"],
"doc": ""}, {"name": "value", "type": ["null", "string"], "doc": ""}, {"name": "version", "type":
["null", "string"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "id",
        "name",
        "value",
        "version",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'id', 'name', 'value', 'version'
    ]

    def __init__(self, **kwargs):
        self.id = kwargs.get(
            'id', None)
        self.name = kwargs.get(
            'name', None)
        self.value = kwargs.get(
            'value', None)
        self.version = kwargs.get(
            'version', None)


class OrganisationNgis(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "OrganisationNgis", "namespace": "org.gel.models.participant.avro",
"fields": [{"name": "organisationId", "type": "string", "doc": ""}, {"name": "organisationCode",
"type": "string", "doc": ""}, {"name": "organisationName", "type": "string", "doc": ""}, {"name":
"organisationNationalGroupingId", "type": "string", "doc": ""}, {"name":
"organisationNationalGroupingName", "type": "string", "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "organisationCode",
        "organisationId",
        "organisationName",
        "organisationNationalGroupingId",
        "organisationNationalGroupingName",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'organisationCode', 'organisationId', 'organisationName',
        'organisationNationalGroupingId',
        'organisationNationalGroupingName'
    ]

    def __init__(self, **kwargs):
        self.organisationCode = kwargs.get(
            'organisationCode', None)
        self.organisationId = kwargs.get(
            'organisationId', None)
        self.organisationName = kwargs.get(
            'organisationName', None)
        self.organisationNationalGroupingId = kwargs.get(
            'organisationNationalGroupingId', None)
        self.organisationNationalGroupingName = kwargs.get(
            'organisationNationalGroupingName', None)


class ParticipantQCState(object):
    """
    QCState Status
    """
    noState = "noState"
    passedMedicalReviewReadyForInterpretation = "passedMedicalReviewReadyForInterpretation"
    passedMedicalReviewNotReadyForInterpretation = "passedMedicalReviewNotReadyForInterpretation"
    queryToGel = "queryToGel"
    queryToGMC = "queryToGMC"
    failed = "failed"

    def __hash__(self):
        return str(self).__hash__()


class Pedigree(ProtocolElement):
    """
    This is the concept of a family with associated phenotypes as
    present in the record RDParticipant
    """
    _schemaSource = """
{"type": "record", "name": "Pedigree", "namespace": "org.gel.models.participant.avro", "doc": "",
"fields": [{"name": "versionControl", "type": ["null", {"type": "record", "name": "VersionControl",
"fields": [{"name": "GitVersionControl", "type": "string", "doc": "", "default": "1.2.0"}]}], "doc":
""}, {"name": "LDPCode", "type": ["null", "string"], "doc": ""}, {"name": "familyId", "type":
"string", "doc": ""}, {"name": "members", "type": {"type": "array", "items": {"type": "record",
"name": "PedigreeMember", "doc": "", "fields": [{"name": "pedigreeId", "type": ["null", "int"],
"doc": ""}, {"name": "isProband", "type": ["null", "boolean"], "doc": ""}, {"name": "participantId",
"type": ["null", "string"], "doc": ""}, {"name": "participantQCState", "type": ["null", {"type":
"enum", "name": "ParticipantQCState", "doc": "", "symbols": ["noState",
"passedMedicalReviewReadyForInterpretation", "passedMedicalReviewNotReadyForInterpretation",
"queryToGel", "queryToGMC", "failed"]}], "doc": ""}, {"name": "gelSuperFamilyId", "type": ["null",
"string"], "doc": ""}, {"name": "sex", "type": {"type": "enum", "name": "Sex", "doc": "", "symbols":
["MALE", "FEMALE", "UNKNOWN"]}, "doc": ""}, {"name": "personKaryotypicSex", "type": ["null",
{"type": "enum", "name": "PersonKaryotipicSex", "doc": "", "symbols": ["UNKNOWN", "XX", "XY", "XO",
"XXY", "XXX", "XXYY", "XXXY", "XXXX", "XYY", "OTHER"]}], "doc": ""}, {"name": "yearOfBirth", "type":
["null", "int"], "doc": ""}, {"name": "fatherId", "type": ["null", "int"], "doc": ""}, {"name":
"motherId", "type": ["null", "int"], "doc": ""}, {"name": "superFatherId", "type": ["null", "int"],
"doc": ""}, {"name": "superMotherId", "type": ["null", "int"], "doc": ""}, {"name": "twinGroup",
"type": ["null", "int"], "doc": ""}, {"name": "monozygotic", "type": ["null", {"type": "enum",
"name": "TernaryOption", "doc": "", "symbols": ["yes", "no", "unknown"]}], "doc": ""}, {"name":
"adoptedStatus", "type": ["null", {"type": "enum", "name": "AdoptedStatus", "doc": "", "symbols":
["notadopted", "adoptedin", "adoptedout"]}], "doc": ""}, {"name": "lifeStatus", "type": ["null",
{"type": "enum", "name": "LifeStatus", "doc": "", "symbols": ["ALIVE", "ABORTED", "DECEASED",
"UNBORN", "STILLBORN", "MISCARRIAGE"]}], "doc": ""}, {"name": "consanguineousParents", "type":
["null", "TernaryOption"], "doc": ""}, {"name": "affectionStatus", "type": ["null", {"type": "enum",
"name": "AffectionStatus", "doc": "", "symbols": ["UNAFFECTED", "AFFECTED", "UNCERTAIN"]}], "doc":
""}, {"name": "disorderList", "type": ["null", {"type": "array", "items": {"type": "record", "name":
"Disorder", "doc": "", "fields": [{"name": "diseaseGroup", "type": ["null", "string"], "doc": ""},
{"name": "diseaseSubGroup", "type": ["null", "string"], "doc": ""}, {"name": "specificDisease",
"type": ["null", "string"], "doc": ""}, {"name": "ageOfOnset", "type": ["null", "float"], "doc":
""}]}}], "doc": ""}, {"name": "hpoTermList", "type": ["null", {"type": "array", "items": {"type":
"record", "name": "HpoTerm", "doc": "", "fields": [{"name": "term", "type": "string", "doc": ""},
{"name": "termPresence", "type": ["null", "TernaryOption"], "doc": ""}, {"name": "hpoBuildNumber",
"type": ["null", "string"], "doc": ""}, {"name": "modifiers", "type": ["null", {"type": "array",
"items": {"type": "record", "name": "HpoTermModifiers", "doc": "", "fields": [{"name": "laterality",
"type": ["null", {"type": "enum", "name": "Laterality", "symbols": ["RIGHT", "UNILATERAL",
"BILATERAL", "LEFT"]}]}, {"name": "progression", "type": ["null", {"type": "enum", "name":
"Progression", "symbols": ["PROGRESSIVE", "NONPROGRESSIVE"]}]}, {"name": "severity", "type":
["null", {"type": "enum", "name": "Severity", "symbols": ["BORDERLINE", "MILD", "MODERATE",
"SEVERE", "PROFOUND"]}]}, {"name": "spatialPattern", "type": ["null", {"type": "enum", "name":
"SpatialPattern", "symbols": ["DISTAL", "GENERALIZED", "LOCALIZED", "PROXIMAL"]}]}, {"name":
"hpoModifierCode", "type": ["null", "string"]}, {"name": "hpoModifierVersion", "type": ["null",
"string"]}]}}], "doc": ""}, {"name": "ageOfOnset", "type": ["null", {"type": "enum", "name":
"AgeOfOnset", "symbols": ["EMBRYONAL_ONSET", "FETAL_ONSET", "NEONATAL_ONSET", "INFANTILE_ONSET",
"CHILDHOOD_ONSET", "JUVENILE_ONSET", "YOUNG_ADULT_ONSET", "LATE_ONSET", "MIDDLE_AGE_ONSET"]}],
"doc": ""}]}}], "doc": ""}, {"name": "ancestries", "type": ["null", {"type": "record", "name":
"Ancestries", "doc": "", "fields": [{"name": "mothersEthnicOrigin", "type": ["null", {"type":
"enum", "name": "EthnicCategory", "doc": "", "symbols": ["D", "E", "F", "G", "A", "B", "C", "L",
"M", "N", "H", "J", "K", "P", "S", "R", "Z"]}], "doc": ""}, {"name": "mothersOtherRelevantAncestry",
"type": ["null", "string"], "doc": ""}, {"name": "fathersEthnicOrigin", "type": ["null",
"EthnicCategory"], "doc": ""}, {"name": "fathersOtherRelevantAncestry", "type": ["null", "string"],
"doc": ""}, {"name": "chiSquare1KGenomesPhase3Pop", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "ChiSquare1KGenomesPhase3Pop", "doc": "", "fields": [{"name":
"kgSuperPopCategory", "type": {"type": "enum", "name": "KgSuperPopCategory", "doc": "", "symbols":
["AFR", "AMR", "EAS", "EUR", "SAS"]}, "doc": ""}, {"name": "kgPopCategory", "type": ["null",
{"type": "enum", "name": "KgPopCategory", "doc": "", "symbols": ["ACB", "ASW", "BEB", "CDX", "CEU",
"CHB", "CHS", "CLM", "ESN", "FIN", "GBR", "GIH", "GWD", "IBS", "ITU", "JPT", "KHV", "LWK", "MSL",
"MXL", "PEL", "PJL", "PUR", "STU", "TSI", "YRI"]}], "doc": ""}, {"name": "chiSquare", "type":
"double", "doc": ""}]}}], "doc": ""}]}], "doc": ""}, {"name": "consentStatus", "type": ["null",
{"type": "record", "name": "ConsentStatus", "doc": "", "fields": [{"name": "programmeConsent",
"type": "boolean", "doc": "", "default": false}, {"name": "primaryFindingConsent", "type":
"boolean", "doc": "", "default": false}, {"name": "secondaryFindingConsent", "type": "boolean",
"doc": "", "default": false}, {"name": "carrierStatusConsent", "type": "boolean", "doc": "",
"default": false}]}], "doc": ""}, {"name": "testConsentStatus", "type": ["null", {"type": "record",
"name": "GmsConsentStatus", "doc": "", "fields": [{"name": "programmeConsent", "type": {"type":
"enum", "name": "GenericConsent", "doc": "", "symbols": ["yes", "no", "undefined",
"not_applicable"]}, "doc": ""}, {"name": "primaryFindingConsent", "type": "GenericConsent", "doc":
""}, {"name": "researchConsent", "type": "GenericConsent", "doc": ""}, {"name":
"healthRelatedFindingConsent", "type": "GenericConsent", "doc": ""}, {"name":
"carrierStatusConsent", "type": "GenericConsent", "doc": ""}, {"name":
"pharmacogenomicsFindingConsent", "type": "GenericConsent", "doc": ""}]}], "doc": ""}, {"name":
"samples", "type": ["null", {"type": "array", "items": {"type": "record", "name": "GermlineSample",
"doc": "", "fields": [{"name": "sampleId", "type": "string", "doc": ""}, {"name": "labSampleId",
"type": "int", "doc": ""}, {"name": "LDPCode", "type": ["null", "string"], "doc": ""}, {"name":
"source", "type": ["null", {"type": "enum", "name": "SampleSource", "doc": "", "symbols":
["AMNIOTIC_FLUID", "BLOOD", "BONE_MARROW", "BONE_MARROW_ASPIRATE_TUMOUR_CELLS",
"BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS", "BUCCAL_SWAB", "CHORIONIC_VILLUS_SAMPLE", "FIBROBLAST",
"FLUID", "FRESH_TISSUE_IN_CULTURE_MEDIUM", "OTHER", "SALIVA", "TISSUE", "TUMOUR", "URINE"]}], "doc":
""}, {"name": "product", "type": ["null", {"type": "enum", "name": "Product", "symbols": ["DNA",
"RNA"]}], "doc": ""}, {"name": "preparationMethod", "type": ["null", {"type": "enum", "name":
"PreparationMethod", "doc": "", "symbols": ["ASPIRATE", "CD128_SORTED_CELLS", "CD138_SORTED_CELLS",
"EDTA", "FF", "FFPE", "LI_HEP", "ORAGENE"]}], "doc": ""}, {"name": "programmePhase", "type":
["null", {"type": "enum", "name": "ProgrammePhase", "symbols": ["CRUK", "OXFORD", "CLL", "IIP",
"MAIN", "EXPT"]}], "doc": ""}, {"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc":
""}, {"name": "participantId", "type": ["null", "string"]}, {"name": "participantUid", "type":
["null", "string"], "doc": ""}, {"name": "sampleUid", "type": ["null", "string"]}, {"name":
"maskedPid", "type": ["null", "string"]}, {"name": "method", "type": ["null", {"type": "enum",
"name": "Method", "doc": "", "symbols": ["ASPIRATE", "BIOPSY", "NOT_APPLICABLE", "RESECTION",
"SORTED_OTHER", "UNKNOWN", "UNSORTED", "CD138_SORTED"]}], "doc": ""}, {"name": "storageMedium",
"type": ["null", {"type": "enum", "name": "StorageMedium", "doc": "", "symbols": ["EDTA", "FF",
"LI_HEP", "ORAGENE", "FFPE"]}], "doc": ""}, {"name": "sampleType", "type": ["null", "string"],
"doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}}], "doc": ""}, {"name":
"inbreedingCoefficient", "type": ["null", {"type": "record", "name": "InbreedingCoefficient", "doc":
"", "fields": [{"name": "sampleId", "type": "string", "doc": ""}, {"name": "program", "type":
"string", "doc": ""}, {"name": "version", "type": "string", "doc": ""}, {"name": "estimationMethod",
"type": "string", "doc": ""}, {"name": "coefficient", "type": "double", "doc": ""}, {"name":
"standardError", "type": ["null", "double"], "doc": ""}]}], "doc": ""}, {"name":
"additionalInformation", "type": ["null", {"type": "map", "values": "string"}], "doc": ""}, {"name":
"lastMenstrualPeriod", "type": ["null", "string"], "doc": ""}, {"name": "diagnosticDetails", "type":
["null", {"type": "array", "items": {"type": "record", "name": "DiagnosticDetail", "fields":
[{"name": "diagnosisCodingSystem", "type": "string", "doc": ""}, {"name":
"diagnosisCodingSystemVersion", "type": ["null", "string"], "doc": ""}, {"name": "diagnosisCode",
"type": "string", "doc": ""}, {"name": "diagnosisDescription", "type": ["null", "string"], "doc":
""}, {"name": "diagnosisCertainty", "type": ["null", "string"], "doc": ""}, {"name":
"ageAtOnsetInYears", "type": ["null", "float"], "doc": ""}]}}], "doc": ""}, {"name":
"participantUid", "type": ["null", "string"], "doc": ""}, {"name": "clinicalEthnicities", "type":
["null", {"type": "array", "items": {"type": "enum", "name": "ClinicalEthnicity", "doc": "",
"symbols": ["A", "B", "C", "C2", "C3", "CA", "CB", "CC", "CD", "CE", "CF", "CG", "CH", "CJ", "CK",
"CL", "CM", "CN", "CP", "CQ", "CR", "CS", "CT", "CU", "CV", "CW", "CX", "CY", "D", "E", "F", "G",
"GA", "GB", "GC", "GD", "GE", "GF", "H", "J", "K", "L", "LA", "LB", "LC", "LD", "LE", "LF", "LG",
"LH", "LJ", "LK", "M", "N", "P", "PA", "PB", "PC", "PD", "PE", "R", "S", "S1", "S2", "SA", "SB",
"SC", "SD", "SE", "Z"]}}], "doc": ""}, {"name": "previousTreatment", "type": ["null", {"type":
"array", "items": {"type": "record", "name": "PreviousTreatment", "doc": "", "fields": [{"name":
"previousTreatmentType", "type": ["null", "string"]}, {"name": "previousTreatmentName", "type":
["null", "string"]}, {"name": "previousTreatmentDate", "type": ["null", {"type": "record", "name":
"Date", "doc": "", "fields": [{"name": "year", "type": "int", "doc": ""}, {"name": "month", "type":
["null", "int"], "doc": ""}, {"name": "day", "type": ["null", "int"], "doc": ""}]}]}]}}], "doc":
""}]}}, "doc": ""}, {"name": "analysisPanels", "type": ["null", {"type": "array", "items": {"type":
"record", "name": "AnalysisPanel", "doc": "", "fields": [{"name": "specificDisease", "type":
"string", "doc": ""}, {"name": "panelName", "type": "string", "doc": ""}, {"name": "panelId",
"type": ["null", "string"], "doc": ""}, {"name": "panelVersion", "type": ["null", "string"], "doc":
""}, {"name": "reviewOutcome", "type": ["null", "string"], "doc": ""}, {"name":
"multipleGeneticOrigins", "type": ["null", "string"], "doc": ""}]}}], "doc": ""}, {"name":
"diseasePenetrances", "type": ["null", {"type": "array", "items": {"type": "record", "name":
"DiseasePenetrance", "doc": "", "fields": [{"name": "specificDisease", "type": "string", "doc": ""},
{"name": "penetrance", "type": {"type": "enum", "name": "Penetrance", "doc": "", "symbols":
["complete", "incomplete"]}, "doc": ""}]}}], "doc": ""}, {"name": "readyForAnalysis", "type":
"boolean", "doc": ""}, {"name": "familyQCState", "type": ["null", {"type": "enum", "name":
"FamilyQCState", "doc": "", "symbols": ["noState", "passedMedicalReviewReadyForInterpretation",
"passedMedicalReviewNotReadyForInterpretation", "queryToGel", "queryToGMC", "failed"]}], "doc":
""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "LDPCode",
        "analysisPanels",
        "diseasePenetrances",
        "familyId",
        "familyQCState",
        "members",
        "readyForAnalysis",
        "versionControl",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'analysisPanels': AnalysisPanel,
            'diseasePenetrances': DiseasePenetrance,
            'members': PedigreeMember,
            'versionControl': VersionControl,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'analysisPanels': AnalysisPanel,
            'diseasePenetrances': DiseasePenetrance,
            'members': PedigreeMember,
            'versionControl': VersionControl,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'LDPCode', 'analysisPanels', 'diseasePenetrances', 'familyId',
        'familyQCState', 'members', 'readyForAnalysis',
        'versionControl'
    ]

    def __init__(self, **kwargs):
        self.LDPCode = kwargs.get(
            'LDPCode', None)
        self.analysisPanels = kwargs.get(
            'analysisPanels', None)
        self.diseasePenetrances = kwargs.get(
            'diseasePenetrances', None)
        self.familyId = kwargs.get(
            'familyId', None)
        self.familyQCState = kwargs.get(
            'familyQCState', None)
        self.members = kwargs.get(
            'members', None)
        self.readyForAnalysis = kwargs.get(
            'readyForAnalysis', None)
        self.versionControl = kwargs.get(
            'versionControl', None)


class PedigreeMember(ProtocolElement):
    """
    This defines a RD Participant (demographics and pedigree
    information)
    """
    _schemaSource = """
{"type": "record", "name": "PedigreeMember", "namespace": "org.gel.models.participant.avro", "doc":
"", "fields": [{"name": "pedigreeId", "type": ["null", "int"], "doc": ""}, {"name": "isProband",
"type": ["null", "boolean"], "doc": ""}, {"name": "participantId", "type": ["null", "string"],
"doc": ""}, {"name": "participantQCState", "type": ["null", {"type": "enum", "name":
"ParticipantQCState", "doc": "", "symbols": ["noState", "passedMedicalReviewReadyForInterpretation",
"passedMedicalReviewNotReadyForInterpretation", "queryToGel", "queryToGMC", "failed"]}], "doc": ""},
{"name": "gelSuperFamilyId", "type": ["null", "string"], "doc": ""}, {"name": "sex", "type":
{"type": "enum", "name": "Sex", "doc": "", "symbols": ["MALE", "FEMALE", "UNKNOWN"]}, "doc": ""},
{"name": "personKaryotypicSex", "type": ["null", {"type": "enum", "name": "PersonKaryotipicSex",
"doc": "", "symbols": ["UNKNOWN", "XX", "XY", "XO", "XXY", "XXX", "XXYY", "XXXY", "XXXX", "XYY",
"OTHER"]}], "doc": ""}, {"name": "yearOfBirth", "type": ["null", "int"], "doc": ""}, {"name":
"fatherId", "type": ["null", "int"], "doc": ""}, {"name": "motherId", "type": ["null", "int"],
"doc": ""}, {"name": "superFatherId", "type": ["null", "int"], "doc": ""}, {"name": "superMotherId",
"type": ["null", "int"], "doc": ""}, {"name": "twinGroup", "type": ["null", "int"], "doc": ""},
{"name": "monozygotic", "type": ["null", {"type": "enum", "name": "TernaryOption", "doc": "",
"symbols": ["yes", "no", "unknown"]}], "doc": ""}, {"name": "adoptedStatus", "type": ["null",
{"type": "enum", "name": "AdoptedStatus", "doc": "", "symbols": ["notadopted", "adoptedin",
"adoptedout"]}], "doc": ""}, {"name": "lifeStatus", "type": ["null", {"type": "enum", "name":
"LifeStatus", "doc": "", "symbols": ["ALIVE", "ABORTED", "DECEASED", "UNBORN", "STILLBORN",
"MISCARRIAGE"]}], "doc": ""}, {"name": "consanguineousParents", "type": ["null", "TernaryOption"],
"doc": ""}, {"name": "affectionStatus", "type": ["null", {"type": "enum", "name": "AffectionStatus",
"doc": "", "symbols": ["UNAFFECTED", "AFFECTED", "UNCERTAIN"]}], "doc": ""}, {"name":
"disorderList", "type": ["null", {"type": "array", "items": {"type": "record", "name": "Disorder",
"doc": "", "fields": [{"name": "diseaseGroup", "type": ["null", "string"], "doc": ""}, {"name":
"diseaseSubGroup", "type": ["null", "string"], "doc": ""}, {"name": "specificDisease", "type":
["null", "string"], "doc": ""}, {"name": "ageOfOnset", "type": ["null", "float"], "doc": ""}]}}],
"doc": ""}, {"name": "hpoTermList", "type": ["null", {"type": "array", "items": {"type": "record",
"name": "HpoTerm", "doc": "", "fields": [{"name": "term", "type": "string", "doc": ""}, {"name":
"termPresence", "type": ["null", "TernaryOption"], "doc": ""}, {"name": "hpoBuildNumber", "type":
["null", "string"], "doc": ""}, {"name": "modifiers", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "HpoTermModifiers", "doc": "", "fields": [{"name": "laterality", "type":
["null", {"type": "enum", "name": "Laterality", "symbols": ["RIGHT", "UNILATERAL", "BILATERAL",
"LEFT"]}]}, {"name": "progression", "type": ["null", {"type": "enum", "name": "Progression",
"symbols": ["PROGRESSIVE", "NONPROGRESSIVE"]}]}, {"name": "severity", "type": ["null", {"type":
"enum", "name": "Severity", "symbols": ["BORDERLINE", "MILD", "MODERATE", "SEVERE", "PROFOUND"]}]},
{"name": "spatialPattern", "type": ["null", {"type": "enum", "name": "SpatialPattern", "symbols":
["DISTAL", "GENERALIZED", "LOCALIZED", "PROXIMAL"]}]}, {"name": "hpoModifierCode", "type": ["null",
"string"]}, {"name": "hpoModifierVersion", "type": ["null", "string"]}]}}], "doc": ""}, {"name":
"ageOfOnset", "type": ["null", {"type": "enum", "name": "AgeOfOnset", "symbols": ["EMBRYONAL_ONSET",
"FETAL_ONSET", "NEONATAL_ONSET", "INFANTILE_ONSET", "CHILDHOOD_ONSET", "JUVENILE_ONSET",
"YOUNG_ADULT_ONSET", "LATE_ONSET", "MIDDLE_AGE_ONSET"]}], "doc": ""}]}}], "doc": ""}, {"name":
"ancestries", "type": ["null", {"type": "record", "name": "Ancestries", "doc": "", "fields":
[{"name": "mothersEthnicOrigin", "type": ["null", {"type": "enum", "name": "EthnicCategory", "doc":
"", "symbols": ["D", "E", "F", "G", "A", "B", "C", "L", "M", "N", "H", "J", "K", "P", "S", "R",
"Z"]}], "doc": ""}, {"name": "mothersOtherRelevantAncestry", "type": ["null", "string"], "doc": ""},
{"name": "fathersEthnicOrigin", "type": ["null", "EthnicCategory"], "doc": ""}, {"name":
"fathersOtherRelevantAncestry", "type": ["null", "string"], "doc": ""}, {"name":
"chiSquare1KGenomesPhase3Pop", "type": ["null", {"type": "array", "items": {"type": "record",
"name": "ChiSquare1KGenomesPhase3Pop", "doc": "", "fields": [{"name": "kgSuperPopCategory", "type":
{"type": "enum", "name": "KgSuperPopCategory", "doc": "", "symbols": ["AFR", "AMR", "EAS", "EUR",
"SAS"]}, "doc": ""}, {"name": "kgPopCategory", "type": ["null", {"type": "enum", "name":
"KgPopCategory", "doc": "", "symbols": ["ACB", "ASW", "BEB", "CDX", "CEU", "CHB", "CHS", "CLM",
"ESN", "FIN", "GBR", "GIH", "GWD", "IBS", "ITU", "JPT", "KHV", "LWK", "MSL", "MXL", "PEL", "PJL",
"PUR", "STU", "TSI", "YRI"]}], "doc": ""}, {"name": "chiSquare", "type": "double", "doc": ""}]}}],
"doc": ""}]}], "doc": ""}, {"name": "consentStatus", "type": ["null", {"type": "record", "name":
"ConsentStatus", "doc": "", "fields": [{"name": "programmeConsent", "type": "boolean", "doc": "",
"default": false}, {"name": "primaryFindingConsent", "type": "boolean", "doc": "", "default":
false}, {"name": "secondaryFindingConsent", "type": "boolean", "doc": "", "default": false},
{"name": "carrierStatusConsent", "type": "boolean", "doc": "", "default": false}]}], "doc": ""},
{"name": "testConsentStatus", "type": ["null", {"type": "record", "name": "GmsConsentStatus", "doc":
"", "fields": [{"name": "programmeConsent", "type": {"type": "enum", "name": "GenericConsent",
"doc": "", "symbols": ["yes", "no", "undefined", "not_applicable"]}, "doc": ""}, {"name":
"primaryFindingConsent", "type": "GenericConsent", "doc": ""}, {"name": "researchConsent", "type":
"GenericConsent", "doc": ""}, {"name": "healthRelatedFindingConsent", "type": "GenericConsent",
"doc": ""}, {"name": "carrierStatusConsent", "type": "GenericConsent", "doc": ""}, {"name":
"pharmacogenomicsFindingConsent", "type": "GenericConsent", "doc": ""}]}], "doc": ""}, {"name":
"samples", "type": ["null", {"type": "array", "items": {"type": "record", "name": "GermlineSample",
"doc": "", "fields": [{"name": "sampleId", "type": "string", "doc": ""}, {"name": "labSampleId",
"type": "int", "doc": ""}, {"name": "LDPCode", "type": ["null", "string"], "doc": ""}, {"name":
"source", "type": ["null", {"type": "enum", "name": "SampleSource", "doc": "", "symbols":
["AMNIOTIC_FLUID", "BLOOD", "BONE_MARROW", "BONE_MARROW_ASPIRATE_TUMOUR_CELLS",
"BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS", "BUCCAL_SWAB", "CHORIONIC_VILLUS_SAMPLE", "FIBROBLAST",
"FLUID", "FRESH_TISSUE_IN_CULTURE_MEDIUM", "OTHER", "SALIVA", "TISSUE", "TUMOUR", "URINE"]}], "doc":
""}, {"name": "product", "type": ["null", {"type": "enum", "name": "Product", "symbols": ["DNA",
"RNA"]}], "doc": ""}, {"name": "preparationMethod", "type": ["null", {"type": "enum", "name":
"PreparationMethod", "doc": "", "symbols": ["ASPIRATE", "CD128_SORTED_CELLS", "CD138_SORTED_CELLS",
"EDTA", "FF", "FFPE", "LI_HEP", "ORAGENE"]}], "doc": ""}, {"name": "programmePhase", "type":
["null", {"type": "enum", "name": "ProgrammePhase", "symbols": ["CRUK", "OXFORD", "CLL", "IIP",
"MAIN", "EXPT"]}], "doc": ""}, {"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc":
""}, {"name": "participantId", "type": ["null", "string"]}, {"name": "participantUid", "type":
["null", "string"], "doc": ""}, {"name": "sampleUid", "type": ["null", "string"]}, {"name":
"maskedPid", "type": ["null", "string"]}, {"name": "method", "type": ["null", {"type": "enum",
"name": "Method", "doc": "", "symbols": ["ASPIRATE", "BIOPSY", "NOT_APPLICABLE", "RESECTION",
"SORTED_OTHER", "UNKNOWN", "UNSORTED", "CD138_SORTED"]}], "doc": ""}, {"name": "storageMedium",
"type": ["null", {"type": "enum", "name": "StorageMedium", "doc": "", "symbols": ["EDTA", "FF",
"LI_HEP", "ORAGENE", "FFPE"]}], "doc": ""}, {"name": "sampleType", "type": ["null", "string"],
"doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}}], "doc": ""}, {"name":
"inbreedingCoefficient", "type": ["null", {"type": "record", "name": "InbreedingCoefficient", "doc":
"", "fields": [{"name": "sampleId", "type": "string", "doc": ""}, {"name": "program", "type":
"string", "doc": ""}, {"name": "version", "type": "string", "doc": ""}, {"name": "estimationMethod",
"type": "string", "doc": ""}, {"name": "coefficient", "type": "double", "doc": ""}, {"name":
"standardError", "type": ["null", "double"], "doc": ""}]}], "doc": ""}, {"name":
"additionalInformation", "type": ["null", {"type": "map", "values": "string"}], "doc": ""}, {"name":
"lastMenstrualPeriod", "type": ["null", "string"], "doc": ""}, {"name": "diagnosticDetails", "type":
["null", {"type": "array", "items": {"type": "record", "name": "DiagnosticDetail", "fields":
[{"name": "diagnosisCodingSystem", "type": "string", "doc": ""}, {"name":
"diagnosisCodingSystemVersion", "type": ["null", "string"], "doc": ""}, {"name": "diagnosisCode",
"type": "string", "doc": ""}, {"name": "diagnosisDescription", "type": ["null", "string"], "doc":
""}, {"name": "diagnosisCertainty", "type": ["null", "string"], "doc": ""}, {"name":
"ageAtOnsetInYears", "type": ["null", "float"], "doc": ""}]}}], "doc": ""}, {"name":
"participantUid", "type": ["null", "string"], "doc": ""}, {"name": "clinicalEthnicities", "type":
["null", {"type": "array", "items": {"type": "enum", "name": "ClinicalEthnicity", "doc": "",
"symbols": ["A", "B", "C", "C2", "C3", "CA", "CB", "CC", "CD", "CE", "CF", "CG", "CH", "CJ", "CK",
"CL", "CM", "CN", "CP", "CQ", "CR", "CS", "CT", "CU", "CV", "CW", "CX", "CY", "D", "E", "F", "G",
"GA", "GB", "GC", "GD", "GE", "GF", "H", "J", "K", "L", "LA", "LB", "LC", "LD", "LE", "LF", "LG",
"LH", "LJ", "LK", "M", "N", "P", "PA", "PB", "PC", "PD", "PE", "R", "S", "S1", "S2", "SA", "SB",
"SC", "SD", "SE", "Z"]}}], "doc": ""}, {"name": "previousTreatment", "type": ["null", {"type":
"array", "items": {"type": "record", "name": "PreviousTreatment", "doc": "", "fields": [{"name":
"previousTreatmentType", "type": ["null", "string"]}, {"name": "previousTreatmentName", "type":
["null", "string"]}, {"name": "previousTreatmentDate", "type": ["null", {"type": "record", "name":
"Date", "doc": "", "fields": [{"name": "year", "type": "int", "doc": ""}, {"name": "month", "type":
["null", "int"], "doc": ""}, {"name": "day", "type": ["null", "int"], "doc": ""}]}]}]}}], "doc":
""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "additionalInformation",
        "adoptedStatus",
        "affectionStatus",
        "ancestries",
        "clinicalEthnicities",
        "consanguineousParents",
        "consentStatus",
        "diagnosticDetails",
        "disorderList",
        "fatherId",
        "gelSuperFamilyId",
        "hpoTermList",
        "inbreedingCoefficient",
        "isProband",
        "lastMenstrualPeriod",
        "lifeStatus",
        "monozygotic",
        "motherId",
        "participantId",
        "participantQCState",
        "participantUid",
        "pedigreeId",
        "personKaryotypicSex",
        "previousTreatment",
        "samples",
        "sex",
        "superFatherId",
        "superMotherId",
        "testConsentStatus",
        "twinGroup",
        "yearOfBirth",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'ancestries': Ancestries,
            'consentStatus': ConsentStatus,
            'diagnosticDetails': DiagnosticDetail,
            'disorderList': Disorder,
            'hpoTermList': HpoTerm,
            'inbreedingCoefficient': InbreedingCoefficient,
            'previousTreatment': PreviousTreatment,
            'samples': GermlineSample,
            'testConsentStatus': GmsConsentStatus,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'ancestries': Ancestries,
            'consentStatus': ConsentStatus,
            'diagnosticDetails': DiagnosticDetail,
            'disorderList': Disorder,
            'hpoTermList': HpoTerm,
            'inbreedingCoefficient': InbreedingCoefficient,
            'previousTreatment': PreviousTreatment,
            'samples': GermlineSample,
            'testConsentStatus': GmsConsentStatus,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'additionalInformation', 'adoptedStatus', 'affectionStatus',
        'ancestries', 'clinicalEthnicities', 'consanguineousParents',
        'consentStatus', 'diagnosticDetails', 'disorderList',
        'fatherId', 'gelSuperFamilyId', 'hpoTermList',
        'inbreedingCoefficient', 'isProband', 'lastMenstrualPeriod',
        'lifeStatus', 'monozygotic', 'motherId', 'participantId',
        'participantQCState', 'participantUid', 'pedigreeId',
        'personKaryotypicSex', 'previousTreatment', 'samples', 'sex',
        'superFatherId', 'superMotherId', 'testConsentStatus',
        'twinGroup', 'yearOfBirth'
    ]

    def __init__(self, **kwargs):
        self.additionalInformation = kwargs.get(
            'additionalInformation', None)
        self.adoptedStatus = kwargs.get(
            'adoptedStatus', None)
        self.affectionStatus = kwargs.get(
            'affectionStatus', None)
        self.ancestries = kwargs.get(
            'ancestries', None)
        self.clinicalEthnicities = kwargs.get(
            'clinicalEthnicities', None)
        self.consanguineousParents = kwargs.get(
            'consanguineousParents', None)
        self.consentStatus = kwargs.get(
            'consentStatus', None)
        self.diagnosticDetails = kwargs.get(
            'diagnosticDetails', None)
        self.disorderList = kwargs.get(
            'disorderList', None)
        self.fatherId = kwargs.get(
            'fatherId', None)
        self.gelSuperFamilyId = kwargs.get(
            'gelSuperFamilyId', None)
        self.hpoTermList = kwargs.get(
            'hpoTermList', None)
        self.inbreedingCoefficient = kwargs.get(
            'inbreedingCoefficient', None)
        self.isProband = kwargs.get(
            'isProband', None)
        self.lastMenstrualPeriod = kwargs.get(
            'lastMenstrualPeriod', None)
        self.lifeStatus = kwargs.get(
            'lifeStatus', None)
        self.monozygotic = kwargs.get(
            'monozygotic', None)
        self.motherId = kwargs.get(
            'motherId', None)
        self.participantId = kwargs.get(
            'participantId', None)
        self.participantQCState = kwargs.get(
            'participantQCState', None)
        self.participantUid = kwargs.get(
            'participantUid', None)
        self.pedigreeId = kwargs.get(
            'pedigreeId', None)
        self.personKaryotypicSex = kwargs.get(
            'personKaryotypicSex', None)
        self.previousTreatment = kwargs.get(
            'previousTreatment', None)
        self.samples = kwargs.get(
            'samples', None)
        self.sex = kwargs.get(
            'sex', None)
        self.superFatherId = kwargs.get(
            'superFatherId', None)
        self.superMotherId = kwargs.get(
            'superMotherId', None)
        self.testConsentStatus = kwargs.get(
            'testConsentStatus', None)
        self.twinGroup = kwargs.get(
            'twinGroup', None)
        self.yearOfBirth = kwargs.get(
            'yearOfBirth', None)


class Penetrance(object):
    """
    Penetrance assumed in the analysis
    """
    complete = "complete"
    incomplete = "incomplete"

    def __hash__(self):
        return str(self).__hash__()


class PersonKaryotipicSex(object):
    """
    Karyotipic Sex
    """
    UNKNOWN = "UNKNOWN"
    XX = "XX"
    XY = "XY"
    XO = "XO"
    XXY = "XXY"
    XXX = "XXX"
    XXYY = "XXYY"
    XXXY = "XXXY"
    XXXX = "XXXX"
    XYY = "XYY"
    OTHER = "OTHER"

    def __hash__(self):
        return str(self).__hash__()


class PreparationMethod(object):
    """
    In 100K, preparation Method of sample     NOTE: In GMS, this field
    is deprecated in favour of StorageMedium and Method
    """
    ASPIRATE = "ASPIRATE"
    CD128_SORTED_CELLS = "CD128_SORTED_CELLS"
    CD138_SORTED_CELLS = "CD138_SORTED_CELLS"
    EDTA = "EDTA"
    FF = "FF"
    FFPE = "FFPE"
    LI_HEP = "LI_HEP"
    ORAGENE = "ORAGENE"

    def __hash__(self):
        return str(self).__hash__()


class PreviousTreatment(ProtocolElement):
    """
    In GMS, Previous Treatment of Patient
    """
    _schemaSource = """
{"type": "record", "name": "PreviousTreatment", "namespace": "org.gel.models.participant.avro",
"doc": "", "fields": [{"name": "previousTreatmentType", "type": ["null", "string"]}, {"name":
"previousTreatmentName", "type": ["null", "string"]}, {"name": "previousTreatmentDate", "type":
["null", {"type": "record", "name": "Date", "doc": "", "fields": [{"name": "year", "type": "int",
"doc": ""}, {"name": "month", "type": ["null", "int"], "doc": ""}, {"name": "day", "type": ["null",
"int"], "doc": ""}]}]}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "previousTreatmentDate",
        "previousTreatmentName",
        "previousTreatmentType",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'previousTreatmentDate': Date,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'previousTreatmentDate': Date,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'previousTreatmentDate', 'previousTreatmentName',
        'previousTreatmentType'
    ]

    def __init__(self, **kwargs):
        self.previousTreatmentDate = kwargs.get(
            'previousTreatmentDate', None)
        self.previousTreatmentName = kwargs.get(
            'previousTreatmentName', None)
        self.previousTreatmentType = kwargs.get(
            'previousTreatmentType', None)


class PrimaryOrMetastatic(object):
    """
    No documentation
    """
    PRIMARY = "PRIMARY"
    METASTATIC = "METASTATIC"
    UNKNOWN = "UNKNOWN"
    NOT_APPLICABLE = "NOT_APPLICABLE"

    def __hash__(self):
        return str(self).__hash__()


class Priority(object):
    """
    Transformed from TOMs from routine=medium, and urgent=high
    """
    low = "low"
    routine = "routine"
    urgent = "urgent"

    def __hash__(self):
        return str(self).__hash__()


class Product(object):
    """
    No documentation
    """
    DNA = "DNA"
    RNA = "RNA"

    def __hash__(self):
        return str(self).__hash__()


class ProgrammePhase(object):
    """
    No documentation
    """
    CRUK = "CRUK"
    OXFORD = "OXFORD"
    CLL = "CLL"
    IIP = "IIP"
    MAIN = "MAIN"
    EXPT = "EXPT"

    def __hash__(self):
        return str(self).__hash__()


class Progression(object):
    """
    No documentation
    """
    PROGRESSIVE = "PROGRESSIVE"
    NONPROGRESSIVE = "NONPROGRESSIVE"

    def __hash__(self):
        return str(self).__hash__()


class Referral(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "Referral", "namespace": "org.gel.models.participant.avro", "fields":
[{"name": "referralId", "type": "string", "doc": ""}, {"name": "referralUid", "type": "string",
"doc": ""}, {"name": "referralTests", "type": {"type": "array", "items": {"type": "record", "name":
"ReferralTest", "fields": [{"name": "referralTestId", "type": "string", "doc": ""}, {"name":
"referralTestOrderingDate", "type": ["null", {"type": "record", "name": "Date", "doc": "", "fields":
[{"name": "year", "type": "int", "doc": ""}, {"name": "month", "type": ["null", "int"], "doc": ""},
{"name": "day", "type": ["null", "int"], "doc": ""}]}], "doc": ""}, {"name":
"clinicalIndicationTest", "type": {"type": "record", "name": "ClinicalIndicationTest", "fields":
[{"name": "clinicalIndicationTestTypeId", "type": "string", "doc": ""}, {"name":
"clinicalIndicationTestTypeCode", "type": "string", "doc": ""}, {"name": "testTypeId", "type":
"string", "doc": ""}, {"name": "testTypeName", "type": "string", "doc": ""}, {"name": "technology",
"type": {"type": "record", "name": "Technology", "fields": [{"name": "testTechnologyId", "type":
"string", "doc": ""}, {"name": "testTechnologyDescription", "type": "string", "doc": ""}]}, "doc":
""}]}, "doc": ""}, {"name": "tumourSamples", "type": ["null", {"type": "array", "items": {"type":
"record", "name": "TumourSample", "doc": "", "fields": [{"name": "sampleId", "type": "string",
"doc": ""}, {"name": "labSampleId", "type": "int", "doc": ""}, {"name": "LDPCode", "type": ["null",
"string"], "doc": ""}, {"name": "tumourId", "type": ["null", "string"], "doc": ""}, {"name":
"programmePhase", "type": ["null", "string"], "doc": ""}, {"name": "diseaseType", "type": ["null",
{"type": "enum", "name": "diseaseType", "symbols": ["ADULT_GLIOMA", "BLADDER", "BREAST",
"CARCINOMA_OF_UNKNOWN_PRIMARY", "CHILDHOOD", "COLORECTAL", "ENDOCRINE", "ENDOMETRIAL_CARCINOMA",
"HAEMONC", "HEPATOPANCREATOBILIARY", "LUNG", "MALIGNANT_MELANOMA", "NASOPHARYNGEAL",
"ORAL_OROPHARYNGEAL", "OVARIAN", "PROSTATE", "RENAL", "SARCOMA", "SINONASAL",
"TESTICULAR_GERM_CELL_TUMOURS", "UPPER_GASTROINTESTINAL", "OTHER",
"NON_HODGKINS_B_CELL_LYMPHOMA_LOW_MOD_GRADE", "CLASSICAL_HODGKINS",
"NODULAR_LYMPHOCYTE_PREDOMINANT_HODGKINS", "T_CELL_LYMPHOMA"]}], "doc": ""}, {"name":
"diseaseSubType", "type": ["null", "string"], "doc": ""}, {"name": "haematologicalCancer", "type":
["null", "boolean"], "doc": ""}, {"name": "haematologicalCancerLineage", "type": ["null", {"type":
"enum", "name": "HaematologicalCancerLineage", "symbols": ["MYELOID", "LYMPHOID", "UNKNOWN"]}],
"doc": ""}, {"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc": ""}, {"name":
"tumourType", "type": ["null", "string"], "doc": ""}, {"name": "tumourContent", "type": ["null",
{"type": "enum", "name": "TumourContent", "symbols": ["High", "Medium", "Low"]}], "doc": ""},
{"name": "tumourContentPercentage", "type": ["null", "float"], "doc": ""}, {"name": "source",
"type": ["null", {"type": "enum", "name": "SampleSource", "doc": "", "symbols": ["AMNIOTIC_FLUID",
"BLOOD", "BONE_MARROW", "BONE_MARROW_ASPIRATE_TUMOUR_CELLS",
"BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS", "BUCCAL_SWAB", "CHORIONIC_VILLUS_SAMPLE", "FIBROBLAST",
"FLUID", "FRESH_TISSUE_IN_CULTURE_MEDIUM", "OTHER", "SALIVA", "TISSUE", "TUMOUR", "URINE"]}], "doc":
""}, {"name": "preparationMethod", "type": ["null", {"type": "enum", "name": "PreparationMethod",
"doc": "", "symbols": ["ASPIRATE", "CD128_SORTED_CELLS", "CD138_SORTED_CELLS", "EDTA", "FF", "FFPE",
"LI_HEP", "ORAGENE"]}], "doc": ""}, {"name": "tissueSource", "type": ["null", "string"], "doc": ""},
{"name": "product", "type": ["null", {"type": "enum", "name": "Product", "symbols": ["DNA",
"RNA"]}], "doc": ""}, {"name": "sampleMorphologies", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "Morphology", "fields": [{"name": "id", "type": ["null", "string"],
"doc": ""}, {"name": "name", "type": ["null", "string"], "doc": ""}, {"name": "value", "type":
["null", "string"], "doc": ""}, {"name": "version", "type": ["null", "string"], "doc": ""}]}}],
"doc": ""}, {"name": "sampleTopographies", "type": ["null", {"type": "array", "items": {"type":
"record", "name": "Topography", "fields": [{"name": "id", "type": ["null", "string"], "doc": ""},
{"name": "name", "type": ["null", "string"], "doc": ""}, {"name": "value", "type": ["null",
"string"], "doc": ""}, {"name": "version", "type": ["null", "string"], "doc": ""}]}}], "doc": ""},
{"name": "sampleUid", "type": ["null", "string"], "doc": ""}, {"name": "participantId", "type":
["null", "string"], "doc": ""}, {"name": "participantUid", "type": ["null", "string"], "doc": ""},
{"name": "maskedPid", "type": ["null", "string"], "doc": ""}, {"name": "method", "type": ["null",
{"type": "enum", "name": "Method", "doc": "", "symbols": ["ASPIRATE", "BIOPSY", "NOT_APPLICABLE",
"RESECTION", "SORTED_OTHER", "UNKNOWN", "UNSORTED", "CD138_SORTED"]}], "doc": ""}, {"name":
"storageMedium", "type": ["null", {"type": "enum", "name": "StorageMedium", "doc": "", "symbols":
["EDTA", "FF", "LI_HEP", "ORAGENE", "FFPE"]}], "doc": ""}, {"name": "sampleType", "type": ["null",
"string"], "doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}}], "doc":
""}, {"name": "germlineSamples", "type": ["null", {"type": "array", "items": {"type": "record",
"name": "GermlineSample", "doc": "", "fields": [{"name": "sampleId", "type": "string", "doc": ""},
{"name": "labSampleId", "type": "int", "doc": ""}, {"name": "LDPCode", "type": ["null", "string"],
"doc": ""}, {"name": "source", "type": ["null", "SampleSource"], "doc": ""}, {"name": "product",
"type": ["null", "Product"], "doc": ""}, {"name": "preparationMethod", "type": ["null",
"PreparationMethod"], "doc": ""}, {"name": "programmePhase", "type": ["null", {"type": "enum",
"name": "ProgrammePhase", "symbols": ["CRUK", "OXFORD", "CLL", "IIP", "MAIN", "EXPT"]}], "doc": ""},
{"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc": ""}, {"name": "participantId",
"type": ["null", "string"]}, {"name": "participantUid", "type": ["null", "string"], "doc": ""},
{"name": "sampleUid", "type": ["null", "string"]}, {"name": "maskedPid", "type": ["null",
"string"]}, {"name": "method", "type": ["null", "Method"], "doc": ""}, {"name": "storageMedium",
"type": ["null", "StorageMedium"], "doc": ""}, {"name": "sampleType", "type": ["null", "string"],
"doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}}], "doc": ""}, {"name":
"analysisPanels", "type": ["null", {"type": "array", "items": {"type": "record", "name":
"AnalysisPanel", "doc": "", "fields": [{"name": "specificDisease", "type": "string", "doc": ""},
{"name": "panelName", "type": "string", "doc": ""}, {"name": "panelId", "type": ["null", "string"],
"doc": ""}, {"name": "panelVersion", "type": ["null", "string"], "doc": ""}, {"name":
"reviewOutcome", "type": ["null", "string"], "doc": ""}, {"name": "multipleGeneticOrigins", "type":
["null", "string"], "doc": ""}]}}], "doc": ""}, {"name": "interpreter", "type": {"type": "record",
"name": "OrganisationNgis", "fields": [{"name": "organisationId", "type": "string", "doc": ""},
{"name": "organisationCode", "type": "string", "doc": ""}, {"name": "organisationName", "type":
"string", "doc": ""}, {"name": "organisationNationalGroupingId", "type": "string", "doc": ""},
{"name": "organisationNationalGroupingName", "type": "string", "doc": ""}]}, "doc": ""}, {"name":
"processingLab", "type": "OrganisationNgis", "doc": ""}, {"name": "priority", "type": {"type":
"enum", "name": "Priority", "doc": "", "symbols": ["low", "routine", "urgent"]}, "doc": ""},
{"name": "pipelineStartDate", "type": ["null", "Date"], "doc": ""}, {"name": "diseasePenetrances",
"type": ["null", {"type": "array", "items": {"type": "record", "name": "DiseasePenetrance", "doc":
"", "fields": [{"name": "specificDisease", "type": "string", "doc": ""}, {"name": "penetrance",
"type": {"type": "enum", "name": "Penetrance", "doc": "", "symbols": ["complete", "incomplete"]},
"doc": ""}]}}], "doc": ""}, {"name": "matchedSamples", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "MatchedSamples", "doc": "", "fields": [{"name": "germlineSampleId",
"type": ["null", "string"], "doc": ""}, {"name": "tumourSampleId", "type": ["null", "string"],
"doc": ""}]}}], "doc": ""}]}}, "doc": ""}, {"name": "requester", "type": "OrganisationNgis", "doc":
""}, {"name": "orderingDate", "type": ["null", "Date"], "doc": ""}, {"name": "pedigree", "type":
["null", {"type": "record", "name": "Pedigree", "doc": "", "fields": [{"name": "versionControl",
"type": ["null", {"type": "record", "name": "VersionControl", "fields": [{"name":
"GitVersionControl", "type": "string", "doc": "", "default": "1.2.0"}]}], "doc": ""}, {"name":
"LDPCode", "type": ["null", "string"], "doc": ""}, {"name": "familyId", "type": "string", "doc":
""}, {"name": "members", "type": {"type": "array", "items": {"type": "record", "name":
"PedigreeMember", "doc": "", "fields": [{"name": "pedigreeId", "type": ["null", "int"], "doc": ""},
{"name": "isProband", "type": ["null", "boolean"], "doc": ""}, {"name": "participantId", "type":
["null", "string"], "doc": ""}, {"name": "participantQCState", "type": ["null", {"type": "enum",
"name": "ParticipantQCState", "doc": "", "symbols": ["noState",
"passedMedicalReviewReadyForInterpretation", "passedMedicalReviewNotReadyForInterpretation",
"queryToGel", "queryToGMC", "failed"]}], "doc": ""}, {"name": "gelSuperFamilyId", "type": ["null",
"string"], "doc": ""}, {"name": "sex", "type": {"type": "enum", "name": "Sex", "doc": "", "symbols":
["MALE", "FEMALE", "UNKNOWN"]}, "doc": ""}, {"name": "personKaryotypicSex", "type": ["null",
{"type": "enum", "name": "PersonKaryotipicSex", "doc": "", "symbols": ["UNKNOWN", "XX", "XY", "XO",
"XXY", "XXX", "XXYY", "XXXY", "XXXX", "XYY", "OTHER"]}], "doc": ""}, {"name": "yearOfBirth", "type":
["null", "int"], "doc": ""}, {"name": "fatherId", "type": ["null", "int"], "doc": ""}, {"name":
"motherId", "type": ["null", "int"], "doc": ""}, {"name": "superFatherId", "type": ["null", "int"],
"doc": ""}, {"name": "superMotherId", "type": ["null", "int"], "doc": ""}, {"name": "twinGroup",
"type": ["null", "int"], "doc": ""}, {"name": "monozygotic", "type": ["null", {"type": "enum",
"name": "TernaryOption", "doc": "", "symbols": ["yes", "no", "unknown"]}], "doc": ""}, {"name":
"adoptedStatus", "type": ["null", {"type": "enum", "name": "AdoptedStatus", "doc": "", "symbols":
["notadopted", "adoptedin", "adoptedout"]}], "doc": ""}, {"name": "lifeStatus", "type": ["null",
{"type": "enum", "name": "LifeStatus", "doc": "", "symbols": ["ALIVE", "ABORTED", "DECEASED",
"UNBORN", "STILLBORN", "MISCARRIAGE"]}], "doc": ""}, {"name": "consanguineousParents", "type":
["null", "TernaryOption"], "doc": ""}, {"name": "affectionStatus", "type": ["null", {"type": "enum",
"name": "AffectionStatus", "doc": "", "symbols": ["UNAFFECTED", "AFFECTED", "UNCERTAIN"]}], "doc":
""}, {"name": "disorderList", "type": ["null", {"type": "array", "items": {"type": "record", "name":
"Disorder", "doc": "", "fields": [{"name": "diseaseGroup", "type": ["null", "string"], "doc": ""},
{"name": "diseaseSubGroup", "type": ["null", "string"], "doc": ""}, {"name": "specificDisease",
"type": ["null", "string"], "doc": ""}, {"name": "ageOfOnset", "type": ["null", "float"], "doc":
""}]}}], "doc": ""}, {"name": "hpoTermList", "type": ["null", {"type": "array", "items": {"type":
"record", "name": "HpoTerm", "doc": "", "fields": [{"name": "term", "type": "string", "doc": ""},
{"name": "termPresence", "type": ["null", "TernaryOption"], "doc": ""}, {"name": "hpoBuildNumber",
"type": ["null", "string"], "doc": ""}, {"name": "modifiers", "type": ["null", {"type": "array",
"items": {"type": "record", "name": "HpoTermModifiers", "doc": "", "fields": [{"name": "laterality",
"type": ["null", {"type": "enum", "name": "Laterality", "symbols": ["RIGHT", "UNILATERAL",
"BILATERAL", "LEFT"]}]}, {"name": "progression", "type": ["null", {"type": "enum", "name":
"Progression", "symbols": ["PROGRESSIVE", "NONPROGRESSIVE"]}]}, {"name": "severity", "type":
["null", {"type": "enum", "name": "Severity", "symbols": ["BORDERLINE", "MILD", "MODERATE",
"SEVERE", "PROFOUND"]}]}, {"name": "spatialPattern", "type": ["null", {"type": "enum", "name":
"SpatialPattern", "symbols": ["DISTAL", "GENERALIZED", "LOCALIZED", "PROXIMAL"]}]}, {"name":
"hpoModifierCode", "type": ["null", "string"]}, {"name": "hpoModifierVersion", "type": ["null",
"string"]}]}}], "doc": ""}, {"name": "ageOfOnset", "type": ["null", {"type": "enum", "name":
"AgeOfOnset", "symbols": ["EMBRYONAL_ONSET", "FETAL_ONSET", "NEONATAL_ONSET", "INFANTILE_ONSET",
"CHILDHOOD_ONSET", "JUVENILE_ONSET", "YOUNG_ADULT_ONSET", "LATE_ONSET", "MIDDLE_AGE_ONSET"]}],
"doc": ""}]}}], "doc": ""}, {"name": "ancestries", "type": ["null", {"type": "record", "name":
"Ancestries", "doc": "", "fields": [{"name": "mothersEthnicOrigin", "type": ["null", {"type":
"enum", "name": "EthnicCategory", "doc": "", "symbols": ["D", "E", "F", "G", "A", "B", "C", "L",
"M", "N", "H", "J", "K", "P", "S", "R", "Z"]}], "doc": ""}, {"name": "mothersOtherRelevantAncestry",
"type": ["null", "string"], "doc": ""}, {"name": "fathersEthnicOrigin", "type": ["null",
"EthnicCategory"], "doc": ""}, {"name": "fathersOtherRelevantAncestry", "type": ["null", "string"],
"doc": ""}, {"name": "chiSquare1KGenomesPhase3Pop", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "ChiSquare1KGenomesPhase3Pop", "doc": "", "fields": [{"name":
"kgSuperPopCategory", "type": {"type": "enum", "name": "KgSuperPopCategory", "doc": "", "symbols":
["AFR", "AMR", "EAS", "EUR", "SAS"]}, "doc": ""}, {"name": "kgPopCategory", "type": ["null",
{"type": "enum", "name": "KgPopCategory", "doc": "", "symbols": ["ACB", "ASW", "BEB", "CDX", "CEU",
"CHB", "CHS", "CLM", "ESN", "FIN", "GBR", "GIH", "GWD", "IBS", "ITU", "JPT", "KHV", "LWK", "MSL",
"MXL", "PEL", "PJL", "PUR", "STU", "TSI", "YRI"]}], "doc": ""}, {"name": "chiSquare", "type":
"double", "doc": ""}]}}], "doc": ""}]}], "doc": ""}, {"name": "consentStatus", "type": ["null",
{"type": "record", "name": "ConsentStatus", "doc": "", "fields": [{"name": "programmeConsent",
"type": "boolean", "doc": "", "default": false}, {"name": "primaryFindingConsent", "type":
"boolean", "doc": "", "default": false}, {"name": "secondaryFindingConsent", "type": "boolean",
"doc": "", "default": false}, {"name": "carrierStatusConsent", "type": "boolean", "doc": "",
"default": false}]}], "doc": ""}, {"name": "testConsentStatus", "type": ["null", {"type": "record",
"name": "GmsConsentStatus", "doc": "", "fields": [{"name": "programmeConsent", "type": {"type":
"enum", "name": "GenericConsent", "doc": "", "symbols": ["yes", "no", "undefined",
"not_applicable"]}, "doc": ""}, {"name": "primaryFindingConsent", "type": "GenericConsent", "doc":
""}, {"name": "researchConsent", "type": "GenericConsent", "doc": ""}, {"name":
"healthRelatedFindingConsent", "type": "GenericConsent", "doc": ""}, {"name":
"carrierStatusConsent", "type": "GenericConsent", "doc": ""}, {"name":
"pharmacogenomicsFindingConsent", "type": "GenericConsent", "doc": ""}]}], "doc": ""}, {"name":
"samples", "type": ["null", {"type": "array", "items": "GermlineSample"}], "doc": ""}, {"name":
"inbreedingCoefficient", "type": ["null", {"type": "record", "name": "InbreedingCoefficient", "doc":
"", "fields": [{"name": "sampleId", "type": "string", "doc": ""}, {"name": "program", "type":
"string", "doc": ""}, {"name": "version", "type": "string", "doc": ""}, {"name": "estimationMethod",
"type": "string", "doc": ""}, {"name": "coefficient", "type": "double", "doc": ""}, {"name":
"standardError", "type": ["null", "double"], "doc": ""}]}], "doc": ""}, {"name":
"additionalInformation", "type": ["null", {"type": "map", "values": "string"}], "doc": ""}, {"name":
"lastMenstrualPeriod", "type": ["null", "string"], "doc": ""}, {"name": "diagnosticDetails", "type":
["null", {"type": "array", "items": {"type": "record", "name": "DiagnosticDetail", "fields":
[{"name": "diagnosisCodingSystem", "type": "string", "doc": ""}, {"name":
"diagnosisCodingSystemVersion", "type": ["null", "string"], "doc": ""}, {"name": "diagnosisCode",
"type": "string", "doc": ""}, {"name": "diagnosisDescription", "type": ["null", "string"], "doc":
""}, {"name": "diagnosisCertainty", "type": ["null", "string"], "doc": ""}, {"name":
"ageAtOnsetInYears", "type": ["null", "float"], "doc": ""}]}}], "doc": ""}, {"name":
"participantUid", "type": ["null", "string"], "doc": ""}, {"name": "clinicalEthnicities", "type":
["null", {"type": "array", "items": {"type": "enum", "name": "ClinicalEthnicity", "doc": "",
"symbols": ["A", "B", "C", "C2", "C3", "CA", "CB", "CC", "CD", "CE", "CF", "CG", "CH", "CJ", "CK",
"CL", "CM", "CN", "CP", "CQ", "CR", "CS", "CT", "CU", "CV", "CW", "CX", "CY", "D", "E", "F", "G",
"GA", "GB", "GC", "GD", "GE", "GF", "H", "J", "K", "L", "LA", "LB", "LC", "LD", "LE", "LF", "LG",
"LH", "LJ", "LK", "M", "N", "P", "PA", "PB", "PC", "PD", "PE", "R", "S", "S1", "S2", "SA", "SB",
"SC", "SD", "SE", "Z"]}}], "doc": ""}, {"name": "previousTreatment", "type": ["null", {"type":
"array", "items": {"type": "record", "name": "PreviousTreatment", "doc": "", "fields": [{"name":
"previousTreatmentType", "type": ["null", "string"]}, {"name": "previousTreatmentName", "type":
["null", "string"]}, {"name": "previousTreatmentDate", "type": ["null", "Date"]}]}}], "doc": ""}]}},
"doc": ""}, {"name": "analysisPanels", "type": ["null", {"type": "array", "items":
"AnalysisPanel"}], "doc": ""}, {"name": "diseasePenetrances", "type": ["null", {"type": "array",
"items": "DiseasePenetrance"}], "doc": ""}, {"name": "readyForAnalysis", "type": "boolean", "doc":
""}, {"name": "familyQCState", "type": ["null", {"type": "enum", "name": "FamilyQCState", "doc": "",
"symbols": ["noState", "passedMedicalReviewReadyForInterpretation",
"passedMedicalReviewNotReadyForInterpretation", "queryToGel", "queryToGMC", "failed"]}], "doc":
""}]}], "doc": ""}, {"name": "cancerParticipant", "type": ["null", {"type": "record", "name":
"CancerParticipant", "doc": "", "fields": [{"name": "yearOfBirth", "type": ["null", "int"], "doc":
""}, {"name": "morphology", "type": ["null", {"type": "array", "items": "string"}], "doc": ""},
{"name": "readyForAnalysis", "type": "boolean", "doc": ""}, {"name": "consentStatus", "type":
["null", "ConsentStatus"], "doc": ""}, {"name": "testConsentStatus", "type": ["null",
"GmsConsentStatus"], "doc": ""}, {"name": "center", "type": ["null", "string"], "doc": ""}, {"name":
"individualId", "type": ["null", "string"], "doc": ""}, {"name": "participantId", "type": ["null",
"string"], "doc": ""}, {"name": "primaryDiagnosisDisease", "type": ["null", {"type": "array",
"items": "string"}], "doc": ""}, {"name": "primaryDiagnosisSubDisease", "type": ["null", {"type":
"array", "items": "string"}], "doc": ""}, {"name": "sex", "type": "Sex", "doc": ""}, {"name":
"additionalInformation", "type": ["null", {"type": "map", "values": "string"}], "doc": ""}, {"name":
"assignedICD10", "type": ["null", {"type": "array", "items": "string"}], "doc": ""}, {"name":
"tumourSamples", "type": ["null", {"type": "array", "items": "TumourSample"}], "doc": ""}, {"name":
"germlineSamples", "type": ["null", {"type": "array", "items": "GermlineSample"}], "doc": ""},
{"name": "versionControl", "type": ["null", "VersionControl"], "doc": ""}, {"name":
"participantUid", "type": ["null", "string"], "doc": ""}, {"name": "tumours", "type": ["null",
{"type": "array", "items": {"type": "record", "name": "Tumour", "fields": [{"name": "tumourId",
"type": "string", "doc": ""}, {"name": "tumourLocalId", "type": "string", "doc": ""}, {"name":
"tumourType", "type": {"type": "enum", "name": "TumourType", "doc": "", "symbols": ["BRAIN_TUMOUR",
"HAEMATOLOGICAL_MALIGNANCY_SOLID_SAMPLE", "HAEMATOLOGICAL_MALIGNANCY_LIQUID_SAMPLE",
"SOLID_TUMOUR_METASTATIC", "SOLID_TUMOUR_PRIMARY", "SOLID_TUMOUR", "UNKNOWN"]}, "doc": ""}, {"name":
"tumourParentId", "type": ["null", "string"], "doc": ""}, {"name": "tumourDiagnosisDate", "type":
["null", "Date"], "doc": ""}, {"name": "tumourDescription", "type": ["null", "string"], "doc": ""},
{"name": "tumourMorphologies", "type": ["null", {"type": "array", "items": "Morphology"}], "doc":
""}, {"name": "tumourTopographies", "type": ["null", {"type": "array", "items": "Topography"}],
"doc": ""}, {"name": "tumourPrimaryTopographies", "type": ["null", {"type": "array", "items":
"Topography"}], "doc": ""}, {"name": "tumourGrade", "type": ["null", "string"], "doc": ""}, {"name":
"tumourStage", "type": ["null", "string"], "doc": ""}, {"name": "tumourPrognosticScore", "type":
["null", "string"], "doc": ""}, {"name": "tumourPresentation", "type": ["null", {"type": "enum",
"name": "TumourPresentation", "symbols": ["FIRST_PRESENTATION", "RECURRENCE", "UNKNOWN"]}], "doc":
""}, {"name": "primaryOrMetastatic", "type": ["null", {"type": "enum", "name":
"PrimaryOrMetastatic", "symbols": ["PRIMARY", "METASTATIC", "UNKNOWN", "NOT_APPLICABLE"]}], "doc":
""}]}}], "doc": ""}, {"name": "previousTreatment", "type": ["null", {"type": "array", "items":
"PreviousTreatment"}], "doc": ""}]}], "doc": ""}, {"name": "clinicalIndication", "type": {"type":
"record", "name": "ClinicalIndication", "fields": [{"name": "clinicalIndicationUid", "type":
"string", "doc": ""}, {"name": "clinicalIndicationCode", "type": "string", "doc": ""}, {"name":
"clinicalIndicationFullName", "type": "string", "doc": ""}, {"name":
"clinicalIndicationVersionNumber", "type": ["null", "string"], "doc": ""}]}, "doc": ""}, {"name":
"collection", "type": ["null", "string"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "cancerParticipant",
        "clinicalIndication",
        "collection",
        "orderingDate",
        "pedigree",
        "referralId",
        "referralTests",
        "referralUid",
        "requester",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'cancerParticipant': CancerParticipant,
            'clinicalIndication': ClinicalIndication,
            'orderingDate': Date,
            'pedigree': Pedigree,
            'referralTests': ReferralTest,
            'requester': OrganisationNgis,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'cancerParticipant': CancerParticipant,
            'clinicalIndication': ClinicalIndication,
            'orderingDate': Date,
            'pedigree': Pedigree,
            'referralTests': ReferralTest,
            'requester': OrganisationNgis,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'cancerParticipant', 'clinicalIndication', 'collection',
        'orderingDate', 'pedigree', 'referralId', 'referralTests',
        'referralUid', 'requester'
    ]

    def __init__(self, **kwargs):
        self.cancerParticipant = kwargs.get(
            'cancerParticipant', None)
        self.clinicalIndication = kwargs.get(
            'clinicalIndication', ClinicalIndication())
        self.collection = kwargs.get(
            'collection', None)
        self.orderingDate = kwargs.get(
            'orderingDate', None)
        self.pedigree = kwargs.get(
            'pedigree', None)
        self.referralId = kwargs.get(
            'referralId', None)
        self.referralTests = kwargs.get(
            'referralTests', None)
        self.referralUid = kwargs.get(
            'referralUid', None)
        self.requester = kwargs.get(
            'requester', OrganisationNgis())


class ReferralTest(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "ReferralTest", "namespace": "org.gel.models.participant.avro", "fields":
[{"name": "referralTestId", "type": "string", "doc": ""}, {"name": "referralTestOrderingDate",
"type": ["null", {"type": "record", "name": "Date", "doc": "", "fields": [{"name": "year", "type":
"int", "doc": ""}, {"name": "month", "type": ["null", "int"], "doc": ""}, {"name": "day", "type":
["null", "int"], "doc": ""}]}], "doc": ""}, {"name": "clinicalIndicationTest", "type": {"type":
"record", "name": "ClinicalIndicationTest", "fields": [{"name": "clinicalIndicationTestTypeId",
"type": "string", "doc": ""}, {"name": "clinicalIndicationTestTypeCode", "type": "string", "doc":
""}, {"name": "testTypeId", "type": "string", "doc": ""}, {"name": "testTypeName", "type": "string",
"doc": ""}, {"name": "technology", "type": {"type": "record", "name": "Technology", "fields":
[{"name": "testTechnologyId", "type": "string", "doc": ""}, {"name": "testTechnologyDescription",
"type": "string", "doc": ""}]}, "doc": ""}]}, "doc": ""}, {"name": "tumourSamples", "type": ["null",
{"type": "array", "items": {"type": "record", "name": "TumourSample", "doc": "", "fields": [{"name":
"sampleId", "type": "string", "doc": ""}, {"name": "labSampleId", "type": "int", "doc": ""},
{"name": "LDPCode", "type": ["null", "string"], "doc": ""}, {"name": "tumourId", "type": ["null",
"string"], "doc": ""}, {"name": "programmePhase", "type": ["null", "string"], "doc": ""}, {"name":
"diseaseType", "type": ["null", {"type": "enum", "name": "diseaseType", "symbols": ["ADULT_GLIOMA",
"BLADDER", "BREAST", "CARCINOMA_OF_UNKNOWN_PRIMARY", "CHILDHOOD", "COLORECTAL", "ENDOCRINE",
"ENDOMETRIAL_CARCINOMA", "HAEMONC", "HEPATOPANCREATOBILIARY", "LUNG", "MALIGNANT_MELANOMA",
"NASOPHARYNGEAL", "ORAL_OROPHARYNGEAL", "OVARIAN", "PROSTATE", "RENAL", "SARCOMA", "SINONASAL",
"TESTICULAR_GERM_CELL_TUMOURS", "UPPER_GASTROINTESTINAL", "OTHER",
"NON_HODGKINS_B_CELL_LYMPHOMA_LOW_MOD_GRADE", "CLASSICAL_HODGKINS",
"NODULAR_LYMPHOCYTE_PREDOMINANT_HODGKINS", "T_CELL_LYMPHOMA"]}], "doc": ""}, {"name":
"diseaseSubType", "type": ["null", "string"], "doc": ""}, {"name": "haematologicalCancer", "type":
["null", "boolean"], "doc": ""}, {"name": "haematologicalCancerLineage", "type": ["null", {"type":
"enum", "name": "HaematologicalCancerLineage", "symbols": ["MYELOID", "LYMPHOID", "UNKNOWN"]}],
"doc": ""}, {"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc": ""}, {"name":
"tumourType", "type": ["null", "string"], "doc": ""}, {"name": "tumourContent", "type": ["null",
{"type": "enum", "name": "TumourContent", "symbols": ["High", "Medium", "Low"]}], "doc": ""},
{"name": "tumourContentPercentage", "type": ["null", "float"], "doc": ""}, {"name": "source",
"type": ["null", {"type": "enum", "name": "SampleSource", "doc": "", "symbols": ["AMNIOTIC_FLUID",
"BLOOD", "BONE_MARROW", "BONE_MARROW_ASPIRATE_TUMOUR_CELLS",
"BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS", "BUCCAL_SWAB", "CHORIONIC_VILLUS_SAMPLE", "FIBROBLAST",
"FLUID", "FRESH_TISSUE_IN_CULTURE_MEDIUM", "OTHER", "SALIVA", "TISSUE", "TUMOUR", "URINE"]}], "doc":
""}, {"name": "preparationMethod", "type": ["null", {"type": "enum", "name": "PreparationMethod",
"doc": "", "symbols": ["ASPIRATE", "CD128_SORTED_CELLS", "CD138_SORTED_CELLS", "EDTA", "FF", "FFPE",
"LI_HEP", "ORAGENE"]}], "doc": ""}, {"name": "tissueSource", "type": ["null", "string"], "doc": ""},
{"name": "product", "type": ["null", {"type": "enum", "name": "Product", "symbols": ["DNA",
"RNA"]}], "doc": ""}, {"name": "sampleMorphologies", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "Morphology", "fields": [{"name": "id", "type": ["null", "string"],
"doc": ""}, {"name": "name", "type": ["null", "string"], "doc": ""}, {"name": "value", "type":
["null", "string"], "doc": ""}, {"name": "version", "type": ["null", "string"], "doc": ""}]}}],
"doc": ""}, {"name": "sampleTopographies", "type": ["null", {"type": "array", "items": {"type":
"record", "name": "Topography", "fields": [{"name": "id", "type": ["null", "string"], "doc": ""},
{"name": "name", "type": ["null", "string"], "doc": ""}, {"name": "value", "type": ["null",
"string"], "doc": ""}, {"name": "version", "type": ["null", "string"], "doc": ""}]}}], "doc": ""},
{"name": "sampleUid", "type": ["null", "string"], "doc": ""}, {"name": "participantId", "type":
["null", "string"], "doc": ""}, {"name": "participantUid", "type": ["null", "string"], "doc": ""},
{"name": "maskedPid", "type": ["null", "string"], "doc": ""}, {"name": "method", "type": ["null",
{"type": "enum", "name": "Method", "doc": "", "symbols": ["ASPIRATE", "BIOPSY", "NOT_APPLICABLE",
"RESECTION", "SORTED_OTHER", "UNKNOWN", "UNSORTED", "CD138_SORTED"]}], "doc": ""}, {"name":
"storageMedium", "type": ["null", {"type": "enum", "name": "StorageMedium", "doc": "", "symbols":
["EDTA", "FF", "LI_HEP", "ORAGENE", "FFPE"]}], "doc": ""}, {"name": "sampleType", "type": ["null",
"string"], "doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}}], "doc":
""}, {"name": "germlineSamples", "type": ["null", {"type": "array", "items": {"type": "record",
"name": "GermlineSample", "doc": "", "fields": [{"name": "sampleId", "type": "string", "doc": ""},
{"name": "labSampleId", "type": "int", "doc": ""}, {"name": "LDPCode", "type": ["null", "string"],
"doc": ""}, {"name": "source", "type": ["null", "SampleSource"], "doc": ""}, {"name": "product",
"type": ["null", "Product"], "doc": ""}, {"name": "preparationMethod", "type": ["null",
"PreparationMethod"], "doc": ""}, {"name": "programmePhase", "type": ["null", {"type": "enum",
"name": "ProgrammePhase", "symbols": ["CRUK", "OXFORD", "CLL", "IIP", "MAIN", "EXPT"]}], "doc": ""},
{"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc": ""}, {"name": "participantId",
"type": ["null", "string"]}, {"name": "participantUid", "type": ["null", "string"], "doc": ""},
{"name": "sampleUid", "type": ["null", "string"]}, {"name": "maskedPid", "type": ["null",
"string"]}, {"name": "method", "type": ["null", "Method"], "doc": ""}, {"name": "storageMedium",
"type": ["null", "StorageMedium"], "doc": ""}, {"name": "sampleType", "type": ["null", "string"],
"doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}}], "doc": ""}, {"name":
"analysisPanels", "type": ["null", {"type": "array", "items": {"type": "record", "name":
"AnalysisPanel", "doc": "", "fields": [{"name": "specificDisease", "type": "string", "doc": ""},
{"name": "panelName", "type": "string", "doc": ""}, {"name": "panelId", "type": ["null", "string"],
"doc": ""}, {"name": "panelVersion", "type": ["null", "string"], "doc": ""}, {"name":
"reviewOutcome", "type": ["null", "string"], "doc": ""}, {"name": "multipleGeneticOrigins", "type":
["null", "string"], "doc": ""}]}}], "doc": ""}, {"name": "interpreter", "type": {"type": "record",
"name": "OrganisationNgis", "fields": [{"name": "organisationId", "type": "string", "doc": ""},
{"name": "organisationCode", "type": "string", "doc": ""}, {"name": "organisationName", "type":
"string", "doc": ""}, {"name": "organisationNationalGroupingId", "type": "string", "doc": ""},
{"name": "organisationNationalGroupingName", "type": "string", "doc": ""}]}, "doc": ""}, {"name":
"processingLab", "type": "OrganisationNgis", "doc": ""}, {"name": "priority", "type": {"type":
"enum", "name": "Priority", "doc": "", "symbols": ["low", "routine", "urgent"]}, "doc": ""},
{"name": "pipelineStartDate", "type": ["null", "Date"], "doc": ""}, {"name": "diseasePenetrances",
"type": ["null", {"type": "array", "items": {"type": "record", "name": "DiseasePenetrance", "doc":
"", "fields": [{"name": "specificDisease", "type": "string", "doc": ""}, {"name": "penetrance",
"type": {"type": "enum", "name": "Penetrance", "doc": "", "symbols": ["complete", "incomplete"]},
"doc": ""}]}}], "doc": ""}, {"name": "matchedSamples", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "MatchedSamples", "doc": "", "fields": [{"name": "germlineSampleId",
"type": ["null", "string"], "doc": ""}, {"name": "tumourSampleId", "type": ["null", "string"],
"doc": ""}]}}], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "analysisPanels",
        "clinicalIndicationTest",
        "diseasePenetrances",
        "germlineSamples",
        "interpreter",
        "matchedSamples",
        "pipelineStartDate",
        "priority",
        "processingLab",
        "referralTestId",
        "referralTestOrderingDate",
        "tumourSamples",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'analysisPanels': AnalysisPanel,
            'clinicalIndicationTest': ClinicalIndicationTest,
            'diseasePenetrances': DiseasePenetrance,
            'germlineSamples': GermlineSample,
            'interpreter': OrganisationNgis,
            'matchedSamples': MatchedSamples,
            'pipelineStartDate': Date,
            'processingLab': OrganisationNgis,
            'referralTestOrderingDate': Date,
            'tumourSamples': TumourSample,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'analysisPanels': AnalysisPanel,
            'clinicalIndicationTest': ClinicalIndicationTest,
            'diseasePenetrances': DiseasePenetrance,
            'germlineSamples': GermlineSample,
            'interpreter': OrganisationNgis,
            'matchedSamples': MatchedSamples,
            'pipelineStartDate': Date,
            'processingLab': OrganisationNgis,
            'referralTestOrderingDate': Date,
            'tumourSamples': TumourSample,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'analysisPanels', 'clinicalIndicationTest',
        'diseasePenetrances', 'germlineSamples', 'interpreter',
        'matchedSamples', 'pipelineStartDate', 'priority',
        'processingLab', 'referralTestId', 'referralTestOrderingDate',
        'tumourSamples'
    ]

    def __init__(self, **kwargs):
        self.analysisPanels = kwargs.get(
            'analysisPanels', None)
        self.clinicalIndicationTest = kwargs.get(
            'clinicalIndicationTest', ClinicalIndicationTest())
        self.diseasePenetrances = kwargs.get(
            'diseasePenetrances', None)
        self.germlineSamples = kwargs.get(
            'germlineSamples', None)
        self.interpreter = kwargs.get(
            'interpreter', OrganisationNgis())
        self.matchedSamples = kwargs.get(
            'matchedSamples', None)
        self.pipelineStartDate = kwargs.get(
            'pipelineStartDate', None)
        self.priority = kwargs.get(
            'priority', None)
        self.processingLab = kwargs.get(
            'processingLab', OrganisationNgis())
        self.referralTestId = kwargs.get(
            'referralTestId', None)
        self.referralTestOrderingDate = kwargs.get(
            'referralTestOrderingDate', None)
        self.tumourSamples = kwargs.get(
            'tumourSamples', None)


class SampleSource(object):
    """
    The source of the sample     NOTE: IN GMS,
    BONE_MARROW_ASPIRATE_TUMOUR_CELLS and
    BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS are deprecated as they
    have been separated into their respective biotypes
    """
    AMNIOTIC_FLUID = "AMNIOTIC_FLUID"
    BLOOD = "BLOOD"
    BONE_MARROW = "BONE_MARROW"
    BONE_MARROW_ASPIRATE_TUMOUR_CELLS = "BONE_MARROW_ASPIRATE_TUMOUR_CELLS"
    BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS = "BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS"
    BUCCAL_SWAB = "BUCCAL_SWAB"
    CHORIONIC_VILLUS_SAMPLE = "CHORIONIC_VILLUS_SAMPLE"
    FIBROBLAST = "FIBROBLAST"
    FLUID = "FLUID"
    FRESH_TISSUE_IN_CULTURE_MEDIUM = "FRESH_TISSUE_IN_CULTURE_MEDIUM"
    OTHER = "OTHER"
    SALIVA = "SALIVA"
    TISSUE = "TISSUE"
    TUMOUR = "TUMOUR"
    URINE = "URINE"

    def __hash__(self):
        return str(self).__hash__()


class SensitiveInformation(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "SensitiveInformation", "namespace": "org.gel.models.participant.avro",
"fields": [{"name": "versionControl", "type": {"type": "record", "name": "VersionControl", "fields":
[{"name": "GitVersionControl", "type": "string", "doc": "", "default": "1.2.0"}]}, "doc": ""},
{"name": "gelID", "type": "string"}, {"name": "externalIds", "type": ["null", {"type": "array",
"items": "string"}]}, {"name": "genomicMedicineCenter", "type": ["null", "string"]}, {"name":
"fullNameOfResponsibleConsultant", "type": ["null", "string"]}, {"name": "contactNumber", "type":
["null", "string"]}, {"name": "hospitalOfResponsibleConsultant", "type": ["null", "string"]},
{"name": "centerSampleId", "type": ["null", "string"]}, {"name": "originatingCenter", "type":
["null", "string"]}, {"name": "centerPatientId", "type": ["null", "string"]}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "centerPatientId",
        "centerSampleId",
        "contactNumber",
        "externalIds",
        "fullNameOfResponsibleConsultant",
        "gelID",
        "genomicMedicineCenter",
        "hospitalOfResponsibleConsultant",
        "originatingCenter",
        "versionControl",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'versionControl': VersionControl,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'versionControl': VersionControl,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'centerPatientId', 'centerSampleId', 'contactNumber',
        'externalIds', 'fullNameOfResponsibleConsultant', 'gelID',
        'genomicMedicineCenter', 'hospitalOfResponsibleConsultant',
        'originatingCenter', 'versionControl'
    ]

    def __init__(self, **kwargs):
        self.centerPatientId = kwargs.get(
            'centerPatientId', None)
        self.centerSampleId = kwargs.get(
            'centerSampleId', None)
        self.contactNumber = kwargs.get(
            'contactNumber', None)
        self.externalIds = kwargs.get(
            'externalIds', None)
        self.fullNameOfResponsibleConsultant = kwargs.get(
            'fullNameOfResponsibleConsultant', None)
        self.gelID = kwargs.get(
            'gelID', None)
        self.genomicMedicineCenter = kwargs.get(
            'genomicMedicineCenter', None)
        self.hospitalOfResponsibleConsultant = kwargs.get(
            'hospitalOfResponsibleConsultant', None)
        self.originatingCenter = kwargs.get(
            'originatingCenter', None)
        self.versionControl = kwargs.get(
            'versionControl', VersionControl())


class Severity(object):
    """
    No documentation
    """
    BORDERLINE = "BORDERLINE"
    MILD = "MILD"
    MODERATE = "MODERATE"
    SEVERE = "SEVERE"
    PROFOUND = "PROFOUND"

    def __hash__(self):
        return str(self).__hash__()


class Sex(object):
    """
    Sex
    """
    MALE = "MALE"
    FEMALE = "FEMALE"
    UNKNOWN = "UNKNOWN"

    def __hash__(self):
        return str(self).__hash__()


class SpatialPattern(object):
    """
    No documentation
    """
    DISTAL = "DISTAL"
    GENERALIZED = "GENERALIZED"
    LOCALIZED = "LOCALIZED"
    PROXIMAL = "PROXIMAL"

    def __hash__(self):
        return str(self).__hash__()


class StorageMedium(object):
    """
    In GMS, storage medium of sample
    """
    EDTA = "EDTA"
    FF = "FF"
    LI_HEP = "LI_HEP"
    ORAGENE = "ORAGENE"
    FFPE = "FFPE"

    def __hash__(self):
        return str(self).__hash__()


class Technology(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "Technology", "namespace": "org.gel.models.participant.avro", "fields":
[{"name": "testTechnologyId", "type": "string", "doc": ""}, {"name": "testTechnologyDescription",
"type": "string", "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "testTechnologyDescription",
        "testTechnologyId",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'testTechnologyDescription', 'testTechnologyId'
    ]

    def __init__(self, **kwargs):
        self.testTechnologyDescription = kwargs.get(
            'testTechnologyDescription', None)
        self.testTechnologyId = kwargs.get(
            'testTechnologyId', None)


class TernaryOption(object):
    """
    This defines a yes/no/unknown case
    """
    yes = "yes"
    no = "no"
    unknown = "unknown"

    def __hash__(self):
        return str(self).__hash__()


class TissueSource(object):
    """
    No documentation
    """
    BMA_TUMOUR_SORTED_CELLS = "BMA_TUMOUR_SORTED_CELLS"
    CT_GUIDED_BIOPSY = "CT_GUIDED_BIOPSY"
    ENDOSCOPIC_BIOPSY = "ENDOSCOPIC_BIOPSY"
    ENDOSCOPIC_ULTRASOUND_GUIDED_BIOPSY = "ENDOSCOPIC_ULTRASOUND_GUIDED_BIOPSY"
    ENDOSCOPIC_ULTRASOUND_GUIDED_FNA = "ENDOSCOPIC_ULTRASOUND_GUIDED_FNA"
    LAPAROSCOPIC_BIOPSY = "LAPAROSCOPIC_BIOPSY"
    LAPAROSCOPIC_EXCISION = "LAPAROSCOPIC_EXCISION"
    MRI_GUIDED_BIOPSY = "MRI_GUIDED_BIOPSY"
    NON_GUIDED_BIOPSY = "NON_GUIDED_BIOPSY"
    SURGICAL_RESECTION = "SURGICAL_RESECTION"
    STEREOTACTICALLY_GUIDED_BIOPSY = "STEREOTACTICALLY_GUIDED_BIOPSY"
    USS_GUIDED_BIOPSY = "USS_GUIDED_BIOPSY"
    NON_STANDARD_BIOPSY = "NON_STANDARD_BIOPSY"
    NOT_SPECIFIED = "NOT_SPECIFIED"

    def __hash__(self):
        return str(self).__hash__()


class Topography(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "Topography", "namespace": "org.gel.models.participant.avro", "fields":
[{"name": "id", "type": ["null", "string"], "doc": ""}, {"name": "name", "type": ["null", "string"],
"doc": ""}, {"name": "value", "type": ["null", "string"], "doc": ""}, {"name": "version", "type":
["null", "string"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "id",
        "name",
        "value",
        "version",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'id', 'name', 'value', 'version'
    ]

    def __init__(self, **kwargs):
        self.id = kwargs.get(
            'id', None)
        self.name = kwargs.get(
            'name', None)
        self.value = kwargs.get(
            'value', None)
        self.version = kwargs.get(
            'version', None)


class Tumour(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "Tumour", "namespace": "org.gel.models.participant.avro", "fields":
[{"name": "tumourId", "type": "string", "doc": ""}, {"name": "tumourLocalId", "type": "string",
"doc": ""}, {"name": "tumourType", "type": {"type": "enum", "name": "TumourType", "doc": "",
"symbols": ["BRAIN_TUMOUR", "HAEMATOLOGICAL_MALIGNANCY_SOLID_SAMPLE",
"HAEMATOLOGICAL_MALIGNANCY_LIQUID_SAMPLE", "SOLID_TUMOUR_METASTATIC", "SOLID_TUMOUR_PRIMARY",
"SOLID_TUMOUR", "UNKNOWN"]}, "doc": ""}, {"name": "tumourParentId", "type": ["null", "string"],
"doc": ""}, {"name": "tumourDiagnosisDate", "type": ["null", {"type": "record", "name": "Date",
"doc": "", "fields": [{"name": "year", "type": "int", "doc": ""}, {"name": "month", "type": ["null",
"int"], "doc": ""}, {"name": "day", "type": ["null", "int"], "doc": ""}]}], "doc": ""}, {"name":
"tumourDescription", "type": ["null", "string"], "doc": ""}, {"name": "tumourMorphologies", "type":
["null", {"type": "array", "items": {"type": "record", "name": "Morphology", "fields": [{"name":
"id", "type": ["null", "string"], "doc": ""}, {"name": "name", "type": ["null", "string"], "doc":
""}, {"name": "value", "type": ["null", "string"], "doc": ""}, {"name": "version", "type": ["null",
"string"], "doc": ""}]}}], "doc": ""}, {"name": "tumourTopographies", "type": ["null", {"type":
"array", "items": {"type": "record", "name": "Topography", "fields": [{"name": "id", "type":
["null", "string"], "doc": ""}, {"name": "name", "type": ["null", "string"], "doc": ""}, {"name":
"value", "type": ["null", "string"], "doc": ""}, {"name": "version", "type": ["null", "string"],
"doc": ""}]}}], "doc": ""}, {"name": "tumourPrimaryTopographies", "type": ["null", {"type": "array",
"items": "Topography"}], "doc": ""}, {"name": "tumourGrade", "type": ["null", "string"], "doc": ""},
{"name": "tumourStage", "type": ["null", "string"], "doc": ""}, {"name": "tumourPrognosticScore",
"type": ["null", "string"], "doc": ""}, {"name": "tumourPresentation", "type": ["null", {"type":
"enum", "name": "TumourPresentation", "symbols": ["FIRST_PRESENTATION", "RECURRENCE", "UNKNOWN"]}],
"doc": ""}, {"name": "primaryOrMetastatic", "type": ["null", {"type": "enum", "name":
"PrimaryOrMetastatic", "symbols": ["PRIMARY", "METASTATIC", "UNKNOWN", "NOT_APPLICABLE"]}], "doc":
""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "primaryOrMetastatic",
        "tumourDescription",
        "tumourDiagnosisDate",
        "tumourGrade",
        "tumourId",
        "tumourLocalId",
        "tumourMorphologies",
        "tumourParentId",
        "tumourPresentation",
        "tumourPrimaryTopographies",
        "tumourPrognosticScore",
        "tumourStage",
        "tumourTopographies",
        "tumourType",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'tumourDiagnosisDate': Date,
            'tumourMorphologies': Morphology,
            'tumourPrimaryTopographies': Topography,
            'tumourTopographies': Topography,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'tumourDiagnosisDate': Date,
            'tumourMorphologies': Morphology,
            'tumourPrimaryTopographies': Topography,
            'tumourTopographies': Topography,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'primaryOrMetastatic', 'tumourDescription',
        'tumourDiagnosisDate', 'tumourGrade', 'tumourId',
        'tumourLocalId', 'tumourMorphologies', 'tumourParentId',
        'tumourPresentation', 'tumourPrimaryTopographies',
        'tumourPrognosticScore', 'tumourStage', 'tumourTopographies',
        'tumourType'
    ]

    def __init__(self, **kwargs):
        self.primaryOrMetastatic = kwargs.get(
            'primaryOrMetastatic', None)
        self.tumourDescription = kwargs.get(
            'tumourDescription', None)
        self.tumourDiagnosisDate = kwargs.get(
            'tumourDiagnosisDate', None)
        self.tumourGrade = kwargs.get(
            'tumourGrade', None)
        self.tumourId = kwargs.get(
            'tumourId', None)
        self.tumourLocalId = kwargs.get(
            'tumourLocalId', None)
        self.tumourMorphologies = kwargs.get(
            'tumourMorphologies', None)
        self.tumourParentId = kwargs.get(
            'tumourParentId', None)
        self.tumourPresentation = kwargs.get(
            'tumourPresentation', None)
        self.tumourPrimaryTopographies = kwargs.get(
            'tumourPrimaryTopographies', None)
        self.tumourPrognosticScore = kwargs.get(
            'tumourPrognosticScore', None)
        self.tumourStage = kwargs.get(
            'tumourStage', None)
        self.tumourTopographies = kwargs.get(
            'tumourTopographies', None)
        self.tumourType = kwargs.get(
            'tumourType', None)


class TumourContent(object):
    """
    No documentation
    """
    High = "High"
    Medium = "Medium"
    Low = "Low"

    def __hash__(self):
        return str(self).__hash__()


class TumourPresentation(object):
    """
    No documentation
    """
    FIRST_PRESENTATION = "FIRST_PRESENTATION"
    RECURRENCE = "RECURRENCE"
    UNKNOWN = "UNKNOWN"

    def __hash__(self):
        return str(self).__hash__()


class TumourSample(ProtocolElement):
    """
    A tumour sample
    """
    _schemaSource = """
{"type": "record", "name": "TumourSample", "namespace": "org.gel.models.participant.avro", "doc":
"", "fields": [{"name": "sampleId", "type": "string", "doc": ""}, {"name": "labSampleId", "type":
"int", "doc": ""}, {"name": "LDPCode", "type": ["null", "string"], "doc": ""}, {"name": "tumourId",
"type": ["null", "string"], "doc": ""}, {"name": "programmePhase", "type": ["null", "string"],
"doc": ""}, {"name": "diseaseType", "type": ["null", {"type": "enum", "name": "diseaseType",
"symbols": ["ADULT_GLIOMA", "BLADDER", "BREAST", "CARCINOMA_OF_UNKNOWN_PRIMARY", "CHILDHOOD",
"COLORECTAL", "ENDOCRINE", "ENDOMETRIAL_CARCINOMA", "HAEMONC", "HEPATOPANCREATOBILIARY", "LUNG",
"MALIGNANT_MELANOMA", "NASOPHARYNGEAL", "ORAL_OROPHARYNGEAL", "OVARIAN", "PROSTATE", "RENAL",
"SARCOMA", "SINONASAL", "TESTICULAR_GERM_CELL_TUMOURS", "UPPER_GASTROINTESTINAL", "OTHER",
"NON_HODGKINS_B_CELL_LYMPHOMA_LOW_MOD_GRADE", "CLASSICAL_HODGKINS",
"NODULAR_LYMPHOCYTE_PREDOMINANT_HODGKINS", "T_CELL_LYMPHOMA"]}], "doc": ""}, {"name":
"diseaseSubType", "type": ["null", "string"], "doc": ""}, {"name": "haematologicalCancer", "type":
["null", "boolean"], "doc": ""}, {"name": "haematologicalCancerLineage", "type": ["null", {"type":
"enum", "name": "HaematologicalCancerLineage", "symbols": ["MYELOID", "LYMPHOID", "UNKNOWN"]}],
"doc": ""}, {"name": "clinicalSampleDateTime", "type": ["null", "string"], "doc": ""}, {"name":
"tumourType", "type": ["null", "string"], "doc": ""}, {"name": "tumourContent", "type": ["null",
{"type": "enum", "name": "TumourContent", "symbols": ["High", "Medium", "Low"]}], "doc": ""},
{"name": "tumourContentPercentage", "type": ["null", "float"], "doc": ""}, {"name": "source",
"type": ["null", {"type": "enum", "name": "SampleSource", "doc": "", "symbols": ["AMNIOTIC_FLUID",
"BLOOD", "BONE_MARROW", "BONE_MARROW_ASPIRATE_TUMOUR_CELLS",
"BONE_MARROW_ASPIRATE_TUMOUR_SORTED_CELLS", "BUCCAL_SWAB", "CHORIONIC_VILLUS_SAMPLE", "FIBROBLAST",
"FLUID", "FRESH_TISSUE_IN_CULTURE_MEDIUM", "OTHER", "SALIVA", "TISSUE", "TUMOUR", "URINE"]}], "doc":
""}, {"name": "preparationMethod", "type": ["null", {"type": "enum", "name": "PreparationMethod",
"doc": "", "symbols": ["ASPIRATE", "CD128_SORTED_CELLS", "CD138_SORTED_CELLS", "EDTA", "FF", "FFPE",
"LI_HEP", "ORAGENE"]}], "doc": ""}, {"name": "tissueSource", "type": ["null", "string"], "doc": ""},
{"name": "product", "type": ["null", {"type": "enum", "name": "Product", "symbols": ["DNA",
"RNA"]}], "doc": ""}, {"name": "sampleMorphologies", "type": ["null", {"type": "array", "items":
{"type": "record", "name": "Morphology", "fields": [{"name": "id", "type": ["null", "string"],
"doc": ""}, {"name": "name", "type": ["null", "string"], "doc": ""}, {"name": "value", "type":
["null", "string"], "doc": ""}, {"name": "version", "type": ["null", "string"], "doc": ""}]}}],
"doc": ""}, {"name": "sampleTopographies", "type": ["null", {"type": "array", "items": {"type":
"record", "name": "Topography", "fields": [{"name": "id", "type": ["null", "string"], "doc": ""},
{"name": "name", "type": ["null", "string"], "doc": ""}, {"name": "value", "type": ["null",
"string"], "doc": ""}, {"name": "version", "type": ["null", "string"], "doc": ""}]}}], "doc": ""},
{"name": "sampleUid", "type": ["null", "string"], "doc": ""}, {"name": "participantId", "type":
["null", "string"], "doc": ""}, {"name": "participantUid", "type": ["null", "string"], "doc": ""},
{"name": "maskedPid", "type": ["null", "string"], "doc": ""}, {"name": "method", "type": ["null",
{"type": "enum", "name": "Method", "doc": "", "symbols": ["ASPIRATE", "BIOPSY", "NOT_APPLICABLE",
"RESECTION", "SORTED_OTHER", "UNKNOWN", "UNSORTED", "CD138_SORTED"]}], "doc": ""}, {"name":
"storageMedium", "type": ["null", {"type": "enum", "name": "StorageMedium", "doc": "", "symbols":
["EDTA", "FF", "LI_HEP", "ORAGENE", "FFPE"]}], "doc": ""}, {"name": "sampleType", "type": ["null",
"string"], "doc": ""}, {"name": "sampleState", "type": ["null", "string"], "doc": ""}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {
        "LDPCode",
        "clinicalSampleDateTime",
        "diseaseSubType",
        "diseaseType",
        "haematologicalCancer",
        "haematologicalCancerLineage",
        "labSampleId",
        "maskedPid",
        "method",
        "participantId",
        "participantUid",
        "preparationMethod",
        "product",
        "programmePhase",
        "sampleId",
        "sampleMorphologies",
        "sampleState",
        "sampleTopographies",
        "sampleType",
        "sampleUid",
        "source",
        "storageMedium",
        "tissueSource",
        "tumourContent",
        "tumourContentPercentage",
        "tumourId",
        "tumourType",
    }

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'sampleMorphologies': Morphology,
            'sampleTopographies': Topography,
        }
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {
            'sampleMorphologies': Morphology,
            'sampleTopographies': Topography,
        }

        return embeddedTypes[fieldName]

    __slots__ = [
        'LDPCode', 'clinicalSampleDateTime', 'diseaseSubType',
        'diseaseType', 'haematologicalCancer',
        'haematologicalCancerLineage', 'labSampleId', 'maskedPid',
        'method', 'participantId', 'participantUid',
        'preparationMethod', 'product', 'programmePhase', 'sampleId',
        'sampleMorphologies', 'sampleState', 'sampleTopographies',
        'sampleType', 'sampleUid', 'source', 'storageMedium',
        'tissueSource', 'tumourContent', 'tumourContentPercentage',
        'tumourId', 'tumourType'
    ]

    def __init__(self, **kwargs):
        self.LDPCode = kwargs.get(
            'LDPCode', None)
        self.clinicalSampleDateTime = kwargs.get(
            'clinicalSampleDateTime', None)
        self.diseaseSubType = kwargs.get(
            'diseaseSubType', None)
        self.diseaseType = kwargs.get(
            'diseaseType', None)
        self.haematologicalCancer = kwargs.get(
            'haematologicalCancer', None)
        self.haematologicalCancerLineage = kwargs.get(
            'haematologicalCancerLineage', None)
        self.labSampleId = kwargs.get(
            'labSampleId', None)
        self.maskedPid = kwargs.get(
            'maskedPid', None)
        self.method = kwargs.get(
            'method', None)
        self.participantId = kwargs.get(
            'participantId', None)
        self.participantUid = kwargs.get(
            'participantUid', None)
        self.preparationMethod = kwargs.get(
            'preparationMethod', None)
        self.product = kwargs.get(
            'product', None)
        self.programmePhase = kwargs.get(
            'programmePhase', None)
        self.sampleId = kwargs.get(
            'sampleId', None)
        self.sampleMorphologies = kwargs.get(
            'sampleMorphologies', None)
        self.sampleState = kwargs.get(
            'sampleState', None)
        self.sampleTopographies = kwargs.get(
            'sampleTopographies', None)
        self.sampleType = kwargs.get(
            'sampleType', None)
        self.sampleUid = kwargs.get(
            'sampleUid', None)
        self.source = kwargs.get(
            'source', None)
        self.storageMedium = kwargs.get(
            'storageMedium', None)
        self.tissueSource = kwargs.get(
            'tissueSource', None)
        self.tumourContent = kwargs.get(
            'tumourContent', None)
        self.tumourContentPercentage = kwargs.get(
            'tumourContentPercentage', None)
        self.tumourId = kwargs.get(
            'tumourId', None)
        self.tumourType = kwargs.get(
            'tumourType', None)


class TumourType(object):
    """
    NOTE: This has been changed completely, the previous tumour type
    has been split into TumourPresentation and PrimaryOrMetastatic
    """
    BRAIN_TUMOUR = "BRAIN_TUMOUR"
    HAEMATOLOGICAL_MALIGNANCY_SOLID_SAMPLE = "HAEMATOLOGICAL_MALIGNANCY_SOLID_SAMPLE"
    HAEMATOLOGICAL_MALIGNANCY_LIQUID_SAMPLE = "HAEMATOLOGICAL_MALIGNANCY_LIQUID_SAMPLE"
    SOLID_TUMOUR_METASTATIC = "SOLID_TUMOUR_METASTATIC"
    SOLID_TUMOUR_PRIMARY = "SOLID_TUMOUR_PRIMARY"
    SOLID_TUMOUR = "SOLID_TUMOUR"
    UNKNOWN = "UNKNOWN"

    def __hash__(self):
        return str(self).__hash__()


class VersionControl(ProtocolElement):
    """
    No documentation
    """
    _schemaSource = """
{"type": "record", "name": "VersionControl", "namespace": "org.gel.models.participant.avro",
"fields": [{"name": "GitVersionControl", "type": "string", "doc": "", "default": "1.2.0"}]}
"""
    schema = avro_parse(_schemaSource)
    requiredFields = {}

    @classmethod
    def isEmbeddedType(cls, fieldName):
        embeddedTypes = {}
        return fieldName in embeddedTypes

    @classmethod
    def getEmbeddedType(cls, fieldName):
        embeddedTypes = {}

        return embeddedTypes[fieldName]

    __slots__ = [
        'GitVersionControl'
    ]

    def __init__(self, **kwargs):
        self.GitVersionControl = kwargs.get(
            'GitVersionControl', '1.2.0')


class diseaseType(object):
    """
    No documentation
    """
    ADULT_GLIOMA = "ADULT_GLIOMA"
    BLADDER = "BLADDER"
    BREAST = "BREAST"
    CARCINOMA_OF_UNKNOWN_PRIMARY = "CARCINOMA_OF_UNKNOWN_PRIMARY"
    CHILDHOOD = "CHILDHOOD"
    COLORECTAL = "COLORECTAL"
    ENDOCRINE = "ENDOCRINE"
    ENDOMETRIAL_CARCINOMA = "ENDOMETRIAL_CARCINOMA"
    HAEMONC = "HAEMONC"
    HEPATOPANCREATOBILIARY = "HEPATOPANCREATOBILIARY"
    LUNG = "LUNG"
    MALIGNANT_MELANOMA = "MALIGNANT_MELANOMA"
    NASOPHARYNGEAL = "NASOPHARYNGEAL"
    ORAL_OROPHARYNGEAL = "ORAL_OROPHARYNGEAL"
    OVARIAN = "OVARIAN"
    PROSTATE = "PROSTATE"
    RENAL = "RENAL"
    SARCOMA = "SARCOMA"
    SINONASAL = "SINONASAL"
    TESTICULAR_GERM_CELL_TUMOURS = "TESTICULAR_GERM_CELL_TUMOURS"
    UPPER_GASTROINTESTINAL = "UPPER_GASTROINTESTINAL"
    OTHER = "OTHER"
    NON_HODGKINS_B_CELL_LYMPHOMA_LOW_MOD_GRADE = "NON_HODGKINS_B_CELL_LYMPHOMA_LOW_MOD_GRADE"
    CLASSICAL_HODGKINS = "CLASSICAL_HODGKINS"
    NODULAR_LYMPHOCYTE_PREDOMINANT_HODGKINS = "NODULAR_LYMPHOCYTE_PREDOMINANT_HODGKINS"
    T_CELL_LYMPHOMA = "T_CELL_LYMPHOMA"

    def __hash__(self):
        return str(self).__hash__()
