unicef / carrotjuice2

Front end to resources repo. Defaults to Brazil but will eventually be virus and country agnostic.
1 stars 1 forks source link

CarrotJuice

Dependencies

Setup

Running tests

Mocha frontend tests use Mocha (to organize test suites and such) within the browser, to test components as they modify the DOM. You can either run these by simply going to localhost:8080/test.html, or running make phantomjs-tests (which uses Docker, suitable for running tests automatically via the command line).

New code path notes (React)

The new code path uses React, and P.js-based models (simple object-oriented classes). The relationship between views and models is like,

model

The design principles here are:

Developer API

Dictionary

Routes

Called from function: fetch_matrix_then_draw

Fetches diagonal of the mobility matrix. i.e. the number of people who've made two calls from the same tower. We think this is a measure of population density. It's a dynamic estimate. It changes from day.

Currently fetches matrix for one single day

The max value of the Diagonal of matrix is used to normalize all diagonal values. These values are used in the opacity of polygon colors to represent population density.

Called from function: fetch_geojson_for_divisions

Fetches geojson for either admin 2 polygons or voranoi cells to be displayed on map.

TODO(mikefab): Change 'division' to 'geojson'

Notes