Set up

Packages

#library
library(tidyverse)

Custom functions

#education recode ego function
feducation_ego <- function(x) {
  x2 <- ifelse(x == 1, 6, x)
  x3 <- ifelse(x == 2, 10, x2)
  x4 <- ifelse(x == 3, 11.5, x3)
  x5 <- ifelse(x == 4, 10.5, x4)
  x6 <- ifelse(x == 5, 15, x5)
  x7 <- ifelse(x == 6, 16, x6)
  x8 <- ifelse(x == 7, NA, x7)
  x9 <- ifelse(x == 8, 4, x8)
  x10 <- ifelse(x == 9, NA, x9)
  return(x10)
}
#education recode alter function
feducation_alter <- function(x) {
  x2 <- ifelse(x == 1, 4, x)
  x3 <- ifelse(x == 2, 6, x2)
  x4 <- ifelse(x == 3, 10, x3)
  x5 <- ifelse(x == 4, 11.5, x4)
  x6 <- ifelse(x == 5, 10.5, x5)
  x7 <- ifelse(x == 6, 15, x6)
  x8<- ifelse(x == 7, 16, x7)
  return(x8)
}

#event transition 
event_transition_f <- function(event, option, time) {
  if (option == "event") {
    #for when we want 1, 0.5, 0.25.
    y <- if_else(lag(event, 2) == 1, 0.25, 0)
    y <- if_else(lag(event) == 1, 0.5, y)
    y <- if_else(event == 1, 1, y)
    y <- if_else(is.na(y) & !is.na(event), 0, y)
    return(y)
  }
  if (option == "transition") {
    #when it is a transition 00001111
    y <- tibble(time, event) %>% 
      filter(event == 1)
    
    if (nrow(y) == 0) {
      y <- ifelse(!is.na(time) & !is.na(event), 0, NA)
      return(y)
    } else{
      y <- y %>%
        pull(time)
      
      y <- if_else(time >= y, 1, 0)
      return(y)
    }
  }
}

Data import

load("datafiles/data-processed/disaggregated_data/2023-06-12_liss-repeated-risk-data.rda")

load("datafiles/data-processed/common_data/0623_v5_liss_merged_core_file.rds")

Ego and Alter data

Alter data

Step 1: select the variables needed from the liss_long file and rename them accordingly. Step 2: use pivot_longer to make a long file. Step 3: perform data manipulation on the alter variables.

#------------------------------ Add ego and Alter Data ------------------------------#
#alter data
#get alter data.
alter_data <- liss_long %>%
  select(
    nomem_encr,
    survey_wave,
    starts_with("alter_id"),
    starts_with("educ_alter"),
    starts_with("age_alter"),
    starts_with("gender_alter"),
    starts_with("poltalk_alter"),
    starts_with("talk_alter"),
    starts_with("origin_alter"),
    starts_with("rel_alter"),
    starts_with("dear_alter"),
    starts_with("prof_alter"),
    starts_with("work_a"),
    starts_with("length")
  ) %>% 
  mutate(across(.cols = 1:62, #remove haven labelled
                .fns = ~as.numeric(.x)))

