CovInce
CovInce is an an application built in React for visualising numbers and proportions of lineages for cases of SARS-CoV2. It is currently used primarily for the spatiotemporal displays at https://covid19.sanger.ac.uk/ and https://covglobe.org/.
If you would like to deploy your own version of covince and need assistance please raise an issue and we will try to help.
Demo of the code in this repository (with old static data): http://covince.vercel.app
Configuration
Top-level sections
area_search_terms
(optional) enable additional search terms for areaschart [object]
definitions [array]
list of chart definitionssettings [object]
(optional)
chart_tooltip [object]
[DEPRECATED - usechart.settings
.tooltip
]use_nomenclature [boolean]
defaults to true
charts [array]
list of chart definitions [DEPRECATED - usechart.definitions
]colors [object|array]
(optional, static builds only) lineages mapped to color definitions, or a list of ordered colors. Optionally provide dark mode alternatives in the format{ "light": "...", "dark": "..." }
datetime_format [string]
for e.g. data updated date referencedynamic_mode [object]
(required for dynamic builds)initial_lineages [array|object]
list of lineages, or an object mapping lineages to a numerical index in the colour palette. Numbers must be 0-8 for the built-in palette.colour_palette [array]
(optional) list of color definitions or ordered colours. Optionally provide dark mode alternatives in the format{ "light": "...", "dark": "..." }
mutations ['single'|'multi']
(optional) enable mutation features, and whether multiple mutations can be selected
map [object]
fade_uncertainty [{[parameter_id]: boolean}]
(optional) enable fade uncertainty for specific parameterssettings [object]
(optional)viewport [object]
nomenclature [array]
(optional) list of nomenclature definitions, the order will be reflected on the UIontology [object]
parameters [array]
list of parameter definitionstimeline [object]
(optional)
Area Search Terms
url [string]
should load a JSON file with the following structure:{ "search_term": "area_id", ... }
mode [string]
type of search to apply to additional terms:padded-first-input-token
pads the term to the length of the input and matches against the first token of the input padded to the original length
Chart settings
csv_download [boolean]
(optional) defaults to truetooltip [object]
(optional)use_nomenclature [boolean]
defaults to true
group_stacked_colors [boolean]
(optional) reorder stacked areas to group colours together, defaults to true
Chart
allow_stack [boolean]
(optional) enables stackingdefault_type ['line'|'area']
heading [string]
parameter [string]
should match a parameter idpreset ['percentage']
(optional) applies formatting rules [DEPRECATED - useparameter
.format
]y_axis [object]
(optional)
Chart Y-Axis
domain [number[]]
(optional) referenceticks [string[]]
(optional) referencereference_line [number]
(optional) display a dotted line at the specified valueallow_data_overflow [boolean]
(optional) reference
Map settings
default_lineage [string]
(optional) should match a lineage in lists, defaults to first lineagedefault_color_by [string]
(optional) should match a parameter id, defaults to first parameterdefault_color_scale ['linear'|'quadratic'|{[parameter_id]: 'linear'|'quadratic'}]
(optional) can be a string for all parameters, or an object for specific parameters. Omit parameters from the object to hide the scale control.color_map_domain [{[parameter_id]: object}]
(optional) set the range of the colour map per parameter. Object should provide at least one of:- min [number] (optional) minimum value of the color map
- max [number] (optional) maximum value of the color map
Map viewport
min_zoom [number]
referencedefault_lat [number]
referencedefault_lon [number]
referencedefault_zoom [number|object]
reference provide a number for all screen types, or an object with properties:mobile
,desktop
,big
default_zoom_mob [number]
Mobile option where proportions are different reference [DEPRECATED - usedefault_zoom.mobile
]bounds [object]
Nomenclature
lineage [string]
should match a lineage in listsalt_name [string]
alternative name
Ontology
overview [object]
category [string]
e.g. "National Overview"heading [string]
e.g. "England"short_heading [string]
e.g. "National"
area [object]
category [string]
e.g. "Local authority"noun_plural [string]
e.g. "local authorities"
Parameter
id [string]
display [string]
format ['percentage']
(optional) values should be 0-1 and are formatted as percentagesprecision [number|object]
(optional) decimal places for values, can a number for all values or an object with the following required keys:mean [number]
range [number]
Timeline
label [string]
(optional) e.g. "timeline",initial_date [string]
(optional) should be in ISO format e.g. "2021-01-01", defaults to latest datedate_format [string|object]
(optional) can be a string for all dates or an object with the following required keys:frame_length [number]
(optional) time in milliseconds per date when playing the timeline. Defaults to 100.
Development
Install dependencies
yarn install
Start dev server
yarn dev
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Build:
npm run build
Contributors
Richard Goater |
Theo Sanderson |
Harald Vöhringer |