Last updated: 2022-07-13

Checks: 7 0

Knit directory: myTidyTuesday/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210907) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 773622d. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    data/.Rhistory
    Ignored:    data/CNHI_Excel_Chart.xlsx
    Ignored:    data/Chicago.rds
    Ignored:    data/CommunityTreemap.jpeg
    Ignored:    data/Community_Roles.jpeg
    Ignored:    data/SeriesReport-20220414171148_6c3b18.xlsx
    Ignored:    data/Weekly_Chicago_IL_Regular_Reformulated_Retail_Gasoline_Prices.csv
    Ignored:    data/YammerDigitalDataScienceMembership.xlsx
    Ignored:    data/YammerMemberPage.rds
    Ignored:    data/YammerMembers.rds
    Ignored:    data/df.rds
    Ignored:    data/grainstocks.rds
    Ignored:    data/hike_data.rds
    Ignored:    data/netflixTitles.rds
    Ignored:    data/netflixTitles2.rds
    Ignored:    data/raw_weather.RData
    Ignored:    data/us_states.rds
    Ignored:    data/us_states_hexgrid.geojson
    Ignored:    data/weatherstats_toronto_daily.csv

Untracked files:
    Untracked:  analysis/2022_May_tabular_playground.Rmd
    Untracked:  analysis/2022_May_tabular_playground_tabnet.Rmd
    Untracked:  code/YammerReach.R
    Untracked:  code/autokeras.R
    Untracked:  code/chicago.R
    Untracked:  code/glmnet_test.R
    Untracked:  code/googleCompute.R
    Untracked:  code/work list batch targets.R
    Untracked:  environment.yml
    Untracked:  figure/
    Untracked:  report.html

