Quality and Outcomes Framework

Primary Care Domain reference sets (refsets)

Exploratory
Explore the QOF Primary Care Domain reference sets (refsets)
Author

Alasdair Warwick

Published

September 30, 2024

Code
library(targets)
library(dplyr)
library(purrr)
library(reactable)
library(flextable)
library(stringr)
library(UpSetR)

withr::with_dir(here::here(), {
  tar_load(pcd_refset)
})

reactable2 <- function(df) {
  reactable::reactable(df,
                       searchable = TRUE,
                       filterable = TRUE,
                       showPagination = TRUE,
                       paginationType = "jump",
                       pageSizeOptions = c(10, 25, 50, 100, 200),
                       showPageSizeOptions = TRUE,
                       resizable = TRUE)
}

Overview

Key resources:

Terminology:

  • Code lists are grouped under “Cluster IDs” (e.g. AST_CODE for “Asthma diagnosis codes”)
  • Various Cluster IDs may contribute to one or more “Output IDs” (e.g. AST_COD & ASTTRT_COD & ASTRES_COD for Output ID AST_REG, “Asthma register”)
  • Output IDs fall under “Ruleset mappings”, which fall under “Service mappings”

graph TD
    A{{Service Mappings}}
    B{{Ruleset Mappings}}
    C{{Output IDs}}
    D{{Cluster IDs}}

    A --> B
    B --> C
    C --> D

    subgraph Service Mappings
        A1[QOF]
        A2[Network Contract DES]
        A3[CC Core GP Contract]
    end

    subgraph Ruleset Mappings
        B1[Asthma]
        B2[Dementia]
        B3[Diabetes]
    end

    subgraph Output IDs
        C1[AST_REG<br>Asthma register]
        C2[DEM_REG<br>Dementia register]
    end

    subgraph Cluster IDs
        D1[AST_COD<br>Asthma diagnosis codes]
        D2[ASTTRT_COD<br>Asthma treatment codes]
        D3[ASTRES_COD<br>Asthma review codes]
        D4[DEM_COD<br>Dementia diagnosis codes]
    end

    A1 --> B1
    A1 --> B2
    A2 --> B3

    B1 --> C1
    B2 --> C2

    C1 --> D1
    C1 --> D2
    C1 --> D3
    C2 --> D4

Registers:

  • GPs are required to maintain a register of patients with certain conditions (e.g. dementia, cancer, diabetes)
  • See Output IDs with suffix _REG for code lists
  • Output IDs (also termed “Indicator IDs” in the Business Rules word documents) typically apply to patient populations defined by these registers (e.g. AST007, AST008 & AST011 are all applied to population AST_REG)

General

Preview tables

Code
pcd_refset$PCD_SERVICE_FULL_NAME_MAPPINGS |>
  flextable()

Service

Service_Full_Name

CC

Core Contract (CC)

ES

Enhanced Service (ES)

INLIQ

Indicators No Longer In QOF (INLIQ)

NCD

Network Contract DES

Other

Other

PLE

Patient Level Extract (PLE)

QOF

Quality and Outcomes Framework (QOF)

VI

Vaccination and Immunisations (VI)

Code
pcd_refset$PCD_RULSET_FULL_NAME_MAPPINGS |>
  reactable2()
Code
pcd_refset$PCD_SERVICE_OUTPUT_DESCRIPTIONS |>
  reactable2()

Content

Code
pcd_refset$PCD_REFSET_CONTENT |>
  count(Service_and_Ruleset,
        Cluster_description,
        Cluster_ID) |>
  reactable2()

Content by output

Code
pcd_refset$PCD_REFSET_CONTENT_BY_OUTPUT |>
  count(Output_ID,
        Cluster_Description,
        Cluster_ID) |>
  reactable2()

‘Content’ and ‘content by output’ have some non-overlapping code sets

Code
list(
  content = unique(pcd_refset$PCD_REFSET_CONTENT$Cluster_ID),
  content_by_output = unique(pcd_refset$PCD_REFSET_CONTENT_BY_OUTPUT$Cluster_ID)
) |>
  purrr::map(as.character) |>
  ggVennDiagram::ggVennDiagram()

