"ratios": {
                 "S": 0.6,
                 "E": 0.1,
                 "N": 0.2,
                 "M": 0.1
             }
         }
     },
     most_recent_smoking_code=patients.with_these_clinical_events(
         clear_smoking_codes,
         find_last_match_in_period=True,
         on_or_before="2019-02-01",
         returning="category",
     ),
     ever_smoked=patients.with_these_clinical_events(
         filter_codes_by_category(clear_smoking_codes, include=["S", "E"]),
         on_or_before="2019-02-01",
     ),
 ),
 smoking_status_date=patients.with_these_clinical_events(
     clear_smoking_codes,
     on_or_before="2019-02-01",
     return_last_date_in_period=True,
     include_month=True,
 ),
 chronic_respiratory_disease=patients.with_these_clinical_events(
     chronic_respiratory_disease_codes,
     return_first_date_in_period=True,
     include_month=True,
     return_expectations={"date": {
         "latest": "2019-01-31"
コード例 #2
0
             "ratios": {
                 "S": 0.6,
                 "E": 0.1,
                 "N": 0.2,
                 "M": 0.1
             }
         }
     },
     most_recent_smoking_code=patients.with_these_clinical_events(
         clear_smoking_codes,
         find_last_match_in_period=True,
         on_or_before="2020-02-29",
         returning="category",
     ),
     ever_smoked=patients.with_these_clinical_events(
         filter_codes_by_category(clear_smoking_codes, include=["S", "E"]),
         on_or_before="2020-02-29",
     ),
 ),
 #    smoking_status_date=patients.with_these_clinical_events(
 #        clear_smoking_codes,
 #        on_or_before="2020-02-29",
 #        return_last_date_in_period=True,
 #        include_month=True,
 #        return_expectations={"date": {"latest": "2020-02-29"}},
 #    ),
 ### GP CONSULTATION RATE
 gp_consult_count=patients.with_gp_consultations(
     between=["2019-03-01", "2020-02-29"],
     returning="number_of_matches_in_period",
     return_expectations={
     ),
     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},
     ),
     stroke_ons=patients.with_these_codes_on_death_certificate(
         stroke_hospital,
         between=["index_date", "last_day_of_month(index_date)"],
         return_expectations={"incidence": 0.05},
     ),
 ),
 DVT=patients.satisfying(
     "dvt_gp OR dvt_hospital OR dvt_ons",
     dvt_gp=patients.with_these_clinical_events(
         filter_codes_by_category(vte_codes_gp, include=["dvt"]),
         between=["index_date", "last_day_of_month(index_date)"],
         return_expectations={"incidence": 0.05},
     ),
     dvt_hospital=patients.admitted_to_hospital(
         with_these_diagnoses=filter_codes_by_category(vte_codes_hospital,
                                                       include=["dvt"]),
         between=["index_date", "last_day_of_month(index_date)"],
         return_expectations={"incidence": 0.05},
     ),
     dvt_ons=patients.with_these_codes_on_death_certificate(
         filter_codes_by_category(vte_codes_hospital, include=["dvt"]),
         between=["index_date", "last_day_of_month(index_date)"],
         return_expectations={"incidence": 0.05},
     ),
 ),