Unstaged changes:
    Modified:   analysis/2021_01_19_tidy_tuesday.Rmd
    Modified:   analysis/2021_03_24_tidy_tuesday.Rmd
    Deleted:    analysis/2021_04_20.Rmd
    Deleted:    analysis/2022_02_11_tabular_playground.Rmd
    Deleted:    analysis/2022_04_18.qmd
    Modified:   analysis/Survival.Rmd
    Modified:   analysis/_site.yml
    Modified:   code/_common.R

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/2022_07_13_tidy_tuesday.Rmd) and HTML (docs/2022_07_13_tidy_tuesday.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 773622d opus1993 2022-07-13 add geofacet and text sizing and
html 34a1569 opus1993 2022-07-13 Build site.
Rmd 33e29e5 opus1993 2022-07-13 add geofacet and text sizing and
html 9094d54 opus1993 2022-07-13 Build site.
Rmd 2d4ad41 opus1993 2022-07-13 add geofacet and text sizing
html 7396b5c opus1993 2022-07-13 Build site.
Rmd 0e43049 opus1993 2022-07-13 add geofacet
html c37dd08 opus1993 2022-07-13 Build site.
Rmd dd63c3c opus1993 2022-07-13 give credit to brendialj
html 1e824f6 opus1993 2022-07-13 Build site.
Rmd cba7dfc opus1993 2022-07-13 wflow_publish("analysis/2022_07_13_tidy_tuesday.Rmd")

In this weeks #TidyTuesday we take a look at the number of flights arriving and departing from several large European airports.

data is via Eurocontrol at https://ec.europa.eu/eurostat/web/products-eurostat-news/-/ddn-20210914-1

suppressPackageStartupMessages({
library(tidyverse)
library(lubridate)
library(patchwork)
  
library(geofacet)
 })

source(here::here("code","_common.R"),
       verbose = FALSE,
       local = knitr::knit_global())

ggplot2::theme_set(grumanlib::theme_jim(base_size = 12))

Let’s see what we can do to improve BrendiA’s heatmap:

tweetrmd::include_tweet("https://twitter.com/brendialj/status/1547206511910600706")

For this week's #TidyTuesday, I examined the total commercial flight departures across the EU. The recent months show signs of recovery for the aviation industry after the pandemic hit.#RStats code: https://t.co/2sIpKRS1Ur#dataviz #ggplot2 pic.twitter.com/LJO5m4el58

— Brendi Ang (@brendialj) July 13, 2022
tt <- tidytuesdayR::tt_load("2022-07-12")

    Downloading file 1 of 1: `flights.csv`
flights <- tt$flights |>
  rename(airport_label = `Pivot Label`) |>
  janitor::clean_names() |>
  select(-year, -month_num, -month_mon)

total_flights <- flights |>
  group_by(flt_date) |>
  summarise(
    total_dep = sum(flt_dep_1, na.rm = TRUE),
    .groups = "drop"
  ) |>
  complete(flt_date = seq.Date(
    from = as_date("2022-01-01"),
    to = as_date("2022-12-31"),
    by = "day",
    fill = list(value = NA)
  )) |>
  mutate(
    year = year(flt_date),
    week_of_year = week(flt_date),
    month = month(flt_date, label = TRUE, abbr = TRUE),
    day = day(flt_date)
  )
# Function prepares data for plotting based on a given year by BrendiA at https://github.com/BrendiA/tidy-tuesday/blob/main/2022/week-28/week-28.R
create_df <- function(given_year) {

  # Extract first day of the week for the year
  first_day_of_year <-
    wday(as_date(paste(given_year, "01", "01", sep = "-")),
      week_start = 1
    )

  total_flights |>
    filter(year == given_year) |>
    mutate(day_of_week = wday(flt_date,
      label = TRUE,
      week_start = first_day_of_year
    )) |>
    #    mutate(day_of_week = forcats::fct_rev(day_of_week)) |>
    group_by(month) |>
    mutate(week_of_month = -1 * dense_rank(week_of_year)) |>
    ungroup()
}

best_contrast <- function(x, y = c("#010101", "#FFFFFF")) {
  contrasts <- prismatic::contrast_ratio(x, y)
  y[max(contrasts) == contrasts][1]
}

# Function plots heatmap based on the data generated by BrendiA at https://github.com/BrendiA/tidy-tuesday/blob/main/2022/week-28/week-28.R  with Emil Hvitfeldt's Prismatic text color adjustments
plot_heatmap <- function(df) {

  # Year list of the data frame
  given_year <- unique(df$year)

  ggplot(
    data = df,
    aes(
      y = week_of_month,
      x = day_of_week,
      fill = total_dep
    )
  ) +
    # Heat map
    geom_tile() +
    # Calendar days
    geom_text(aes(
      label = day,
      color = ggplot2::after_scale(purrr::map_chr(fill, best_contrast))
    ),
    size = 2
    ) +
    colorspace::scale_fill_continuous_sequential(
      name = "Number of departures",
      palette = "Viridis",
      na.value = "grey60", # Fill missing dates
      limits = c(0, 30000),
      breaks = seq(0, 30000, 10000),
      oob = scales::squish,
      label = scales::label_comma(accuracy = 1),
      c2 = 60, # increase
      l1 = 10
    ) + # decrease
    facet_wrap(~month,
      nrow = 1
    ) +
    theme_minimal() +
    labs(title = given_year) +
    theme(
      axis.text.x = element_blank(),
      axis.text.y = element_blank(),
      axis.title = element_blank(),
      legend.direction = "horizontal",
      legend.key.width = unit(1.5, "cm"),
      legend.text = element_text(family = "Regular 400"),
      legend.title = element_text(vjust = 0.8, family = "Regular 400"),
      panel.spacing.x = unit(0, "lines"),
      panel.grid = element_blank(),
      plot.title = element_text(hjust = 0.5, family = "Black 900 Italic", size = 12, face = "bold"),
      strip.text = element_text(family = "Regular 400", size = 8)
    )
}
plot_list <-
  purrr::map(
    unique(sort(total_flights$year)),
    ~ create_df(.x) |>
      plot_heatmap()
  )

The functions above create a big list of heat maps, one for each year. I’ve added prismatic contrasts to the geom_text to make the dates just a bit more legible.

# Subtitle
sub <-
  str_wrap(
    "The Covid-19 pandemic took a toll on the aviation industry .
    There are signs of recovery, with EU commercial flight departures increasing from mid-June 2021.",
    width = 100
  )

plot_list[[3]] +
  plot_list[[4]] +
  plot_list[[5]] +
  plot_list[[6]] +
  plot_list[[7]] +
  plot_layout(
    guides = "collect",
    ncol = 1,
    height = 0.5
  ) &
  plot_annotation(
    title = "Commercial flight departures in the EU",
    subtitle = sub,
    caption = "Source: Eurocontrol | #TidyTuesday Week 28 | @brendialj with the heatmap concept",
    theme = theme(
      legend.position = "bottom",
      plot.title = element_text(hjust = 0.5, size = 18, face = "bold"),
      plot.subtitle = element_text(hjust = 0.5, size = 14),
      plot.background = element_rect(fill = "#f0f8ff"),
      plot.caption = element_text(vjust = 1)
    )
  )

Cameron Kay posted a noteworthy animation. I’ll skip doing an animation this time go another direction.

tweetrmd::include_tweet("https://twitter.com/cameronskay/status/1547291272183832577")

My first #TidyTuesday contribution (now with legible text and more Norway!) #ICPSR #sumprog22 pic.twitter.com/efky0OQfLD

— Cameron Kay (@cameronskay) July 13, 2022
flights |>
  group_by(year = year(flt_date), month = month(flt_date), state_name) |>
  summarise(
    total_dep = sum(flt_dep_1, na.rm = TRUE),
    .groups = "drop"
  ) |>
  mutate(color = case_when(
    year < 2020 ~ "#b2e2e2",
    year == 2020 ~ "#66c2a4",
    year == 2021 ~ "#238b45",
    year == 2022 ~ "#006d2c"
  )) |>
  ggplot(aes(
    x = month,
    total_dep
  )) +
  geom_line(aes(
    group = factor(year),
    color = color
  ),
  show.legend = TRUE
  ) +
  scale_color_identity(
    guide = "legend",
    labels = c("2022", "2021", "2020", "Prior Yrs")
  ) +
  scale_x_continuous(
    breaks = c(3, 6, 9),
    labels = c("Mar", "Jun", "Sep"),
    minor_breaks = NULL
  ) +
  scale_y_continuous(
    limits = c(0, NA),
    n.breaks = 3,
    labels = scales::comma
  ) +
  facet_geo(~state_name,
    grid = "eu_grid1",
    label = "name",
    scales = "free_y"
  ) +
  labs(
    y = "Monthly Departures",
    title = "Commercial flight departures in select EU Countries",
    subtitle = sub,
    color = NULL,
    caption = "Source: Eurocontrol | #TidyTuesday Week 28"
  ) +
  theme(
    legend.position = c(0.1, 0.1),
    plot.title = element_text(hjust = 0.5, size = 18, face = "bold"),
    plot.subtitle = element_text(hjust = 0.5, size = 14),
    axis.text.x = element_text(size = 8),
    axis.text.y = element_text(size = 8),
    strip.text = element_text(size = 8),
    plot.background = element_rect(fill = "#edf8fb"),
    plot.caption = element_text(vjust = 1)
  )


sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] geofacet_0.2.0  patchwork_1.1.1 lubridate_1.8.0 forcats_0.5.1  
 [5] stringr_1.4.0   dplyr_1.0.9     purrr_0.3.4     readr_2.1.2    
 [9] tidyr_1.2.0     tibble_3.1.7    ggplot2_3.3.6   tidyverse_1.3.1