QOF codes for register outcomes

Code
qof_service_reg_output_ids <- pcd_refset$PCD_SERVICE_OUTPUT_DESCRIPTIONS |>
  filter(Service_ID == "QOF") |>
  filter(str_detect(Output_ID, "_REG$"))
Code
pcd_refset$PCD_REFSET_CONTENT_BY_OUTPUT |>
  filter(Output_ID %in% !!qof_service_reg_output_ids$Output_ID) |>
  reactable2()
Code
qof_service_reg_output_ids |>
  flextable() |>
  autofit()

Service_ID

Ruleset_ID

Output_ID

Output_Description

Type

QOF

Asthma

AST_REG

Asthma Register: Patients aged at least 6 years old with an unresolved asthma diagnosis and have received asthma-related drug treatment in the preceding 12 months, up to the end of the reporting period

P

QOF

Atrial fibrillation

AFIB_REG

Atrial fibrillation register: Patients with an unresolved diagnosis of atrial fibrillation

P

QOF

Cancer

CAN_REG

Cancer register; patients diagnosed with cancer since 1st April 2003

P

QOF

Cervical screening

CS_REG

Cervical screening register: Females aged 25 to 64 years on the achievement date

P

QOF

CHD

CHD_REG

CHD register: Register of patients with a coronary heart disease (CHD) diagnosis.

P

QOF

Cholesterol

CHOL_REG

Cholesterol register: Patients with a diagnosis of any of coronary heart disease (CHD), peripheral arterial disease (PAD), stroke or transient ischaemic attack (TIA) or who are aged 18 years or over with chronic kidney disease (CKD) category G3a to G5.

P

QOF

Cholesterol

CHOL2_REG

Cholesterol register: Patients with a diagnosis of any of coronary heart disease (CHD), peripheral arterial disease (PAD), stroke or transient ischaemic attack (TIA).

P

QOF

CKD

CKD_REG

CKD register: Register of patients aged 18 years or over with CKD with classification of categories G3a to G5

P

QOF

COPD

COPD_REG

COPD register: Register of patients with a clinical diagnosis of COPD before1 April 2023; and Patients with a clinical diagnosis of COPD on or after 1 April 2023 whose diagnosis has been confirmed by a quality assured post-bronchodilator spirometry FEV1/FVC ratio below 0.7 between 3 months before or 6 months after diagnosis (or if newly registered at the practice in the preceding 12 months without a record of spirometry having been performed, a record of an FEV1/FVC ratio below 0.7 recorded within 6 months of registration); and Patients with a clinical diagnosis of COPD on or after 1 April 2023 who are unable to undertake spirometry.

P

QOF

Dementia

DEM_REG

Dementia register: Patients with a dementia diagnosis up to the end of the reporting period

P

QOF

Depression

DEP1_REG

Depression register: Patients aged at least 18 years old whose latest unresolved episode of depression is since 1st April 2006.

P

QOF

Diabetes

DM_REG

Diabetes register: Patients aged at least 17 years old with an unresolved diabetes diagnosis

P

QOF

Epilepsy

EPIL_REG

Epilepsy register: Patients aged at least 18 years old with an unresolved diagnosis of epilepsy who have a record of being on drug treatment for epilepsy in the last 6 months

P

QOF

Heart failure

HF1_REG

Heart failure register 1: Patients with an unresolved diagnosis of heart failure

P

QOF

Heart failure

HF2_REG

Heart failure register 2: Patients with an unresolved diagnosis of heart failure due to left ventricular systolic dysfunction (LVSD) or reduced ejection fraction

P

QOF

Hypertension

HYP_REG

Hypertension register: Patients with an unresolved diagnosis of hypertension

P

QOF

Learning disability

LD_REG

Learning disability register: Patients with a learning disability

P

QOF

Mental health

MH1_REG

