e-mission / em-public-dashboard

A simple and stupid public dashboard prototype.
BSD 3-Clause "New" or "Revised" License
1 stars 23 forks source link

May Dashboard Cleanup #136

Closed Abby-Wheelis closed 2 months ago

Abby-Wheelis commented 3 months ago

Beginning this PR to address bugs and cleanup in the public dashboard, see list starting here: #1051

With respect to the error handling with the survey responses, I believe this is fine, it's been working in the notebooks (and on production, noted since dfc-fermata has no data at the moment), but I will keep an eye on it. I am seeing the behavior that only one chart appears in the notebook, but all of the calls to generate_missing are going through, and I can see the figures saved in plots.

@shankari re:

for likert questions, use the related text ("neutral" or "strongly agree") instead of "3" or "5"

We currently have: "1, 2, 3, 4, 5", if we used the related text, it would be "disagree, -, neutral, -, agree" due to the formatting of the surveys to appear nicely in the app. I could check for the dashes and give us "disagree, 2, neutral, 4, agree" - is that any better? I think it could work if we make sure it is order that way in the legend at least - haven't planned how that would work yet but I'm sure it's possible.

Abby-Wheelis commented 3 months ago

I think it could work if we make sure it is order that way in the legend at least - haven't planned how that would work yet but I'm sure it's possible.

Trying this, and I am able to order them in the dataframe, but when I pass it into the plot_and_text_stacked_bar_chart function, they get ordered again... can I take this ordering out?

-- commented out for now, how does this look? If there is just a subset of these labels, that is what is shown as well image

shankari commented 3 months ago

@Abby-Wheelis I would suggest the following:

Abby-Wheelis commented 3 months ago

include the numeric value for all the labels to make it clear (e.g. Disagree (1), and Neutral(3))

Done!

You can pass in a command line argument on whether to sort or not. If you feel comfortable, I would actually suggest moving the sorting to the pre-processing

I can absolutely do this, but for my own understanding, why do we need to order the metrics in the other charts? The reason that comes to front of mind would be so that they are in the same order between charts?

shankari commented 3 months ago

I can absolutely do this, but for my own understanding, why do we need to order the metrics in the other charts? The reason that comes to front of mind would be so that they are in the same order between charts?

I think it is just to draw the eye towards the biggest bar; and have the ordering be in a logical order instead of arbitrary. You can try removing it for the other metrics and see what they look like.

Having said all that, I think that we may want to change that sorting anyway when we unify the colors and have them be mapped to the base modes. I will anticipate that we will not want to sort at that point since we will want to have the same ordering for all the charts, which would ideally be based on similar base modes. That's why I am ok with the short-term solution of just passing in an additional argument to the plot function.

Abby-Wheelis commented 3 months ago

Piloting a few of the options we've been talking about:

Ordered: sorted

Unordered: not_sorted

By count with high participation: plot_by_count

By count with low participation: low_labeling

Abby-Wheelis commented 3 months ago

side-by-side html tables with a small css change, could increase the padding if wanted, but not by much to avoid cuttoff

we cold also make sure that scroll left-right is available, which will be important when we add inferred (3rd table)

Screenshot 2024-05-29 at 4 55 54 PM

Abby-Wheelis commented 3 months ago

What it would look like if all of the survey charts were together: image

Long survey: image

I think this would look fine if we split the survey question names into two or three lines ... worried about the longer keys since it's more difficult to put them below now.

shankari commented 3 months ago

For the TripConfirmSurvey, you should also have the question on the side of the bar. Right now, you have one question at the top (which is really only the question for the last bar) and "Responses" on the side of all the bars.

I do think that the DfcEvReturnTrip looks much nicer this way. It gives a sense of the set of questions asked for this survey. And it looks like both the ReturnTrip and the RoamingTrip have the question "You are satisfied with your choice to take an EV on this trip" (Return shows up here, Roaming shows up on the public dashboard), so grouping the questions by the survey would help clarify that as well.

