<commit_before>from radar.fixtures.validation import validate_and_add
from radar.models import CohortDiagnosis, Cohort

COHORT_DIAGNOSES = {
    'INS': [
        'SRNS - Primary Steroid Resistance',
        'SRNS - Secondary Steroid Resistance',
        'SRNS - Presumed Steroid Resistance',
        'SSNS - Steroid Sensitive',
        'SSNS - Steroid Dependant',
        'SSNS - Frequently Relapsing',
        'SSNS - Partial Steroid Resistance',
    ]
}


def create_cohort_diagnoses():
    for cohort_code, cohort_diagnosis_labels in COHORT_DIAGNOSES.items():
        cohort = Cohort.query.filter(Cohort.code == cohort_code).one()

        for cohort_diagnosis_label in cohort_diagnosis_labels:
            cohort_diagnosis = CohortDiagnosis()
            cohort_diagnosis.cohort = cohort
            cohort_diagnosis.label = cohort_diagnosis_label
            validate_and_add(cohort_diagnosis)<commit_msg>Add sub diagnoses<commit_after>from radar.fixtures.validation import validate_and_add
from radar.models import CohortDiagnosis, Cohort

# TODO
COHORT_DIAGNOSES = {
    'ALPORT': [
        'Alport Syndrome - No Histology',
        'Alport Syndrome - Histologically Proven',
        'Thin Basement Membrane Disease',
    ],
    'APRT': [
        'Adenine Phosphoribosyltransferase (APRT) Deficiency',
    ],
    'ARPKD': [],
    'AHUS': [
        'Atypical Haemolytic Uraemic Syndrome',
    ],
    'CALCIP': [],
    'CYSTIN': [
        'Cystinosis',
    ],
    'CYSURIA': [
        'Cystinuria',
    ],
    'DENTLOWE': [
        'Lowe syndome (Oculocerebrorenal Syndrome)',
        'Dent Disease',
        'Other Primary Renal Fanconi Syndrome',
    ],
    'FUAN': [],
    'HNF1B': [
        'Renal Cysts & Diabetes Syndrome',
        'Glomerulocystic Disease',
        'Multicystic Dysplastic Kidneys',
        'Inherited/Genetic Diabetes Mellitus Type II (MODY)',
    ],
    'HYPERRDG': [
        'Primary Hyperoxaluria',
        'Primary Hyperoxaluria Type I',
        'Primary Hyperoxaluria Type II',
    ],
    'HYPALK': [
        'Gitelman Syndrome',
        'Type 1 Bartter Syndrome',
        'Type 2 Bartter Syndrome',
        'Type 3 Bartter Syndrome',
        'Type 4a Bartter Syndrome',
        'Type 4b Bartter Syndrome',
        'EAST Syndrome',
        'Liddle Syndrome',
    ],
    'INS': [
        'SRNS - Primary Steroid Resistance',
        'SRNS - Secondary Steroid Resistance',
        'SRNS - Presumed Steroid Resistance',
        'SSNS - Steroid Sensitive',
        'SSNS - Steroid Dependant',
        'SSNS - Frequently Relapsing',
        'SSNS - Partial Steroid Resistance',
    ],
    'IGANEPHRO': [],
    'MPGN': [
        'MPGN (Membranoproliferative Glomerulonephritis Type II - Dense Deposit Disease)',
    ],
    'MEMRDG': [],
    'NEPHROS': [],
    'NSMPGNC3': [],
    'OBS': [
        'Pregnancy',
    ],
    'PCRA': [],
    'STECHUS': [
        'STEC Associated HUS (Diarrhoea Associated)',
    ],
    'VASRDG': [
        'Systemic Vasculitis - ANCA Positive - No Histology',
        'Systemic Vasculitis - ANCA Negative - Histologially Proven',
    ],
}


def create_cohort_diagnoses():
    for cohort_code, cohort_diagnosis_labels in COHORT_DIAGNOSES.items():
        cohort = Cohort.query.filter(Cohort.code == cohort_code).one()

        for cohort_diagnosis_label in cohort_diagnosis_labels:
            cohort_diagnosis = CohortDiagnosis()
            cohort_diagnosis.cohort = cohort
            cohort_diagnosis.label = cohort_diagnosis_label
            validate_and_add(cohort_diagnosis)
{'fraction_non_alphanumeric': 0.10765753037581238, 'fraction_numerical': 0.0019779598756710934, 'mean_word_length': 2.4911242603550297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1863046', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1099, 'n_words': 247}