Mental health register 1: Patients with a diagnosis of psychosis, schizophrenia or bipolar affective disease

P

QOF

Mental health

MH2_REG

Mental health register 2: Patients with a lithium prescription in the last 6 months whose lithium treatment has not been subsequently stopped

P

QOF

Non-diabetic hyperglycaemia

NDH_REG

Non-diabetic hyperglycaemia register: Patients aged 18 years or over with a diagnosis of non-diabetic hyperglycaemia.

P

QOF

Obesity

OBES_REG

Obesity register: Patients aged 18 years or over with a body mass index (BMI) greater than or equal to 30 kg/m2 in the preceding 12 months or a BMI greater than or equal to 27.5 kg/m2 recorded in the preceding 12 months for patients with a South Asian, Chinese, other Asian, Middle Eastern, Black African or African-Caribbean family background.

P

QOF

Osteoporosis

OSTEO1_REG

Osteoporosis register 1: Patients aged 50 or over who have not attained the age of 75 with a record of a fragility fracture on or after 1 April 2012 and a diagnosis of osteoporosis confirmed on a DXA scan

P

QOF

Osteoporosis

OSTEO2_REG

Osteoporosis register 2: Patients aged 75 and over with a record of fragility fracture on or after 1 April 2014 and an osteoporosis diagnosis.

P

QOF

PAD

PAD_REG

PAD register: Register of patients with peripheral arterial disease

P

QOF

Palliative care

PALCARE_REG

Palliative Care register: Patients who have been identified as requiring palliative care

P

QOF

Rheumatoid arthritis

RA_REG

Rheumatoid arthritis register: Patients aged 16 years or over with a diagnosis of rheumatoid arthritis

P

QOF

Smoking

SMOK1_REG

Register of patients with a co-morbidity of CHD, PAD, stroke or TIA, hypertension, diabetes, COPD, asthma, CKD, schizophrenia, bipolar affective disorder or other psychoses

P

QOF

Smoking

SMOK2_REG

Register of patients who are aged 15 years and over

P

QOF

Stroke

STIA_REG

Stroke/TIA register: Register of patients with a Stroke or TIA diagnosis

P

Code
pcd_refset$PCD_REFSET_CONTENT_BY_OUTPUT |>
  filter(Output_ID %in% !!qof_service_reg_output_ids$Output_ID) |>
  count(Output_ID, Cluster_ID) |>
  left_join(qof_service_reg_output_ids |>
              select(Output_ID,
                     Output_Description),
            by = "Output_ID") |>
  tidyr::unite("Output",
               Output_ID,
               Output_Description, 
               sep = "\n", 
               remove = TRUE) |>
  as_grouped_data("Output") |>
  flextable() |>
  autofit()

Output

Cluster_ID

n

AFIB_REG
Atrial fibrillation register: Patients with an unresolved diagnosis of atrial fibrillation

AFIBRES_COD

1

AFIB_COD

24

AST_REG
Asthma Register: Patients aged at least 6 years old with an unresolved asthma diagnosis and have received asthma-related drug treatment in the preceding 12 months, up to the end of the reporting period

ASTRES_COD

1

ASTTRT_COD

1

AST_COD

141

CAN_REG
Cancer register; patients diagnosed with cancer since 1st April 2003

CAN_COD

6,024

CHD_REG
CHD register: Register of patients with a coronary heart disease (CHD) diagnosis.

CHD_COD

336

CHOL2_REG
Cholesterol register: Patients with a diagnosis of any of coronary heart disease (CHD), peripheral arterial disease (PAD), stroke or transient ischaemic attack (TIA).

CHD_COD

336

PAD_COD

47

STRK_COD

264

TIA_COD

17

CHOL_REG
Cholesterol register: Patients with a diagnosis of any of coronary heart disease (CHD), peripheral arterial disease (PAD), stroke or transient ischaemic attack (TIA) or who are aged 18 years or over with chronic kidney disease (CKD) category G3a to G5.

CHD_COD

336

CKD1AND2_COD

27

CKDRES_COD