[13] workflowr_1.7.0

loaded via a namespace (and not attached):
  [1] readxl_1.4.0         backports_1.4.1      systemfonts_1.0.4   
  [4] workflows_1.0.0      selectr_0.4-2        tidytuesdayR_1.0.2  
  [7] sp_1.5-0             splines_4.1.3        listenv_0.8.0       
 [10] usethis_2.1.6        digest_0.6.29        foreach_1.5.2       
 [13] htmltools_0.5.2      yardstick_1.0.0      viridis_0.6.2       
 [16] parsnip_1.0.0        fansi_1.0.3          magrittr_2.0.3      
 [19] memoise_2.0.1        tune_1.0.0           tzdb_0.3.0          
 [22] recipes_1.0.1        globals_0.15.1       modelr_0.1.8        
 [25] gower_1.0.0          vroom_1.5.7          R.utils_2.12.0      
 [28] hardhat_1.2.0        rsample_1.0.0        jpeg_0.1-9          
 [31] dials_1.0.0          colorspace_2.0-3     rvest_1.0.2         
 [34] ggrepel_0.9.1        textshaping_0.3.6    haven_2.5.0         
 [37] xfun_0.31            prismatic_1.1.0      callr_3.7.0         
 [40] crayon_1.5.1         jsonlite_1.8.0       survival_3.3-1      
 [43] iterators_1.0.14     glue_1.6.2           gtable_0.3.0        
 [46] ipred_0.9-13         R.cache_0.15.0       tweetrmd_0.0.9      
 [49] future.apply_1.9.0   imguR_1.0.3          scales_1.2.0        
 [52] infer_1.0.2          DBI_1.1.3            Rcpp_1.0.9          
 [55] viridisLite_0.4.0    units_0.8-0          bit_4.0.4           
 [58] GPfit_1.0-8          proxy_0.4-27         lava_1.6.10         
 [61] prodlim_2019.11.13   geogrid_0.1.1        httr_1.4.3          
 [64] ellipsis_0.3.2       farver_2.1.1         R.methodsS3_1.8.2   
 [67] pkgconfig_2.0.3      nnet_7.3-17          sass_0.4.1          
 [70] dbplyr_2.2.1         janitor_2.1.0        utf8_1.2.2          
 [73] here_1.0.1           labeling_0.4.2       tidyselect_1.1.2    
 [76] rlang_1.0.3          DiceDesign_1.9       later_1.3.0         
 [79] munsell_0.5.0        cellranger_1.1.0     tools_4.1.3         
 [82] cachem_1.0.6         cli_3.3.0            generics_0.1.3      
 [85] broom_1.0.0          evaluate_0.15        fastmap_1.1.0       
 [88] yaml_2.3.5           ragg_1.2.2           rematch2_2.1.2      
 [91] bit64_4.0.5          processx_3.7.0       knitr_1.39          
 [94] fs_1.5.2             workflowsets_0.2.1   future_1.26.1       
 [97] whisker_0.4          R.oo_1.25.0          xml2_1.3.3          