#create long file so alter is in dyad
alter_data <- alter_data %>%
  rename(educ_alter.1 = educ_alter1,
         educ_alter.2 = educ_alter2,
         educ_alter.3 = educ_alter3,
         educ_alter.4 = educ_alter4,
         educ_alter.5 = educ_alter5,
         alter_id.1 = alter_id_1,
         alter_id.2 = alter_id_2,
         alter_id.3 = alter_id_3,
         alter_id.4 = alter_id_4,
         alter_id.5 = alter_id_5,
         age_alter.1 = age_alter1,
         age_alter.2 = age_alter2,
         age_alter.3 = age_alter3,
         age_alter.4 = age_alter4,
         age_alter.5 = age_alter5,
         gender_alter.1 = gender_alter1,
         gender_alter.2 = gender_alter2,
         gender_alter.3 = gender_alter3,
         gender_alter.4 = gender_alter4,
         gender_alter.5 = gender_alter5,
         rel_alter.1 = rel_alter1,
         rel_alter.2 = rel_alter2,
         rel_alter.3 = rel_alter3,
         rel_alter.4 = rel_alter4,
         rel_alter.5 = rel_alter5,
         poltalk_alter.1 = poltalk_alter1,
         poltalk_alter.2 = poltalk_alter2,
         poltalk_alter.3 = poltalk_alter3,
         poltalk_alter.4 = poltalk_alter4,
         poltalk_alter.5 = poltalk_alter5,
         talk_alter.1 = talk_alter1,
         talk_alter.2 = talk_alter2,
         talk_alter.3 = talk_alter3,
         talk_alter.4 = talk_alter4,
         talk_alter.5 = talk_alter5,
         origin_alter.1 = origin_alter1,
         origin_alter.2 = origin_alter2,
         origin_alter.3 = origin_alter3,
         origin_alter.4 = origin_alter4,
         origin_alter.5 = origin_alter5,
         dear_alter.1 = dear_alter1,
         dear_alter.2 = dear_alter2,
         dear_alter.3 = dear_alter3,
         dear_alter.4 = dear_alter4,
         dear_alter.5 = dear_alter5,
         prof_alter.1 = prof_alter1,
         prof_alter.2 = prof_alter2,
         prof_alter.3 = prof_alter3,
         prof_alter.4 = prof_alter4,
         prof_alter.5 = prof_alter5,
         work_alter.1 = work_a1,
         work_alter.2 = work_a2,
         work_alter.3 = work_a3,
         work_alter.4 = work_a4,
         work_alter.5 = work_a5,
         length.1 = length_1,
         length.2 = length_2,
         length.3 = length_3,
         length.4 = length_4,
         length.5 = length_5) %>%
  pivot_longer(3:62,
               names_to = c("name","alter"),
               names_pattern = "(.+)\\.(.+)",
               values_to = "value") %>%
  pivot_wider(names_from = name,
              values_from = value)

#create dyad_id and drop alter handle
alter_data <- alter_data %>%
  mutate(dyad_id = paste0(nomem_encr, alter_id),
         survey_wave = as.numeric(survey_wave)) %>%
  filter(!is.na(alter_id)) %>%
  select(!alter)


#alter data prep
alter_data <- alter_data %>%
  mutate(
    educ_alter = feducation_alter(educ_alter),
    gender_alter = ifelse(is.na(gender_alter), 3, gender_alter),
    gender_alter_fac = factor(
      gender_alter,
      levels = 1:3,
      labels = c("Male", "Female", "Missing")
    ),
    rel_alter_rec = ifelse(rel_alter == 1, 1, rel_alter),
    rel_alter_rec = ifelse(rel_alter_rec > 2 &
                             rel_alter_rec < 5, 2, rel_alter_rec),
    rel_alter_rec = ifelse(rel_alter_rec == 5, 3, rel_alter_rec),
    rel_alter_rec = ifelse(rel_alter_rec == 6, 4, rel_alter_rec),
    rel_alter_rec = ifelse(rel_alter_rec == 7, 5, rel_alter_rec),
    rel_alter_rec = ifelse(rel_alter_rec == 8, 6, rel_alter_rec),
    rel_alter_rec = ifelse(rel_alter_rec == 9, 7, rel_alter_rec),
    rel_alter_rec = ifelse(rel_alter_rec == 10, 8, rel_alter_rec),
    rel_alter_rec = ifelse(rel_alter_rec == 11, 9, rel_alter_rec),
    rel_alter_rec = ifelse(is.na(rel_alter_rec), 10, rel_alter_rec),
    rel_alter_rec = factor(
      rel_alter_rec,
      levels = 1:10,
      labels = c(
        "Partner",
        "Close family",
        "Other family",
        "Colleague",
        "Same group or club",
        "Neighbour",
        "Friend",
        "Advisor",
        "Other",
        "Missing"
      )
    ),
    origin_alter_rec = case_when(
      origin_alter == 1 ~ 0,
      origin_alter > 1 &
        origin_alter < 8 ~ 1,
      origin_alter == 8 ~ 2
    ),
    origin_alter_rec_fac = factor(
      origin_alter_rec,
      levels = 0:2,
      labels = c(
        "No migration background",
        "Non-Western migration background",
        "Western migration background"
      )
    )
  )  

#add the alter data to the event_data
repeated_event_data <- repeated_event_data %>%
  left_join(alter_data, by = c("dyad_id", "survey_wave", "nomem_encr"))

Ego data

