adhdR_0

ADHD diagnosis assessed within one year of childbirth (>0 year and <1 year)...

Description

Format

binary

N repeats

21

Harmonisation status per Cohort

Overview of the harmonisation status per Cohort...

  • Completed
  • Partial
  • No data
About statuses
BIB
CHOP
ELFE
ELSPAC
INMA
MoBa
NINFEA
adhdR_0
complete
unmapped
unmapped
complete
unmapped
complete
unmapped
adhdR_1
complete
unmapped
complete
complete
unmapped
unmapped
unmapped
adhdR_2
complete
unmapped
complete
complete
unmapped
unmapped
unmapped
adhdR_3
complete
unmapped
complete
unmapped
complete
unmapped
unmapped
adhdR_4
complete
unmapped
complete
complete
complete
unmapped
unmapped
adhdR_5
complete
unmapped
complete
unmapped
complete
partial
unmapped
adhdR_6
complete
complete
complete
complete
complete
unmapped
unmapped
adhdR_7
complete
complete
unmapped
complete
complete
unmapped
unmapped
adhdR_8
complete
complete
unmapped
unmapped
complete
unmapped
unmapped
adhdR_9
complete
unmapped
unmapped
unmapped
complete
unmapped
unmapped
adhdR_10
complete
unmapped
unmapped
complete
complete
unmapped
complete
adhdR_11
complete
unmapped
unmapped
unmapped
complete
unmapped
unmapped
adhdR_12
complete
unmapped
unmapped
complete
complete
unmapped
unmapped
adhdR_13
complete
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
adhdR_14
complete
unmapped
unmapped
complete
unmapped
unmapped
unmapped
adhdR_15
complete
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
adhdR_16
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
adhdR_17
unmapped
unmapped
unmapped
complete
unmapped
unmapped
unmapped
adhdR_18
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
adhdR_19
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
adhdR_20
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
adhdR_21
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped
unmapped

Harmonisation details per Cohort

Select a Cohort to see the details of the harmonisation...

BIB
CHOP
ELFE
ELSPAC
INMA
MoBa
NINFEA
Name
adhdR_0
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected. additional info: Obtained from GP records
Variables used
Syntax
library(tidyverse)

library(epivaultr)

# read in code list for adhd

adhd_read_code <- read.csv("U:/Born In Bradford/Data and Research team/Gill/MuM-PreDiCT/3. Exposures/2. Read code lists/CodeMapping/out/Exposure-multimorbidity-clinical-codes--main/ADHD_mm_birm_camV2_CPRD_GOLD_ctv3.csv")

# read in property table from epivault 

con <- ev_connect(ev_server = "BHTS-RESRCH22DV", ev_database = "ResearchWarehouse")

bib_geog_property <- ev_simple_fetch(con, 

                       project = "BiB_Geographic", 

                       table = "bib_geog_property",

                       variables = c("is_in_bfd_la"))

ev_disconnect(con)

# create empty df to join final vars to 

dd_outdat <- dd_indat %>%

  distinct(BiBChildID)

# create list of child ages based on GP records

list_ages <- seq(min(dd_indat$age_years, na.rm = TRUE), max(dd_indat$age_years, na.rm = TRUE), 1)

for (i in list_ages) {

  # for age i identify if in bfd

  address_data <- dd_indat %>%

    select(BiBChildID, age_m, property_id) %>%

    distinct(across(.cols = everything()), .keep_all = T) %>%

    mutate(age_y = age_m / 12,

           property_id = as.character(property_id)) %>%

    filter(age_y == i) %>%

    left_join(bib_geog_property, by = "property_id") %>%

    select(BiBChildID, is_in_bfd_la)

  

  # at age i identify if child has adhd

  adhd_data <- dd_indat %>%

    # select medical records column

    select(BiBChildID, age_years, ctv3code) %>%

    # select distinct rows

    distinct(across(.cols = everything()), .keep_all = T) %>%

    # filter for age

    filter(age_years == i) %>%

    # create indicator for ADHD

    mutate(ADHD = case_when(ctv3code %in% c(adhd_read_code$CTV3_CODE) ~ 1,

                            is.na(ctv3code) ~ NA_real_,

                            TRUE ~ 0)) %>%

    # select max record per child - so child only needs one diagnosis in year to be classed as diagnosed with ADHD in that year

    group_by(BiBChildID) %>%

    slice_max(ADHD, with_ties = FALSE) %>%

    ungroup()

  

  # set variable names 

  var_adhdr <-  paste0("adhdR_",i) 

  

  # join together and create adhdR variable

  dat <- address_data %>%

    left_join(adhd_data, by = "BiBChildID") %>%

    # identifies if 0 or NA based on their geographic status. if child is not in Bradford (BFD) then we don't have their medical records

    mutate(!!var_adhdr := case_when(ADHD == 1 & is_in_bfd_la == 0 ~ 1,

                                    ADHD == 1 & is_in_bfd_la == 1 ~ 1,

                                    ADHD == 1 & is.na(is_in_bfd_la) ~ 1,

                                    ADHD == 0 & is_in_bfd_la == 1 ~ 0,

                                    ADHD == 0 & is_in_bfd_la == 0 ~ NA_real_,

                                    ADHD == 0 & is.na(is_in_bfd_la) ~ 0,

                                    is.na(ADHD) & is_in_bfd_la == 0 ~ NA_real_,

                                    is.na(ADHD) & is_in_bfd_la == 1 ~ NA_real_,

                                    is.na(ADHD) & is.na(is_in_bfd_la) ~ NA_real_)) %>%

    select(BiBChildID, !!var_adhdr)

  

  dd_outdat <- dd_outdat %>%

    left_join(dat, by = "BiBChildID")

}

Name
adhdR_1
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected.
Variables used
Syntax
var <- subset(gprec, subset = gprec$ICD10 %in% c("F90", "F909"))
var$ChildID <- var$X.U.FEFF.ChildID
var$AgeInYears[var$AgeInYears=="NULL"] <- NA
var$age <- as.character(var$AgeInYears)
var <- var[var$age=="1",c("ChildID", "age", "ICD10")]
var$adhdR_1 <- as.factor(ifelse(!is.na(var$ICD10), 1, NA))
var <- var[var$adhdR_1==1, c("ChildID", "adhdR_1")]
var2 <- unique(var)
var3 <- bibloadr::get_bibloadr_data(varlist = "admincgender", level = "child")
var <- merge(var3, var2, by="ChildID", all.x=T)

Name
adhdR_2
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected. additional info: Obtained from GP records
Variables used
Syntax
library(tidyverse)

library(epivaultr)

# read in code list for adhd

adhd_read_code <- read.csv("U:/Born In Bradford/Data and Research team/Gill/MuM-PreDiCT/3. Exposures/2. Read code lists/CodeMapping/out/Exposure-multimorbidity-clinical-codes--main/ADHD_mm_birm_camV2_CPRD_GOLD_ctv3.csv")

# read in property table from epivault 

con <- ev_connect(ev_server = "BHTS-RESRCH22DV", ev_database = "ResearchWarehouse")

bib_geog_property <- ev_simple_fetch(con, 

                       project = "BiB_Geographic", 

                       table = "bib_geog_property",

                       variables = c("is_in_bfd_la"))

ev_disconnect(con)

# create empty df to join final vars to 

dd_outdat <- dd_indat %>%

  distinct(BiBChildID)

# create list of child ages based on GP records

list_ages <- seq(min(dd_indat$age_years, na.rm = TRUE), max(dd_indat$age_years, na.rm = TRUE), 1)

for (i in list_ages) {

  # for age i identify if in bfd

  address_data <- dd_indat %>%

    select(BiBChildID, age_m, property_id) %>%

    distinct(across(.cols = everything()), .keep_all = T) %>%

    mutate(age_y = age_m / 12,

           property_id = as.character(property_id)) %>%

    filter(age_y == i) %>%

    left_join(bib_geog_property, by = "property_id") %>%

    select(BiBChildID, is_in_bfd_la)

  

  # at age i identify if child has adhd

  adhd_data <- dd_indat %>%

    # select medical records column

    select(BiBChildID, age_years, ctv3code) %>%

    # select distinct rows

    distinct(across(.cols = everything()), .keep_all = T) %>%

    # filter for age

    filter(age_years == i) %>%

    # create indicator for ADHD

    mutate(ADHD = case_when(ctv3code %in% c(adhd_read_code$CTV3_CODE) ~ 1,

                            is.na(ctv3code) ~ NA_real_,

                            TRUE ~ 0)) %>%

    # select max record per child - so child only needs one diagnosis in year to be classed as diagnosed with ADHD in that year

    group_by(BiBChildID) %>%

    slice_max(ADHD, with_ties = FALSE) %>%

    ungroup()

  

  # set variable names 

  var_adhdr <-  paste0("adhdR_",i) 

  

  # join together and create adhdR variable

  dat <- address_data %>%

    left_join(adhd_data, by = "BiBChildID") %>%

    # identifies if 0 or NA based on their geographic status. if child is not in Bradford (BFD) then we don't have their medical records

    mutate(!!var_adhdr := case_when(ADHD == 1 & is_in_bfd_la == 0 ~ 1,

                                    ADHD == 1 & is_in_bfd_la == 1 ~ 1,

                                    ADHD == 1 & is.na(is_in_bfd_la) ~ 1,

                                    ADHD == 0 & is_in_bfd_la == 1 ~ 0,

                                    ADHD == 0 & is_in_bfd_la == 0 ~ NA_real_,

                                    ADHD == 0 & is.na(is_in_bfd_la) ~ 0,

                                    is.na(ADHD) & is_in_bfd_la == 0 ~ NA_real_,

                                    is.na(ADHD) & is_in_bfd_la == 1 ~ NA_real_,

                                    is.na(ADHD) & is.na(is_in_bfd_la) ~ NA_real_)) %>%

    select(BiBChildID, !!var_adhdr)

  

  dd_outdat <- dd_outdat %>%

    left_join(dat, by = "BiBChildID")

}

