knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(message = FALSE)
knitr::opts_chunk$set(warning = FALSE)

library(dplyr)
library(tidyr)
library(tibble)
library(ggplot2)
library(readr)
library(stringr)

lvls <- tibble(level_num = c(0, 1, 2, 3), level = c("beginner", "user", "advanced", "expert"))
# theme and palette
theme_set(correltools::theme_correlaid(base_size = 12))
correlpal <- correltools::correlaid_pal()
appl <- readr::read_csv(params$anon_path, col_types = cols())

a <- appl %>% 
  filter(applicant_id == params$applicant_id) 

if (nrow(a) == 0) stop(glue::glue('There is no applicant with id {params$applicant_id}. Available ids: {paste(appl$applicant_id, collapse = ", ")}'))

gender_str <- stringr::str_replace(a$gender, '_', ' ')
role_str <- stringr::str_replace(a$project_role, '_', ' ')

a_skills <- a %>% 
  select(applicant_id, starts_with(c("skills", "techniques", "topics"))) %>% 
  pivot_longer(starts_with(c("skills", "techniques", "topics")), names_to = "category", values_to = "level") %>% 
  mutate(question = stringr::str_extract(category, "skills|techniques|topics")) %>% 
  mutate(category = stringr::str_replace(category, "skills_|techniques_|topics_", "")) %>% 
  mutate(category = stringr::str_replace_all(category, '_', ' ')) %>% 
  rownames_to_column() %>% 
  left_join(lvls, by = "level")

r a$applicant_id - r gender_str - r role_str {#applicant-r a$applicant_id}

Gender: r gender_str

Project role for this project: r role_str

Projects they applied to: r a$applied_to %>% stringr::str_replace_all(' ', ', ')

German skills: r a$german_skills

Past applications

if (is.na(a$past_applications)) {
  cat('No information about past applications was collected')
}

if (a$past_applications == 'first_application') {
  cat('The applicant is applying to a CorrelAid project for the **first time**.')
} else if(a$past_applications == 'successful') {
    cat(glue::glue('The applicant has **successfully applied** to a CorrelAid project before.'))
} else if(a$past_applications == 'not_successful') {
    cat(glue::glue("The applicant was **not successful** with their application(s) so far. They specified the following when asked about when/where they have applied in the past:\n\n > {a$past_applications_details}"))
}

What skills qualify you?

r a$motivation_skills

Why do you want to get involved?

r a$motivation_why_involved

Self-rated experience with skills, techniques and topics

ggplot(a_skills, aes(x = category, y = level_num, group = question)) +
  geom_segment(aes(
    x = fct_rev(category),
    xend = fct_rev(category),
    y = 0,
    yend = level_num
  )) +
  geom_point(size = 3, color = correlpal(1)) +
  coord_flip() +
  theme(
    panel.grid.minor.y = element_blank(),
    panel.grid.major.y = element_blank(),
    legend.position = "none"
  ) +
  scale_y_continuous(
    "level",
    limits = c(0, max(lvls$level_num)),
    breaks = seq(0, max(lvls$level_num), 1),
    labels = lvls$level
  ) +
  facet_wrap(~question, nrow = 3, scales = "free_y") +
  xlab("")


CorrelAid/projectutils documentation built on Oct. 7, 2022, 4:40 a.m.