Step 1: select the variables needed from the liss_long file and rename and transform them accordingly. Step 2: use pivot_longer to make a long file. Step 3: perform data manipulation on the ego variables.

#add ego level data
ego_data <- liss_long %>% #select variables from long_file
  select(
    nomem_encr,
    survey_wave,
    oplmet,
    leeftijd,
    geslacht,
    nettoink,
    belbezig,
    burgstat,
    partner,
    gebjaar,
    year_residence,
    year_municipality,
    starts_with("close"),
    origin,
    aantalki,
    belbezig,
    partner_current,
    partner_same,
    partner_different_reason,
    partner_none_reason,
    has_children,
    birthyear_firstchild
  ) %>%
  mutate(#transform data
    survey_wave = as.numeric(survey_wave),
    year = as.numeric(survey_wave) + 2007,
    educ_ego = feducation_ego(oplmet),
    year = as.factor(survey_wave + 2007),
    age_sq = leeftijd * leeftijd,
    age = leeftijd,
    gender = geslacht,
    gender = ifelse(is.na(gender), 3, gender),
    gender_fac = factor(
      gender,
      levels = 1:3,
      labels = c("Male", "Female", "Missing")
    ),
    origin_rec = case_when(
      origin == 0 ~ 0,
      origin == 102 | origin == 202 ~ 1,
      origin == 101 | origin == 201 ~ 2
    ),
    origin_rec_fac = factor(
      origin_rec,           
      levels = 0:2,
      labels = c(
        "No migration background",
        "Non-Western migration background",
        "Western migration background"
      )
    ),
    belbezig_rec = ifelse(belbezig == 2 | belbezig == 3, 2, belbezig),
    belbezig_rec = ifelse(belbezig == 4 |
                            belbezig == 5, 3, belbezig_rec),
    belbezig_rec = ifelse(belbezig == 7 , 4, belbezig_rec),
    belbezig_rec = ifelse(belbezig == 8, 5, belbezig_rec),
    belbezig_rec = ifelse(belbezig == 9, 6, belbezig_rec),
    belbezig_rec = ifelse(belbezig == 6 |
                            belbezig >= 10, 7, belbezig_rec),
    employment_status = factor(
      belbezig_rec,
      levels = c(1:7),
      labels = c(
        "employed",
        "self-employed",
        "unemployed",
        "student",
        "housework",
        "retired",
        "other"
      )
    ),
    paid_work = if_else(belbezig < 4, 1, 0),
    first_child = ifelse(birthyear_firstchild == year, 1, 0),
    divorced_seperated = ifelse((partner_same == 2 & partner_different_reason == 1) | 
                                       (partner_current == 2 & partner_none_reason == 1), 1, 0),
    lost_partner = ifelse((partner_same == 2 & partner_different_reason == 2) | 
                                 (partner_current == 2 & partner_none_reason == 2), 1, 0)
  ) %>%
  #create change scores.
  group_by(nomem_encr) %>%
  dplyr::arrange(nomem_encr, survey_wave) %>%
  mutate(
    new_residence = ifelse(year_residence == lag(year_residence), 0, 1),
    new_municipality = ifelse(year_municipality == lag(year_municipality), 0, 1),
    divorced_background = ifelse(burgstat == 3 &
                        lag(burgstat) != 3, 1, 0),
    child_change_hh = ifelse(lag(aantalki) == aantalki, 0, 1),
    child_diff_hh = aantalki - lag(aantalki),
    first_child_hh = ifelse(aantalki > 0 & lag(aantalki) == 0, 1, 0),
    employment_change = ifelse(belbezig_rec == lag(belbezig_rec), 0, 1),
    retired = ifelse(lag(belbezig_rec) != 6 & belbezig_rec == 6, 1, 0),
         unemployment = ifelse(lag(belbezig_rec) != 3 & belbezig_rec == 3, 1, 0),
         employment = ifelse(lag(belbezig_rec) == 3 & belbezig_rec < 3, 1, 0)
  ) %>%
  ungroup()



# Robustness prep: create different types of changes: transition and event. 

#first child transition and event 
ego_data <- ego_data %>%
  group_by(nomem_encr) %>% 
  arrange(nomem_encr, survey_wave) %>% 
  mutate(first_child_event = event_transition_f(event = first_child,
                                                  option = "event"),
         first_child_transition = event_transition_f(event = first_child,
                                                     option = "transition",
                                                     time = survey_wave)) %>% 
  ungroup()

