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

Question: How to determine how long it takes participants to complete each survey? #333

Closed
isaactpetersen opened this issue Apr 4, 2021 · 9 comments
Assignees

Comments

@isaactpetersen
Copy link

I have a few questions, not an issue. Basically, my questions are about how to calculate the duration it takes each participant to complete each survey:

  1. REDCapR allows exporting survey timestamps using the argument export_survey_fields. However, it exports only one survey timestamp for each survey. Is the survey timestamp exported by REDCapR the timestamp for the start or completion of the survey? I seem to have the impression that it's the completion timestamp, but I could be mistaken.

  2. If REDCapR exports the survey start timestamp (instead of the survey completion timestamp), is there a way I could modify the survey in REDCap to keep track of the survey completion times?

  3. Given that REDCapR exports only the survey completion timestamp and not the survey start timestamp (or vice versa?), what would be the best way to determine the completion time for each survey? Should I add a hidden item at the beginning of each survey with a computer-generated timestamp to indicate the timestamp of the start of each survey and use that (along with the survey completion timestamp) to calculate the duration of time it takes each participant to complete each survey? Or is there a better way?

  4. Are the default survey timestamp values exported by REDCapR in UTC or the user's local time? Basically, are they equivalent to the action tag @Now or @Now-UTC? I'm wondering because if I have to add an item to the beginning of each survey to indicate the survey start time, it'd be helpful to know whether to use @Now or @Now-UTC to be consistent with the REDCapR exported timestamps for the survey completion times.

Thanks very much for your help!

@wibeasley
Copy link
Member

I haven't needed to do this, but I can understand the need and I think you're asking the right questions. Here are my best guesses. I think you can confirm all of them with a little bit of testing.

  1. I think the completion/submission, but try it out. Also see what happens if someone returns to a survey and edits a response.
  2. Let's see what the answer to question 1.
  3. Yes, my best guess is to add a hidden item with an action tag.
  4. I'm guessing it's a third option, the server's local time (not UTC, and not the user's local time). But please tell us what you find out.

@thomasnwilson, add anything you'd like.

@wibeasley wibeasley self-assigned this Apr 4, 2021
@isaactpetersen
Copy link
Author

Okay, I just tested it. Here's what I found:

  1. The survey timestamps exported by REDCapR when using the argument export_survey_fields are the survey completion timestamps. If a user goes into the survey after the survey is completed and edits an item, the survey completion time does not get changed. However, if the survey has the following setting enabled ("Allow respondents to return and modify completed responses"), and a respondent returns and modifies a completed response, the survey time see updated (see attached image).
    allow respondents to return and modify completed responses

  2. This question is no longer relevant.

  3. A hidden item with an action tag seemed to work well to track the start time of the survey.

  4. You might be right. It's either the server time or the local time. I verified that it's not the UTC time. I'm not able to determine whether it's the server time or local time because they are the same for me. I can record both, just in case.

Many thanks!

@wibeasley
Copy link
Member

Cool. Thanks for digging into it. That's good to know for sure for points 1-3.

To disentangle point 4, you can temporarily change your local machine's time and/or timezone

One reason I'm guessing that it's the server's time & timezone is that would be a bad thing for a server to trust a client value like that.

@isaactpetersen
Copy link
Author

isaactpetersen commented Apr 6, 2021

Yep, you nailed it. Looks like it's the server time. Thanks for helping me figure that out. That answers all of my questions. Might be helpful to add that to the package documentation--something like: "The timestamps exported using the argument export_survey_fields reflect the timestamp of the survey completion time based on the timezone of the REDCap server."

@wibeasley
Copy link
Member

@isaactpetersen, I like suggestion. See the commit above --would this have made sense to you three days ago (coming fresh into these questions)? If you have better wording, please respond here or send a PR.

If you're happy with it, I'll pull it into the master branch and it will be added to the functions' online documentation.

@isaactpetersen
Copy link
Author

Looks perfect, thanks for your responsiveness and help with this issue! It is much appreciated.

@isaactpetersen
Copy link
Author

@wibeasley It seems that REDCap added smart variables for survey start time and survey duration: https://github-wiki-see.page/m/idea-labs/documentation/wiki/Neue-Features-in-REDCap.

For instance, the following smart variables were added in REDCap 12.2.0:
[survey-time-started:instrument]
[survey-date-started:instrument]
[survey-duration:instrument:units]
[survey-duration-completed:instrument:units]

Are these smart variables things that REDCapR can access and export, or do we need to pipe them into survey fields in order to access them via REDCapR?

@wibeasley
Copy link
Member

wibeasley commented Apr 26, 2022

pipe them into survey fields in order to access them via REDCapR

That's how we've done it in the paste (with other smart variables). Do you have another way in mind? The API pulls whatever is stored in MySQL, and wouldn't have access to the JavaScript/PHP functions.

Edit: And thanks for telling me about these. They'll be useful.

@isaactpetersen
Copy link
Author

Okay, that makes sense. We'll try piping these values in so we have access to them via export. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants