diff --git a/.lintr b/.lintr index ef6caf3a..b54b8f8b 100644 --- a/.lintr +++ b/.lintr @@ -1,5 +1,7 @@ linters: linters_with_defaults( object_name_linter = NULL, - object_usage_linter = NULL + object_usage_linter = NULL, + object_usage_linter = NULL, + return_linter = NULL ) encoding: "UTF-8" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 54e8d7de..845cf614 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.2 + rev: v0.4.3.9015 hooks: - id: style-files args: [--style_pkg=styler, --style_fun=tidyverse_style] @@ -10,7 +10,7 @@ repos: - id: no-browser-statement - id: no-debug-statement - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v6.0.0 hooks: - id: check-added-large-files args: ['--maxkb=250'] @@ -19,7 +19,7 @@ repos: - id: trailing-whitespace exclude: activate.R - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.0 + rev: v0.14.2 hooks: # Python linter. Ruff recommends running this before the formatter to # avoid conflicts when using the --fix flag diff --git a/reports/analytics/.Rprofile b/reports/analytics/.Rprofile new file mode 100644 index 00000000..81b960f5 --- /dev/null +++ b/reports/analytics/.Rprofile @@ -0,0 +1 @@ +source("renv/activate.R") diff --git a/reports/analytics/analytics_dashboard.Rproj b/reports/analytics/analytics_dashboard.Rproj new file mode 100644 index 00000000..e83436a3 --- /dev/null +++ b/reports/analytics/analytics_dashboard.Rproj @@ -0,0 +1,16 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes diff --git a/reports/analytics/analytics_dashboard.qmd b/reports/analytics/analytics_dashboard.qmd new file mode 100644 index 00000000..80226cb2 --- /dev/null +++ b/reports/analytics/analytics_dashboard.qmd @@ -0,0 +1,1102 @@ +--- +title: "HomeVal Analytics" +execute: + echo: false + warning: false + message: false +format: + html: + embed-resources: true + grid: + body-width: 1000px +--- + +```{r} +library(arrow) +library(DBI) +library(dplyr) +library(fs) +library(glue) +library(leaflet) +library(lubridate) +library(paws) +library(plotly) +library(purrr) +library(tibble) +library(tidyverse) +library(urltools) +library(uaparserjs) +``` + + +```{r} +conn <- dbConnect(noctua::athena(), rstudio_conn_tab = FALSE) + +cache_dir <- "data/assessment_card" +dir.create(cache_dir, recursive = TRUE, showWarnings = FALSE) + +cache_file <- file.path(cache_dir, "assessment_card.parquet") + +if (!file.exists(cache_file)) { + message("Cache not found. Querying Athena and saving to cache...") + + assessment_card <- dbGetQuery( + conn, + "SELECT * FROM pinval.vw_assessment_card" + ) + + write_parquet(assessment_card, cache_file) +} else { + message("Reading cached file") + assessment_card <- read_parquet(cache_file) +} +``` + +```{r} +tz_local <- "America/Chicago" +baseline_date <- as.Date("2025-09-04") + +log_group_name <- "/aws-cloudfront/pinval-prod" +log_stream_name <- "CloudFront_E3AIN3GTEPCCYR" + +out_dir <- fs::path_abs("data/cloudwatch_cache") +fs::dir_create(out_dir) +message("Writing to: ", out_dir) + +cloudwatchlogs_client <- paws::cloudwatchlogs() + +to_epoch_ms_utc <- function(x_dt_local) { + as.numeric(with_tz(x_dt_local, "UTC")) * 1000 +} + +fetch_events_for_day <- function(date_local) { + # Dates are queried in epoch time and converted to local + # time to make data readable + start_local <- as.POSIXct(date_local, tz = tz_local) + end_local <- start_local + days(1) + + start_ms <- to_epoch_ms_utc(start_local) + end_ms <- to_epoch_ms_utc(end_local) + + # Create an initial call + resp <- cloudwatchlogs_client$get_log_events( + logGroupName = log_group_name, + logStreamName = log_stream_name, + startTime = start_ms, + endTime = end_ms, + startFromHead = TRUE + ) + + events <- resp$events %||% list() + prev_token <- NULL + next_token <- resp$nextForwardToken %||% NULL + + # Keep calling until token stops changing + while (!is.null(next_token) && !identical(next_token, prev_token)) { + prev_token <- next_token + resp <- cloudwatchlogs_client$get_log_events( + logGroupName = log_group_name, + logStreamName = log_stream_name, + endTime = end_ms, + nextToken = next_token, + startFromHead = TRUE + ) + events <- c(events, resp$events %||% list()) + next_token <- resp$nextForwardToken %||% NULL + } + + if (length(events) == 0) { + return(tibble( + timestamp = numeric(0), + message = character(0), + datetime = as.POSIXct(character(0)), + date = as.Date(character(0)) + )) + } + + tibble( + timestamp = map_dbl(events, ~ .x$timestamp), + message = map_chr(events, ~ .x$message) + ) %>% + mutate( + # CloudWatch timestamps are epoch ms in UTC + datetime = with_tz(as_datetime(timestamp / 1000, tz = "UTC"), tz_local), + date = as.Date(datetime) + ) +} + +# Today in local time +today_local <- today(tzone = tz_local) + +# Look for already-cached files like logs_YYYY-MM-DD.parquet +cached_files <- dir_ls(out_dir, + regexp = "logs_\\d{4}-\\d{2}-\\d{2}\\.parquet$", + type = "file" +) +# Match dates in cached filenames +cached_dates <- str_match( + basename(cached_files), + "logs_(\\d{4}-\\d{2}-\\d{2})\\.parquet" +)[, 2] + +cached_dates <- as.Date(na.omit(cached_dates)) + +# Build the full sequence of dates +all_dates <- seq(baseline_date, today_local, by = "day") + +dates_to_fetch <- c( + # Always call today's date + setdiff(all_dates[all_dates != today_local], cached_dates), + today_local +) %>% sort() + +message( + "Dates to fetch (", length(dates_to_fetch), "): ", + paste(format(dates_to_fetch), collapse = ", ") +) + +walk(dates_to_fetch, function(d) { + out_file <- fs::path(out_dir, paste0("logs_", format(d), ".parquet")) + message("Target file: ", fs::path_abs(out_file)) + + if (fs::file_exists(out_file) && d != today_local) { + message("Skipping ", format(d), " (already cached).") + return(invisible(NULL)) + } + + message("Fetching ", format(d), " ...") + df <- fetch_events_for_day(d) + + arrow::write_parquet(df, out_file) + message("Wrote ", nrow(df), " events to ", fs::path_abs(out_file)) + stopifnot(fs::file_exists(out_file)) + message("Verified exists: ", as.character(fs::file_size(out_file)), " bytes") +}) + + +logs <- fs::dir_ls( + out_dir, + regexp = "logs_\\d{4}-\\d{2}-\\d{2}\\.parquet$", + type = "file" +) %>% + purrr::map_dfr(arrow::read_parquet) +``` + + +```{r} +fields <- c( + "date", "time", "sc-bytes", "c-ip", "cs-method", "cs(Host)", + "cs-uri-stem", "sc-status", "cs(Referer)", "cs(User-Agent)", + "cs-uri-query", "x-host-header", "cs-protocol", "cs-bytes", + "time-taken", "x-forwarded-for", "x-edge-response-result-type", + "cs-protocol-version", "c-port", "time-to-first-byte", + "sc-content-type", "sc-content-len" +) + +data <- logs %>% + mutate(parsed = purrr::map(message, ~ { + val <- jsonlite::fromJSON(.x, simplifyVector = TRUE) + out <- setNames(vector("list", length(fields)), fields) + for (nm in fields) { + out[[nm]] <- + if (nm %in% names(val)) as.character(val[[nm]]) else NA_character_ + } + out + })) %>% + select(-any_of(fields)) %>% + tidyr::unnest_wider(parsed, names_repair = "minimal") %>% + mutate( + pin = coalesce( + str_extract(`cs-uri-stem`, "(?<=/)\\d{14}"), + str_extract(`cs(Referer)`, "\\d{14}(?=\\.html)") + ), + extract_year = coalesce( + str_extract(`cs-uri-stem`, "(?<=/)(202[0-9])(?=/)"), + str_extract(`cs(Referer)`, "(?<=/)(202[0-9])(?=/)") + ), + extract_year = as.integer(extract_year), + # This is an indicator for the main query, or the query + # for the static assets. + # For the rest of the document, we will use the value of 'Query' + # when trying to identify a unique query. We keep the static in + # to see how many static assets are hit and we keep in Other + # to look for bot requests. + uri_indicator = case_when( + str_detect(`cs-uri-stem`, "^/202[0-9]/") ~ "Query", + str_detect(`cs-uri-stem`, "^/static/") ~ "Static", + TRUE ~ "Other" + ), + ) %>% + left_join( + assessment_card %>% + mutate(assessment_year = as.integer(assessment_year)) %>% + select( + meta_pin, char_class, assessment_year, + meta_triad_name, meta_card_num, is_report_eligible, + reason_report_ineligible, meta_township_name, loc_latitude, + loc_longitude + ), + by = c("pin" = "meta_pin", "extract_year" = "assessment_year") + ) +``` + +--- + +## Request Count by Class + +NA values are for PINs which do not have a matching assessment_card record. + +::: {.panel-tabset} + +### Overall + + +```{r} +# We want to keep multi-cards just for the class related plots +data_class <- data %>% + filter(uri_indicator == "Query") %>% + mutate( + # Make sure we identify PINs which are incorrect + # or not joined to assessment_card + # For example PIN 14110010074923 + char_class = if_else(is.na(char_class), "NA", as.character(char_class)) + ) %>% + # This keeps unique classes by queries. + # If a multi-class card is queried, it will return + # one value for the class tables. + # Datetime has issues with second lag, so it is not + # a fool-proof method. + distinct(pin, date, datetime, char_class) + +data_class %>% + group_by(char_class) %>% + summarise(request_count = n(), .groups = "drop") %>% + plot_ly( + x = ~char_class, + y = ~request_count, + type = "bar", + marker = list(color = "lightblue"), + hovertemplate = paste( + "Class: %{x}
", + "Count: %{y}" + ) + ) %>% + layout( + xaxis = list(title = "Class"), + yaxis = list(title = "Count"), + showlegend = FALSE + ) +``` + + +### Count Over Time + +```{r} +data_class %>% + group_by(date, char_class) %>% + summarise(request_count = n(), .groups = "drop") %>% + plot_ly( + x = ~date, + y = ~request_count, + color = ~char_class, + type = "bar", + hovertemplate = paste( + "Date: %{x}
", + "Class: %{fullData.name}
", + "Count: %{y}" + ) + ) %>% + layout( + barmode = "stack", + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Count"), + legend = list(title = list(text = "Class")) + ) +``` + +### % Over Time + +```{r} +data_class %>% + mutate(date = as.Date(datetime)) %>% + group_by(date, char_class) %>% + summarise(request_count = n(), .groups = "drop") %>% + group_by(date) %>% + mutate(pct = request_count / sum(request_count) * 100) %>% + plot_ly( + x = ~date, + y = ~pct, + color = ~char_class, + type = "bar", + hovertemplate = paste( + "Date: %{x}
", + "Class: %{fullData.name}
", + "Share: %{y:.1f}%" + ) + ) %>% + layout( + barmode = "stack", + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Percentage", ticksuffix = "%"), + legend = list(title = list(text = "Class")) + ) +``` +::: + +--- + +## Request Count by Extract Year + +Extract year refers to the year which the user queried the data for. + +::: {.panel-tabset} + +### Overall + +```{r} +# This removes the duplicate cards from the previous join. +data <- data %>% + distinct(message, .keep_all = TRUE) %>% + mutate(extract_year = as.character(extract_year)) + +data %>% + group_by(extract_year) %>% + filter(uri_indicator == "Query") %>% + summarise(request_count = n(), .groups = "drop") %>% + plot_ly( + x = ~extract_year, + y = ~request_count, + type = "bar", + marker = list(color = "lightblue"), + hovertemplate = paste( + "Year: %{x}
", + "Count: %{y}" + ) + ) %>% + layout( + xaxis = list(title = "Year"), + yaxis = list(title = "Count") + ) +``` + +### Total Over Time + +```{r} +data %>% + filter( + uri_indicator == "Query" + ) %>% + group_by(date, extract_year) %>% + summarise(request_count = n(), .groups = "drop") %>% + plot_ly( + x = ~date, + y = ~request_count, + color = ~extract_year, + type = "bar", + hovertemplate = paste( + "Date: %{x}
", + "Year: %{fullData.name}
", + "Count: %{y}" + ) + ) %>% + layout( + barmode = "stack", + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Count"), + legend = list(title = list(text = "Year")) + ) +``` + +### % Over Time + +```{r} +data %>% + filter( + uri_indicator == "Query" + ) %>% + group_by(date, extract_year) %>% + summarise(request_count = n(), .groups = "drop") %>% + group_by(date) %>% + mutate(pct = request_count / sum(request_count) * 100) %>% + plot_ly( + x = ~date, + y = ~pct, + color = ~extract_year, + type = "bar", + hovertemplate = paste( + "Date: %{x}
", + "Year: %{fullData.name}
", + "Share: %{y:.1f}%" + ) + ) %>% + layout( + barmode = "stack", + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Percentage", ticksuffix = "%"), + legend = list(title = list(text = "Year")) + ) +``` + +::: + +--- + +## Request Count by Report Eligibility + +::: {.panel-tabset} + +### Overall + +```{r} +data %>% + filter(uri_indicator == "Query") %>% + mutate( + eligibility = case_when( + is_report_eligible == TRUE ~ "Eligible", + is_report_eligible == FALSE ~ "Not Eligible", + is.na(is_report_eligible) ~ "N/A" + ) + ) %>% + count(eligibility, name = "request_count") %>% + plot_ly( + x = ~eligibility, + y = ~request_count, + type = "bar", + marker = list(color = c("lightblue", "tomato", "grey")), + hovertemplate = paste( + "Eligibility: %{x}
", + "Count: %{y}" + ) + ) %>% + layout( + xaxis = list(title = "Eligibility"), + yaxis = list(title = "Count") + ) +``` + +### Type of Ineligibility Reason + +This allows for duplicate reasons if the same query is deemed ineligible. + +```{r} +ineligbility_data <- data %>% + filter( + uri_indicator == "Query", + # This filters out eligible pins which will all have NA reason + # It allow us to keep queries which did not have a valid pin + # as their own category and provide an Invalid PIN reason. + is_report_eligible %in% c(FALSE, NA) + ) %>% + mutate( + reason_clean = case_when( + is.na(reason_report_ineligible) ~ "Invalid PIN", + TRUE ~ as.character(reason_report_ineligible) + ) + ) + +ineligbility_data %>% + count(reason_clean, name = "request_count") %>% + plot_ly( + x = ~reason_clean, + y = ~request_count, + type = "bar", + marker = list(color = "lightblue"), + hovertemplate = paste( + "Reason: %{x}
", + "Count: %{y}" + ) + ) %>% + layout( + xaxis = list( + title = "Eligibility Reason", + categoryorder = "total descending" + ), + yaxis = list(title = "Count") + ) +``` + +### Count Over Time + +```{r} +ineligbility_data %>% + count(reason_clean, date, name = "request_count") %>% + plot_ly( + x = ~date, + y = ~request_count, + color = ~reason_clean, + type = "bar", + hovertemplate = paste( + "Date: %{x}
", + "Reason: %{fullData.name}
", + "Count: %{y}" + ) + ) %>% + layout( + barmode = "stack", + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Count"), + legend = list(title = list(text = "Eligibility Reason")) + ) +``` + +### % Over Time + +```{r} +ineligbility_data %>% + count(date, reason_report_ineligible, name = "request_count") %>% + complete(date, reason_report_ineligible, fill = list(request_count = 0)) %>% + group_by(date) %>% + mutate(pct = 100 * request_count / sum(request_count)) %>% + ungroup() %>% + arrange(date) %>% + plot_ly( + x = ~date, + y = ~pct, + color = ~reason_report_ineligible, + type = "bar", + hovertemplate = "Date: %{x}
Reason: + %{fullData.name}
Share: %{y:.1f}%" + ) %>% + layout( + barmode = "stack", + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Percentage", ticksuffix = "%"), + legend = list(title = list(text = "Eligibility Reason")) + ) +``` +::: + +--- + +```{r} +df_counts <- data %>% + filter(uri_indicator == "Query") %>% + mutate( + township = dplyr::coalesce(meta_township_name, "NA"), + triad = dplyr::coalesce(meta_triad_name, "NA"), + extract_year = dplyr::coalesce(extract_year, "NA") + ) %>% + group_by(extract_year, triad, township) %>% + summarise(request_count = n(), .groups = "drop") + +plot_township_year <- function(df_counts, target_year) { + df_y <- df_counts %>% + filter(extract_year == target_year) %>% + mutate(x_label = paste(triad, township, sep = " | ")) %>% + arrange(triad, township) + + plot_ly( + df_y, + x = ~x_label, + y = ~request_count, + type = "bar", + color = ~triad, + hovertemplate = paste( + "Year: ", target_year, "
", + "Township: %{x}
", + "Count: %{y}" + ) + ) %>% + layout( + xaxis = list(title = "Triad | Township"), + yaxis = list(title = "Count"), + legend = list(title = list(text = "Triad")) + ) +} + +years <- sort(unique(df_counts$extract_year)) +``` + +## Request Count by Township and Query Year + +::: {.panel-tabset} + +### Overall + +```{r} +data %>% + filter(uri_indicator == "Query") %>% + transmute( + triad = dplyr::coalesce(meta_triad_name, "NA"), + township = dplyr::coalesce(meta_township_name, "NA") + ) %>% + count(triad, township, name = "request_count") %>% + arrange(triad, township) %>% + mutate(x_label = paste(triad, township, sep = " | ")) %>% + plot_ly( + x = ~x_label, + y = ~request_count, + type = "bar", + color = ~triad, + hovertemplate = paste( + "Triad | Township: %{x}
", + "Count: %{y}" + ) + ) %>% + layout( + xaxis = list(title = "Triad | Township"), + yaxis = list(title = "Count"), + legend = list(title = list(text = "Triad")) + ) +``` + + +### 2024 +```{r} +plot_township_year(df_counts, "2024") +``` + +### 2025 + +```{r} +plot_township_year(df_counts, "2025") +``` +::: + +--- + +## Map of Distinct Queried Pins + +This map filters out any queries for PINs that do not have coordinates in the +underlying data, which is always true for non-tri PINs. As such, any queries +for non-tri PINs (e.g. north suburbs PINs in 2024) will not appear on this map. + +```{r} +df <- data %>% + filter(uri_indicator == "Query") %>% + distinct(pin, .keep_all = TRUE) %>% + filter(!is.na(loc_latitude), !is.na(loc_longitude)) %>% + mutate( + extract_year = as.factor(extract_year) + ) + +pal <- colorFactor( + palette = "Set1", + domain = df$extract_year, + na.color = "gray" +) + + +leaflet(df) %>% + addProviderTiles("OpenStreetMap") %>% + addCircleMarkers( + lng = ~loc_longitude, + lat = ~loc_latitude, + radius = 4, + color = ~ pal(extract_year), + stroke = FALSE, + fillOpacity = 0.7 + ) %>% + addLegend( + "bottomright", + pal = pal, + values = ~extract_year, + title = "Extract Year", + opacity = 1 + ) +``` + +## Distribution of HTTP Response Status Code over Time + +::: {.panel-tabset} + +### Excluding Static File Requests + +```{r} +data %>% + mutate( + date = as.Date(datetime), + status = ifelse(is.na(`sc-status`), "Unknown", as.character(`sc-status`)) + ) %>% + filter(uri_indicator == "Query") %>% + count(date, status, name = "Count") %>% + arrange(date, status) %>% + plot_ly( + x = ~date, + y = ~Count, + color = ~status, + type = "scatter", + mode = "lines+markers", + hovertemplate = "Date: %{x}
Status: + %{fullData.name}
Count: %{y}" + ) %>% + layout( + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Count"), + legend = list(title = list(text = "Status")) + ) +``` + +### Including Static File Requests + +```{r} +data %>% + mutate( + date = as.Date(datetime), + status = ifelse(is.na(`sc-status`), "Unknown", as.character(`sc-status`)) + ) %>% + count(date, status, name = "Count") %>% + arrange(date, status) %>% + plot_ly( + x = ~date, + y = ~Count, + color = ~status, + type = "scatter", + mode = "lines+markers", + hovertemplate = "Date: %{x}
Status: + %{fullData.name}
Count: %{y}" + ) %>% + layout( + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Count"), + legend = list(title = list(text = "Status")) + ) +``` + +### Recent Errors (non-2xx/3xx status codes) + +```{r} +data %>% + # Keep only errors (not 2xx or 3xx) + filter(!is.na(`sc-status`), !substr(`sc-status`, 1, 1) %in% c("2", "3")) %>% + mutate( + timestamp = as.POSIXct(datetime), + status = as.character(`sc-status`), + path = `cs-uri-stem` + ) %>% + arrange(desc(timestamp)) %>% + slice_head(n = 100) %>% + plot_ly( + type = "table", + header = list( + values = c("Timestamp", "Status", "Path"), + fill = list(color = "lightgrey"), + align = "left" + ), + cells = list( + values = list(~timestamp, ~status, ~path), + align = "left" + ) + ) +``` + +::: + +## Most Common Browsers + +::: {.panel-tabset} + +### Excluding Static File Requests + +```{r} +normalize_browser <- function(x) { + x <- str_to_lower(str_squish(x)) + case_when( + str_detect(x, "chrome") ~ "Chrome", + str_detect(x, "edge") ~ "Edge", + str_detect(x, "firefox") ~ "Firefox", + str_detect(x, "opera") ~ "Opera", + str_detect(x, "safari") ~ "Safari", + str_detect(x, "samsung") ~ "Samsung", + str_detect(x, "internet explorer") ~ "Internet Explorer", + str_detect(x, "whatsapp") ~ "WhatsApp", + str_detect(x, "facebook") ~ "Facebook", + str_detect(x, "slack") ~ "Slack", + str_detect(x, "linkedin") ~ "LinkedIn", + str_detect(x, "apple") ~ "Apple", + TRUE ~ str_to_title(x) + ) +} + +data %>% + mutate(parsed = ua_parse(`cs(User-Agent)`)) %>% + filter(uri_indicator == "Query") %>% + unnest_wider(parsed) %>% + rename(browser = `ua.family`) %>% + mutate(browser = normalize_browser(browser)) %>% + count(browser, name = "request_count") %>% + mutate(browser = fct_reorder(browser, request_count)) %>% + plot_ly( + x = ~browser, y = ~request_count, + type = "bar", + marker = list(color = "lightblue"), + hovertemplate = "Browser: %{x}
Count: %{y}" + ) %>% + layout( + xaxis = list(title = "Browser"), + yaxis = list(title = "Count") + ) +``` + +### Including Static File Requests + +```{r} +data %>% + mutate(parsed = ua_parse(`cs(User-Agent)`)) %>% + unnest_wider(parsed) %>% + rename(browser = `ua.family`) %>% + mutate(browser = normalize_browser(browser)) %>% + count(browser, name = "request_count") %>% + mutate(browser = fct_reorder(browser, request_count)) %>% + plot_ly( + x = ~browser, y = ~request_count, + type = "bar", + marker = list(color = "lightblue"), + hovertemplate = "Browser: %{x}
Count: %{y}" + ) %>% + layout( + xaxis = list(title = "Browser"), + yaxis = list(title = "Count") + ) +``` + + +--- + +::: + +## Most Common Referer Domains + +::: {.panel-tabset} + +### Excluding Static File Requests + +```{r} +data %>% + filter(uri_indicator == "Query") %>% + mutate( + referer_raw = `cs(Referer)`, + domain = ifelse( + is.na(referer_raw) | referer_raw == "-", + "None", + domain(referer_raw) + ) + ) %>% + group_by(domain) %>% + summarise(request_count = n(), .groups = "drop") %>% + arrange(desc(request_count)) %>% + plot_ly( + x = ~ reorder(domain, request_count), + y = ~request_count, + type = "bar", + marker = list(color = "lightblue"), + hovertemplate = "Domain: %{x}
Count: %{y}" + ) %>% + layout( + xaxis = list(title = "Domain"), + yaxis = list(title = "Count"), + bargap = 0.2 + ) +``` + +### Including Static File Requests + +```{r} +data %>% + mutate( + referer_raw = `cs(Referer)`, + domain = ifelse( + is.na(referer_raw) | referer_raw == "-", + "None", + domain(referer_raw) + ) + ) %>% + group_by(domain) %>% + summarise(request_count = n(), .groups = "drop") %>% + arrange(desc(request_count)) %>% + plot_ly( + x = ~ reorder(domain, request_count), + y = ~request_count, + type = "bar", + marker = list(color = "lightblue"), + hovertemplate = "Domain: %{x}
Count: %{y}" + ) %>% + layout( + xaxis = list(title = "Domain"), + yaxis = list(title = "Count"), + bargap = 0.2 + ) +``` + + +--- + +::: + +## Cache Hit Rate over Time + +::: {.panel-tabset} + +### Excluding Static File Requests + +```{r} +data %>% + filter(uri_indicator == "Query") %>% + mutate( + result_type = as.character(`x-edge-response-result-type`), + is_hit = str_detect( + coalesce(result_type, ""), + regex("hit|redirect", ignore_case = TRUE) + ) + ) %>% + group_by(date) %>% + summarise( + count = n(), + cache_hit_pct = 100 * sum(is_hit, na.rm = TRUE) / count, + .groups = "drop" + ) %>% + arrange(date) %>% + plot_ly( + x = ~date, + y = ~cache_hit_pct, + type = "scatter", + mode = "lines+markers", + hovertemplate = "Date: %{x}
Cache hit: %{y:.1f}%" + ) %>% + layout( + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Cache hit %", ticksuffix = "%") + ) +``` + +### Including Static File Requests + +```{r} +data %>% + mutate( + result_type = as.character(`x-edge-response-result-type`), + is_hit = str_detect( + coalesce(result_type, ""), + regex("hit|redirect", ignore_case = TRUE) + ) + ) %>% + group_by(date) %>% + summarise( + count = n(), + cache_hit_pct = 100 * sum(is_hit, na.rm = TRUE) / count, + .groups = "drop" + ) %>% + arrange(date) %>% + plot_ly( + x = ~date, + y = ~cache_hit_pct, + type = "scatter", + mode = "lines+markers", + hovertemplate = "Date: %{x}
Cache hit: %{y:.1f}%" + ) %>% + layout( + xaxis = list( + title = "Date", + nticks = 10, + tickformat = "%b %d", + automargin = TRUE, + tickangle = 45 + ), + yaxis = list(title = "Cache hit %", ticksuffix = "%") + ) +``` + +::: + +## Request Times + +::: {.panel-tabset} + +### Time to First byte + +```{r} +data %>% + filter(uri_indicator != "Other") %>% + mutate( + time_to_first_byte_ms = as.numeric(`time-to-first-byte`) * 1000 + ) %>% + plot_ly( + x = ~time_to_first_byte_ms, + type = "histogram", + nbinsx = 50, + marker = list(color = "lightblue"), + hovertemplate = + "Time to first byte (ms):%{x}
Count: %{y}" + ) %>% + layout( + xaxis = list(title = "Time to First Byte (ms)"), + yaxis = list(title = "Count") + ) +``` + +### Time Taken + +```{r} +data %>% + filter(uri_indicator != "Other") %>% + mutate( + time_taken_ms = as.numeric(`time-taken`) * 1000 + ) %>% + plot_ly( + x = ~time_taken_ms, + type = "histogram", + nbinsx = 50, + marker = list(color = "lightblue"), + hovertemplate = "Time taken (ms): %{x}
Count: %{y}" + ) %>% + layout( + xaxis = list(title = "Time Taken (ms)"), + yaxis = list(title = "Count") + ) +``` + +::: diff --git a/reports/analytics/renv.lock b/reports/analytics/renv.lock new file mode 100644 index 00000000..7cf89ac5 --- /dev/null +++ b/reports/analytics/renv.lock @@ -0,0 +1,2050 @@ +{ + "R": { + "Version": "4.5.1", + "Repositories": [ + { + "Name": "CRAN", + "URL": "https://cloud.r-project.org" + } + ] + }, + "Packages": { + "DBI": { + "Package": "DBI", + "Version": "1.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "065ae649b05f1ff66bb0c793107508f5" + }, + "KernSmooth": { + "Package": "KernSmooth", + "Version": "2.23-26", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stats" + ], + "Hash": "2fb39782c07b5ad422b0448ae83f64c4" + }, + "MASS": { + "Package": "MASS", + "Version": "7.3-65", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics", + "methods", + "stats", + "utils" + ], + "Hash": "a41d0fc833ea756a1136b60a437efe26" + }, + "R6": { + "Package": "R6", + "Version": "2.6.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "d4335fe7207f1c01ab8c41762f5840d4" + }, + "RColorBrewer": { + "Package": "RColorBrewer", + "Version": "1.1-3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "45f0398006e83a5b10b72a90663d8d8c" + }, + "Rcpp": { + "Package": "Rcpp", + "Version": "1.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods", + "utils" + ], + "Hash": "0d3d8867aa41b0d9ad113b50c169ecb2" + }, + "S7": { + "Package": "S7", + "Version": "0.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "5deb66b3ae702137e1f4162c11861e76" + }, + "V8": { + "Package": "V8", + "Version": "8.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "Rcpp", + "curl", + "jsonlite", + "utils" + ], + "Hash": "f0301ca7b867eeb5c9b586a9e400729a" + }, + "arrow": { + "Package": "arrow", + "Version": "21.0.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "assertthat", + "bit64", + "cpp11", + "glue", + "methods", + "purrr", + "rlang", + "stats", + "tidyselect", + "utils", + "vctrs" + ], + "Hash": "ef54a31808517d2197e83dd57ca391e5" + }, + "askpass": { + "Package": "askpass", + "Version": "1.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "sys" + ], + "Hash": "c39f4155b3ceb1a9a2799d700fbd4b6a" + }, + "assertthat": { + "Package": "assertthat", + "Version": "0.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "tools" + ], + "Hash": "50c838a310445e954bc13f26f26a6ecf" + }, + "backports": { + "Package": "backports", + "Version": "1.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "e1e1b9d75c37401117b636b7ae50827a" + }, + "base64enc": { + "Package": "base64enc", + "Version": "0.1-3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "543776ae6848fde2f48ff3816d0628bc" + }, + "bit": { + "Package": "bit", + "Version": "4.6.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "ebe86ffd194564abdc895d87742d5a29" + }, + "bit64": { + "Package": "bit64", + "Version": "4.6.0-1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bit", + "graphics", + "methods", + "stats", + "utils" + ], + "Hash": "4f572fbc586294afff277db583b9060f" + }, + "blob": { + "Package": "blob", + "Version": "1.2.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods", + "rlang", + "vctrs" + ], + "Hash": "40415719b5a479b87949f3aa0aee737c" + }, + "broom": { + "Package": "broom", + "Version": "1.0.10", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "backports", + "cli", + "dplyr", + "generics", + "glue", + "lifecycle", + "purrr", + "rlang", + "stringr", + "tibble", + "tidyr" + ], + "Hash": "ef7ec50d4928be47aeae566ac32ea4d5" + }, + "bslib": { + "Package": "bslib", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "cachem", + "fastmap", + "grDevices", + "htmltools", + "jquerylib", + "jsonlite", + "lifecycle", + "memoise", + "mime", + "rlang", + "sass" + ], + "Hash": "70a6489cc254171fb9b4a7f130f44dca" + }, + "cachem": { + "Package": "cachem", + "Version": "1.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "fastmap", + "rlang" + ], + "Hash": "cd9a672193789068eb5a2aad65a0dedf" + }, + "callr": { + "Package": "callr", + "Version": "3.7.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "processx", + "utils" + ], + "Hash": "d7e13f49c19103ece9e58ad2d83a7354" + }, + "cellranger": { + "Package": "cellranger", + "Version": "1.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "rematch", + "tibble" + ], + "Hash": "f61dbaec772ccd2e17705c1e872e9e7c" + }, + "class": { + "Package": "class", + "Version": "7.3-23", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "MASS", + "R", + "stats", + "utils" + ], + "Hash": "d0cb9cc838c3b43560bd958fc4317fdc" + }, + "classInt": { + "Package": "classInt", + "Version": "0.4-11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "KernSmooth", + "R", + "class", + "e1071", + "grDevices", + "graphics", + "stats" + ], + "Hash": "f2af70314a63d7f025ae668f08bd933a" + }, + "cli": { + "Package": "cli", + "Version": "3.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "16850760556401a2eeb27d39bd11c9cb" + }, + "clipr": { + "Package": "clipr", + "Version": "0.8.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "3f038e5ac7f41d4ac41ce658c85e3042" + }, + "conflicted": { + "Package": "conflicted", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "memoise", + "rlang" + ], + "Hash": "bb097fccb22d156624fd07cd2894ddb6" + }, + "cpp11": { + "Package": "cpp11", + "Version": "0.5.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "2720e3fd3dad08f34b19b56b3d6f073d" + }, + "crayon": { + "Package": "crayon", + "Version": "1.5.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grDevices", + "methods", + "utils" + ], + "Hash": "859d96e65ef198fd43e82b9628d593ef" + }, + "crosstalk": { + "Package": "crosstalk", + "Version": "1.2.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R6", + "htmltools", + "jsonlite", + "lazyeval" + ], + "Hash": "8b008bc619e0bbebb5646b3d37efdad1" + }, + "curl": { + "Package": "curl", + "Version": "7.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "aa27e963d3deccf4bade44d06b976977" + }, + "data.table": { + "Package": "data.table", + "Version": "1.17.8", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "1d991cd6160fa7b1fdbd3689034cbd15" + }, + "dbplyr": { + "Package": "dbplyr", + "Version": "2.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "DBI", + "R", + "R6", + "blob", + "cli", + "dplyr", + "glue", + "lifecycle", + "magrittr", + "methods", + "pillar", + "purrr", + "rlang", + "tibble", + "tidyr", + "tidyselect", + "utils", + "vctrs", + "withr" + ], + "Hash": "e38d7151c767b00b919091be4686e274" + }, + "digest": { + "Package": "digest", + "Version": "0.6.37", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "33698c4b3127fc9f506654607fb73676" + }, + "dplyr": { + "Package": "dplyr", + "Version": "1.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "generics", + "glue", + "lifecycle", + "magrittr", + "methods", + "pillar", + "rlang", + "tibble", + "tidyselect", + "utils", + "vctrs" + ], + "Hash": "fedd9d00c2944ff00a0e2696ccf048ec" + }, + "dtplyr": { + "Package": "dtplyr", + "Version": "1.3.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "data.table", + "dplyr", + "glue", + "lifecycle", + "rlang", + "tibble", + "tidyselect", + "vctrs" + ], + "Hash": "50bbedd3d5b6a4ddc3c3c1602456aa35" + }, + "e1071": { + "Package": "e1071", + "Version": "1.7-16", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "class", + "grDevices", + "graphics", + "methods", + "proxy", + "stats", + "utils" + ], + "Hash": "27a09ca40266a1066d62ef5402dd51d6" + }, + "evaluate": { + "Package": "evaluate", + "Version": "1.0.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "94cf2c54237f6841cee68e3ba4ab5a14" + }, + "farver": { + "Package": "farver", + "Version": "2.1.2", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "680887028577f3fa2a81e410ed0d6e42" + }, + "fastmap": { + "Package": "fastmap", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8" + }, + "fontawesome": { + "Package": "fontawesome", + "Version": "0.5.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "htmltools", + "rlang" + ], + "Hash": "bd1297f9b5b1fc1372d19e2c4cd82215" + }, + "forcats": { + "Package": "forcats", + "Version": "1.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "magrittr", + "rlang", + "tibble" + ], + "Hash": "f884a14605c6a9eb01db676eee793ba7" + }, + "fs": { + "Package": "fs", + "Version": "1.6.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "7eb1e342eee7e0a7449c49cdaa526d39" + }, + "gargle": { + "Package": "gargle", + "Version": "1.6.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "fs", + "glue", + "httr", + "jsonlite", + "lifecycle", + "openssl", + "rappdirs", + "rlang", + "stats", + "utils", + "withr" + ], + "Hash": "77fecfba06c868a6bfe2f0d60b2b6b36" + }, + "generics": { + "Package": "generics", + "Version": "0.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "4b29bf698d0c7bdb9f1e4976e7ade41d" + }, + "ggplot2": { + "Package": "ggplot2", + "Version": "4.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "S7", + "cli", + "grDevices", + "grid", + "gtable", + "isoband", + "lifecycle", + "rlang", + "scales", + "stats", + "vctrs", + "withr" + ], + "Hash": "3b4625a157bcbd82b937fcb3acdd2d85" + }, + "glue": { + "Package": "glue", + "Version": "1.8.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "5899f1eaa825580172bb56c08266f37c" + }, + "googledrive": { + "Package": "googledrive", + "Version": "2.1.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "gargle", + "glue", + "httr", + "jsonlite", + "lifecycle", + "magrittr", + "pillar", + "purrr", + "rlang", + "tibble", + "utils", + "uuid", + "vctrs", + "withr" + ], + "Hash": "292be194aa519482c4b83f488a818ba3" + }, + "googlesheets4": { + "Package": "googlesheets4", + "Version": "1.1.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cellranger", + "cli", + "curl", + "gargle", + "glue", + "googledrive", + "httr", + "ids", + "lifecycle", + "magrittr", + "methods", + "purrr", + "rematch2", + "rlang", + "tibble", + "utils", + "vctrs", + "withr" + ], + "Hash": "376adbf359b416dbb30a76a2d2051ed5" + }, + "gtable": { + "Package": "gtable", + "Version": "0.3.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "grid", + "lifecycle", + "rlang", + "stats" + ], + "Hash": "de949855009e2d4d0e52a844e30617ae" + }, + "haven": { + "Package": "haven", + "Version": "2.5.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "cpp11", + "forcats", + "hms", + "lifecycle", + "methods", + "readr", + "rlang", + "tibble", + "tidyselect", + "vctrs" + ], + "Hash": "437bc7804f8ffdfcfed38d0aead6a9d7" + }, + "highr": { + "Package": "highr", + "Version": "0.11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "xfun" + ], + "Hash": "d65ba49117ca223614f71b60d85b8ab7" + }, + "hms": { + "Package": "hms", + "Version": "1.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "cli", + "lifecycle", + "methods", + "pkgconfig", + "rlang", + "vctrs" + ], + "Hash": "2799ac720626cec589478b191e48b88b" + }, + "htmltools": { + "Package": "htmltools", + "Version": "0.5.8.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "digest", + "fastmap", + "grDevices", + "rlang", + "utils" + ], + "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" + }, + "htmlwidgets": { + "Package": "htmlwidgets", + "Version": "1.6.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grDevices", + "htmltools", + "jsonlite", + "knitr", + "rmarkdown", + "yaml" + ], + "Hash": "04291cc45198225444a397606810ac37" + }, + "httr": { + "Package": "httr", + "Version": "1.4.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "curl", + "jsonlite", + "mime", + "openssl" + ], + "Hash": "ac107251d9d9fd72f0ca8049988f1d7f" + }, + "httr2": { + "Package": "httr2", + "Version": "1.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "curl", + "glue", + "lifecycle", + "magrittr", + "openssl", + "rappdirs", + "rlang", + "vctrs", + "withr" + ], + "Hash": "6e29f1ed132b927f7d52e9fd8869f0ea" + }, + "ids": { + "Package": "ids", + "Version": "1.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "openssl", + "uuid" + ], + "Hash": "99df65cfef20e525ed38c3d2577f7190" + }, + "isoband": { + "Package": "isoband", + "Version": "0.2.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grid", + "utils" + ], + "Hash": "0080607b4a1a7b28979aecef976d8bc2" + }, + "jquerylib": { + "Package": "jquerylib", + "Version": "0.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "htmltools" + ], + "Hash": "5aab57a3bd297eee1c1d862735972182" + }, + "jsonlite": { + "Package": "jsonlite", + "Version": "2.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods" + ], + "Hash": "b0776f526d36d8bd4a3344a88fe165c4" + }, + "knitr": { + "Package": "knitr", + "Version": "1.50", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "evaluate", + "highr", + "methods", + "tools", + "xfun", + "yaml" + ], + "Hash": "5a07d8ec459d7b80bd4acca5f4a6e062" + }, + "labeling": { + "Package": "labeling", + "Version": "0.4.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "graphics", + "stats" + ], + "Hash": "b64ec208ac5bc1852b285f665d6368b3" + }, + "later": { + "Package": "later", + "Version": "1.4.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "Rcpp", + "rlang" + ], + "Hash": "a729883bff94b606cd4f0445aeed95b5" + }, + "lattice": { + "Package": "lattice", + "Version": "0.22-5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics", + "grid", + "stats", + "utils" + ], + "Hash": "7c5e89f04e72d6611c77451f6331a091" + }, + "lazyeval": { + "Package": "lazyeval", + "Version": "0.2.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "d908914ae53b04d4c0c0fd72ecc35370" + }, + "leaflet": { + "Package": "leaflet", + "Version": "2.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "RColorBrewer", + "crosstalk", + "htmltools", + "htmlwidgets", + "jquerylib", + "leaflet.providers", + "magrittr", + "methods", + "png", + "raster", + "rlang", + "scales", + "sf", + "stats", + "viridisLite", + "xfun" + ], + "Hash": "da8aa03b2885c2b934923e6a53fe592a" + }, + "leaflet.providers": { + "Package": "leaflet.providers", + "Version": "2.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "htmltools" + ], + "Hash": "c0b81ad9d5d932772f7a457ac398cf36" + }, + "lifecycle": { + "Package": "lifecycle", + "Version": "1.0.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "rlang" + ], + "Hash": "b8552d117e1b808b09a832f589b79035" + }, + "lubridate": { + "Package": "lubridate", + "Version": "1.9.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "generics", + "methods", + "timechange" + ], + "Hash": "be38bc740fc51783a78edb5a157e4104" + }, + "magrittr": { + "Package": "magrittr", + "Version": "2.0.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "8b3b213aa0c54a0dec254288ccb545d1" + }, + "memoise": { + "Package": "memoise", + "Version": "2.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "cachem", + "rlang" + ], + "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c" + }, + "mime": { + "Package": "mime", + "Version": "0.13", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "tools" + ], + "Hash": "0ec19f34c72fab674d8f2b4b1c6410e1" + }, + "modelr": { + "Package": "modelr", + "Version": "0.1.11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "broom", + "magrittr", + "purrr", + "rlang", + "tibble", + "tidyr", + "tidyselect", + "vctrs" + ], + "Hash": "4f50122dc256b1b6996a4703fecea821" + }, + "noctua": { + "Package": "noctua", + "Version": "2.6.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "DBI", + "R", + "data.table", + "methods", + "paws", + "stats", + "utils", + "uuid" + ], + "Hash": "15471c0eaafcb7f2a4dabc983ea71112" + }, + "openssl": { + "Package": "openssl", + "Version": "2.3.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "askpass" + ], + "Hash": "d5811dade9cd3a34a9038a45f1a59bae" + }, + "paws": { + "Package": "paws", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.analytics", + "paws.application.integration", + "paws.common", + "paws.compute", + "paws.cost.management", + "paws.customer.engagement", + "paws.database", + "paws.developer.tools", + "paws.end.user.computing", + "paws.machine.learning", + "paws.management", + "paws.networking", + "paws.security.identity", + "paws.storage" + ], + "Hash": "694342c0b4f1a09ea666861bc140cd46" + }, + "paws.analytics": { + "Package": "paws.analytics", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "3213419b212594e3d5ba31b92522e493" + }, + "paws.application.integration": { + "Package": "paws.application.integration", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "b36a81f2be98e63b209ddebeeea51909" + }, + "paws.common": { + "Package": "paws.common", + "Version": "0.8.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp", + "base64enc", + "curl", + "digest", + "httr2", + "jsonlite", + "methods", + "stats", + "utils", + "xml2" + ], + "Hash": "988d9d011a6f6fe5063f0be358047ffb" + }, + "paws.compute": { + "Package": "paws.compute", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "b6f7689860e23aad2722a15790999bc9" + }, + "paws.cost.management": { + "Package": "paws.cost.management", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "cbf7124973cff04a96c5dc75d380ba2a" + }, + "paws.customer.engagement": { + "Package": "paws.customer.engagement", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "f6ffb43e3600734f4407fdb2624a2f8a" + }, + "paws.database": { + "Package": "paws.database", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "aeebf8b9c74940263f873492fd2206f3" + }, + "paws.developer.tools": { + "Package": "paws.developer.tools", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "162420e68b0d68235893e3a85255e08b" + }, + "paws.end.user.computing": { + "Package": "paws.end.user.computing", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "33c2424c8606acae8064af2dc1c2f017" + }, + "paws.machine.learning": { + "Package": "paws.machine.learning", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "925b45f2b6ee221271d8cf25f7a5f1f7" + }, + "paws.management": { + "Package": "paws.management", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "a4720ad47b2f3073370ec0c18de1cbf5" + }, + "paws.networking": { + "Package": "paws.networking", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "da9b0f0c9663cb049be40b4aaf1b9af6" + }, + "paws.security.identity": { + "Package": "paws.security.identity", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "8544aa9e403357d7af332d86126f0b85" + }, + "paws.storage": { + "Package": "paws.storage", + "Version": "0.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "paws.common" + ], + "Hash": "e6735db72fe328ce12c044c95cf325cb" + }, + "pillar": { + "Package": "pillar", + "Version": "1.11.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "cli", + "glue", + "lifecycle", + "rlang", + "utf8", + "utils", + "vctrs" + ], + "Hash": "1395e64f2689ffd503657778e810cee2" + }, + "pkgconfig": { + "Package": "pkgconfig", + "Version": "2.0.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "01f28d4278f15c76cddbea05899c5d6f" + }, + "plotly": { + "Package": "plotly", + "Version": "4.11.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "RColorBrewer", + "base64enc", + "crosstalk", + "data.table", + "digest", + "dplyr", + "ggplot2", + "htmltools", + "htmlwidgets", + "httr", + "jsonlite", + "lazyeval", + "magrittr", + "promises", + "purrr", + "rlang", + "scales", + "tibble", + "tidyr", + "tools", + "vctrs", + "viridisLite" + ], + "Hash": "51ccd0076867d9597cfba6771fee9080" + }, + "png": { + "Package": "png", + "Version": "0.1-8", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "bd54ba8a0a5faded999a7aab6e46b374" + }, + "prettyunits": { + "Package": "prettyunits", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7" + }, + "processx": { + "Package": "processx", + "Version": "3.8.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "ps", + "utils" + ], + "Hash": "720161b280b0a35f4d1490ead2fe81d0" + }, + "progress": { + "Package": "progress", + "Version": "1.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "crayon", + "hms", + "prettyunits" + ], + "Hash": "f4625e061cb2865f111b47ff163a5ca6" + }, + "promises": { + "Package": "promises", + "Version": "1.3.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R6", + "Rcpp", + "fastmap", + "later", + "magrittr", + "rlang", + "stats" + ], + "Hash": "70157a4a73963da5779f9c67f4d31fd1" + }, + "proxy": { + "Package": "proxy", + "Version": "0.4-27", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stats", + "utils" + ], + "Hash": "e0ef355c12942cf7a6b91a6cfaea8b3e" + }, + "ps": { + "Package": "ps", + "Version": "1.9.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "093688087b0bacce6ba2f661f36328e2" + }, + "purrr": { + "Package": "purrr", + "Version": "1.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "lifecycle", + "magrittr", + "rlang", + "vctrs" + ], + "Hash": "9240cfb47489133f809918a0d3cc60cb" + }, + "ragg": { + "Package": "ragg", + "Version": "1.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "systemfonts", + "textshaping" + ], + "Hash": "cdb40b21711a8870f305b24226698f9f" + }, + "rappdirs": { + "Package": "rappdirs", + "Version": "0.3.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "5e3c5dc0b071b21fa128676560dbe94d" + }, + "raster": { + "Package": "raster", + "Version": "3.6-32", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp", + "methods", + "sp", + "terra" + ], + "Hash": "1e193fc2c727a6f83cf95d9e16024423" + }, + "readr": { + "Package": "readr", + "Version": "2.1.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "clipr", + "cpp11", + "crayon", + "hms", + "lifecycle", + "methods", + "rlang", + "tibble", + "tzdb", + "utils", + "vroom" + ], + "Hash": "9de96463d2117f6ac49980577939dfb3" + }, + "readxl": { + "Package": "readxl", + "Version": "1.4.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cellranger", + "cpp11", + "progress", + "tibble", + "utils" + ], + "Hash": "18948de59f05d38a44d3e5065a76b4b6" + }, + "rematch": { + "Package": "rematch", + "Version": "2.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "cbff1b666c6fa6d21202f07e2318d4f1" + }, + "rematch2": { + "Package": "rematch2", + "Version": "2.1.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "tibble" + ], + "Hash": "76c9e04c712a05848ae7a23d2f170a40" + }, + "renv": { + "Package": "renv", + "Version": "1.0.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "397b7b2a265bc5a7a06852524dabae20" + }, + "reprex": { + "Package": "reprex", + "Version": "2.1.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "callr", + "cli", + "clipr", + "fs", + "glue", + "knitr", + "lifecycle", + "rlang", + "rmarkdown", + "rstudioapi", + "utils", + "withr" + ], + "Hash": "97b1d5361a24d9fb588db7afe3e5bcbf" + }, + "rlang": { + "Package": "rlang", + "Version": "1.1.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "892124978869b74935dc3934c42bfe5a" + }, + "rmarkdown": { + "Package": "rmarkdown", + "Version": "2.30", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bslib", + "evaluate", + "fontawesome", + "htmltools", + "jquerylib", + "jsonlite", + "knitr", + "methods", + "tinytex", + "tools", + "utils", + "xfun", + "yaml" + ], + "Hash": "efe19db0fde0fff13cea7eec6f695021" + }, + "rstudioapi": { + "Package": "rstudioapi", + "Version": "0.17.1", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "5f90cd73946d706cfe26024294236113" + }, + "rvest": { + "Package": "rvest", + "Version": "1.0.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "httr", + "lifecycle", + "magrittr", + "rlang", + "selectr", + "tibble", + "xml2" + ], + "Hash": "2804ddcd7737082306c559d919886546" + }, + "s2": { + "Package": "s2", + "Version": "1.1.9", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp", + "wk" + ], + "Hash": "4e664a5d610d58f27ec196e96cdb7f6f" + }, + "sass": { + "Package": "sass", + "Version": "0.4.10", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R6", + "fs", + "htmltools", + "rappdirs", + "rlang" + ], + "Hash": "3fb78d066fb92299b1d13f6a7c9a90a8" + }, + "scales": { + "Package": "scales", + "Version": "1.4.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "RColorBrewer", + "cli", + "farver", + "glue", + "labeling", + "lifecycle", + "rlang", + "viridisLite" + ], + "Hash": "c5bba8f0d1df8c4b9538a40570798d9b" + }, + "selectr": { + "Package": "selectr", + "Version": "0.4-2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "methods", + "stringr" + ], + "Hash": "3838071b66e0c566d55cc26bd6e27bf4" + }, + "sf": { + "Package": "sf", + "Version": "1.0-21", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "DBI", + "R", + "Rcpp", + "classInt", + "grDevices", + "graphics", + "grid", + "magrittr", + "methods", + "s2", + "stats", + "tools", + "units", + "utils" + ], + "Hash": "14a8dae2a678fa953907893a9df561c0" + }, + "sp": { + "Package": "sp", + "Version": "2.2-0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics", + "grid", + "lattice", + "methods", + "stats", + "utils" + ], + "Hash": "d9ff3b753db98bc50650314c8782abe6" + }, + "stringi": { + "Package": "stringi", + "Version": "1.8.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stats", + "tools", + "utils" + ], + "Hash": "2b56088e23bdd58f89aebf43a0913457" + }, + "stringr": { + "Package": "stringr", + "Version": "1.5.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "magrittr", + "rlang", + "stringi", + "vctrs" + ], + "Hash": "8f28c568a22dde52d2c8b11958776ac2" + }, + "sys": { + "Package": "sys", + "Version": "3.4.3", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "de342ebfebdbf40477d0758d05426646" + }, + "systemfonts": { + "Package": "systemfonts", + "Version": "1.3.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "cpp11", + "grid", + "jsonlite", + "lifecycle", + "tools", + "utils" + ], + "Hash": "4fae513a3bb1a155943d1e9d1ae467ec" + }, + "terra": { + "Package": "terra", + "Version": "1.8-70", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp", + "methods" + ], + "Hash": "366d90437eed64db1ada9722388d8a58" + }, + "textshaping": { + "Package": "textshaping", + "Version": "1.0.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11", + "lifecycle", + "stats", + "stringi", + "systemfonts", + "utils" + ], + "Hash": "477d70e23914730aa7f5c5fd351f4721" + }, + "tibble": { + "Package": "tibble", + "Version": "3.3.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "lifecycle", + "magrittr", + "methods", + "pillar", + "pkgconfig", + "rlang", + "utils", + "vctrs" + ], + "Hash": "784b27d0801c3829de602105757b2cd7" + }, + "tidyr": { + "Package": "tidyr", + "Version": "1.3.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "cpp11", + "dplyr", + "glue", + "lifecycle", + "magrittr", + "purrr", + "rlang", + "stringr", + "tibble", + "tidyselect", + "utils", + "vctrs" + ], + "Hash": "915fb7ce036c22a6a33b5a8adb712eb1" + }, + "tidyselect": { + "Package": "tidyselect", + "Version": "1.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "rlang", + "vctrs", + "withr" + ], + "Hash": "829f27b9c4919c16b593794a6344d6c0" + }, + "tidyverse": { + "Package": "tidyverse", + "Version": "2.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "broom", + "cli", + "conflicted", + "dbplyr", + "dplyr", + "dtplyr", + "forcats", + "ggplot2", + "googledrive", + "googlesheets4", + "haven", + "hms", + "httr", + "jsonlite", + "lubridate", + "magrittr", + "modelr", + "pillar", + "purrr", + "ragg", + "readr", + "readxl", + "reprex", + "rlang", + "rstudioapi", + "rvest", + "stringr", + "tibble", + "tidyr", + "xml2" + ], + "Hash": "c328568cd14ea89a83bd4ca7f54ae07e" + }, + "timechange": { + "Package": "timechange", + "Version": "0.3.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11" + ], + "Hash": "c5f3c201b931cd6474d17d8700ccb1c8" + }, + "tinytex": { + "Package": "tinytex", + "Version": "0.57", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "xfun" + ], + "Hash": "02d65e0c0415bf36a7ddc0d2ba50a840" + }, + "triebeard": { + "Package": "triebeard", + "Version": "0.4.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "Rcpp" + ], + "Hash": "642507a148b0dd9b5620177e0a044413" + }, + "tzdb": { + "Package": "tzdb", + "Version": "0.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11" + ], + "Hash": "09e3961e87b7bafa4a9340bbb34aeda8" + }, + "uaparserjs": { + "Package": "uaparserjs", + "Version": "0.3.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "V8", + "progress" + ], + "Hash": "9238ac9a41f8a21aa067f3aaff756c41" + }, + "units": { + "Package": "units", + "Version": "1.0-0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp" + ], + "Hash": "3797c73fd3bde8b1601a4e1bf53557ac" + }, + "urltools": { + "Package": "urltools", + "Version": "1.7.3.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp", + "methods", + "triebeard" + ], + "Hash": "0951eeef49e3df040dfc67ce75a052ac" + }, + "utf8": { + "Package": "utf8", + "Version": "1.2.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "d526d558be176e9ceb68c3d1e83479b7" + }, + "uuid": { + "Package": "uuid", + "Version": "1.2-1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "34e965e62a41fcafb1ca60e9b142085b" + }, + "vctrs": { + "Package": "vctrs", + "Version": "0.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "rlang" + ], + "Hash": "c03fa420630029418f7e6da3667aac4a" + }, + "viridisLite": { + "Package": "viridisLite", + "Version": "0.4.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "c826c7c4241b6fc89ff55aaea3fa7491" + }, + "vroom": { + "Package": "vroom", + "Version": "1.6.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bit64", + "cli", + "cpp11", + "crayon", + "glue", + "hms", + "lifecycle", + "methods", + "progress", + "rlang", + "stats", + "tibble", + "tidyselect", + "tzdb", + "vctrs", + "withr" + ], + "Hash": "a9d1c6bf67f15a0d07be840caeaab49a" + }, + "withr": { + "Package": "withr", + "Version": "3.0.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics" + ], + "Hash": "cc2d62c76458d425210d1eb1478b30b4" + }, + "wk": { + "Package": "wk", + "Version": "0.9.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "37be35d733130f1de1ef51672cf7cdc0" + }, + "xfun": { + "Package": "xfun", + "Version": "0.53", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "stats", + "tools" + ], + "Hash": "1befe97a0d56060b3964e3986d408df9" + }, + "xml2": { + "Package": "xml2", + "Version": "1.4.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "methods", + "rlang" + ], + "Hash": "3dfd9ffbe221af775cb37f95e7e893ec" + }, + "yaml": { + "Package": "yaml", + "Version": "2.3.10", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "51dab85c6c98e50a18d7551e9d49f76c" + } + } +} diff --git a/reports/analytics/renv/.gitignore b/reports/analytics/renv/.gitignore new file mode 100644 index 00000000..0ec0cbba --- /dev/null +++ b/reports/analytics/renv/.gitignore @@ -0,0 +1,7 @@ +library/ +local/ +cellar/ +lock/ +python/ +sandbox/ +staging/ diff --git a/reports/analytics/renv/activate.R b/reports/analytics/renv/activate.R new file mode 100644 index 00000000..d13f9932 --- /dev/null +++ b/reports/analytics/renv/activate.R @@ -0,0 +1,1220 @@ + +local({ + + # the requested version of renv + version <- "1.0.7" + attr(version, "sha") <- NULL + + # the project directory + project <- Sys.getenv("RENV_PROJECT") + if (!nzchar(project)) + project <- getwd() + + # use start-up diagnostics if enabled + diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") + if (diagnostics) { + start <- Sys.time() + profile <- tempfile("renv-startup-", fileext = ".Rprof") + utils::Rprof(profile) + on.exit({ + utils::Rprof(NULL) + elapsed <- signif(difftime(Sys.time(), start, units = "auto"), digits = 2L) + writeLines(sprintf("- renv took %s to run the autoloader.", format(elapsed))) + writeLines(sprintf("- Profile: %s", profile)) + print(utils::summaryRprof(profile)) + }, add = TRUE) + } + + # figure out whether the autoloader is enabled + enabled <- local({ + + # first, check config option + override <- getOption("renv.config.autoloader.enabled") + if (!is.null(override)) + return(override) + + # if we're being run in a context where R_LIBS is already set, + # don't load -- presumably we're being run as a sub-process and + # the parent process has already set up library paths for us + rcmd <- Sys.getenv("R_CMD", unset = NA) + rlibs <- Sys.getenv("R_LIBS", unset = NA) + if (!is.na(rlibs) && !is.na(rcmd)) + return(FALSE) + + # next, check environment variables + # TODO: prefer using the configuration one in the future + envvars <- c( + "RENV_CONFIG_AUTOLOADER_ENABLED", + "RENV_AUTOLOADER_ENABLED", + "RENV_ACTIVATE_PROJECT" + ) + + for (envvar in envvars) { + envval <- Sys.getenv(envvar, unset = NA) + if (!is.na(envval)) + return(tolower(envval) %in% c("true", "t", "1")) + } + + # enable by default + TRUE + + }) + + # bail if we're not enabled + if (!enabled) { + + # if we're not enabled, we might still need to manually load + # the user profile here + profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile") + if (file.exists(profile)) { + cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE") + if (tolower(cfg) %in% c("true", "t", "1")) + sys.source(profile, envir = globalenv()) + } + + return(FALSE) + + } + + # avoid recursion + if (identical(getOption("renv.autoloader.running"), TRUE)) { + warning("ignoring recursive attempt to run renv autoloader") + return(invisible(TRUE)) + } + + # signal that we're loading renv during R startup + options(renv.autoloader.running = TRUE) + on.exit(options(renv.autoloader.running = NULL), add = TRUE) + + # signal that we've consented to use renv + options(renv.consent = TRUE) + + # load the 'utils' package eagerly -- this ensures that renv shims, which + # mask 'utils' packages, will come first on the search path + library(utils, lib.loc = .Library) + + # unload renv if it's already been loaded + if ("renv" %in% loadedNamespaces()) + unloadNamespace("renv") + + # load bootstrap tools + `%||%` <- function(x, y) { + if (is.null(x)) y else x + } + + catf <- function(fmt, ..., appendLF = TRUE) { + + quiet <- getOption("renv.bootstrap.quiet", default = FALSE) + if (quiet) + return(invisible()) + + msg <- sprintf(fmt, ...) + cat(msg, file = stdout(), sep = if (appendLF) "\n" else "") + + invisible(msg) + + } + + header <- function(label, + ..., + prefix = "#", + suffix = "-", + n = min(getOption("width"), 78)) + { + label <- sprintf(label, ...) + n <- max(n - nchar(label) - nchar(prefix) - 2L, 8L) + if (n <= 0) + return(paste(prefix, label)) + + tail <- paste(rep.int(suffix, n), collapse = "") + paste0(prefix, " ", label, " ", tail) + + } + + heredoc <- function(text, leave = 0) { + + # remove leading, trailing whitespace + trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text) + + # split into lines + lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]] + + # compute common indent + indent <- regexpr("[^[:space:]]", lines) + common <- min(setdiff(indent, -1L)) - leave + paste(substring(lines, common), collapse = "\n") + + } + + startswith <- function(string, prefix) { + substring(string, 1, nchar(prefix)) == prefix + } + + bootstrap <- function(version, library) { + + friendly <- renv_bootstrap_version_friendly(version) + section <- header(sprintf("Bootstrapping renv %s", friendly)) + catf(section) + + # attempt to download renv + catf("- Downloading renv ... ", appendLF = FALSE) + withCallingHandlers( + tarball <- renv_bootstrap_download(version), + error = function(err) { + catf("FAILED") + stop("failed to download:\n", conditionMessage(err)) + } + ) + catf("OK") + on.exit(unlink(tarball), add = TRUE) + + # now attempt to install + catf("- Installing renv ... ", appendLF = FALSE) + withCallingHandlers( + status <- renv_bootstrap_install(version, tarball, library), + error = function(err) { + catf("FAILED") + stop("failed to install:\n", conditionMessage(err)) + } + ) + catf("OK") + + # add empty line to break up bootstrapping from normal output + catf("") + + return(invisible()) + } + + renv_bootstrap_tests_running <- function() { + getOption("renv.tests.running", default = FALSE) + } + + renv_bootstrap_repos <- function() { + + # get CRAN repository + cran <- getOption("renv.repos.cran", "https://cloud.r-project.org") + + # check for repos override + repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) + if (!is.na(repos)) { + + # check for RSPM; if set, use a fallback repository for renv + rspm <- Sys.getenv("RSPM", unset = NA) + if (identical(rspm, repos)) + repos <- c(RSPM = rspm, CRAN = cran) + + return(repos) + + } + + # check for lockfile repositories + repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity) + if (!inherits(repos, "error") && length(repos)) + return(repos) + + # retrieve current repos + repos <- getOption("repos") + + # ensure @CRAN@ entries are resolved + repos[repos == "@CRAN@"] <- cran + + # add in renv.bootstrap.repos if set + default <- c(FALLBACK = "https://cloud.r-project.org") + extra <- getOption("renv.bootstrap.repos", default = default) + repos <- c(repos, extra) + + # remove duplicates that might've snuck in + dupes <- duplicated(repos) | duplicated(names(repos)) + repos[!dupes] + + } + + renv_bootstrap_repos_lockfile <- function() { + + lockpath <- Sys.getenv("RENV_PATHS_LOCKFILE", unset = "renv.lock") + if (!file.exists(lockpath)) + return(NULL) + + lockfile <- tryCatch(renv_json_read(lockpath), error = identity) + if (inherits(lockfile, "error")) { + warning(lockfile) + return(NULL) + } + + repos <- lockfile$R$Repositories + if (length(repos) == 0) + return(NULL) + + keys <- vapply(repos, `[[`, "Name", FUN.VALUE = character(1)) + vals <- vapply(repos, `[[`, "URL", FUN.VALUE = character(1)) + names(vals) <- keys + + return(vals) + + } + + renv_bootstrap_download <- function(version) { + + sha <- attr(version, "sha", exact = TRUE) + + methods <- if (!is.null(sha)) { + + # attempting to bootstrap a development version of renv + c( + function() renv_bootstrap_download_tarball(sha), + function() renv_bootstrap_download_github(sha) + ) + + } else { + + # attempting to bootstrap a release version of renv + c( + function() renv_bootstrap_download_tarball(version), + function() renv_bootstrap_download_cran_latest(version), + function() renv_bootstrap_download_cran_archive(version) + ) + + } + + for (method in methods) { + path <- tryCatch(method(), error = identity) + if (is.character(path) && file.exists(path)) + return(path) + } + + stop("All download methods failed") + + } + + renv_bootstrap_download_impl <- function(url, destfile) { + + mode <- "wb" + + # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 + fixup <- + Sys.info()[["sysname"]] == "Windows" && + substring(url, 1L, 5L) == "file:" + + if (fixup) + mode <- "w+b" + + args <- list( + url = url, + destfile = destfile, + mode = mode, + quiet = TRUE + ) + + if ("headers" %in% names(formals(utils::download.file))) + args$headers <- renv_bootstrap_download_custom_headers(url) + + do.call(utils::download.file, args) + + } + + renv_bootstrap_download_custom_headers <- function(url) { + + headers <- getOption("renv.download.headers") + if (is.null(headers)) + return(character()) + + if (!is.function(headers)) + stopf("'renv.download.headers' is not a function") + + headers <- headers(url) + if (length(headers) == 0L) + return(character()) + + if (is.list(headers)) + headers <- unlist(headers, recursive = FALSE, use.names = TRUE) + + ok <- + is.character(headers) && + is.character(names(headers)) && + all(nzchar(names(headers))) + + if (!ok) + stop("invocation of 'renv.download.headers' did not return a named character vector") + + headers + + } + + renv_bootstrap_download_cran_latest <- function(version) { + + spec <- renv_bootstrap_download_cran_latest_find(version) + type <- spec$type + repos <- spec$repos + + baseurl <- utils::contrib.url(repos = repos, type = type) + ext <- if (identical(type, "source")) + ".tar.gz" + else if (Sys.info()[["sysname"]] == "Windows") + ".zip" + else + ".tgz" + name <- sprintf("renv_%s%s", version, ext) + url <- paste(baseurl, name, sep = "/") + + destfile <- file.path(tempdir(), name) + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (inherits(status, "condition")) + return(FALSE) + + # report success and return + destfile + + } + + renv_bootstrap_download_cran_latest_find <- function(version) { + + # check whether binaries are supported on this system + binary <- + getOption("renv.bootstrap.binary", default = TRUE) && + !identical(.Platform$pkgType, "source") && + !identical(getOption("pkgType"), "source") && + Sys.info()[["sysname"]] %in% c("Darwin", "Windows") + + types <- c(if (binary) "binary", "source") + + # iterate over types + repositories + for (type in types) { + for (repos in renv_bootstrap_repos()) { + + # retrieve package database + db <- tryCatch( + as.data.frame( + utils::available.packages(type = type, repos = repos), + stringsAsFactors = FALSE + ), + error = identity + ) + + if (inherits(db, "error")) + next + + # check for compatible entry + entry <- db[db$Package %in% "renv" & db$Version %in% version, ] + if (nrow(entry) == 0) + next + + # found it; return spec to caller + spec <- list(entry = entry, type = type, repos = repos) + return(spec) + + } + } + + # if we got here, we failed to find renv + fmt <- "renv %s is not available from your declared package repositories" + stop(sprintf(fmt, version)) + + } + + renv_bootstrap_download_cran_archive <- function(version) { + + name <- sprintf("renv_%s.tar.gz", version) + repos <- renv_bootstrap_repos() + urls <- file.path(repos, "src/contrib/Archive/renv", name) + destfile <- file.path(tempdir(), name) + + for (url in urls) { + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (identical(status, 0L)) + return(destfile) + + } + + return(FALSE) + + } + + renv_bootstrap_download_tarball <- function(version) { + + # if the user has provided the path to a tarball via + # an environment variable, then use it + tarball <- Sys.getenv("RENV_BOOTSTRAP_TARBALL", unset = NA) + if (is.na(tarball)) + return() + + # allow directories + if (dir.exists(tarball)) { + name <- sprintf("renv_%s.tar.gz", version) + tarball <- file.path(tarball, name) + } + + # bail if it doesn't exist + if (!file.exists(tarball)) { + + # let the user know we weren't able to honour their request + fmt <- "- RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." + msg <- sprintf(fmt, tarball) + warning(msg) + + # bail + return() + + } + + catf("- Using local tarball '%s'.", tarball) + tarball + + } + + renv_bootstrap_download_github <- function(version) { + + enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") + if (!identical(enabled, "TRUE")) + return(FALSE) + + # prepare download options + pat <- Sys.getenv("GITHUB_PAT") + if (nzchar(Sys.which("curl")) && nzchar(pat)) { + fmt <- "--location --fail --header \"Authorization: token %s\"" + extra <- sprintf(fmt, pat) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "curl", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } else if (nzchar(Sys.which("wget")) && nzchar(pat)) { + fmt <- "--header=\"Authorization: token %s\"" + extra <- sprintf(fmt, pat) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "wget", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } + + url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) + name <- sprintf("renv_%s.tar.gz", version) + destfile <- file.path(tempdir(), name) + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (!identical(status, 0L)) + return(FALSE) + + renv_bootstrap_download_augment(destfile) + + return(destfile) + + } + + # Add Sha to DESCRIPTION. This is stop gap until #890, after which we + # can use renv::install() to fully capture metadata. + renv_bootstrap_download_augment <- function(destfile) { + sha <- renv_bootstrap_git_extract_sha1_tar(destfile) + if (is.null(sha)) { + return() + } + + # Untar + tempdir <- tempfile("renv-github-") + on.exit(unlink(tempdir, recursive = TRUE), add = TRUE) + untar(destfile, exdir = tempdir) + pkgdir <- dir(tempdir, full.names = TRUE)[[1]] + + # Modify description + desc_path <- file.path(pkgdir, "DESCRIPTION") + desc_lines <- readLines(desc_path) + remotes_fields <- c( + "RemoteType: github", + "RemoteHost: api.github.com", + "RemoteRepo: renv", + "RemoteUsername: rstudio", + "RemotePkgRef: rstudio/renv", + paste("RemoteRef: ", sha), + paste("RemoteSha: ", sha) + ) + writeLines(c(desc_lines[desc_lines != ""], remotes_fields), con = desc_path) + + # Re-tar + local({ + old <- setwd(tempdir) + on.exit(setwd(old), add = TRUE) + + tar(destfile, compression = "gzip") + }) + invisible() + } + + # Extract the commit hash from a git archive. Git archives include the SHA1 + # hash as the comment field of the tarball pax extended header + # (see https://www.kernel.org/pub/software/scm/git/docs/git-archive.html) + # For GitHub archives this should be the first header after the default one + # (512 byte) header. + renv_bootstrap_git_extract_sha1_tar <- function(bundle) { + + # open the bundle for reading + # We use gzcon for everything because (from ?gzcon) + # > Reading from a connection which does not supply a 'gzip' magic + # > header is equivalent to reading from the original connection + conn <- gzcon(file(bundle, open = "rb", raw = TRUE)) + on.exit(close(conn)) + + # The default pax header is 512 bytes long and the first pax extended header + # with the comment should be 51 bytes long + # `52 comment=` (11 chars) + 40 byte SHA1 hash + len <- 0x200 + 0x33 + res <- rawToChar(readBin(conn, "raw", n = len)[0x201:len]) + + if (grepl("^52 comment=", res)) { + sub("52 comment=", "", res) + } else { + NULL + } + } + + renv_bootstrap_install <- function(version, tarball, library) { + + # attempt to install it into project library + dir.create(library, showWarnings = FALSE, recursive = TRUE) + output <- renv_bootstrap_install_impl(library, tarball) + + # check for successful install + status <- attr(output, "status") + if (is.null(status) || identical(status, 0L)) + return(status) + + # an error occurred; report it + header <- "installation of renv failed" + lines <- paste(rep.int("=", nchar(header)), collapse = "") + text <- paste(c(header, lines, output), collapse = "\n") + stop(text) + + } + + renv_bootstrap_install_impl <- function(library, tarball) { + + # invoke using system2 so we can capture and report output + bin <- R.home("bin") + exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" + R <- file.path(bin, exe) + + args <- c( + "--vanilla", "CMD", "INSTALL", "--no-multiarch", + "-l", shQuote(path.expand(library)), + shQuote(path.expand(tarball)) + ) + + system2(R, args, stdout = TRUE, stderr = TRUE) + + } + + renv_bootstrap_platform_prefix <- function() { + + # construct version prefix + version <- paste(R.version$major, R.version$minor, sep = ".") + prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-") + + # include SVN revision for development versions of R + # (to avoid sharing platform-specific artefacts with released versions of R) + devel <- + identical(R.version[["status"]], "Under development (unstable)") || + identical(R.version[["nickname"]], "Unsuffered Consequences") + + if (devel) + prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r") + + # build list of path components + components <- c(prefix, R.version$platform) + + # include prefix if provided by user + prefix <- renv_bootstrap_platform_prefix_impl() + if (!is.na(prefix) && nzchar(prefix)) + components <- c(prefix, components) + + # build prefix + paste(components, collapse = "/") + + } + + renv_bootstrap_platform_prefix_impl <- function() { + + # if an explicit prefix has been supplied, use it + prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA) + if (!is.na(prefix)) + return(prefix) + + # if the user has requested an automatic prefix, generate it + auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) + if (is.na(auto) && getRversion() >= "4.4.0") + auto <- "TRUE" + + if (auto %in% c("TRUE", "True", "true", "1")) + return(renv_bootstrap_platform_prefix_auto()) + + # empty string on failure + "" + + } + + renv_bootstrap_platform_prefix_auto <- function() { + + prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity) + if (inherits(prefix, "error") || prefix %in% "unknown") { + + msg <- paste( + "failed to infer current operating system", + "please file a bug report at https://github.com/rstudio/renv/issues", + sep = "; " + ) + + warning(msg) + + } + + prefix + + } + + renv_bootstrap_platform_os <- function() { + + sysinfo <- Sys.info() + sysname <- sysinfo[["sysname"]] + + # handle Windows + macOS up front + if (sysname == "Windows") + return("windows") + else if (sysname == "Darwin") + return("macos") + + # check for os-release files + for (file in c("/etc/os-release", "/usr/lib/os-release")) + if (file.exists(file)) + return(renv_bootstrap_platform_os_via_os_release(file, sysinfo)) + + # check for redhat-release files + if (file.exists("/etc/redhat-release")) + return(renv_bootstrap_platform_os_via_redhat_release()) + + "unknown" + + } + + renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) { + + # read /etc/os-release + release <- utils::read.table( + file = file, + sep = "=", + quote = c("\"", "'"), + col.names = c("Key", "Value"), + comment.char = "#", + stringsAsFactors = FALSE + ) + + vars <- as.list(release$Value) + names(vars) <- release$Key + + # get os name + os <- tolower(sysinfo[["sysname"]]) + + # read id + id <- "unknown" + for (field in c("ID", "ID_LIKE")) { + if (field %in% names(vars) && nzchar(vars[[field]])) { + id <- vars[[field]] + break + } + } + + # read version + version <- "unknown" + for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) { + if (field %in% names(vars) && nzchar(vars[[field]])) { + version <- vars[[field]] + break + } + } + + # join together + paste(c(os, id, version), collapse = "-") + + } + + renv_bootstrap_platform_os_via_redhat_release <- function() { + + # read /etc/redhat-release + contents <- readLines("/etc/redhat-release", warn = FALSE) + + # infer id + id <- if (grepl("centos", contents, ignore.case = TRUE)) + "centos" + else if (grepl("redhat", contents, ignore.case = TRUE)) + "redhat" + else + "unknown" + + # try to find a version component (very hacky) + version <- "unknown" + + parts <- strsplit(contents, "[[:space:]]")[[1L]] + for (part in parts) { + + nv <- tryCatch(numeric_version(part), error = identity) + if (inherits(nv, "error")) + next + + version <- nv[1, 1] + break + + } + + paste(c("linux", id, version), collapse = "-") + + } + + renv_bootstrap_library_root_name <- function(project) { + + # use project name as-is if requested + asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE") + if (asis) + return(basename(project)) + + # otherwise, disambiguate based on project's path + id <- substring(renv_bootstrap_hash_text(project), 1L, 8L) + paste(basename(project), id, sep = "-") + + } + + renv_bootstrap_library_root <- function(project) { + + prefix <- renv_bootstrap_profile_prefix() + + path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) + if (!is.na(path)) + return(paste(c(path, prefix), collapse = "/")) + + path <- renv_bootstrap_library_root_impl(project) + if (!is.null(path)) { + name <- renv_bootstrap_library_root_name(project) + return(paste(c(path, prefix, name), collapse = "/")) + } + + renv_bootstrap_paths_renv("library", project = project) + + } + + renv_bootstrap_library_root_impl <- function(project) { + + root <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) + if (!is.na(root)) + return(root) + + type <- renv_bootstrap_project_type(project) + if (identical(type, "package")) { + userdir <- renv_bootstrap_user_dir() + return(file.path(userdir, "library")) + } + + } + + renv_bootstrap_validate_version <- function(version, description = NULL) { + + # resolve description file + # + # avoid passing lib.loc to `packageDescription()` below, since R will + # use the loaded version of the package by default anyhow. note that + # this function should only be called after 'renv' is loaded + # https://github.com/rstudio/renv/issues/1625 + description <- description %||% packageDescription("renv") + + # check whether requested version 'version' matches loaded version of renv + sha <- attr(version, "sha", exact = TRUE) + valid <- if (!is.null(sha)) + renv_bootstrap_validate_version_dev(sha, description) + else + renv_bootstrap_validate_version_release(version, description) + + if (valid) + return(TRUE) + + # the loaded version of renv doesn't match the requested version; + # give the user instructions on how to proceed + dev <- identical(description[["RemoteType"]], "github") + remote <- if (dev) + paste("rstudio/renv", description[["RemoteSha"]], sep = "@") + else + paste("renv", description[["Version"]], sep = "@") + + # display both loaded version + sha if available + friendly <- renv_bootstrap_version_friendly( + version = description[["Version"]], + sha = if (dev) description[["RemoteSha"]] + ) + + fmt <- heredoc(" + renv %1$s was loaded from project library, but this project is configured to use renv %2$s. + - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile. + - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library. + ") + catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote) + + FALSE + + } + + renv_bootstrap_validate_version_dev <- function(version, description) { + expected <- description[["RemoteSha"]] + is.character(expected) && startswith(expected, version) + } + + renv_bootstrap_validate_version_release <- function(version, description) { + expected <- description[["Version"]] + is.character(expected) && identical(expected, version) + } + + renv_bootstrap_hash_text <- function(text) { + + hashfile <- tempfile("renv-hash-") + on.exit(unlink(hashfile), add = TRUE) + + writeLines(text, con = hashfile) + tools::md5sum(hashfile) + + } + + renv_bootstrap_load <- function(project, libpath, version) { + + # try to load renv from the project library + if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) + return(FALSE) + + # warn if the version of renv loaded does not match + renv_bootstrap_validate_version(version) + + # execute renv load hooks, if any + hooks <- getHook("renv::autoload") + for (hook in hooks) + if (is.function(hook)) + tryCatch(hook(), error = warnify) + + # load the project + renv::load(project) + + TRUE + + } + + renv_bootstrap_profile_load <- function(project) { + + # if RENV_PROFILE is already set, just use that + profile <- Sys.getenv("RENV_PROFILE", unset = NA) + if (!is.na(profile) && nzchar(profile)) + return(profile) + + # check for a profile file (nothing to do if it doesn't exist) + path <- renv_bootstrap_paths_renv("profile", profile = FALSE, project = project) + if (!file.exists(path)) + return(NULL) + + # read the profile, and set it if it exists + contents <- readLines(path, warn = FALSE) + if (length(contents) == 0L) + return(NULL) + + # set RENV_PROFILE + profile <- contents[[1L]] + if (!profile %in% c("", "default")) + Sys.setenv(RENV_PROFILE = profile) + + profile + + } + + renv_bootstrap_profile_prefix <- function() { + profile <- renv_bootstrap_profile_get() + if (!is.null(profile)) + return(file.path("profiles", profile, "renv")) + } + + renv_bootstrap_profile_get <- function() { + profile <- Sys.getenv("RENV_PROFILE", unset = "") + renv_bootstrap_profile_normalize(profile) + } + + renv_bootstrap_profile_set <- function(profile) { + profile <- renv_bootstrap_profile_normalize(profile) + if (is.null(profile)) + Sys.unsetenv("RENV_PROFILE") + else + Sys.setenv(RENV_PROFILE = profile) + } + + renv_bootstrap_profile_normalize <- function(profile) { + + if (is.null(profile) || profile %in% c("", "default")) + return(NULL) + + profile + + } + + renv_bootstrap_path_absolute <- function(path) { + + substr(path, 1L, 1L) %in% c("~", "/", "\\") || ( + substr(path, 1L, 1L) %in% c(letters, LETTERS) && + substr(path, 2L, 3L) %in% c(":/", ":\\") + ) + + } + + renv_bootstrap_paths_renv <- function(..., profile = TRUE, project = NULL) { + renv <- Sys.getenv("RENV_PATHS_RENV", unset = "renv") + root <- if (renv_bootstrap_path_absolute(renv)) NULL else project + prefix <- if (profile) renv_bootstrap_profile_prefix() + components <- c(root, renv, prefix, ...) + paste(components, collapse = "/") + } + + renv_bootstrap_project_type <- function(path) { + + descpath <- file.path(path, "DESCRIPTION") + if (!file.exists(descpath)) + return("unknown") + + desc <- tryCatch( + read.dcf(descpath, all = TRUE), + error = identity + ) + + if (inherits(desc, "error")) + return("unknown") + + type <- desc$Type + if (!is.null(type)) + return(tolower(type)) + + package <- desc$Package + if (!is.null(package)) + return("package") + + "unknown" + + } + + renv_bootstrap_user_dir <- function() { + dir <- renv_bootstrap_user_dir_impl() + path.expand(chartr("\\", "/", dir)) + } + + renv_bootstrap_user_dir_impl <- function() { + + # use local override if set + override <- getOption("renv.userdir.override") + if (!is.null(override)) + return(override) + + # use R_user_dir if available + tools <- asNamespace("tools") + if (is.function(tools$R_user_dir)) + return(tools$R_user_dir("renv", "cache")) + + # try using our own backfill for older versions of R + envvars <- c("R_USER_CACHE_DIR", "XDG_CACHE_HOME") + for (envvar in envvars) { + root <- Sys.getenv(envvar, unset = NA) + if (!is.na(root)) + return(file.path(root, "R/renv")) + } + + # use platform-specific default fallbacks + if (Sys.info()[["sysname"]] == "Windows") + file.path(Sys.getenv("LOCALAPPDATA"), "R/cache/R/renv") + else if (Sys.info()[["sysname"]] == "Darwin") + "~/Library/Caches/org.R-project.R/R/renv" + else + "~/.cache/R/renv" + + } + + renv_bootstrap_version_friendly <- function(version, shafmt = NULL, sha = NULL) { + sha <- sha %||% attr(version, "sha", exact = TRUE) + parts <- c(version, sprintf(shafmt %||% " [sha: %s]", substring(sha, 1L, 7L))) + paste(parts, collapse = "") + } + + renv_bootstrap_exec <- function(project, libpath, version) { + if (!renv_bootstrap_load(project, libpath, version)) + renv_bootstrap_run(version, libpath) + } + + renv_bootstrap_run <- function(version, libpath) { + + # perform bootstrap + bootstrap(version, libpath) + + # exit early if we're just testing bootstrap + if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) + return(TRUE) + + # try again to load + if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { + return(renv::load(project = getwd())) + } + + # failed to download or load renv; warn the user + msg <- c( + "Failed to find an renv installation: the project will not be loaded.", + "Use `renv::activate()` to re-initialize the project." + ) + + warning(paste(msg, collapse = "\n"), call. = FALSE) + + } + + renv_json_read <- function(file = NULL, text = NULL) { + + jlerr <- NULL + + # if jsonlite is loaded, use that instead + if ("jsonlite" %in% loadedNamespaces()) { + + json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity) + if (!inherits(json, "error")) + return(json) + + jlerr <- json + + } + + # otherwise, fall back to the default JSON reader + json <- tryCatch(renv_json_read_default(file, text), error = identity) + if (!inherits(json, "error")) + return(json) + + # report an error + if (!is.null(jlerr)) + stop(jlerr) + else + stop(json) + + } + + renv_json_read_jsonlite <- function(file = NULL, text = NULL) { + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") + jsonlite::fromJSON(txt = text, simplifyVector = FALSE) + } + + renv_json_read_default <- function(file = NULL, text = NULL) { + + # find strings in the JSON + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") + pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + locs <- gregexpr(pattern, text, perl = TRUE)[[1]] + + # if any are found, replace them with placeholders + replaced <- text + strings <- character() + replacements <- character() + + if (!identical(c(locs), -1L)) { + + # get the string values + starts <- locs + ends <- locs + attr(locs, "match.length") - 1L + strings <- substring(text, starts, ends) + + # only keep those requiring escaping + strings <- grep("[[\\]{}:]", strings, perl = TRUE, value = TRUE) + + # compute replacements + replacements <- sprintf('"\032%i\032"', seq_along(strings)) + + # replace the strings + mapply(function(string, replacement) { + replaced <<- sub(string, replacement, replaced, fixed = TRUE) + }, strings, replacements) + + } + + # transform the JSON into something the R parser understands + transformed <- replaced + transformed <- gsub("{}", "`names<-`(list(), character())", transformed, fixed = TRUE) + transformed <- gsub("[[{]", "list(", transformed, perl = TRUE) + transformed <- gsub("[]}]", ")", transformed, perl = TRUE) + transformed <- gsub(":", "=", transformed, fixed = TRUE) + text <- paste(transformed, collapse = "\n") + + # parse it + json <- parse(text = text, keep.source = FALSE, srcfile = NULL)[[1L]] + + # construct map between source strings, replaced strings + map <- as.character(parse(text = strings)) + names(map) <- as.character(parse(text = replacements)) + + # convert to list + map <- as.list(map) + + # remap strings in object + remapped <- renv_json_read_remap(json, map) + + # evaluate + eval(remapped, envir = baseenv()) + + } + + renv_json_read_remap <- function(json, map) { + + # fix names + if (!is.null(names(json))) { + lhs <- match(names(json), names(map), nomatch = 0L) + rhs <- match(names(map), names(json), nomatch = 0L) + names(json)[rhs] <- map[lhs] + } + + # fix values + if (is.character(json)) + return(map[[json]] %||% json) + + # handle true, false, null + if (is.name(json)) { + text <- as.character(json) + if (text == "true") + return(TRUE) + else if (text == "false") + return(FALSE) + else if (text == "null") + return(NULL) + } + + # recurse + if (is.recursive(json)) { + for (i in seq_along(json)) { + json[i] <- list(renv_json_read_remap(json[[i]], map)) + } + } + + json + + } + + # load the renv profile, if any + renv_bootstrap_profile_load(project) + + # construct path to library root + root <- renv_bootstrap_library_root(project) + + # construct library prefix for platform + prefix <- renv_bootstrap_platform_prefix() + + # construct full libpath + libpath <- file.path(root, prefix) + + # run bootstrap code + renv_bootstrap_exec(project, libpath, version) + + invisible() + +}) diff --git a/reports/analytics/renv/settings.json b/reports/analytics/renv/settings.json new file mode 100644 index 00000000..ffdbb320 --- /dev/null +++ b/reports/analytics/renv/settings.json @@ -0,0 +1,19 @@ +{ + "bioconductor.version": null, + "external.libraries": [], + "ignored.packages": [], + "package.dependency.fields": [ + "Imports", + "Depends", + "LinkingTo" + ], + "ppm.enabled": null, + "ppm.ignored.urls": [], + "r.version": null, + "snapshot.type": "implicit", + "use.cache": true, + "vcs.ignore.cellar": true, + "vcs.ignore.library": true, + "vcs.ignore.local": true, + "vcs.manage.ignores": true +} diff --git a/reports/pin-comparison/pin_comparison.qmd b/reports/pin-comparison/pin_comparison.qmd index 063a4198..4f72343b 100644 --- a/reports/pin-comparison/pin_comparison.qmd +++ b/reports/pin-comparison/pin_comparison.qmd @@ -152,22 +152,31 @@ if (all(map_lgl(cache_files, file.exists))) { by = "meta_pin" ) - if (year >= 2025 && - nrow(pin_labels %>% - filter(total_cards <= 3 & !is.na(primary_card))) > 0) { + if ( + year >= 2025 && + pin_labels %>% + filter(total_cards <= 3 & !is.na(primary_card)) %>% + nrow() > 0 + ) { stop("Error: For PINs with <= 3 cards and 2025 or later, the `pin_{x}_card_num` param must be empty.") } - if (year <= 2024 && - nrow(pin_labels %>% - filter(total_cards %in% c(2, 3) & is.na(primary_card))) > 0) { + if ( + year <= 2024 && + pin_labels %>% + filter(total_cards %in% c(2, 3) & is.na(primary_card)) %>% + nrow() > 0 + ) { stop("Error: For PINs with 2-3 cards and 2024 or before, the `pin_{x}_card_num` param must have a value.") } - if (nrow(pin_labels %>% - filter(total_cards >= 4 & is.na(primary_card))) > 0) { + if ( + pin_labels %>% + filter(total_cards >= 4 & is.na(primary_card)) %>% + nrow() > 0 + ) { stop("Error: For PINs with >= 4 cards, the `pin_{x}_card_num` param must have a value.") }