[100] compiler_4.1.3       rstudioapi_0.13      curl_4.3.2          
[103] png_0.1-7            e1071_1.7-11         reprex_2.0.1        
[106] lhs_1.1.5            bslib_0.3.1          stringi_1.7.8       
[109] highr_0.9            ps_1.7.1             rgeos_0.5-9         
[112] lattice_0.20-45      Matrix_1.4-0         styler_1.7.0        
[115] classInt_0.4-7       conflicted_1.1.0     vctrs_0.4.1         
[118] tidymodels_0.2.0     pillar_1.7.0         lifecycle_1.0.1     
[121] furrr_0.3.0          jquerylib_0.1.4      httpuv_1.6.5        
[124] R6_2.5.1             promises_1.2.0.1     KernSmooth_2.23-20  
[127] gridExtra_2.3        parallelly_1.32.0    codetools_0.2-18    
[130] MASS_7.3-55          assertthat_0.2.1     rprojroot_2.0.3     
[133] withr_2.5.0          rnaturalearth_0.1.0  parallel_4.1.3      
[136] hms_1.1.1            grid_4.1.3           rpart_4.1.16        
[139] timeDate_3043.102    class_7.3-20         snakecase_0.11.0    
[142] rmarkdown_2.14       grumanlib_0.1.0.9999 git2r_0.30.1        
[145] sf_1.0-7             getPass_0.2-2       
LS0tDQp0aXRsZTogIkV1cm9wZWFuIEZsaWdodHMiDQphdXRob3I6ICJKaW0gR3J1bWFuIg0KZGF0ZTogIkp1bHkgMTMsIDIwMjIiDQpvdXRwdXQ6DQogIHdvcmtmbG93cjo6d2Zsb3dfaHRtbDoNCiAgICB0b2M6IG5vDQogICAgY29kZV9mb2xkaW5nOiBoaWRlDQogICAgY29kZV9kb3dubG9hZDogdHJ1ZQ0KICAgIGRmX3ByaW50OiBwYWdlZA0KZWRpdG9yX29wdGlvbnM6DQogIGNodW5rX291dHB1dF90eXBlOiBjb25zb2xlDQotLS0NCg0KSW4gdGhpcyB3ZWVrcyAjVGlkeVR1ZXNkYXkgd2UgdGFrZSBhIGxvb2sgYXQgdGhlIG51bWJlciBvZiBmbGlnaHRzIGFycml2aW5nIGFuZCBkZXBhcnRpbmcgZnJvbSBzZXZlcmFsIGxhcmdlIEV1cm9wZWFuIGFpcnBvcnRzLg0KDQpkYXRhIGlzIHZpYSBFdXJvY29udHJvbCBhdCBbaHR0cHM6Ly9lYy5ldXJvcGEuZXUvZXVyb3N0YXQvd2ViL3Byb2R1Y3RzLWV1cm9zdGF0LW5ld3MvLS9kZG4tMjAyMTA5MTQtMV0oaHR0cHM6Ly9lYy5ldXJvcGEuZXUvZXVyb3N0YXQvd2ViL3Byb2R1Y3RzLWV1cm9zdGF0LW5ld3MvLS9kZG4tMjAyMTA5MTQtMSkNCg0KYGBge3IgfQ0KI3wgbGFiZWw6IHNldHVwDQoNCnN1cHByZXNzUGFja2FnZVN0YXJ0dXBNZXNzYWdlcyh7DQpsaWJyYXJ5KHRpZHl2ZXJzZSkNCmxpYnJhcnkobHVicmlkYXRlKQ0KbGlicmFyeShwYXRjaHdvcmspDQ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AgIGZpbGwgPSB0b3RhbF9kZXApKSArDQogICAgIyBIZWF0IG1hcA0KICAgIGdlb21fdGlsZSgpICsNCiAgICAjIENhbGVuZGFyIGRheXMNCiAgICBnZW9tX3RleHQoYWVzKGxhYmVsID0gZGF5LA0KICAgICAgICAgICAgICAgICAgY29sb3IgPSBnZ3Bsb3QyOjphZnRlcl9zY2FsZShwdXJycjo6bWFwX2NocihmaWxsLCBiZXN0X2NvbnRyYXN0KSkpLA0KICAgICAgICAgICAgICBzaXplID0gMikgKw0KICAgIGNvbG9yc3BhY2U6OnNjYWxlX2ZpbGxfY29udGludW91c19zZXF1ZW50aWFsKG5hbWUgPSAiTnVtYmVyIG9mIGRlcGFydHVyZXMiLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhbGV0dGUgPSAiVmlyaWRpcyIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmEudmFsdWUgPSAiZ3JleTYwIiwgIyBGaWxsIG1pc3NpbmcgZGF0ZXMNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW1pdHMgPSBjKDAsIDMwMDAwKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha3MgPSBzZXEoMCwgMzAwMDAsIDEwMDAwKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvb2IgPSBzY2FsZXM6OnNxdWlzaCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbCA9IHNjYWxlczo6bGFiZWxfY29tbWEoYWNjdXJhY3kgPSAxKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjMiA9IDYwLCAjIGluY3JlYXNlDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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PiANCiAgbXV0YXRlKGNvbG9yID0gY2FzZV93aGVuKHllYXIgPCAyMDIwIH4gJyNiMmUyZTInLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWVhciA9PSAyMDIwIH4gJyM2NmMyYTQnLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWVhciA9PSAyMDIxIH4gJyMyMzhiNDUnLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWVhciA9PSAyMDIyIH4gIiMwMDZkMmMiKSkgfD4gDQogIGdncGxvdChhZXMoeCA9IG1vbnRoLCAgDQogICAgICAgICAgICAgdG90YWxfZGVwKSkgKw0KICBnZW9tX2xpbmUoYWVzKGdyb3VwID0gZmFjdG9yKHllYXIpLCANCiAgICAgICAgICAgICAgICBjb2xvciA9IGNvbG9yKSwNCiAgICAgICAgICAgIHNob3cubGVnZW5kID0gVFJVRSkgKw0KICBzY2FsZV9jb2xvcl9pZGVudGl0eShndWlkZSA9ICJsZWdlbmQiLA0KICAgICAgICAgICAgICAgICAgICAgICBsYWJlbHMgPSBjKCIyMDIyIiwgIjIwMjEiLCAiMjAyMCIsICJQcmlvciBZcnMiKSkgKw0KICBzY2FsZV94X2NvbnRpbnVvdXMoYnJlYWtzID0gYygzLDYsOSksDQogICAgICAgICAgICAgICAgICAgICBsYWJlbHMgPSBjKCJNYXIiLCJKdW4iLCJTZXAiKSwNCiAgICAgICAgICAgICAgICAgICAgIG1pbm9yX2JyZWFrcyA9IE5VTEwpICsNCiAgc2NhbGVfeV9jb250aW51b3VzKGxpbWl0cyA9IGMoMCwgTkEpLCANCiAgICAgICAgICAgICAgICAgICAgIG4uYnJlYWtzID0gMywNCiAgICAgICAgICAgICAgICAgICAgIGxhYmVscyA9IHNjYWxlczo6Y29tbWEpICsNCiAgZmFjZXRfZ2VvKCB+IHN0YXRlX25hbWUsIA0KICAgICAgICAgICAgIGdyaWQgPSAiZXVfZ3JpZDEiLCANCiAgICAgICAgICAgICBsY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