diff --git a/analysis/measures_definition_pf_codes_conditions.py b/analysis/measures_definition_pf_codes_conditions.py index 15e2003..3e61ab1 100644 --- a/analysis/measures_definition_pf_codes_conditions.py +++ b/analysis/measures_definition_pf_codes_conditions.py @@ -96,3 +96,13 @@ denominator=denominator, intervals=months(monthly_intervals).starting_on(start_date), ) + + measures.define_measure( + name=f"count_{condition_name}_by_age", + numerator=numerator, + denominator=denominator, + group_by={ + "age_band": age_band, + }, + intervals=months(monthly_intervals).starting_on(start_date), + ) diff --git a/reports/pharmacy_first_report.Rmd b/reports/pharmacy_first_report.Rmd index 3623595..1f9e2e0 100644 --- a/reports/pharmacy_first_report.Rmd +++ b/reports/pharmacy_first_report.Rmd @@ -35,6 +35,17 @@ pf_clinical_condition_dict <- c( "count_uncomplicated_urinary_tract_infection" = "UTI" ) +# Define the custom labels for clinical conditions by age +pf_clinical_condition_dict_by_age <- c( + "count_acute_otitis_media_by_age" = "Acute Otitis Media", + "count_herpes_zoster_by_age" = "Herpes Zoster", + "count_acute_sinusitis_by_age" = "Acute Sinusitis", + "count_impetigo_by_age" = "Impetigo", + "count_infected_insect_bite_by_age" = "Infected Insect Bite", + "count_acute_pharyngitis_by_age" = "Acute Pharyngitis", + "count_uncomplicated_urinary_tract_infection_by_age" = "UTI" +) + # Define the custom labels for clinical services pf_clinical_service_dict <- c( "count_blood_pressure_service" = "Blood Pressure Service", @@ -114,3 +125,17 @@ plot_measures(df_measures, y_label = "Number of codes for consultations", ) ``` + +### Clinical Conditions by Age + +```{r, message=FALSE, warning=FALSE} + +plot_measures(df_measures, + title = "Number of consultations for each clinical condition by age per month", + measure_names = names(pf_clinical_condition_dict_by_age), + custom_labels = pf_clinical_condition_dict_by_age, + y_label = "Number of codes for consultations", + facet_var = "age_band", + rotate_x_labels = TRUE +) +``` \ No newline at end of file