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

Allow the user to create bar charts in the DAD #130

Merged
merged 15 commits into from
May 21, 2019

Conversation

jeancochrane
Copy link
Contributor

@jeancochrane jeancochrane commented May 8, 2019

Overview

Closes #96, closes #97

Add logic for displaying bar charts for surveys in the data analysis designer.

Demo

test

Notes

There's officially enough data processing logic in the DAD (particularly in charts.js) that it would make sense for us to have tests. I didn't want to have to add the task of configuring a whole JavaScript test runner to the scope of this PR, so I opened up #131 instead.

Testing Instructions

  • Make sure you have surveys with questions and responses of each question type:
    • A custom Number (e.g. "How many fingers do you have?")
    • A preset observational question (e.g. gender_observational)
    • A preset intercept question with dropdown responses (e.g. "What is your gender?")
    • A preset intercept question with free response (e.g. "How old are you?")
  • On the Collected data view, try making charts for each question type and confirm that they look right

@jeancochrane jeancochrane changed the title [ WIP ] Allow the user to create Observational bar charts in the DAD [ WIP ] Allow the user to create bar charts in the DAD May 10, 2019
@jeancochrane jeancochrane changed the title [ WIP ] Allow the user to create bar charts in the DAD Allow the user to create bar charts in the DAD May 13, 2019
@jeancochrane jeancochrane requested a review from beamalsky May 13, 2019 19:03
Copy link
Contributor

@beamalsky beamalsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very fun to play with this, and this PR accomplishes a lot! A couple comments big and small below.

# the UIDs of Fobi form elements that can sensibly be turned into charts.

# "Count" types represent a single numeric value, and will be displayed as a median.
COUNT_TYPES = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a float field and submitted 3 values:

Screen Shot 2019-05-13 at 2 38 12 PM

Here's the chart it made me:

Screen Shot 2019-05-13 at 2 38 03 PM

What I'd expect to see here is a chart with an X axis of response values and a Y axis of how many times that response was submitted. Is there any case where an integer question would show anything other than a bar chart with a single bar? The single median value doesn't do much as a bar chart for me, and would be better displayed as a single number.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use case I'm thinking of here is specifically one where the user wants to compare the median of a survey to the medians of past surveys (not currently possible, but planned in #102). In that case, the chart would show a series of bars that are comparable.

Showing the count of each response seems dangerous to me since it's basically a free-response question and we could wind up with hundreds of slightly different responses. A variation of that approach might be to bin the data in some way and compare distributions, but then we'd have to know up front what the bins are, or bin them by e.g. quantiles and risking having quantiles that don't make sense if the data are very close together.

This seems like a case where a box plot could be a good compromise: in the single-survey case it would at least give a sense of the distribution of the answers, and in the multiple-survey case it would allow for more detailed comparisons. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All makes sense! I can't quite picture the UI for #102 yet, but I'm comfortable leaving this question open until you get to that issue. For single surveys a box or scatter plot makes sense to me.

@jeancochrane jeancochrane force-pushed the feature/jfc/display-dad-charts branch from d33c671 to 7098a0c Compare May 20, 2019 22:03
@jeancochrane jeancochrane requested a review from beamalsky May 20, 2019 22:16
@jeancochrane
Copy link
Contributor Author

@beamalsky I believe I addressed all your comments -- once tests pass, this should be ready for a second look!

Copy link
Contributor

@beamalsky beamalsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small thing:

For this age element, could the percentage have fewer decimals and a % sign at the end?

Screen Shot 2019-05-21 at 11 34 55 AM

Otherwise this looks great to me and ready to merge!

@jeancochrane jeancochrane force-pushed the feature/jfc/display-dad-charts branch from 78549e9 to cbab07b Compare May 21, 2019 20:44
@jeancochrane jeancochrane merged commit 1cde410 into master May 21, 2019
@jeancochrane jeancochrane deleted the feature/jfc/display-dad-charts branch May 21, 2019 20:49
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

Successfully merging this pull request may close these issues.

Allow intercept data sources in DAD Allow the user to create a bar chart in the DAD
2 participants