Analytics Module
This module calculates NHS performance metrics and creates comprehensive summary statistics for practice level appointment data analysis.
The module implements statistical analysis and metric calculation including: - Temporal analysis of appointment patterns by month and status - Healthcare professional (HCP) type distribution analysis - Appointment mode analysis (face-to-face, telephone, online) - Regional and geographical performance comparisons - Booking time analysis and access metrics - Key NHS performance indicators (DNA rates, completion rates)
Classes:
| Name | Description |
|---|---|
SummarisationStage |
Pipeline stage for creating descriptive statistics and summary tables |
Notes
All metrics are calculated according to NHS performance monitoring standards and include appropriate statistical measures (sum, mean, count) for different data types. The module generates both detailed breakdowns and high-level key performance indicators suitable for NHS reporting requirements.
Examples:
>>> config = NHSPracticeAnalysisConfig()
>>> stage = SummarisationStage(config)
>>> context = {"combined_data": joined_dataframe}
>>> results = stage.run(context)
SummarisationStage
Bases: PipelineStage
Pipeline stage for creating descriptive statistics and summary tables.
This stage processes the combined appointment data to generate comprehensive statistical summaries and NHS performance metrics suitable for analysis and reporting purposes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
NHSPracticeAnalysisConfig
|
Configuration object containing analysis parameters and specifications. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
NHSPracticeAnalysisConfig
|
The configuration object passed during initialisation. |
Methods:
| Name | Description |
|---|---|
run |
Execute the summarisation stage and generate statistical summaries. |
Notes
Generated summaries include: - Monthly appointment trends by status (attended, DNA, cancelled) - Healthcare professional type distribution and workload analysis - Appointment mode analysis (face-to-face, telephone, online) - Regional performance comparisons and geographical analysis - Booking time analysis and access pattern evaluation - Key NHS performance indicators and completion rates
All metrics follow NHS performance monitoring standards and include appropriate statistical measures for different analytical purposes.
Examples:
>>> config = NHSPracticeAnalysisConfig()
>>> stage = SummarisationStage(config)
>>> context = {"combined_data": dataframe}
>>> results = stage.run(context)
Source code in practice_level_gp_appointments/analytics.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
__init__(config)
Initialize the summarisation stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
NHSPracticeAnalysisConfig
|
Configuration object containing analysis parameters. |
required |
Source code in practice_level_gp_appointments/analytics.py
run(context)
Create descriptive statistics and summary tables.
This method processes the combined appointment data to generate multiple summary tables and key performance indicators for NHS practice level analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
dict
|
Pipeline execution context containing combined appointment data. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Updated pipeline context containing summary statistics and metrics. |
Notes
The method generates seven main summary categories: 1. Monthly trends by appointment status 2. Healthcare professional type analysis 3. Appointment mode temporal analysis 4. Regional performance summaries 5. Booking time access analysis 6. Overall descriptive statistics 7. Key NHS performance metrics (DNA rates, completion rates)
Source code in practice_level_gp_appointments/analytics.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |