feat: add ability to use wellbeing query (#213)

This commit is contained in:
Martin Chan 2022-05-17 17:07:15 +01:00
Родитель ec88b70621
Коммит 832547a900
3 изменённых файлов: 41 добавлений и 22 удалений

Просмотреть файл

@ -17,16 +17,23 @@ Column {data-width=30%}
```{r}
KPI_1 <-
my_sq_data %>%
create_bar(metric = "Work_time",
hrvar = NULL,
return="table") %>%
select(Work_time) %>%
pull(1) %>%
round(1)
if(sum(my_sq_data$Work_time, na.rm = TRUE) == 0){
KPI_1 <- "0 "
} else {
KPI_1 <-
my_sq_data %>%
create_bar(metric = "Work_time",
hrvar = NULL,
return = "table") %>%
select(Work_time) %>%
pull(1) %>%
round(1)
}
paste(KPI_1, "hr work days") %>%
flexdashboard::valueBox(icon = "fa-calendar", color = "#34b1e2")
@ -36,16 +43,26 @@ paste(KPI_1, "hr work days") %>%
```{r}
balance1_w1_plot1 <-
my_sq_data %>%
mutate(Personal_time = 16-Work_time) %>%
create_stacked(metric = c("Work_time", "Personal_time"),
hrvar = hrvar,
rank = NULL) +
labs(title = "Employee workday",
subtitle = "Average hours per person per day")
balance1_w1_plot1
if(sum(my_sq_data$Work_time, na.rm = TRUE) == 0){
md2html("## Note: there is insufficient urgent collaboration data to display.")
} else {
balance1_w1_plot1 <-
my_sq_data %>%
mutate(Personal_time = 16 - Work_time) %>%
create_stacked(metric = c("Work_time", "Personal_time"),
hrvar = hrvar,
rank = NULL) +
labs(title = "Employee workday",
subtitle = "Average hours per person per day")
balance1_w1_plot1
}
```

Просмотреть файл

@ -38,7 +38,7 @@ Recurrent disconnection time is when the same hour(s) are inactive all 5 days of
The percentage represents the percentage of time employees were able to schedule recurrent disconnection time. "
Unscheduled Call hours ,"The number of hours the person spent in unscheduled calls through Teams with at least one other person, during and outside of working hours."
Urgent Collaboration,Email hours where subject line includes key words: urgent; immediately; ASAP; fire drill; immediate action; dringend; urgente; 緊急; pressant; Immédiatement; 直ちに; Sofort; inmediatamente
Urgent Collaboration,Email and meeting hours where subject line includes key words: urgent; immediately; ASAP; fire drill; immediate action; dringend; urgente; 緊急; pressant; Immédiatement; 直ちに; Sofort; inmediatamente
Urgent Week,Person weeks where urgent collaboration > 0
Intimate Meetings,"Number of hours the person spent in meetings with up to 5 attendees, during and outside of working hours."
Weekend work,Weekend work is defined as having sent at least 1 email or 1 instant message over Saturday or Sunday. Note that the first day of a week is set as Sunday in Workplace Analytics.

1 Metric Definition
38
39
40
41
42
43
44

Просмотреть файл

@ -83,6 +83,7 @@ my_sq_data <-
col_checker(col = "Collaboration_hrs", replacement = "Collaboration_hours") %>%
col_checker(col = "Unscheduled_call_hours", replacement = "Unscheduled_Call_hours") %>%
col_checker(col = "Urgent_email_hours") %>%
col_checker(col = "Urgent_meeting_hours") %>%
col_checker(col = "Weekend_Email", replacement = "Weekend_emails_sent") %>%
col_checker(col = "Weekend_IMs_sent") %>%
col_checker(col = "IMs_sent_same_level") %>%
@ -91,6 +92,7 @@ my_sq_data <-
col_checker(col = "Meeting_hours_intimate_group",
replacement = "Intimate_group_meeting_hours") %>%
col_checker(col = "IMs_sent", replacement = "Instant_messages_sent") %>%
col_checker(col = "Workweek_span") %>%
# Daily estimates --------------------------------------------------------
@ -100,8 +102,8 @@ my_sq_data <-
# Urgent collaboration ---------------------------------------------------
mutate(Urgent_collaboration_hours = Urgent_email_hours) %>%
# mutate(Urgent_collaboration_hours = Urgent_meeting_hours + Urgent_email_hours) %>%
# mutate(Urgent_collaboration_hours = Urgent_email_hours) %>%
mutate(Urgent_collaboration_hours = Urgent_meeting_hours + Urgent_email_hours) %>%
mutate(IsUrgent = ifelse(Urgent_collaboration_hours > 0, TRUE, FALSE)) %>%
# Weekend work ------------------------------------------------------------