#create absolute change scores and some extra variables.
ego_data <- ego_data %>%
  mutate(
    moving = new_municipality + new_residence,
    moving = factor(
      moving,
      levels = 0:2,
      labels = c("no_move", "new_residence",
                 "new_residence_municipality")
    ),
    moving_fac = ifelse(moving == "no_move", 1, moving),
    moving_fac = ifelse(moving == "new_residence", 2, moving_fac),
    moving_fac = ifelse(moving == "new_residence_municipality", 3, moving_fac),
    moving_fac = ifelse(is.na(moving), 4, moving_fac),
    moving_fac = factor(
      moving_fac,
      levels = 1:4,
      labels = c("no_move", "new_residence",
                 "new_municipality", "missing")
    ),
    divorced_fac = ifelse(is.na(divorced_seperated), 2, divorced_seperated),
    divorced_fac = factor(
      divorced_fac,
      levels = 0:2,
      labels = c("not divorced", "divorced", "missing")
    )
  )


#divorce as transition and event
ego_data <- ego_data %>%
  group_by(nomem_encr) %>% 
  arrange(nomem_encr, survey_wave) %>% 
  mutate(divorced_event = event_transition_f(event = divorced_seperated,
                                                  option = "event"),
         divorced_transition = event_transition_f(event = divorced_seperated,
                                                     option = "transition",
                                                     time = survey_wave)) %>% 
  ungroup()

#lost_partner as transition and event
ego_data <- ego_data %>%
  group_by(nomem_encr) %>% 
  arrange(nomem_encr, survey_wave) %>% 
  mutate(lost_partner_event = event_transition_f(event = lost_partner,
                                                  option = "event"),
         lost_partner_transition = event_transition_f(event = lost_partner,
                                                     option = "transition",
                                                     time = survey_wave)) %>% 
  ungroup()

#moving as event or transition.
ego_data <- ego_data %>%
  mutate(move = if_else(!is.na(new_municipality) == 1 | !is.na(new_residence) == 1, 1, 0)) %>% 
  group_by(nomem_encr) %>%
  arrange(nomem_encr, survey_wave) %>%
  mutate(
    new_municipality_event = event_transition_f(event = new_municipality,
                                                option = "event"),
    new_municipality_transition =  event_transition_f(
      event = new_municipality,
      option = "transition",
      time = survey_wave
    ),
    new_residence_event = event_transition_f(event = new_residence,
                                             option = "event"),
    new_residence_transition =  event_transition_f(
      event = new_residence,
      option = "transition",
      time = survey_wave
    ),
    move_event = event_transition_f(event = move,
                                             option = "event"),
    move_transition =  event_transition_f(
      event = move,
      option = "transition",
      time = survey_wave
    )
  ) %>% 
  ungroup()

#employment status change as transition or event
ego_data <- ego_data %>%
  group_by(nomem_encr) %>% 
  arrange(nomem_encr, survey_wave) %>% 
  mutate(employment_event = event_transition_f(event = employment,
                                                  option = "event"),
         employment_transition = event_transition_f(event = employment,
                                                     option = "transition",
                                                     time = survey_wave),
         retired_event = event_transition_f(event = retired,
                                                  option = "event"),
         retired_transition = event_transition_f(event = retired,
                                                     option = "transition",
                                                     time = survey_wave),
         unemployed_event = event_transition_f(event = unemployment,
                                                  option = "event"),
         unemployed_transition = event_transition_f(event = unemployment,
                                                     option = "transition",
                                                     time = survey_wave),
         
         ) %>% 
  ungroup()

#fill ego's origin with information of later waves.
ego_data <- ego_data %>%
  group_by(nomem_encr) %>%
  mutate(
    origin_rec_nar = ifelse(is.na(origin_rec), min(origin_rec, na.rm = T), origin_rec),
    origin_rec_nar = ifelse(origin_rec_nar > 3, NA, origin_rec_nar)
  ) %>%
  ungroup() %>%
  mutate(origin_rec_nar_fac = factor(
    origin_rec_nar,
    levels = 0:2,
    labels = c(
      "No migration background",
      "Non-Western migration background",
      "Western migration background"
    )
  ))