So assuming you can split the questions into multiple lines, I would suggest that we do group by survey. We should also make sure that the questions for the "Insufficent data" bars are also shown.

Abby-Wheelis commented 3 months ago

For the TripConfirmSurvey, you should also have the question on the side of the bar. Right now, you have one question at the top (which is really only the question for the last bar) and "Responses" on the side of all the bars.

Will do! Sorry, this was one of the first drafts then I kept making changes before I took the 2nd screenshot, I should have clarified that in the comment!

line split the questions: image

question shown even if no data: image

Remaining tasks:

Abby-Wheelis commented 3 months ago

The issue with caebike was the missing Other label -- laos has Other as a mode, caebike has Other mode which is why only some were broken, I have added the mode manually as a part of the label generation process

Abby-Wheelis commented 3 months ago

Adding a new plot to show the difference between labeled and sensed over time - caebike image cortezebikes image

Abby-Wheelis commented 3 months ago

Testing Done:

ca-ebikes (custom labels) ![ca-ebike-default](https://github.com/e-mission/em-public-dashboard/assets/54848919/1e7b983e-5b00-41eb-a98f-bcdcb23f24ae) ![ca-ebike-stacked](https://github.com/e-mission/em-public-dashboard/assets/54848919/48e97a02-3d0a-41a6-ad60-7bbe0233d4dd) ![ca-ebike-time](https://github.com/e-mission/em-public-dashboard/assets/54848919/c819790c-8628-4d57-a09f-e022fe3feea6) ![ca-ebike-ebike](https://github.com/e-mission/em-public-dashboard/assets/54848919/5fbb4ace-29aa-4e39-baf5-b6c16a904737) ![ca-ebike-ebike-time](https://github.com/e-mission/em-public-dashboard/assets/54848919/c8f27e2f-f242-40ad-b8f1-93d7c60f6de4)
dfc-fermata (low data, pushes limits of survey space) ![Screenshot 2024-05-30 at 4 33 10 PM](https://github.com/e-mission/em-public-dashboard/assets/54848919/0d94fe9c-0933-4edd-b55b-919aa73989fd) ^ I wish these could be dynamically sized, and need to figure out why the axis label is pushed so far below the axis itself
washingtoncommons (more "normal" survey data, also to test command line since dfc has show tests set to false now) ![Screenshot 2024-05-30 at 4 45 04 PM](https://github.com/e-mission/em-public-dashboard/assets/54848919/78547ecd-20ba-4c05-bd6d-280e622b52c8)

TODO:

@shankari Hoping to have this fully ready for review by tonight, getting down to the last details!

Abby-Wheelis commented 3 months ago

I think this works with the legend always by the side - makes sure the mapping is easily visible with each of the bars image

The way we adjust the positioning of the x axis label is with: fig.supxlabel('Proportion (Count)', fontsize=20, x=0.5, y= ax.xaxis.get_label().get_position()[0] - .62, va='top')

If I lower this number, I can get it to fit right with all of the bars in the surveys - but for just 1 or 2 bars it overlaps the graph. Is there a better way to position it?

Added the labeled vs sensed time series to the survey deployments!

Abby-Wheelis commented 3 months ago

Last few changes fixing the html side-by-side and an extra python version change:

Screenshot 2024-05-31 at 9 44 05 AM

This is ready for a review!

shankari commented 3 months ago

fig.supxlabel('Proportion (Count)', fontsize=20, x=0.5, y= ax.xaxis.get_label().get_position()[0] - .62, va='top')

@Abby-Wheelis In general, I am not a big fan of tweaking X and Y positions because, as you found out, it can be complicated to deal with overlaps. Is there a reason that we have to do this instead of just setting the x label? Since we use sharex and sharey, only one x label will be displayed. We don't need a special supxlabel call.

Abby-Wheelis commented 3 months ago

Is there a reason that we have to do this instead of just setting the x label? Since we use sharex and sharey, only one x label will be displayed. We don't need a special supxlabel call.

I was not aware of a specific reason - a simple set_xlabel works much better!

image