Name
adhdR_3
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 3. 'adhdR_3' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected.
Variables used
Syntax
var <- subset(gprec, subset = gprec$ICD10 %in% c("F90", "F909"))
var$ChildID <- var$X.U.FEFF.ChildID
var$AgeInYears[var$AgeInYears=="NULL"] <- NA
var$age <- as.character(var$AgeInYears)
var <- var[var$age=="3",c("ChildID", "age", "ICD10")]
var$adhdR_3 <- as.factor(ifelse(!is.na(var$ICD10), 1, NA))
var <- var[var$adhdR_3==1, c("ChildID", "age", "adhdR_3")]
var2 <- unique(var)
var3 <- bibloadr::get_bibloadr_data(varlist = "admincgender", level = "child")
var <- merge(var3, var2, by="ChildID", all.x=T)

Name
adhdR_4
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 4. 'adhdR_4' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected.
Variables used
Syntax
var <- subset(gprec, subset = gprec$ICD10 %in% c("F90", "F909"))
var$ChildID <- var$X.U.FEFF.ChildID
var$AgeInYears[var$AgeInYears=="NULL"] <- NA
var$age <- as.character(var$AgeInYears)
var <- var[var$age=="4",c("ChildID", "age", "ICD10")]
var$adhdR_4 <- as.factor(ifelse(!is.na(var$ICD10), 1, NA))
var <- var[var$adhdR_4==1, c("ChildID", "age", "adhdR_4")]
var2 <- unique(var)
var3 <- bibloadr::get_bibloadr_data(varlist = "admincgender", level = "child")
var <- merge(var3, var2, by="ChildID", all.x=T)

Name
adhdR_5
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 5. 'adhdR_5' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected.
Variables used
Syntax
var <- subset(gprec, subset = gprec$ICD10 %in% c("F90", "F909"))
var$ChildID <- var$X.U.FEFF.ChildID
var$AgeInYears[var$AgeInYears=="NULL"] <- NA
var$age <- as.character(var$AgeInYears)
var <- var[var$age=="5",c("ChildID", "age", "ICD10")]
var$adhdR_5 <- as.factor(ifelse(!is.na(var$ICD10), 1, NA))
var <- var[var$adhdR_5==1, c("ChildID", "age", "adhdR_5")]
var2 <- unique(var)
var3 <- bibloadr::get_bibloadr_data(varlist = "admincgender", level = "child")
var <- merge(var3, var2, by="ChildID", all.x=T)

Name
adhdR_6
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 6. 'adhdR_6' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected.
Variables used
Syntax
var <- subset(gprec, subset = gprec$ICD10 %in% c("F90", "F909"))
var$ChildID <- var$X.U.FEFF.ChildID
var$AgeInYears[var$AgeInYears=="NULL"] <- NA
var$age <- as.character(var$AgeInYears)
var <- var[var$age=="6",c("ChildID", "age", "ICD10")]
var$adhdR_6 <- as.factor(ifelse(!is.na(var$ICD10), 1, NA))
var <- var[var$adhdR_6==1, c("ChildID", "age", "adhdR_6")]
var2 <- unique(var)
var3 <- bibloadr::get_bibloadr_data(varlist = "admincgender", level = "child")
var <- merge(var3, var2, by="ChildID", all.x=T)

