Devographics/state-of-js-graphql-results-api

Query Builder/Filtering UI

SachaG opened this issue · 0 comments

(I'm opening this thread here even though it's more about the results UI because it's not really specific to any given results repo)

Problem

No matter which demographics we reach with the survey, we'll always have minoritized segments by definition. The issue is that these segments then get drowned out by the majority, and you can't always hear their voices. For example, if e.g. a JavaScript library was especially popular in a given country, or did a really great job reaching out to women, that wouldn't necessarily be reflected in the current survey results.

Solution

The solution would be a filtering/querying UI somewhat similar to the Mac OS search dialog, for example.

Screen Shot 2021-04-02 at 9 48 28

Scenarios

  • Show React trends in France.
  • Show Salary limited to Black/African-American women.
  • Show front-end rankings for women who earn more than $X in Spain.
  • etc.

Things to Consider

Flexibility vs Simplicity

Ideally, we'd support any combination of filters. At the same time, we can anticipate some filters being the most used (non-male, non-white, etc.) and it would make sense not to require people to re-specify them manually each time.

Operators

It'd be great to support in, not in, equal to, etc. operators for filtering.

In-chart vs Inter-chart

Do we want to compare chart A to chart B, or else within a single chart compare different datasets? In other words, having two different bar charts vs having a single bar chart with double bars for each datapoint (the first solution would be much easier to implement, the second one is not currently supported by the API and wouldn't work for some chart types).

Filtering All Charts

If someone lives in China they probably want to add the "China" filter to every chart without having to manually specify it each time.

State

Ideally, each chart would preserve its filtering state in case of a page reload, component re-rendering, etc.

Applicability

Can every filter be applied to every chart? How do we account for e.g. filtering the "gender identity" chart by "gender identity"? Disable it, return an error?

Sharing

Can we make the filtered charts shareable? Generating a dynamic thumbnail preview seems hard, but we can probably at least make them linkable? This means loading state via the URL?

Ideas

What I currently have in mind would be a system that provides predefined presets in combination with the ability to create your own custom filters. Ideally, once a custom filter is created it would then be available as a preset for all other charts to save people time.