#add ego data. 
repeated_event_data <- repeated_event_data %>%
  left_join(ego_data, by = c("nomem_encr", "survey_wave")) 

Export data

Export the ego alter prepped data so we can use it for creation of network data and for dyad similarity variables.

save(repeated_event_data, file = "datafiles/data-processed/disaggregated_data/2023-06-12_liss-repeated-risk-alter-ego-data.rda")
save(ego_data,
     file = "datafiles/data-processed/disaggregated_data/2023-06-12_ego-data.rda")
save(alter_data,
     file = "datafiles/data-processed/disaggregated_data/2023-06-12_alter-data.rda")
LS0tDQp0aXRsZTogJ0RhdGFwcmVwOiBhZGQgZWdvIGFuZCBhbHRlciBkYXRhJw0KYXV0aG9yOiAiVGhpam1lbiBKZXJvZW5zZSINCm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AgIGVtcGxveW1lbnRfc3RhdHVzID0gZmFjdG9yKA0KICAgICAgYmVsYmV6aWdfcmVjLA0KICAgICAgbGV2ZWxzID0gYygxOjcpLA0KICAgICAgbGFiZWxzID0gYygNCiAgICAgICAgImVtcGxveWVkIiwNCiAgICAgICAgInNlbGYtZW1wbG95ZWQiLA0KICAgICAgICAidW5lbXBsb3llZCIsDQogICAgICAgICJzdHVkZW50IiwNCiAgICAgICAgImhvdXNld29yayIsDQogICAgICAgICJyZXRpcmVkIiwNCiAgICAgICAgIm90aGVyIg0KICAgICAgKQ0KICAgICksDQogICAgcGFpZF93b3JrID0gaWZfZWxzZShiZWxiZXppZyA8IDQsIDEsIDApLA0KICAgIGZpcnN0X2NoaWxkID0gaWZlbHNlKGJpcnRoeWVhcl9maXJzdGNoaWxkID09IHllYXIsIDEsIDApLA0KICAgIGRpdm9yY2VkX3NlcGVyYXRlZCA9IGlmZWxzZSgocGFydG5lcl9zYW1lID09IDIgJiBwYXJ0bmVyX2RpZmZlcmVudF9yZWFzb24gPT0gMSkgfCANCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwYXJ0bmVyX2N1cnJlbnQgPT0gMiAmIHBhcnRuZXJfbm9uZV9yZWFzb24gPT0gMSksIDEsIDApLA0KICAgIGxvc3RfcGFydG5lciA9IGlmZWxzZSgocGFydG5lcl9zYW1lID09IDIgJiBwYXJ0bmVyX2RpZmZlcmVudF9yZWFzb24gPT0gMikgfCANCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwYXJ0bmVyX2N1cnJlbnQgPT0gMiAmIHBhcnRuZXJfbm9uZV9yZWFzb24gPT0gMiksIDEsIDApDQogICkgJT4lDQogICNjcmVhdGUgY2hhbmdlIHNjb3Jlcy4NCiAgZ3JvdXBfYnkobm9tZW1fZW5jcikgJT4lDQogIGRwbHlyOjphcnJhbmdlKG5vbWVtX2VuY3IsIHN1cnZleV93YXZlKSAlPiUNCiAgbXV0YXRlKA0KICA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VudF90cmFuc2l0aW9uX2YoZXZlbnQgPSBkaXZvcmNlZF9zZXBlcmF0ZWQsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbiA9ICJldmVudCIpLA0KICAgICAgICAgZGl2b3JjZWRfdHJhbnNpdGlvbiA9IGV2ZW50X3RyYW5zaXRpb25fZihldmVudCA9IGRpdm9yY2VkX3NlcGVyYXRlZCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uID0gInRyYW5zaXRpb24iLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lID0gc3VydmV5X3dhdmUpKSAlPiUgDQogIHVuZ3JvdXAoKQ0KDQojbG9zdF9wYXJ0bmVyIGFzIHRyYW5zaXRpb24gYW5kIGV2ZW50DQplZ29fZGF0YSA8LSBlZ29fZGF0YSAlPiUNCiAgZ3JvdXBfYnkobm9tZW1fZW5jcikgJT4lIA0KICBhcnJhbmdlKG5vbWVtX2VuY3IsIHN1cnZleV93YXZlKSAlPiUgDQogIG11dGF0ZShsb3N0X3BhcnRuZXJfZXZlbnQgPSBldmVudF90cmFuc2l0aW9uX2YoZXZlbnQgPSBsb3N0X3BhcnRuZXIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbiA9ICJldmVudCIpLA0KICAgICAgICAgbG9zdF9wYXJ0bmVyX3RyYW5zaXRpb24gPSBldmVudF90cmFuc2l0aW9uX2YoZXZlbnQgPSBsb3N0X3BhcnRuZXIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbiA9ICJ0cmFuc2l0aW9uIiwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZSA9IHN1cnZleV93YXZlKSkgJ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9ldmVudCA9IGV2ZW50X3RyYW5zaXRpb25fZihldmVudCA9IG1vdmUsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb24gPSAiZXZlbnQiKSwNCiAgICBtb3ZlX3RyYW5zaXRpb24gPSAgZXZlbnRfdHJhbnNpdGlvbl9mKA0KICAgICAgZXZlbnQgPSBtb3ZlLA0KICAgICAgb3B0aW9uID0gInRyYW5zaXRpb24iLA0KICAgICAgdGltZSA9IHN1cnZleV93YXZlDQogICAgKQ0KICApICU+JSANCiAgdW5ncm91cCgpDQoNCiNlbXBsb3ltZW50IHN0YXR1cyBjaGFuZ2UgYXMgdHJhbnNpdGlvbiBvciBldmVudA0KZWdvX2RhdGEgPC0gZWdvX2RhdGEgJT4lDQogIGdyb3VwX2J5KG5vbWVtX2VuY3IpICU+JSANCiAgYXJyYW5nZShub21lbV9lbmNyLCBzdXJ2ZXlfd2F2ZSkgJT4lIA0KICBtdXRhdGUoZW1wbG95bWVudF9ldmVudCA9IGV2ZW50X3RyYW5zaXRpb25fZihldmVudCA9IGVtcGxveW1lbnQsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbiA9ICJldmVudCIpLA0KICAgICAgICAgZW1wbG95bWVudF90cmFuc2l0aW9uID0gZXZlbnRfdHJhbnNpdGlvbl9mKGV2ZW50ID0gZW1wbG95bWVudCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uID0gInRyYW5zaXRpb24iLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lID0gc3VydmV5X3dhdmUpLA0KICAgICAgICAgcmV0aXJlZF9ldmVudCA9IGV2ZW50X3RyYW5zaXRpb25fZihldmVudCA9IHJldGlyZWQsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbiA9ICJldmVudCIpLA0KICAgICAgICAgcmV0aXJlZF90cmFuc2l0aW9uID0gZXZlbnRfdHJhbnNpdGlvbl9mKGV2ZW50ID0gcmV0aXJlZCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uID0gInRyYW5zaXRpb24iLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lID0gc3VydmV5X3dhdmUpLA0KICAgICAgICAgdW5lbXBsb3llZF9ldmVudCA9IGV2ZW50X3RyYW5zaXRpb25fZihldmVudCA9IHVuZW1wbG95bWVudCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uID0gImV2ZW50IiksDQogICAgICAgICB1bmVtcGxveWVkX3RyYW5zaXRpb24gPSBldmVudF90cmFuc2l0aW9uX2YoZXZlbnQgPSB1bmVtcGxveW1lbnQsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbiA9ICJ0cmFuc2l0aW9uIiwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZSA9IHN1cnZleV93YXZlKSwNCiAgICAgICAgIA0KICAgICAgICAgKSAlPiUgDQogIHVuZ3JvdXAoKQ0KDQojZmlsbCBlZ28ncyBvcmlnaW4gd2l0aCBpbmZvcm1hdGlvbiBvZiBsYXRlciB3YXZlcy4NCmVnb19kYXRhIDwtIGVnb19kYXRhICU+JQ0KICBncm91cF9ieShub21lbV9lbmNyKSAlPiUNCiAgbXV0YXRlKA0KICAgIG9yaWdpbl9yZWNfbmFyID0gaWZlbHNlKGlzLm5hKG9yaWdpbl9yZWMpLCBtaW4ob3JpZ2luX3JlYywgbmEucm0gPSBUKSwgb3JpZ2luX3JlYyksDQogICAgb3JpZ2luX3JlY19uYXIgP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