Name
adhdR_7
Harmonisation status
Completed
Description
ADHD ICD10 codes(F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 7. 'adhdR_7' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected.
Variables used
Syntax
var <- subset(gprec, subset = gprec$ICD10 %in% c("F90", "F909"))
var$ChildID <- var$X.U.FEFF.ChildID
var$AgeInYears[var$AgeInYears=="NULL"] <- NA
var$age <- as.character(var$AgeInYears)
var <- var[var$age=="7",c("ChildID", "age", "ICD10")]
var$adhdR_7 <- as.factor(ifelse(!is.na(var$ICD10), 1, NA))
var <- var[var$adhdR_7==1, c("ChildID", "age", "adhdR_7")]
var2 <- unique(var)
var3 <- bibloadr::get_bibloadr_data(varlist = "admincgender", level = "child")
var <- merge(var3, var2, by="ChildID", all.x=T)

Name
adhdR_8
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 8. 'adhdR_8' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected.
Variables used
Syntax
var <- subset(gprec, subset = gprec$ICD10 %in% c("F90", "F909"))
var$ChildID <- var$X.U.FEFF.ChildID
var$AgeInYears[var$AgeInYears=="NULL"] <- NA
var$age <- as.character(var$AgeInYears)
var <- var[var$age=="8",c("ChildID", "age", "ICD10")]
var$adhdR_8 <- as.factor(ifelse(!is.na(var$ICD10), 1, NA))
var <- var[var$adhdR_8==1, c("ChildID", "age", "adhdR_8")]
var2 <- unique(var)
var3 <- bibloadr::get_bibloadr_data(varlist = "admincgender", level = "child")
var <- merge(var3, var2, by="ChildID", all.x=T)

Name
adhdR_9
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected. additional info: Obtained from GP records
Variables used
Syntax
library(tidyverse)

library(epivaultr)

# read in code list for adhd

adhd_read_code <- read.csv("U:/Born In Bradford/Data and Research team/Gill/MuM-PreDiCT/3. Exposures/2. Read code lists/CodeMapping/out/Exposure-multimorbidity-clinical-codes--main/ADHD_mm_birm_camV2_CPRD_GOLD_ctv3.csv")

# read in property table from epivault 

con <- ev_connect(ev_server = "BHTS-RESRCH22DV", ev_database = "ResearchWarehouse")

bib_geog_property <- ev_simple_fetch(con, 

                       project = "BiB_Geographic", 

                       table = "bib_geog_property",

                       variables = c("is_in_bfd_la"))

ev_disconnect(con)

# create empty df to join final vars to 

dd_outdat <- dd_indat %>%

  distinct(BiBChildID)

# create list of child ages based on GP records

list_ages <- seq(min(dd_indat$age_years, na.rm = TRUE), max(dd_indat$age_years, na.rm = TRUE), 1)

for (i in list_ages) {

  # for age i identify if in bfd

  address_data <- dd_indat %>%

    select(BiBChildID, age_m, property_id) %>%

    distinct(across(.cols = everything()), .keep_all = T) %>%

    mutate(age_y = age_m / 12,

           property_id = as.character(property_id)) %>%

    filter(age_y == i) %>%

    left_join(bib_geog_property, by = "property_id") %>%

    select(BiBChildID, is_in_bfd_la)

  

  # at age i identify if child has adhd

  adhd_data <- dd_indat %>%

    # select medical records column

    select(BiBChildID, age_years, ctv3code) %>%

    # select distinct rows

    distinct(across(.cols = everything()), .keep_all = T) %>%

    # filter for age

    filter(age_years == i) %>%

    # create indicator for ADHD

    mutate(ADHD = case_when(ctv3code %in% c(adhd_read_code$CTV3_CODE) ~ 1,

                            is.na(ctv3code) ~ NA_real_,

                            TRUE ~ 0)) %>%

    # select max record per child - so child only needs one diagnosis in year to be classed as diagnosed with ADHD in that year

    group_by(BiBChildID) %>%

    slice_max(ADHD, with_ties = FALSE) %>%

    ungroup()

  

  # set variable names 

  var_adhdr <-  paste0("adhdR_",i) 

  

  # join together and create adhdR variable

  dat <- address_data %>%

    left_join(adhd_data, by = "BiBChildID") %>%

    # identifies if 0 or NA based on their geographic status. if child is not in Bradford (BFD) then we don't have their medical records

    mutate(!!var_adhdr := case_when(ADHD == 1 & is_in_bfd_la == 0 ~ 1,

                                    ADHD == 1 & is_in_bfd_la == 1 ~ 1,

                                    ADHD == 1 & is.na(is_in_bfd_la) ~ 1,

                                    ADHD == 0 & is_in_bfd_la == 1 ~ 0,

                                    ADHD == 0 & is_in_bfd_la == 0 ~ NA_real_,

                                    ADHD == 0 & is.na(is_in_bfd_la) ~ 0,

                                    is.na(ADHD) & is_in_bfd_la == 0 ~ NA_real_,

                                    is.na(ADHD) & is_in_bfd_la == 1 ~ NA_real_,

                                    is.na(ADHD) & is.na(is_in_bfd_la) ~ NA_real_)) %>%

    select(BiBChildID, !!var_adhdr)

  

  dd_outdat <- dd_outdat %>%

    left_join(dat, by = "BiBChildID")

}

Name
adhdR_10
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected. additional info: Obtained from GP records
Variables used
Syntax
library(tidyverse)

library(epivaultr)

# read in code list for adhd

adhd_read_code <- read.csv("U:/Born In Bradford/Data and Research team/Gill/MuM-PreDiCT/3. Exposures/2. Read code lists/CodeMapping/out/Exposure-multimorbidity-clinical-codes--main/ADHD_mm_birm_camV2_CPRD_GOLD_ctv3.csv")

# read in property table from epivault 

con <- ev_connect(ev_server = "BHTS-RESRCH22DV", ev_database = "ResearchWarehouse")

bib_geog_property <- ev_simple_fetch(con, 

                       project = "BiB_Geographic", 

                       table = "bib_geog_property",

                       variables = c("is_in_bfd_la"))

ev_disconnect(con)

# create empty df to join final vars to 

dd_outdat <- dd_indat %>%

  distinct(BiBChildID)

# create list of child ages based on GP records

list_ages <- seq(min(dd_indat$age_years, na.rm = TRUE), max(dd_indat$age_years, na.rm = TRUE), 1)

for (i in list_ages) {

  # for age i identify if in bfd

  address_data <- dd_indat %>%

    select(BiBChildID, age_m, property_id) %>%

    distinct(across(.cols = everything()), .keep_all = T) %>%

    mutate(age_y = age_m / 12,

           property_id = as.character(property_id)) %>%

    filter(age_y == i) %>%

    left_join(bib_geog_property, by = "property_id") %>%

    select(BiBChildID, is_in_bfd_la)

  

  # at age i identify if child has adhd

  adhd_data <- dd_indat %>%

    # select medical records column

    select(BiBChildID, age_years, ctv3code) %>%

    # select distinct rows

    distinct(across(.cols = everything()), .keep_all = T) %>%

    # filter for age

    filter(age_years == i) %>%

    # create indicator for ADHD

    mutate(ADHD = case_when(ctv3code %in% c(adhd_read_code$CTV3_CODE) ~ 1,

                            is.na(ctv3code) ~ NA_real_,

                            TRUE ~ 0)) %>%

    # select max record per child - so child only needs one diagnosis in year to be classed as diagnosed with ADHD in that year

    group_by(BiBChildID) %>%

    slice_max(ADHD, with_ties = FALSE) %>%

    ungroup()

  

  # set variable names 

  var_adhdr <-  paste0("adhdR_",i) 

  

  # join together and create adhdR variable

  dat <- address_data %>%

    left_join(adhd_data, by = "BiBChildID") %>%

    # identifies if 0 or NA based on their geographic status. if child is not in Bradford (BFD) then we don't have their medical records

    mutate(!!var_adhdr := case_when(ADHD == 1 & is_in_bfd_la == 0 ~ 1,

                                    ADHD == 1 & is_in_bfd_la == 1 ~ 1,

                                    ADHD == 1 & is.na(is_in_bfd_la) ~ 1,

                                    ADHD == 0 & is_in_bfd_la == 1 ~ 0,

                                    ADHD == 0 & is_in_bfd_la == 0 ~ NA_real_,

                                    ADHD == 0 & is.na(is_in_bfd_la) ~ 0,

                                    is.na(ADHD) & is_in_bfd_la == 0 ~ NA_real_,

                                    is.na(ADHD) & is_in_bfd_la == 1 ~ NA_real_,

                                    is.na(ADHD) & is.na(is_in_bfd_la) ~ NA_real_)) %>%

    select(BiBChildID, !!var_adhdr)

  

  dd_outdat <- dd_outdat %>%

    left_join(dat, by = "BiBChildID")

}

Name
adhdR_11
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected. additional info: Obtained from GP records
Variables used
Syntax
library(tidyverse)

library(epivaultr)

# read in code list for adhd

adhd_read_code <- read.csv("U:/Born In Bradford/Data and Research team/Gill/MuM-PreDiCT/3. Exposures/2. Read code lists/CodeMapping/out/Exposure-multimorbidity-clinical-codes--main/ADHD_mm_birm_camV2_CPRD_GOLD_ctv3.csv")

# read in property table from epivault 

con <- ev_connect(ev_server = "BHTS-RESRCH22DV", ev_database = "ResearchWarehouse")

bib_geog_property <- ev_simple_fetch(con, 

                       project = "BiB_Geographic", 

                       table = "bib_geog_property",

                       variables = c("is_in_bfd_la"))

ev_disconnect(con)

# create empty df to join final vars to 

dd_outdat <- dd_indat %>%

  distinct(BiBChildID)

# create list of child ages based on GP records

list_ages <- seq(min(dd_indat$age_years, na.rm = TRUE), max(dd_indat$age_years, na.rm = TRUE), 1)

for (i in list_ages) {

  # for age i identify if in bfd

  address_data <- dd_indat %>%

    select(BiBChildID, age_m, property_id) %>%

    distinct(across(.cols = everything()), .keep_all = T) %>%

    mutate(age_y = age_m / 12,

           property_id = as.character(property_id)) %>%

    filter(age_y == i) %>%

    left_join(bib_geog_property, by = "property_id") %>%

    select(BiBChildID, is_in_bfd_la)

  

  # at age i identify if child has adhd

  adhd_data <- dd_indat %>%

    # select medical records column

    select(BiBChildID, age_years, ctv3code) %>%

    # select distinct rows

    distinct(across(.cols = everything()), .keep_all = T) %>%

    # filter for age

    filter(age_years == i) %>%

    # create indicator for ADHD

    mutate(ADHD = case_when(ctv3code %in% c(adhd_read_code$CTV3_CODE) ~ 1,

                            is.na(ctv3code) ~ NA_real_,

                            TRUE ~ 0)) %>%

    # select max record per child - so child only needs one diagnosis in year to be classed as diagnosed with ADHD in that year

    group_by(BiBChildID) %>%

    slice_max(ADHD, with_ties = FALSE) %>%

    ungroup()

  

  # set variable names 

  var_adhdr <-  paste0("adhdR_",i) 

  

  # join together and create adhdR variable

  dat <- address_data %>%

    left_join(adhd_data, by = "BiBChildID") %>%

    # identifies if 0 or NA based on their geographic status. if child is not in Bradford (BFD) then we don't have their medical records

    mutate(!!var_adhdr := case_when(ADHD == 1 & is_in_bfd_la == 0 ~ 1,

                                    ADHD == 1 & is_in_bfd_la == 1 ~ 1,

                                    ADHD == 1 & is.na(is_in_bfd_la) ~ 1,

                                    ADHD == 0 & is_in_bfd_la == 1 ~ 0,

                                    ADHD == 0 & is_in_bfd_la == 0 ~ NA_real_,

                                    ADHD == 0 & is.na(is_in_bfd_la) ~ 0,

                                    is.na(ADHD) & is_in_bfd_la == 0 ~ NA_real_,

                                    is.na(ADHD) & is_in_bfd_la == 1 ~ NA_real_,

                                    is.na(ADHD) & is.na(is_in_bfd_la) ~ NA_real_)) %>%

    select(BiBChildID, !!var_adhdr)

  

  dd_outdat <- dd_outdat %>%

    left_join(dat, by = "BiBChildID")

}

Name
adhdR_12
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected. additional info: Obtained from GP records
Variables used
Syntax
library(tidyverse)

library(epivaultr)

# read in code list for adhd

adhd_read_code <- read.csv("U:/Born In Bradford/Data and Research team/Gill/MuM-PreDiCT/3. Exposures/2. Read code lists/CodeMapping/out/Exposure-multimorbidity-clinical-codes--main/ADHD_mm_birm_camV2_CPRD_GOLD_ctv3.csv")

# read in property table from epivault 

con <- ev_connect(ev_server = "BHTS-RESRCH22DV", ev_database = "ResearchWarehouse")

bib_geog_property <- ev_simple_fetch(con, 

                       project = "BiB_Geographic", 

                       table = "bib_geog_property",

                       variables = c("is_in_bfd_la"))

ev_disconnect(con)

# create empty df to join final vars to 

dd_outdat <- dd_indat %>%

  distinct(BiBChildID)

# create list of child ages based on GP records

list_ages <- seq(min(dd_indat$age_years, na.rm = TRUE), max(dd_indat$age_years, na.rm = TRUE), 1)

for (i in list_ages) {

  # for age i identify if in bfd

  address_data <- dd_indat %>%

    select(BiBChildID, age_m, property_id) %>%

    distinct(across(.cols = everything()), .keep_all = T) %>%

    mutate(age_y = age_m / 12,

           property_id = as.character(property_id)) %>%

    filter(age_y == i) %>%

    left_join(bib_geog_property, by = "property_id") %>%

    select(BiBChildID, is_in_bfd_la)

  

  # at age i identify if child has adhd

  adhd_data <- dd_indat %>%

    # select medical records column

    select(BiBChildID, age_years, ctv3code) %>%

    # select distinct rows

    distinct(across(.cols = everything()), .keep_all = T) %>%

    # filter for age

    filter(age_years == i) %>%

    # create indicator for ADHD

    mutate(ADHD = case_when(ctv3code %in% c(adhd_read_code$CTV3_CODE) ~ 1,

                            is.na(ctv3code) ~ NA_real_,

                            TRUE ~ 0)) %>%

    # select max record per child - so child only needs one diagnosis in year to be classed as diagnosed with ADHD in that year

    group_by(BiBChildID) %>%

    slice_max(ADHD, with_ties = FALSE) %>%

    ungroup()

  

  # set variable names 

  var_adhdr <-  paste0("adhdR_",i) 

  

  # join together and create adhdR variable

  dat <- address_data %>%

    left_join(adhd_data, by = "BiBChildID") %>%

    # identifies if 0 or NA based on their geographic status. if child is not in Bradford (BFD) then we don't have their medical records

    mutate(!!var_adhdr := case_when(ADHD == 1 & is_in_bfd_la == 0 ~ 1,

                                    ADHD == 1 & is_in_bfd_la == 1 ~ 1,

                                    ADHD == 1 & is.na(is_in_bfd_la) ~ 1,

                                    ADHD == 0 & is_in_bfd_la == 1 ~ 0,

                                    ADHD == 0 & is_in_bfd_la == 0 ~ NA_real_,

                                    ADHD == 0 & is.na(is_in_bfd_la) ~ 0,

                                    is.na(ADHD) & is_in_bfd_la == 0 ~ NA_real_,

                                    is.na(ADHD) & is_in_bfd_la == 1 ~ NA_real_,

                                    is.na(ADHD) & is.na(is_in_bfd_la) ~ NA_real_)) %>%

    select(BiBChildID, !!var_adhdr)

  

  dd_outdat <- dd_outdat %>%

    left_join(dat, by = "BiBChildID")

}

Name
adhdR_13
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected. additional info: Obtained from GP records
Variables used
Syntax
library(tidyverse)

library(epivaultr)

# read in code list for adhd

adhd_read_code <- read.csv("U:/Born In Bradford/Data and Research team/Gill/MuM-PreDiCT/3. Exposures/2. Read code lists/CodeMapping/out/Exposure-multimorbidity-clinical-codes--main/ADHD_mm_birm_camV2_CPRD_GOLD_ctv3.csv")

# read in property table from epivault 

con <- ev_connect(ev_server = "BHTS-RESRCH22DV", ev_database = "ResearchWarehouse")

bib_geog_property <- ev_simple_fetch(con, 

                       project = "BiB_Geographic", 

                       table = "bib_geog_property",

                       variables = c("is_in_bfd_la"))

ev_disconnect(con)

# create empty df to join final vars to 

dd_outdat <- dd_indat %>%

  distinct(BiBChildID)

# create list of child ages based on GP records

list_ages <- seq(min(dd_indat$age_years, na.rm = TRUE), max(dd_indat$age_years, na.rm = TRUE), 1)

for (i in list_ages) {

  # for age i identify if in bfd

  address_data <- dd_indat %>%

    select(BiBChildID, age_m, property_id) %>%

    distinct(across(.cols = everything()), .keep_all = T) %>%

    mutate(age_y = age_m / 12,

           property_id = as.character(property_id)) %>%

    filter(age_y == i) %>%

    left_join(bib_geog_property, by = "property_id") %>%

    select(BiBChildID, is_in_bfd_la)

  

  # at age i identify if child has adhd

  adhd_data <- dd_indat %>%

    # select medical records column

    select(BiBChildID, age_years, ctv3code) %>%

    # select distinct rows

    distinct(across(.cols = everything()), .keep_all = T) %>%

    # filter for age

    filter(age_years == i) %>%

    # create indicator for ADHD

    mutate(ADHD = case_when(ctv3code %in% c(adhd_read_code$CTV3_CODE) ~ 1,

                            is.na(ctv3code) ~ NA_real_,

                            TRUE ~ 0)) %>%

    # select max record per child - so child only needs one diagnosis in year to be classed as diagnosed with ADHD in that year

    group_by(BiBChildID) %>%

    slice_max(ADHD, with_ties = FALSE) %>%

    ungroup()

  

  # set variable names 

  var_adhdr <-  paste0("adhdR_",i) 

  

  # join together and create adhdR variable

  dat <- address_data %>%

    left_join(adhd_data, by = "BiBChildID") %>%

    # identifies if 0 or NA based on their geographic status. if child is not in Bradford (BFD) then we don't have their medical records

    mutate(!!var_adhdr := case_when(ADHD == 1 & is_in_bfd_la == 0 ~ 1,

                                    ADHD == 1 & is_in_bfd_la == 1 ~ 1,

                                    ADHD == 1 & is.na(is_in_bfd_la) ~ 1,

                                    ADHD == 0 & is_in_bfd_la == 1 ~ 0,

                                    ADHD == 0 & is_in_bfd_la == 0 ~ NA_real_,

                                    ADHD == 0 & is.na(is_in_bfd_la) ~ 0,

                                    is.na(ADHD) & is_in_bfd_la == 0 ~ NA_real_,

                                    is.na(ADHD) & is_in_bfd_la == 1 ~ NA_real_,

                                    is.na(ADHD) & is.na(is_in_bfd_la) ~ NA_real_)) %>%

    select(BiBChildID, !!var_adhdr)

  

  dd_outdat <- dd_outdat %>%

    left_join(dat, by = "BiBChildID")

}

Name
adhdR_14
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected. additional info: Obtained from GP records
Variables used
Syntax
library(tidyverse)

library(epivaultr)

# read in code list for adhd

adhd_read_code <- read.csv("U:/Born In Bradford/Data and Research team/Gill/MuM-PreDiCT/3. Exposures/2. Read code lists/CodeMapping/out/Exposure-multimorbidity-clinical-codes--main/ADHD_mm_birm_camV2_CPRD_GOLD_ctv3.csv")

# read in property table from epivault 

con <- ev_connect(ev_server = "BHTS-RESRCH22DV", ev_database = "ResearchWarehouse")

bib_geog_property <- ev_simple_fetch(con, 

                       project = "BiB_Geographic", 

                       table = "bib_geog_property",

                       variables = c("is_in_bfd_la"))

ev_disconnect(con)

# create empty df to join final vars to 

dd_outdat <- dd_indat %>%

  distinct(BiBChildID)

# create list of child ages based on GP records

list_ages <- seq(min(dd_indat$age_years, na.rm = TRUE), max(dd_indat$age_years, na.rm = TRUE), 1)

for (i in list_ages) {

  # for age i identify if in bfd

  address_data <- dd_indat %>%

    select(BiBChildID, age_m, property_id) %>%

    distinct(across(.cols = everything()), .keep_all = T) %>%

    mutate(age_y = age_m / 12,

           property_id = as.character(property_id)) %>%

    filter(age_y == i) %>%

    left_join(bib_geog_property, by = "property_id") %>%

    select(BiBChildID, is_in_bfd_la)

  

  # at age i identify if child has adhd

  adhd_data <- dd_indat %>%

    # select medical records column

    select(BiBChildID, age_years, ctv3code) %>%

    # select distinct rows

    distinct(across(.cols = everything()), .keep_all = T) %>%

    # filter for age

    filter(age_years == i) %>%

    # create indicator for ADHD

    mutate(ADHD = case_when(ctv3code %in% c(adhd_read_code$CTV3_CODE) ~ 1,

                            is.na(ctv3code) ~ NA_real_,

                            TRUE ~ 0)) %>%

    # select max record per child - so child only needs one diagnosis in year to be classed as diagnosed with ADHD in that year

    group_by(BiBChildID) %>%

    slice_max(ADHD, with_ties = FALSE) %>%

    ungroup()

  

  # set variable names 

  var_adhdr <-  paste0("adhdR_",i) 

  

  # join together and create adhdR variable

  dat <- address_data %>%

    left_join(adhd_data, by = "BiBChildID") %>%

    # identifies if 0 or NA based on their geographic status. if child is not in Bradford (BFD) then we don't have their medical records

    mutate(!!var_adhdr := case_when(ADHD == 1 & is_in_bfd_la == 0 ~ 1,

                                    ADHD == 1 & is_in_bfd_la == 1 ~ 1,

                                    ADHD == 1 & is.na(is_in_bfd_la) ~ 1,

                                    ADHD == 0 & is_in_bfd_la == 1 ~ 0,

                                    ADHD == 0 & is_in_bfd_la == 0 ~ NA_real_,

                                    ADHD == 0 & is.na(is_in_bfd_la) ~ 0,

                                    is.na(ADHD) & is_in_bfd_la == 0 ~ NA_real_,

                                    is.na(ADHD) & is_in_bfd_la == 1 ~ NA_real_,

                                    is.na(ADHD) & is.na(is_in_bfd_la) ~ NA_real_)) %>%

    select(BiBChildID, !!var_adhdr)

  

  dd_outdat <- dd_outdat %>%

    left_join(dat, by = "BiBChildID")

}

Name
adhdR_15
Harmonisation status
Completed
Description
ADHD ICD10 codes (F90, F90.9) were used to select for children who have a doctor diagnosis of ADHD. Children were selected if they were aged 1. 'adhdR_1' = 1 if the ICD10 code was not missing and NA otherwise. As children could have been diagnosed more than once in a year, unique cases were selected. additional info: Obtained from GP records
Variables used
Syntax
library(tidyverse)

library(epivaultr)

# read in code list for adhd

adhd_read_code <- read.csv("U:/Born In Bradford/Data and Research team/Gill/MuM-PreDiCT/3. Exposures/2. Read code lists/CodeMapping/out/Exposure-multimorbidity-clinical-codes--main/ADHD_mm_birm_camV2_CPRD_GOLD_ctv3.csv")

# read in property table from epivault 

con <- ev_connect(ev_server = "BHTS-RESRCH22DV", ev_database = "ResearchWarehouse")

bib_geog_property <- ev_simple_fetch(con, 

                       project = "BiB_Geographic", 

                       table = "bib_geog_property",

                       variables = c("is_in_bfd_la"))

ev_disconnect(con)

# create empty df to join final vars to 

dd_outdat <- dd_indat %>%

  distinct(BiBChildID)

# create list of child ages based on GP records

list_ages <- seq(min(dd_indat$age_years, na.rm = TRUE), max(dd_indat$age_years, na.rm = TRUE), 1)

for (i in list_ages) {

  # for age i identify if in bfd

  address_data <- dd_indat %>%

    select(BiBChildID, age_m, property_id) %>%

    distinct(across(.cols = everything()), .keep_all = T) %>%

    mutate(age_y = age_m / 12,

           property_id = as.character(property_id)) %>%

    filter(age_y == i) %>%

    left_join(bib_geog_property, by = "property_id") %>%

    select(BiBChildID, is_in_bfd_la)

  

  # at age i identify if child has adhd

  adhd_data <- dd_indat %>%

    # select medical records column

    select(BiBChildID, age_years, ctv3code) %>%

    # select distinct rows

    distinct(across(.cols = everything()), .keep_all = T) %>%

    # filter for age

    filter(age_years == i) %>%

    # create indicator for ADHD

    mutate(ADHD = case_when(ctv3code %in% c(adhd_read_code$CTV3_CODE) ~ 1,

                            is.na(ctv3code) ~ NA_real_,

                            TRUE ~ 0)) %>%

    # select max record per child - so child only needs one diagnosis in year to be classed as diagnosed with ADHD in that year

    group_by(BiBChildID) %>%

    slice_max(ADHD, with_ties = FALSE) %>%

    ungroup()

  

  # set variable names 

  var_adhdr <-  paste0("adhdR_",i) 

  

  # join together and create adhdR variable

  dat <- address_data %>%

    left_join(adhd_data, by = "BiBChildID") %>%

    # identifies if 0 or NA based on their geographic status. if child is not in Bradford (BFD) then we don't have their medical records

    mutate(!!var_adhdr := case_when(ADHD == 1 & is_in_bfd_la == 0 ~ 1,

                                    ADHD == 1 & is_in_bfd_la == 1 ~ 1,

                                    ADHD == 1 & is.na(is_in_bfd_la) ~ 1,

                                    ADHD == 0 & is_in_bfd_la == 1 ~ 0,

                                    ADHD == 0 & is_in_bfd_la == 0 ~ NA_real_,

                                    ADHD == 0 & is.na(is_in_bfd_la) ~ 0,

                                    is.na(ADHD) & is_in_bfd_la == 0 ~ NA_real_,

                                    is.na(ADHD) & is_in_bfd_la == 1 ~ NA_real_,

                                    is.na(ADHD) & is.na(is_in_bfd_la) ~ NA_real_)) %>%

    select(BiBChildID, !!var_adhdr)

  

  dd_outdat <- dd_outdat %>%

    left_join(dat, by = "BiBChildID")

}

Name
adhdR_16
Harmonisation status
No data
Description
None
Variables used
  • None
Syntax
None

Name
adhdR_17
Harmonisation status
No data
Description
None
Variables used
  • None
Syntax
None

Name
adhdR_18
Harmonisation status
No data
Description
None
Variables used
None
Syntax
None

Name
adhdR_19
Harmonisation status
No data
Description
None
Variables used
None
Syntax
None

Name
adhdR_20
Harmonisation status
No data
Description
None
Variables used
None
Syntax
None

Name
adhdR_21
Harmonisation status
No data
Description
None
Variables used
None
Syntax
None