1

CKD_COD

54

PAD_COD

47

STRK_COD

264

TIA_COD

17

CKD_REG
CKD register: Register of patients aged 18 years or over with CKD with classification of categories G3a to G5

CKD1AND2_COD

27

CKDRES_COD

1

CKD_COD

54

COPD_REG
COPD register: Register of patients with a clinical diagnosis of COPD before1 April 2023; and Patients with a clinical diagnosis of COPD on or after 1 April 2023 whose diagnosis has been confirmed by a quality assured post-bronchodilator spirometry FEV1/FVC ratio below 0.7 between 3 months before or 6 months after diagnosis (or if newly registered at the practice in the preceding 12 months without a record of spirometry having been performed, a record of an FEV1/FVC ratio below 0.7 recorded within 6 months of registration); and Patients with a clinical diagnosis of COPD on or after 1 April 2023 who are unable to undertake spirometry.

COPDRES_COD

1

COPD_COD

55

FEV1FVCL70_COD

1

FEV1FVC_COD

1

DEM_REG
Dementia register: Patients with a dementia diagnosis up to the end of the reporting period

DEM_COD

322

DEP1_REG
Depression register: Patients aged at least 18 years old whose latest unresolved episode of depression is since 1st April 2006.

DEPRES_COD

1

DEPR_COD

106

DM_REG
Diabetes register: Patients aged at least 17 years old with an unresolved diabetes diagnosis

DMRES_COD

1

DM_COD

86

EPIL_REG
Epilepsy register: Patients aged at least 18 years old with an unresolved diagnosis of epilepsy who have a record of being on drug treatment for epilepsy in the last 6 months

EPILDRUG_COD

1

EPILRES_COD

1

EPIL_COD

210

HF1_REG
Heart failure register 1: Patients with an unresolved diagnosis of heart failure

HFRES_COD

1

HF_COD

41

HF2_REG
Heart failure register 2: Patients with an unresolved diagnosis of heart failure due to left ventricular systolic dysfunction (LVSD) or reduced ejection fraction

HFLVSD_COD

5

HFRES_COD

1

HF_COD

41

REDEJCFRAC_COD

5

HYP_REG
Hypertension register: Patients with an unresolved diagnosis of hypertension

HYPRES_COD

1

HYP_COD

117

LD_REG
Learning disability register: Patients with a learning disability

LD_COD

696

MH1_REG
Mental health register 1: Patients with a diagnosis of psychosis, schizophrenia or bipolar affective disease

MH_COD

198

MH2_REG
Mental health register 2: Patients with a lithium prescription in the last 6 months whose lithium treatment has not been subsequently stopped

LITSTP_COD

1

LIT_COD

1

NDH_REG
Non-diabetic hyperglycaemia register: Patients aged 18 years or over with a diagnosis of non-diabetic hyperglycaemia.

DMRES_COD

1

DM_COD

86

IGT_COD

10

NDH_COD

1

PRD_COD

2

OBES_REG
Obesity register: Patients aged 18 years or over with a body mass index (BMI) greater than or equal to 30 kg/m2 in the preceding 12 months or a BMI greater than or equal to 27.5 kg/m2 recorded in the preceding 12 months for patients with a South Asian, Chinese, other Asian, Middle Eastern, Black African or African-Caribbean family background.

BMI30_COD

12

BMIVAL_COD

3

ETH2016AB_COD

2

ETH2016AC_COD

3

ETH2016AI_COD

2

ETH2016AO_COD

1

ETH2016AP_COD

2

ETH2016BA_COD

1

ETH2016BC_COD

1

ETH2016BO_COD

1

ETH2016MO_COD

1

ETH2016MWA_COD

2

ETH2016MWBA_COD

1

ETH2016MWBC_COD

2

ETH2016NSTAT_COD

1

ETH2016OA_COD

2

ETH2016OO_COD

3

ETH2016WB_COD

2

ETH2016WGT_COD

4

ETH2016WI_COD

2

ETH2016WO_COD

1

OSTEO1_REG
Osteoporosis register 1: Patients aged 50 or over who have not attained the age of 75 with a record of a fragility fracture on or after 1 April 2012 and a diagnosis of osteoporosis confirmed on a DXA scan

DXA2_COD

5

DXA_COD

3

FF_COD

2

OSTEO_COD

40

OSTEO2_REG
Osteoporosis register 2: Patients aged 75 and over with a record of fragility fracture on or after 1 April 2014 and an osteoporosis diagnosis.

FF_COD

2

OSTEO_COD

40

PAD_REG
PAD register: Register of patients with peripheral arterial disease

PAD_COD

47

PALCARE_REG
Palliative Care register: Patients who have been identified as requiring palliative care

PALCARENI_COD

2

PALCARE_COD

79

RA_REG
Rheumatoid arthritis register: Patients aged 16 years or over with a diagnosis of rheumatoid arthritis

RARTH_COD

131

SMOK1_REG
Register of patients with a co-morbidity of CHD, PAD, stroke or TIA, hypertension, diabetes, COPD, asthma, CKD, schizophrenia, bipolar affective disorder or other psychoses

ASTRES_COD

1

ASTTRT_COD

1

AST_COD

141

CHD_COD

336

CKD1AND2_COD

27

CKDRES_COD

1

CKD_COD

54

COPDRES_COD

1

COPD_COD

55

DMRES_COD

1

DM_COD

86

HYPRES_COD

1

HYP_COD

117

MH_COD

198

PAD_COD

47

STRK_COD

264

TIA_COD

17

STIA_REG
Stroke/TIA register: Register of patients with a Stroke or TIA diagnosis

STRK_COD

264

TIA_COD

17

Examples

Dementia

  • Cluster ID DEM_COD contains all codes for dementia diagnosis
  • Other Cluster IDs pertaining to dementia diagnosis contain subsets of these codes: DEMALZ_COD, DEMVASC_COD, DEMOTHER_COD, DEMFTEMP_COD DEMLEWY_COD, DEMMIX_COD & DEMOTHER_COD
Code
pcd_refset$PCD_REFSET_CONTENT |>
  filter(str_detect(Cluster_ID, "^DEM")) |>
  count(Cluster_ID, Cluster_description) |>
  arrange(desc(n)) |>
  flextable()

Cluster_ID

Cluster_description

n

DEM_COD

Codes for dementia

322

DEMOTHER_COD

Dementia diagnosis codes excluding Alzheimer's, Vascular, Lewy Body, Frontotemporal, and Mixed

200

DEMALZ_COD

Alzheimer’s disease dementia codes

48

DEMVASC_COD

Vascular dementia codes

39

DEMFTEMP_COD

Frontotemporal dementia codes

20

DEMMEDRVW_COD

Dementia medication review codes

17

DEMASS_COD

Assessment for dementia codes

16

DEMLEWY_COD

Lewy body dementia codes

14

DEMINVITE_COD

Invite for dementia care review codes

9

DEMCPRVWDEC_COD

Codes indicating the patient has chosen not to receive dementia care plan review

3

DEMCPRVW_COD

Dementia care plan review codes

3

DEMCPDEC_COD

Codes indicating the patient has chosen not to receive dementia care plan

2

DEMCP_COD

Dementia care plan codes

2

DEMMIX_COD

Mixed dementia codes

1

DEMPCADEC_COD

Codes indicating the patient has chosen not to receive dementia quality indicator care

1

DEMPCAPU_COD

Codes for dementia quality indicator care unsuitable for patient

1

Code
pcd_refset$PCD_REFSET_CONTENT |>
  filter(str_detect(Cluster_ID, "^DEM")) |>
  pull(Cluster_ID) |>
  unique() |>
  set_names() |>
  map(\(x) pcd_refset$PCD_REFSET_CONTENT |>
        filter(Cluster_ID == !!x) |>
        pull(SNOMED_code)) |>
  fromList() |>
  upset(order.by = "freq", 
        nsets = 50)