Skip to content

Refactor: improvements on workingpatterns_classify_bw() #215

Merged
martinctc merged 41 commits into
mainfrom
refactor/working-patterns
Jun 24, 2022
Merged

Refactor: improvements on workingpatterns_classify_bw() #215
martinctc merged 41 commits into
mainfrom
refactor/working-patterns

Conversation

@martinctc

@martinctc martinctc commented May 19, 2022

Copy link
Copy Markdown
Member

Summary

This branch improves the existing workpatterns_classify_bw() to:

  • Improve readability of the code
  • Enable users to supply custom 'expected hours'
  • Changed the output archetypes which reflects better consistency

Note that this branch introduces several breaking changes. This pull request mainly addresses #216 and the intention is to bundle this PR in the release of v1.8.0.

Package version is incremented v1.7.0.9000.

Changes

The changes made in this PR are:

  1. Improved the clarity of the output archetypes by changing them to the following:
  • 0 Low Activity (< 3 hours on)
  • 1.1 Standard continuous (expected schedule)
  • 1.2 Standard continuous (shifted schedule)
  • 2.1 Standard flexible (expected schedule)
  • 2.2 Standard flexible (shifted schedule)
  • 3 Long flexible workday
  • 4 Long continuous workday
  • 5 Always on (13h+)

This new archetype satisfies the mutually exclusive, collectively exhaustive (MECE) principle, and addresses certain ambiguities of for instance, whether standard hour continuous is technically 'standard hours'. Previously, the output archetypes were:

  • 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+)
  1. The algorithm for workpatterns_classify_bw() is streamlined, and now there is an option for user to supply expected hours worked (exp_hours) as an argument. Previously, this was calculated as a simple difference between start_hour and end_hour, which may not necessarily be appropriate for all scenarios (e.g. lunch breaks).

  2. Adds the ability of workpatterns_rank() to return heatmapped plots instead of binary plots. workpatterns_report() retains binary plots. (Refactor: improvements on workingpatterns_classify_bw()  #215)

  3. Captions contain more parameter information when running workpatterns_classify() (Feature request: print parameters in captions for working patterns visualizations #137)

  4. Provide a mode option in workpatterns_rank() and flex_index() that will enable heatmapped plots. (Feature request: heatmap visual for flex_index()  #212)

  5. Relevant functions now use a single plotting backend function plot_hourly_pat().

image

  1. Added unit testing for workpatterns_classify() and flex_index()

Checks

  • All R CMD checks pass
  • roxygen2::roxygenise() has been run prior to merging to ensure that .Rd and NAMESPACE files are up to date.
  • NEWS.md has been updated.

Notes

This fixes #137, #153, #187, #215, and #216.

Create a temporary function to refactor function. Required in order to ensure reproducibility of results.
martinctc and others added 2 commits May 19, 2022 11:25
Improved variable names, and solved a classification issue
@martinctc martinctc added the enhancement New feature or request label Jun 9, 2022
@martinctc martinctc marked this pull request as ready for review June 24, 2022 09:59
@martinctc martinctc merged commit 6a23f3b into main Jun 24, 2022
@martinctc martinctc deleted the refactor/working-patterns branch June 24, 2022 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment