Giter Club home page Giter Club logo

ensemble's Introduction

Ensemble is the platform that powers the Firefox Public Data Report, a weekly public report on the activity, behavior, and hardware configuration of Firefox Desktop users.

Ensemble fetches data from ensemble-transposer, a JSON server that adds metadata to the raw data hosted by Mozilla data engineers.

Ensemble is written in React with the help of the wonderful create-react-app tool from Facebook. See the create-react-app documentation for more information. Some highlights and some additional information are provided here.

Run

For development

Run npm start

Any of the environment variables in .env can be overridden. For example:

REACT_APP_SITE_TITLE='Firefox Public Lore Report' npm start

In production

See the create-react-app documentation on deployment.

Any of the environment variables in .env can be overridden.

Development

Testing

Run npm test to run Jest, Nightwatch, and ESLint tests locally.

Nightwatch tests can optionally be run against the staging and production sites. Run npm run test:nightwatch:stage or npm run test:nightwatch:prod respectively.

Analyzing

To analyze the size of the JavaScript bundle that will be served, run npm run size.

Notes

Versioning

We maintain a version number for this project. We try to update it when we deploy new code. The version number is specified in package.json.

The number looks like a semantic version number, but semver isn't suitable for applications. We instead follow this basic guideline: the first number is incremented for major changes, the second number is incremented for medium changes, and the third number is incremented for small changes.

ensemble's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar mozilla-github-standards avatar openjck avatar pdehaan avatar renovate-bot avatar renovate[bot] avatar robotblake avatar spasovski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ensemble's Issues

Sort legends by y value

This should make them much easier to read. What we have now jumps around a lot... macOS Sierra, Windows Vista, Linux, macOS High Sierra, Windows XP, etc.

Ensemble support for re:dash data output format

sql.tmo outputs data in JSON and CSV in what appears to be a stable format. It could be nice to have a pathway from sql.tmo scheduled queries directly to ensemble dashboards.

The CSV format is a direct representation of the sql results table. The first row is the column names, subsequent rows are the data rows.

The JSON format is a little more ornate:

"query_result": {
  "retrieved_at": <timestamp>,
  "query_hash": <hash>,
  "query": <SQL>,
  "runtime": <number of seconds>,
  "id": <re:dash's id for the query>,
  "data_source_id": <some id for the data source (i.e., Athena is 26)>,
  "data_scanned": <some really large number, as a string>,
  "data": {
    "data_scanned": <some really large number, as a number>,
    "columns": [
      {"friendly_name": "col_name_1", "type": "datetime", "name": "col_name_1"},
      {"friendly_name": "col_name_2", "type": "string", "name": "col_name_2"},
      ...
    ],
    "rows": [
      {
        "col_name_1": "value_row_1_col_1",
        "col_name_4": "value_row_1_col_4",
        ...
      }, ...
    ]
  }
}

This ornateness comes with some fun extras like retrieved_at which lets you know when the query ran (and, thus, is a hint of how up-to-date the data might be).

Add caching

Cache the data that is coming in and only invalidate it something like once per hour so that loading a dashboard doesn't take a few seconds to load every time.

Add chart annotations

Feedback from the meeting with executives. We should add annotations (e.g., dotted vertical lines) to some charts.

Put Ensemble behind a CDN

Ensemble is completely static, so it can easily go behind a CDN. This would improve performance in non-US regions, although other work would be needed to make ensemble-transposer perform better in other regions, so putting Ensemble alone behind a CDN would have a pretty limited effect.

Support turning lines on and off by clicking corresponding legend items

This feature request came from Rob Miller:

one thing that would be awesome would be to have the ability to toggle lines on the graph by clicking them on the legend

For example, if someone clicks "Other", the population line for "Other" should disappear.

I don't think metrics-graphics supports this natively, but it may be possible to add this behavior without metrics-graphics doing it.

Re-implement the layout without CSS Grid

If we want Ensemble to be used more widely in the future, we'll need to forego the use of CSS Grid. CSS Grid is pretty well-supported in modern browsers, but IE and some other stragglers don't support it very well at all.

Fortunately, the Ensemble interface is pretty simple right now. Only 92 lines of CSS in total, and not all of that is layout.

Enable Greenkeeper

Enable Greenkeeper so that we don't need to manually watch for new versions of our dependencies.

Change favicon

Right now we're using the default create-react-app favicon, that little atom. We should use something else instead. I doubt anyone would mind if I grabbed the favicon from firefox.com and used that.

Support population "groups"

This is something that the Hardware Report currently supports for the GPU Model chart. There are three buttons: INTEL, NVIDIA, and AMD. Clicking one of them hides the population lines corresponding to that manufacturer.

Screenshot of the GPU Model chart and population buttons on the Firefox Hardware Report

This can be specified along with other metadata in an ensemble-transposer manifest. I'm not opposed to putting this metadata in the source dataset, but so far all metadata has gone into transposer manifests.

In other words, don't worry about how to format this. If you tell me what the groups are, I can set them up.

Don't show y=0 unless there is a data point near y=0

Su brought this up in Slack.

Some charts look essentially flat when they aren't because y=0 is shown whether or not there is a data point at y=0. We should just be aware that changing this will exaggerate any trends, including downward trends, whether temporary or otherwise.

Support tabular data

Provide a table for showing data like the top 10 add-ons.

It would be nice if users were able to change the date range of this data. For example, there could be a previous week and a next week button which would cause the data in the table to update accordingly.

onBlur must be used instead of onchange, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users

Tried adding eslint to this repo, along w/ the eslint-plugin-react and eslint-plugin-jsx-a11y plugins, and got a few almost interesting results:

/Users/pdehaan/dev/github/mozilla/ensemble/src/components/views/CustomizableDateMetric.js
  14:13  warning  onBlur must be used instead of onchange, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users  jsx-a11y/no-onchange

/Users/pdehaan/dev/github/mozilla/ensemble/src/components/views/Dashboard.js
  19:17  warning  onBlur must be used instead of onchange, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users  jsx-a11y/no-onchange

<select value={props.activeDate} onChange={props.onDateChange}>

<select name="category" value={props.activeCategory} onChange={props.onCategoryChange}>

No <label> field for the select boxes

Steps to reproduce:

  1. Go to https://metrics.mozilla.com/protected/usage-report-demo/dashboard/user-activity or https://metrics.mozilla.com/protected/usage-report-demo/dashboard/usage-behavior (LDAP).
  2. Click the Region: text.

Actual results:

It isn't a <label> for the <select> field, although the code thinks it is:

<div id="category">
<label htmlFor="category">Region</label>
<select name="category" value={props.activeCategory} onChange={props.onCategoryChange}>

Note that the <label> seems to have an htmlFor="category", which, IIRC, links to the <div id="category"> and not the <select name="category">. Per https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#attr-for:

for
The id of a labelable form-related element in the same document as the label element. The first such element in the document with an ID matching the value of the for attribute is the labeled control for this label element.

Localize content

This hasn't been requested yet, but it may be requested at some point in the future.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Support custom templates

Add some sort of templates with default values that users can override if desired. For example, the dashboard page might have a default template that shows two columns—one for charts and one for descriptions—but a user could override this template to show descriptions below charts.

I'm not sure how to accomplish this in React. It may or may not be possible to use nunjucks or another template library within React. Also, it's unclear how people would edit these templates if they host the site on Heroku or another service that does not have a persistent file system and thus may occasionally delete files added by the developer.

Remove [possibly unused] jQuery dependency?

More of a curiosity on whether it is used (and if so, how, since I can't find any references to it):

$ git grep jquery

package.json:    "jquery": "3.3.1",
yarn.lock:[email protected]:
yarn.lock:  resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
$ npx depcheck@latest
npx: installed 105 in 10.365s

Unused devDependencies
* yarn

Missing dependencies
* eslint-config-react-app
* babel-eslint
* eslint-plugin-import
* eslint-plugin-flowtype
* eslint-plugin-jsx-a11y
* eslint-plugin-react

Support multi-variable metrics

@SuYoungHong wrote about this in another issue. His comment is copied below.

@openjck , something I wanted to bring up. Looking more closely at how the grouping works in FHR, I think there's a slight difference from our data/behavior we want.

The GPU chart for FHR has multiple distinct lines (names of GPUs), each of which fall into 3 categories (intel, AMD, nvidia). clicking on the category buttons turns on/off the lines that fall into that category.

So the default behavior is show all lines, and a button click simply turns certain lines invisible.

For our data however, the data will not be distinct. For example, for our OS chart, say there are 3 lines (Win, Mac, Linux). There will be those same lines for each country category (All, US, DE, etc.). I'm not sure the "show everything, and hide certain lines when the category button is clicked" behavior will be ideal with our data.

Ideally, default behavior is show (Win, Mac, Linux) lines for the 'All' category, and when, lets say, the 'US' button is clicked, the (Win, Mac, Linux) lines changes to the values for US .

Example of our data (structure doesn't have to be exactly like this, we can organize it any way we want, even into separate jsons, but the data is essentially, for each country, the same fields, different values, as for all the other countries:

{date: 20170101,
 data: 
    {metrics: 
        {OS: 
          {All: {Win: 0.90, Mac: 0.08, Linux: 0.02}, 
           US: {Win: 0.80, Mac: 0.12, Linux: 0.08}, 
           ...}
        {YAU: 
          {All: 100, 
           US: 30, 
           ...}
         }
    }
}

Anyways, let me know if this is doable with ensamble, or if it's a pretty involved feature. If it's difficult to implement, we can just move forward with using data for 'All' and put off faceting by country for the launch, but would be awesome to have if possible!

  • Su

Change dashboard titles

Feedback from meeting with executives. Change these:

  • Health -> User Activity
  • Usage -> Usage Behavior

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.