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

⚙️📊 Make the In-App Dashboard configurable #1055

Open
JGreenlee opened this issue Mar 12, 2024 · 2 comments
Open

⚙️📊 Make the In-App Dashboard configurable #1055

JGreenlee opened this issue Mar 12, 2024 · 2 comments

Comments

@JGreenlee
Copy link

In the current version of the app, the Dashboard tab is completely hidden if survey_info . trip-labels is set to ENKETO. This is largely because we couldn't compute carbon footprint without a MODE input.

However, the DFC fermata project will use Bluetooth sensing to detect mode. This means we will be able to show the carbon footprint even without user input.
We also want to show other metrics, including new sections for survey response rate, and potentially user engagement / gamification

I think we should expand the metrics field of the dynamic config. It already has one field include_test_users.
I propose adding a sub-field "phone_dashboard" that contains options that control the UI.

{
  ...
  "metrics": {
    "include_test_users": false,
    "phone_dashboard_ui": {
      "sections": ["footprint", "active_travel", "summary", "engagement", "surveys"],
      "footprint_options": {
        "unlabeled_uncertainty": false
      },
      "active_travel_options": {
        "modes_list": ["walk", "bike"]
      },
      "summary_options": {
        "metrics_list": ["distance", "count", "duration"]
      },
      "engagement_options": {
        "leaderboard_metric": ["distance", "e_car"]
      },
    }
  }
  ...
}

sections

A list of sections to show in the dashboard UI. They will appear in the specified order from top to bottom.
Options are footprint, active_travel, summary, engagement, surveys.
Whichever sections are omitted will not be shown in the UI.
Default: ["footprint", "active_travel", "summary"]

footprint_options . unlabeled_uncertainty

Whether to show the uncertainty on the carbon footprint charts.
Programs using MODE / PURPOSE labels will need this true. Programs using Bluetooth sensing can set this false.
Default: true

active_travel_options . modes_list

Which modes to consider as "active" for the purpose of calculating "active minutes".
Default: ["walk", "bike"]

summary_options . metrics_list

A list of metrics for which to show a graph and descriptives summarizing the metric by mode.
Options are distance, count, duration.
(mean_speed used to also be one but it was removed because the computations were wrong. We can add it back if we fix it)
Default: ["distance", "count", "duration"]

engagement_options . leaderboard_metric

What metric to use as the basis for the leaderboard.
(I am not sure yet how this will be represented, but maybe something like ["distance", "e_car"] to rank participants on miles driven in an EV. But if we do incentives based on survey response % instead, it will look different)

@jiji14 and I will work together on implementing this

@JGreenlee
Copy link
Author

JGreenlee commented Mar 22, 2024

While implementing this, we are going to transition from server-side computation to client-side computation for user metrics.

In the current version on master, all metrics are computed on the server and organized by date. The in-app Dashboard tab fetches the metrics from the server for the selected date range.

Transitioning to client-side computation for user metrics has a few advantages:

  • The dashboard tab will be able to update in real time because it can include unprocessed labels and unprocessed trips. So if a user labels a large batch of trips and switches to the Dashboard tab, they will be able to see the effects of all their new labels
  • We can share data between the Label tab and the Dashboard tab. With client-side metrics, the basis of the metrics computations will be composite trips, which are already being retrieved by the Label tab. This can give a much better UX because there will be fewer network calls and less loading time.

One caveat is that these advantages apply only for the user's metrics. Aggregate metrics (used for group comparisons, summaries for whole cohort, etc) will still need to be computed on the server.
I still think that this client-side computation is worth it for the UX because it allows us to show the most pertinent information upfront (which is the user's own metrics). It gives us flexibility to potentially lazy-load aggregate metrics while the user is already looking at their own metrics.

The steps I think are needed to this to happen for GPG:

  • Hoist the state for the fetched composite trips (and all associated "timeline"-related state) higher in the component tree, such that both the Label tab and the Dashboard tab will be able to access the same data.
  • Sync up the datepickers for Dashboard tab and Label tab, putting a limit on the range if necessary (perhaps a maximum of 2 or 3 months can be loaded at a time)
  • Refactor the Dashboard tab to compute user metrics using e-mission-common, passing the timeline data as input. User metrics will no longer be fetched from the server, but aggregate metrics will stay the same
  • Implement the new metrics components (with computations performed in e-mission-common) and make the dashboard configurable

At a later point in time, or gradually:

  • Refactor the server code to use e-mission-common similarly for aggregate metrics
  • After a while, remove obsolete code on the server

@JGreenlee
Copy link
Author

I have completed the first step on e-mission/e-mission-phone#1138

JGreenlee added a commit to JGreenlee/nrel-openpath-deploy-configs that referenced this issue Mar 28, 2024
This will allow us to test:
- conditional surveys (e-mission/e-mission-phone#1129, merged)
- configurable dashboard (e-mission/e-mission-docs#1055, still in progress)
JGreenlee added a commit to JGreenlee/nrel-openpath-deploy-configs that referenced this issue Mar 28, 2024
This will allow us to test:
- conditional surveys (e-mission/e-mission-phone#1129, merged)
- configurable dashboard (e-mission/e-mission-docs#1055, still in progress)
JGreenlee added a commit to jiji14/e-mission-phone that referenced this issue Apr 3, 2024
Up to now, the dashboard has only been shown for MULTILABEL configurations; on ENKETO configurations it was completely hidden.

We are making the dashboard more configurable -
e-mission/e-mission-docs#1055.
The presence of a new field `metrics`.`phone_dashboard_ui` being defined will cause the dashboard to be shown.
If `phone_dashboard_ui` is not defined, it will fall back to the current behavior (which is to only show dashboard for MULTILABEL configurations).
JGreenlee added a commit to jiji14/e-mission-phone that referenced this issue Apr 3, 2024
e-mission/e-mission-docs#1055 (comment)

***
sections

A list of sections to show in the dashboard UI. They will appear in the specified order from top to bottom.
Options are footprint, active_travel, summary, engagement, surveys.
Whichever sections are omitted will not be shown in the UI.
Default: ["footprint", "active_travel", "summary"]
***
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

1 participant