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

Timezone question #301

Closed
sc00n opened this issue Jan 7, 2023 · 6 comments
Closed

Timezone question #301

sc00n opened this issue Jan 7, 2023 · 6 comments
Assignees
Labels
invalid This doesn't seem right question Further information is requested

Comments

@sc00n
Copy link
Contributor

sc00n commented Jan 7, 2023

Is there a way to add the time zone of the participant in the header? The time in the header (at this actual moment) reads

"start_time": "2023-01-07T20:24:52.266973Z"

But it is 21:24:52 here and I am not in Zulu time zone (but in Alpha time zone aka UTC+1). Its fine if the start_time is just in UTC time, but it would be nice if another field would give the time zone of the participant.

@sc00n sc00n mentioned this issue Jan 16, 2023
@bardram
Copy link
Contributor

bardram commented Jan 18, 2023

I'm not sure what the issue is? The reason to use zulu time is that you can always convert a zulu time to the local time zone. See e.g. the timezone package.

@bardram bardram self-assigned this Jan 18, 2023
@bardram bardram added invalid This doesn't seem right question Further information is requested labels Jan 18, 2023
@sc00n
Copy link
Contributor Author

sc00n commented Jan 19, 2023

When the data is still on the phone you can convert it back to local time. However, when the data is exported away from the phone, this is harder for the researcher. Moreover, it is exactly then that we need to convert it back to local time, for example to link it with other external data (e.g. ESM questionnaire data or data from other sensors and other apps that save entries in local time). The problem is that you don't know the local time zones of all participants.  For example: 

  • When you have participants spread all over the world
  • When some of your participants are travelling during the study 

When you are also gathering locating during the study, you probably could infer the time zone. In some studies we however will not want to gather location data (e.g. for privacy reasons).

@bardram
Copy link
Contributor

bardram commented Feb 8, 2023

ok - I understand. My main problem with this PR is that the DataPoint format incl. the header complies to the API of the CARP web services data upload endpoint. Hence, if we start adding new fields to the data point header, we need to upgrade the backend too.

I know that you probably do not use the CARP backend. So I will look for another solution to this problem.

@bardram
Copy link
Contributor

bardram commented Feb 13, 2023

I will add a new data type for time zone - this is IMO the best solution. Also need to collect it on the phone.

@bardram
Copy link
Contributor

bardram commented Feb 13, 2023

In CAMS v. 0.40.13 you can write a protocol that include collection of time zone information. Examples include:

    // Collect timezone info every time the app restarts.
    protocol.addTriggeredTask(
        ImmediateTrigger(),
        BackgroundTask(measures: [
          Measure(type: DeviceSamplingPackage.TIMEZONE),
        ]),
        phone);

And you can also add it to an AppTask so that you know in which time zone the survey was filled in:

    // Add an app task 2 minutes after deployment and make a notification.
    //
    // This App Task is added for demo purpose and you should see notifications
    // on the phone. However, nothing will happen when you click on it.
    // See the PulmonaryMonitor demo app for a full-scale example of how to use
    // the App Task model.
    //
    // Note also that the timezone measure is added. This entails that timezone
    // information is collected when the user 'executes' this app task.
    protocol.addTriggeredTask(
        ElapsedTimeTrigger(
          elapsedTime: const Duration(minutes: 2),
        ),
        AppTask(
          measures: [Measure(type: DeviceSamplingPackage.TIMEZONE)],
          type: BackgroundSensingUserTask.ONE_TIME_SENSING_TYPE,
          title: "Elapsed Time - 2 minutes",
          notification: true,
        ),
        phone);

@sc00n
Copy link
Contributor Author

sc00n commented Mar 14, 2023

Thanks! This seems to work.

@sc00n sc00n closed this as completed Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants