Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facilitate research on comparing self-reported nap/nonwear with acc-based daytime rest detection #900

Merged
merged 48 commits into from
Sep 13, 2023

Conversation

vincentvanhees
Copy link
Member

@vincentvanhees vincentvanhees commented Sep 12, 2023

This PR expands part 5 to help us get a better understanding of the meaning of daytime SIBs compared with self-reported naps and self-reported nonwear by looking at their overlap.

  • Re-uses the already existing argument possible_nap_duration to optionally filter out all SIBs with a duration shorter than this value (default = 0).
  • New argument possible_nap_edge_acc to specify the maximum acceleration value to consider before and/or after the sustained inactivity bout (default = Inf).

If the user finds an optimal setting for these arguments then that could possibly inform a new nap classification algorithm.

Note: The nap detection itself is still limited to the model trained in 3-year olds and I am not changing anything to that. This functionality should be able to run without using the current nap detection option.

Fixes #687

Checklist before merging:

  • Existing tests still work (check by running the test suite, e.g. from RStudio).
  • Added tests (if you added functionality) or fixed existing test (if you fixed a bug).
  • Updated or expanded the documentation.
  • Updated release notes in inst/NEWS.Rd with a user-readable summary. Please, include references to relevant issues or PR discussions.
  • Added your name to the contributors lists in the DESCRIPTION and CITATION.cff files.

…sibreport anlayses inside g.part5 for initial testing, next step is to move this to separate functions and add unit-tests #687
… nap, more overlap variables added to output, sibreport items changed
@vincentvanhees vincentvanhees changed the title Issue687 nap enhancement2 Facilitate research on comparing self-reported nap/nonwear with acc-based daytime rest detection Sep 12, 2023
@vincentvanhees vincentvanhees marked this pull request as ready for review September 12, 2023 15:47
if (length(longboutsi) > 0) {
sibreport = sibreport[longboutsi,]
srep_tmp = sibreport[which(sibreport$start > min(time) &
sibreport$end < max(time)),]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not getting the expected output when testing this, and it is because time here is introduced as ISO6801, but sibreport$start and sibreport$end are stored as POSIX objects, so the function was not able to find any srep_tmp.
I fixed this locally by introducing these lines at the begining of this function:

# transform time to POSIX
  if (is.ISO8601(time[1])) {
    time = iso8601chartime2POSIX(time, tz = tz)
  }

@vincentvanhees Should I commit this change or do you want to investigate why do you get the expected output and I don't?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please. I have been working so far with the csv variant of ms5.outraw. Maybe if you use the RData variant time is also stored different. It is good to facilitate both.

@vincentvanhees
Copy link
Member Author

Looks like the problem is that is.ISO8601 assumes the input x is a character.
I will now fix is.ISO8601 such that it always first checks that input is a character.

@jhmigueles
Copy link
Collaborator

jhmigueles commented Sep 13, 2023

Looks like the problem is that is.ISO8601 assumes the input x is a character. I will now fix is.ISO8601 such that it always first checks that input is a character.

Great, I have already merged the changes from the master branch, I will not do any more commits.

@codecov-commenter
Copy link

Codecov Report

Merging #900 (f7b53e3) into master (c7bfa8c) will increase coverage by 0.21%.
The diff coverage is 86.91%.

❗ Current head f7b53e3 differs from pull request most recent head 3c36304. Consider uploading reports for the commit 3c36304 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master     #900      +/-   ##
==========================================
+ Coverage   78.01%   78.23%   +0.21%     
==========================================
  Files          91       92       +1     
  Lines       12138    12302     +164     
==========================================
+ Hits         9469     9624     +155     
- Misses       2669     2678       +9     
Files Changed Coverage Δ
R/g.part5.R 80.28% <50.00%> (-0.80%) ⬇️
R/g.sibreport.R 91.66% <89.47%> (+0.64%) ⬆️
R/g.part5.analyseRest.R 97.79% <97.79%> (ø)
R/check_params.R 97.61% <100.00%> (ø)
R/g.part5_analyseSegment.R 93.39% <100.00%> (+0.19%) ⬆️
R/load_params.R 99.13% <100.00%> (+<0.01%) ⬆️

@vincentvanhees vincentvanhees merged commit 859a57f into master Sep 13, 2023
8 checks passed
@vincentvanhees vincentvanhees deleted the issue687_nap_enhancement2 branch September 13, 2023 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants