return_expectations={
            "date": {
                "earliest": "2020-02-01"
            },
            "rate": "exponential_increase"
        },
    ),

    #SUS HOSPITAL ADMISSION
    covid_admission_date=patients.admitted_to_hospital(
        returning="date_admitted",  # defaults to "binary_flag"
        with_these_diagnoses=covid_codelist,  # optional
        on_or_after="2020-02-01",
        find_first_match_in_period=True,
        date_format="YYYY-MM-DD",
        return_expectations={
            "date": {
                "earliest": "2020-02-01"
            },
            "incidence": 0.25
        },
    ),
    covid_admission_primary_diagnosis=patients.admitted_to_hospital(
        returning="primary_diagnosis",
        with_these_diagnoses=covid_codelist,  # optional
        on_or_after="2020-02-01",
        find_first_match_in_period=True,
        date_format="YYYY-MM-DD",
        return_expectations={
            "date": {
                "earliest": "2020-02-01"
                 "General population": 0.8,
             }
         },
     },
     covid_positive=patients.with_test_result_in_sgss(
         pathogen="SARS-CoV-2",
         test_result="positive",
         between=["2020-01-01", "last_day_of_month(index_date)"],
         date_format="YYYY-MM-DD",
         return_expectations={"date": {
             "earliest": "index_date"
         }},
     ),
     covid_hospitalised=patients.admitted_to_hospital(
         with_these_diagnoses=covid_codelist,
         between=["2020-01-01", "last_day_of_month(index_date)"],
         return_expectations={"incidence": 0.20},
     ),
 ),
 stroke=patients.satisfying(
     "stroke_gp OR stroke_hospital OR stroke_ons",
     stroke_gp=patients.with_these_clinical_events(
         stroke,
         between=["index_date", "last_day_of_month(index_date)"],
         return_expectations={"incidence": 0.05},
     ),
     stroke_hospital=patients.admitted_to_hospital(
         with_these_diagnoses=stroke_hospital,
         between=["index_date", "last_day_of_month(index_date)"],
         return_expectations={"incidence": 0.05},
     ),
Exemplo n.º 3
0
                    "85-89": 0.05,
                    "90plus": 0.03,
                    "missing": 0.02,
                }
            },
        },
        age=patients.age_as_of("index_date", ),
    ),

    # patients admitted to hospital with primary diagnoses included in cvd codelist
    # filters out maternity-related admissions and transfers from other providers
    cvd_emergency_elective=patients.admitted_to_hospital(
        with_these_primary_diagnoses=cvd_codelist,
        with_admission_method=[
            "11", "12", "13", "21", "22", "23", "24", "25", "2A", "2B", "2C",
            "2D", "28"
        ],
        between=["index_date", "index_date + 6 days"],
        return_expectations={"incidence": 0.1},
    ),
    cvd_admission_method=patients.admitted_to_hospital(
        with_these_primary_diagnoses=cvd_codelist,
        with_admission_method=[
            "11", "12", "13", "21", "22", "23", "24", "25", "2A", "2B", "2C",
            "2D", "28"
        ],
        between=["index_date", "index_date + 6 days"],
        returning="admission_method",
        return_expectations={
            "incidence": 0.1,
            "category": {
Exemplo n.º 4
0
                    "1": 0.4,
                    "9": 0.1,
                    "": 0.1
                }
            },
        },
    ),

    # SUS HOSPITAL ADMISSION
    covid_admission_date=patients.admitted_to_hospital(
        returning="date_admitted",
        with_these_diagnoses=covid_codelist,
        on_or_after="sgss_pos_inrange",
        find_first_match_in_period=True,
        date_format="YYYY-MM-DD",
        return_expectations={
            "date": {
                "earliest": "2020-11-16"
            },
            "incidence": 0.3
        },
    ),
    covid_discharge_date=patients.admitted_to_hospital(
        returning="date_discharged",
        with_these_diagnoses=covid_codelist,
        on_or_after="sgss_pos_inrange",
        find_first_match_in_period=True,
        date_format="YYYY-MM-DD",
        return_expectations={
            "date": {
                "earliest": "2020-11-16"