diff --git a/R/add-to-calendar.R b/R/add-to-calendar.R deleted file mode 100644 index 0c5162e..0000000 --- a/R/add-to-calendar.R +++ /dev/null @@ -1,47 +0,0 @@ -source(here::here("R/functions.R")) -# library(assertr) -library(tidyverse) -library(lubridate) -library(calendar) -library(glue) - -stop("This prevents accidentally sourcing the whole script.") - -meeting_dates <- tribble( - ~month, ~day, - "January", 9, - "February", 6, - "March", 6, - "March", 24, - "May", 1, - "June", 5, - "September", 4, - "October", 9, - "November", 6, - "December", 4 -) %>% - mutate( - year = "2023", - date = ymd(glue("{year}-{month}-{day}"), tz = "Europe/Copenhagen"), - start_time = "13:00", - end_time = "15:00" - ) - -upcoming_meetings <- meeting_dates %>% - transmute( - UID = map_chr(1:n(), ~ ic_guid()), - DTSTART = ymd_hm(glue("{date} {start_time}"), tz = "Europe/Copenhagen"), - DTEND = ymd_hm(glue("{date} {end_time}"), tz = "Europe/Copenhagen"), - # To show up as the event description - DESCRIPTION = "Details about the meeting are found on the Trello board: https://trello.com/b/ipcYGXhC/epidemiology-group", - # To show up as the event title - SUMMARY = "Steno Aarhus Epidemiology Group Monthly Meeting" - ) - -public_calendar_link <- "https://calendar.google.com/calendar/ical/086okoggkv7c4b0dcbbrj230s8%40group.calendar.google.com/public/basic.ics" -current_calendar <- read_ical(public_calendar_link) %>% - select(DTSTART, DTEND, SUMMARY) - -new_calendar_data <- anti_join(upcoming_meetings, current_calendar) - -ic_write(ical(new_calendar_data), here::here("R/calendar.ics")) diff --git a/R/add-trello-cards.R b/R/add-trello-cards.R deleted file mode 100644 index 0287d0a..0000000 --- a/R/add-trello-cards.R +++ /dev/null @@ -1,62 +0,0 @@ -source(here::here("R/functions.R")) -# Comments will be added over time. -library(tidyverse) -library(lubridate) -library(calendar) -library(trelloR) -library(askpass) - -stop("This prevents accidentally sourcing the whole script.") - -# Details about getting Key and OAuth Secret found here: -# https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/ -trello_key <- askpass("Trello Key.") -trello_oauth_secret <- askpass("Trello OAuth Secret.") - -token <- get_token( - "steno-epi-board", - key = trello_key, - secret = trello_oauth_secret, - scope = c("read", "write"), - expiration = "1day", - cache = FALSE -) - -board_url <- "https://trello.com/b/ipcYGXhC/epidemiology-group" -upcoming_board_id <- get_board_lists(board_url, token = token) %>% - filter(str_detect(name, "Upcoming")) %>% - pull(id) - -public_calendar_link <- "https://calendar.google.com/calendar/ical/086okoggkv7c4b0dcbbrj230s8%40group.calendar.google.com/public/basic.ics" -upcoming_meetings <- read_ical(public_calendar_link) - -meetings_to_add <- upcoming_meetings %>% - transmute(year = year(DTSTART), - date = as.character(as_date(DTSTART))) %>% - filter(year == "2023") - -meeting_label <- get_board_labels(board_url, token = token) %>% - filter(name == "Meeting") %>% - pull(id) - -zoom_link <- askpass("Add Zoom link.") -zoom_passcode <- askpass("Add Zoom passcode.") -template_card_desc <- read_lines(here::here("R/card-template.md")) %>% - whisker::whisker.render(data = list( - passcode = zoom_passcode, - link = zoom_link - )) - -meetings_to_add$date %>% - walk( - ~ add_card( - upcoming_board_id, - body = list( - name = .x, - desc = template_card_desc, - pos = "bottom", - idLabels = array(meeting_label) - ), - token = token - ) - ) diff --git a/R/card-template.md b/R/card-template.md deleted file mode 100644 index 593bb2e..0000000 --- a/R/card-template.md +++ /dev/null @@ -1,28 +0,0 @@ -**Don't add yourself to the card unless you are the chair or notetaker.** - -## General information - -- See our [Steno Epi group website](https://steno-aarhus.github.io/epi) for more details, like [how-to docs](https://steno-aarhus.github.io/epi/how-to.html) and [description of roles](https://steno-aarhus.github.io/epi/roles.html) -- [SDCA Common Docs website](https://steno-aarhus.github.io/research/) for general practices, onboarding, help, etc. -- Newcomer? [Read this section.](https://steno-aarhus.github.io/epi/newcomers.html) - -## Meeting details - -- **Location/Zoom:** Skillerum 1+2 (A201-255+A201-257). Physical attendance is encouraged but not required. Recurring Zoom link: {{link}} (passcode: {{passcode}}). -- **Time:** 13:00-15:00 - -## Agenda - -- Updates on any actions items from previous meeting -- Management updates from Daniel: TOPIC -- (~30 min) 3-4 lightning talks (~5-10 min) by: - - NAME: *TITLE* - - NAME: *TITLE* - - NAME: *TITLE* - - NAME: *TITLE* -- (30 min) Presentation by NAME: *TITLE* -- (45-60 min) Paper discussion and review - -## Minutes - -- NOTES diff --git a/R/functions.R b/R/functions.R deleted file mode 100644 index d6ac458..0000000 --- a/R/functions.R +++ /dev/null @@ -1,17 +0,0 @@ -read_ical <- function(ics) { - read_lines(ics) %>% - # annoyingly have to do this processing because calendar::ic_read() doesn't work well - str_c(collapse = "\n\n") %>% - str_replace_all("\n ", " ") %>% - str_split("\n\n") %>% - unlist() %>% - ic_list() %>% - map_dfr(ic_vector) %>% - mutate(across(matches("VALUE=DATE"), as_date)) %>% - mutate(across(matches("^(DTSTART|DTEND)$"), as_datetime)) %>% - mutate( - DTSTART = with_tz(ymd_hms(DTSTART), "Europe/Copenhagen"), - DTEND = with_tz(ymd_hms(DTEND), "Europe/Copenhagen") - ) %>% - arrange(DTSTART) -} diff --git a/R/update-trello-cards.R b/R/update-trello-cards.R deleted file mode 100644 index 2ed0783..0000000 --- a/R/update-trello-cards.R +++ /dev/null @@ -1,58 +0,0 @@ -# Comments will be added over time. -library(tidyverse) -library(trelloR) -library(askpass) - -stop("This prevents accidentally sourcing the whole script.") - -# Details about getting Key and OAuth Secret found here: -# https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/ -trello_key <- askpass("Trello Key.") -trello_oauth_secret <- askpass("Trello OAuth Secret.") - -token <- get_token( - "steno-epi-board", - key = trello_key, - secret = trello_oauth_secret, - scope = c("read", "write"), - expiration = "1day", - cache = FALSE -) - -board_url <- "https://trello.com/b/ipcYGXhC/epidemiology-group" -upcoming_board_id <- get_board_lists(board_url, token = token) %>% - filter(str_detect(name, "Upcoming")) %>% - pull(id) - -upcoming_board_cards <- get_board_cards(board_url, token = token) %>% - filter(idList == upcoming_board_id) - -zoom_link <- askpass("Add Zoom link.") -zoom_passcode <- askpass("Add Zoom passcode.") -template_card <- read_lines(here::here("R/card-template.md")) %>% - whisker::whisker.render(data = list( - passcode = zoom_passcode, - link = zoom_link - )) %>% - str_c(collapse = "\n") - -# Use to check if there are any new additions before updating. -# Just in case you accidentally delete/overwrite something. -# Modify the code below to fit the purposes of the update. -old_content <- upcoming_board_cards -# pull(old_content, desc) - -walk( - upcoming_board_cards$id[-1], - ~ update_resource( - "card", - id = .x, - body = list(id = .x, - desc = template_card), - token = token - ) -) - -upcoming_board_cards %>% - pull(id) %>% - map(delete_card, token = token) diff --git a/roles.Rmd b/roles.Rmd index acc7082..95805ad 100644 --- a/roles.Rmd +++ b/roles.Rmd @@ -43,7 +43,7 @@ date: "`r Sys.Date()`" ### Using R scripts for admin -* Scripts to add meetings to the calendar and to Trello are found here: https://github.com/steno-aarhus/admin/R +* Scripts to add meetings to the calendar and to Trello are found in the `{sdcar}` package: https://github.com/steno-aarhus/sdcar ### Using Google Drive