зеркало из https://github.com/microsoft/wpa.git
feat: update `Personas` to L2 version
Using only a single set of personas, but updating these to eight archetypes to ensure consistent representation of flexibility.
This commit is contained in:
Родитель
ba4ca864bc
Коммит
dec844b41e
|
@ -35,20 +35,26 @@
|
|||
#'
|
||||
#' @section Binary Week method:
|
||||
#'
|
||||
#' This method classifies each **person-week** into one of the seven
|
||||
#' This method classifies each **person-week** into one of the eight
|
||||
#' archetypes:
|
||||
#' - **0 < 3 hours on**: fewer than 3 hours of active hours
|
||||
#' - **1 Standard with breaks workday**: active for fewer than _expected
|
||||
#' hours_, with no activity outside working hours
|
||||
#' - **2 Standard continuous workday**: number of active hours equal _expected
|
||||
#' hours_, with no activity outside working hours
|
||||
#' - **3 Standard flexible workday**: number of active hours are less than or
|
||||
#' equal to _expected hours_, with some activity outside working hours
|
||||
#' - **4 Long flexible workday**: number of active hours exceed _expected
|
||||
#' - **0 Low Activity (< 3 hours on)**: fewer than 3 hours of active hours
|
||||
#' - **1.1 Standard continuous (expected schedule)**: active hours equal to
|
||||
#' _expected hours_, with all activity confined within the expected start and
|
||||
#' end time
|
||||
#' - **1.2 Standard continuous (shifted schedule)**: active hours equal to
|
||||
#' _expected hours_, with activity occurring beyond either the expected start
|
||||
#' or end time.
|
||||
#' - **2.1 Standard flexible (expected schedule)**: active hours less than or
|
||||
#' equal to _expected hours_, with all activity confined within the expected
|
||||
#' start and end time
|
||||
#' - **2.2 Standard flexible (shifted schedule)**: active hours less than or
|
||||
#' equal to _expected hours_, with activity occurring beyond either the
|
||||
#' expected start or end time.
|
||||
#' - **3 Long flexible workday**: number of active hours exceed _expected
|
||||
#' hours_, with breaks occurring throughout
|
||||
#' - **5 Long continuous workday**: number of active hours exceed _expected
|
||||
#' - **4 Long continuous workday**: number of active hours exceed _expected
|
||||
#' hours_, with activity happening in a continuous block (no breaks)
|
||||
#' - **6 Always on (13h+)**: number of active hours greater than or equal to
|
||||
#' - **5 Always on (13h+)**: number of active hours greater than or equal to
|
||||
#' 13
|
||||
#'
|
||||
#' This is the recommended method over `pav` for several reasons:
|
||||
|
|
|
@ -92,7 +92,6 @@ workpatterns_classify_bw <- function(data,
|
|||
|
||||
## set up variable -------------------------------------------------------
|
||||
Active_Hours <- NULL
|
||||
Personas_L2 <- NULL
|
||||
|
||||
## Handling NULL values passed to hrvar ----------------------------------
|
||||
if(is.null(hrvar)){
|
||||
|
@ -248,29 +247,29 @@ workpatterns_classify_bw <- function(data,
|
|||
|
||||
## Working patterns classification ---------------------------------------
|
||||
|
||||
# Level 1 with 7 personas
|
||||
personas_levels <-
|
||||
c("0 < 3 hours on",
|
||||
"1 Standard with breaks workday",
|
||||
"2 Standard continuous workday",
|
||||
"3 Standard flexible workday",
|
||||
"4 Long flexible workday",
|
||||
"5 Long continuous workday",
|
||||
"6 Always on (13h+)")
|
||||
|
||||
ptn_data_personas <- data.table::copy(WpA_classify)
|
||||
ptn_data_personas[, Personas := "Unclassified"]
|
||||
ptn_data_personas[Active_Hours > exp_hours & Active_Hours==Day_Span , Personas := "5 Long continuous workday"]
|
||||
ptn_data_personas[Active_Hours > exp_hours & Active_Hours<Day_Span, Personas := "4 Long flexible workday"]
|
||||
ptn_data_personas[Active_Hours <= exp_hours & (Before_start>0|After_end>0), Personas := "3 Standard flexible workday"] #do we want to split betwen block and non block?
|
||||
ptn_data_personas[Active_Hours == exp_hours & Within_hours == exp_hours , Personas := "2 Standard continuous workday"]
|
||||
ptn_data_personas[Active_Hours < exp_hours & Before_start==0 & After_end == 0, Personas := "1 Standard with breaks workday"]
|
||||
ptn_data_personas[Active_Hours >= 13, Personas := "6 Always on (13h+)"]
|
||||
ptn_data_personas[Active_Hours < 3, Personas := "0 < 3 hours on"]
|
||||
ptn_data_personas[, Personas := factor(Personas, levels = personas_levels)]
|
||||
# # Level 1 with 7 personas
|
||||
# personas_levels <-
|
||||
# c("0 < 3 hours on",
|
||||
# "1 Standard with breaks workday",
|
||||
# "2 Standard continuous workday",
|
||||
# "3 Standard flexible workday",
|
||||
# "4 Long flexible workday",
|
||||
# "5 Long continuous workday",
|
||||
# "6 Always on (13h+)")
|
||||
#
|
||||
# ptn_data_personas <- data.table::copy(WpA_classify)
|
||||
# ptn_data_personas[, Personas := "Unclassified"]
|
||||
# ptn_data_personas[Active_Hours > exp_hours & Active_Hours==Day_Span , Personas := "5 Long continuous workday"]
|
||||
# ptn_data_personas[Active_Hours > exp_hours & Active_Hours<Day_Span, Personas := "4 Long flexible workday"]
|
||||
# ptn_data_personas[Active_Hours <= exp_hours & (Before_start>0|After_end>0), Personas := "3 Standard flexible workday"] #do we want to split betwen block and non block?
|
||||
# ptn_data_personas[Active_Hours == exp_hours & Within_hours == exp_hours , Personas := "2 Standard continuous workday"]
|
||||
# ptn_data_personas[Active_Hours < exp_hours & Before_start==0 & After_end == 0, Personas := "1 Standard with breaks workday"]
|
||||
# ptn_data_personas[Active_Hours >= 13, Personas := "6 Always on (13h+)"]
|
||||
# ptn_data_personas[Active_Hours < 3, Personas := "0 < 3 hours on"]
|
||||
# ptn_data_personas[, Personas := factor(Personas, levels = personas_levels)]
|
||||
|
||||
# Level 2 with 8 personas
|
||||
personas_levels_l2 <-
|
||||
personas_levels <-
|
||||
c(
|
||||
"0 Low Activity (< 3 hours on)",
|
||||
"1.1 Standard continuous (expected schedule)",
|
||||
|
@ -282,16 +281,17 @@ workpatterns_classify_bw <- function(data,
|
|||
"5 Always on (13h+)"
|
||||
)
|
||||
|
||||
ptn_data_personas[, Personas_L2 := "Unclassified"]
|
||||
ptn_data_personas[Active_Hours > exp_hours & Active_Hours==Day_Span , Personas_L2 := "4 Long continuous workday"]
|
||||
ptn_data_personas[Active_Hours > exp_hours & Active_Hours<Day_Span, Personas_L2 := "3 Long flexible workday"]
|
||||
ptn_data_personas[Active_Hours <= exp_hours & (Before_start>0|After_end>0), Personas_L2 := "2.2 Standard flexible (shifted schedule)"]
|
||||
ptn_data_personas[Active_Hours <= exp_hours & Before_start == 0 & After_end == 0, Personas_L2 := "2.1 Standard flexible (expected schedule)"]
|
||||
ptn_data_personas[Active_Hours == exp_hours & (Before_start > 0 | After_end > 0) & Active_Hours == Day_Span, Personas_L2 := "1.2 Standard continuous (shifted schedule)"]
|
||||
ptn_data_personas[Active_Hours == exp_hours & Before_start == 0 & After_end == 0 & Active_Hours == Day_Span, Personas_L2 := "1.1 Standard continuous (expected schedule)"]
|
||||
ptn_data_personas[Active_Hours >= 13, Personas_L2 := "5 Always on (13h+)"]
|
||||
ptn_data_personas[Active_Hours < 3, Personas_L2 := "0 Low Activity (< 3 hours on)"]
|
||||
ptn_data_personas[, Personas_L2 := factor(Personas_L2, levels = personas_levels_l2)]
|
||||
ptn_data_personas <- data.table::copy(WpA_classify)
|
||||
ptn_data_personas[, Personas := "Unclassified"]
|
||||
ptn_data_personas[Active_Hours > exp_hours & Active_Hours==Day_Span , Personas := "4 Long continuous workday"]
|
||||
ptn_data_personas[Active_Hours > exp_hours & Active_Hours<Day_Span, Personas := "3 Long flexible workday"]
|
||||
ptn_data_personas[Active_Hours <= exp_hours & (Before_start>0|After_end>0), Personas := "2.2 Standard flexible (shifted schedule)"]
|
||||
ptn_data_personas[Active_Hours <= exp_hours & Before_start == 0 & After_end == 0, Personas := "2.1 Standard flexible (expected schedule)"]
|
||||
ptn_data_personas[Active_Hours == exp_hours & (Before_start > 0 | After_end > 0) & Active_Hours == Day_Span, Personas := "1.2 Standard continuous (shifted schedule)"]
|
||||
ptn_data_personas[Active_Hours == exp_hours & Before_start == 0 & After_end == 0 & Active_Hours == Day_Span, Personas := "1.1 Standard continuous (expected schedule)"]
|
||||
ptn_data_personas[Active_Hours >= 13, Personas := "5 Always on (13h+)"]
|
||||
ptn_data_personas[Active_Hours < 3, Personas := "0 Low Activity (< 3 hours on)"]
|
||||
ptn_data_personas[, Personas := factor(Personas, levels = personas_levels)]
|
||||
|
||||
|
||||
|
||||
|
@ -523,13 +523,14 @@ plot_workpatterns_classify_bw <- function(data, range, caption){
|
|||
dplyr::mutate(
|
||||
PersonasNet =
|
||||
case_when(
|
||||
Personas == "0 < 3 hours on" ~ "Low activity",
|
||||
Personas == "1 Standard with breaks workday" ~ "Flexible",
|
||||
Personas == "2 Standard continuous workday" ~ "Standard",
|
||||
Personas == "3 Standard flexible workday" ~ "Flexible",
|
||||
Personas == "4 Long flexible workday" ~ "Long flexible",
|
||||
Personas == "5 Long continuous workday" ~ "Long continuous",
|
||||
Personas == "6 Always on (13h+)" ~ "Always On",
|
||||
Personas == "0 Low Activity (< 3 hours on)" ~ "Low activity",
|
||||
Personas == "2.1 Standard flexible (expected schedule)" ~ "Flexible",
|
||||
Personas == "2.2 Standard flexible (shifted schedule)" ~ "Flexible",
|
||||
Personas == "1.1 Standard continuous (expected schedule)" ~ "Standard",
|
||||
Personas == "1.2 Standard continuous (shifted schedule)" ~ "Standard",
|
||||
Personas == "3 Long flexible workday" ~ "Long flexible",
|
||||
Personas == "4 Long continuous workday" ~ "Long continuous",
|
||||
Personas == "5 Always on (13h+)" ~ "Always On",
|
||||
TRUE ~ NA_character_
|
||||
)
|
||||
) %>%
|
||||
|
|
|
@ -58,14 +58,14 @@ workpatterns_report <- function(data,
|
|||
pd_id <-
|
||||
wp_list$data %>%
|
||||
mutate(PersonWeekId = paste0(PersonId,"_",Date)) %>%
|
||||
select(PersonWeekId, Personas, Personas_L2)
|
||||
select(PersonWeekId, Personas)
|
||||
|
||||
## plot table for `workpatterns_rank`
|
||||
plot_table_list <-
|
||||
data %>%
|
||||
mutate(PersonWeekId = paste0(PersonId,"_",Date)) %>%
|
||||
left_join(pd_id, by = "PersonWeekId") %>%
|
||||
split(.$Personas_L2)
|
||||
split(.$Personas)
|
||||
|
||||
plot_rank_list <-
|
||||
plot_table_list %>%
|
||||
|
|
|
@ -128,21 +128,27 @@ implementations.
|
|||
\section{Binary Week method}{
|
||||
|
||||
|
||||
This method classifies each \strong{person-week} into one of the seven
|
||||
This method classifies each \strong{person-week} into one of the eight
|
||||
archetypes:
|
||||
\itemize{
|
||||
\item \strong{0 < 3 hours on}: fewer than 3 hours of active hours
|
||||
\item \strong{1 Standard with breaks workday}: active for fewer than \emph{expected
|
||||
hours}, with no activity outside working hours
|
||||
\item \strong{2 Standard continuous workday}: number of active hours equal \emph{expected
|
||||
hours}, with no activity outside working hours
|
||||
\item \strong{3 Standard flexible workday}: number of active hours are less than or
|
||||
equal to \emph{expected hours}, with some activity outside working hours
|
||||
\item \strong{4 Long flexible workday}: number of active hours exceed \emph{expected
|
||||
\item \strong{0 Low Activity (< 3 hours on)}: fewer than 3 hours of active hours
|
||||
\item \strong{1.1 Standard continuous (expected schedule)}: active hours equal to
|
||||
\emph{expected hours}, with all activity confined within the expected start and
|
||||
end time
|
||||
\item \strong{1.2 Standard continuous (shifted schedule)}: active hours equal to
|
||||
\emph{expected hours}, with activity occurring beyond either the expected start
|
||||
or end time.
|
||||
\item \strong{2.1 Standard flexible (expected schedule)}: active hours less than or
|
||||
equal to \emph{expected hours}, with all activity confined within the expected
|
||||
start and end time
|
||||
\item \strong{2.2 Standard flexible (shifted schedule)}: active hours less than or
|
||||
equal to \emph{expected hours}, with activity occurring beyond either the
|
||||
expected start or end time.
|
||||
\item \strong{3 Long flexible workday}: number of active hours exceed \emph{expected
|
||||
hours}, with breaks occurring throughout
|
||||
\item \strong{5 Long continuous workday}: number of active hours exceed \emph{expected
|
||||
\item \strong{4 Long continuous workday}: number of active hours exceed \emph{expected
|
||||
hours}, with activity happening in a continuous block (no breaks)
|
||||
\item \strong{6 Always on (13h+)}: number of active hours greater than or equal to
|
||||
\item \strong{5 Always on (13h+)}: number of active hours greater than or equal to
|
||||
13
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче