Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

All of these views operate on the most recent timestamps for all events. Building schedules that rely on a mutable event changing, and triggering a new timeline of sessions to perform, will not work with these adherence APIs. That would be events like “session type X has been completed.” OTOH, it will show compliance with the most recent time stream, and that might be all that matters. Past time streams are no longer actionable.

...

Weekly Adherence Report

This is a date-range list API that returns a set of SessionsOnDate objects.

Code Block
public class SessionsOnDate {
  String userId;
  LocalDate date;
  List<SessionOnDate> sessions;
}

This is a grouping report that lists all sessions that have a startDate/endDate that overlaps with the date of the record (remember that a session really exists for each window in each session in a schedule), grouped by the date. In the database, this is a set of records that simplify the representation of a session. For this reason, the date range is low: 1-7 days only. The database SessionOnDate table would look something like this:

...

Given an input date, we can take each stream, divide it into weeks, and return the week that has sessions which overlap with the input date. These seven records can generate a weekly report for the user (still a set of streams, one per event that is relevant to the schedule).

This report is probably not useful for a single individual, but when cached, it can serve as the basis for the study-wide weekly adherence reports below.

This API would take a local date and return a list of the following objects (one record per event ID), with each object representing one week where one of the days of that week (when measured for this user based on their timestamp for this event ID) falls on that date:

Code Block
public class WeeklyAdherence {
  // Key is userId + studyId + eventId
  String userId;
  String studyId
  String eventId;
  // could record information about burst, if relevant
  int weekNumber;
  DateTime createdOn;
  // Always 7 keys ("0" through "6")
  
  Map<String, List<SessionStreamWindow>> adherence;
}

This could be a straightforward Hibernate object with a child collection converted to a map. We’re generating one per user per study per app every evening, so we may need to use similar batch update tricks as were used to improve the performance of TimelineMetadata records.

Study SessionsOnDate API

Finally, the records above can be returned for a set of users. This is a very large amount of information (if you are looking for one week and are showing 25 users, it’s 25x7 pages of information). This is the visual design of the report this supports:

...