Skip to content

Timezone handling #10

Open
Open

Description

@ps2

Timezone handling in this package needs to be revisited.

In an attempt to deal with timezones, the code in pyloop_parser.py is adding timedeltas to dates that are already correct times, creating incorrect timestamps for glucose data, insulin data, and carb data.

For an example of one place this is being done: https://github.com/tidepool-org/PyLoopKit/blob/develop/pyloopkit/pyloop_parser.py#L36. Similar code is in these functions: get_carb_data, get_insulin_data, and get_glucose_data.

This causes problems further downstream in data processing. Recommend all internal timestamp handling is kept in utc. The only code that should worry about timezones is the following:

  1. Converting pump data in pump time to utc. Not needed in this code; issue reports already have pump events with utc timestamps
  2. Looking up basal rates to compute relative iob for a given dose. This should use the basal schedule timezone.
  3. Display. If desired, the final data can be displayed in a non-utc timezone; either the user's current timezone, or the the apparent timezone in use as inferred from the issue report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions