Module: g

g

This module contains the parameters of the dashboard that have to be defined by the developer in order to tailor the tool to the specific needs of the future users. In the following we will look at the parameters needed to:

  • get the medical and geometry data,
  • check the medical and geometry data,
  • define the charts and maps, feed them with the correct data and define specific interaction,
All these parameters are defined in dev/dev-defined.js and are stored in the global variable g.

g stores other Objects as well that are not defined by the developer but that are the results of the processing and interactions. g can be accessed through your developer browser interface.


As a reminder, two other files are crucial when setting up a new version of the Dashboard which are:
  • the 'index.html' file which defines the divs and the positions of the charts and maps, and
  • the module:module-lang ('lang/module-lang.js') which contains all the text that have to be displayed and its various translations.

Since:
  • 1.0
TODO
  • Limit list of parameters in g.
  • Implement 'module_list' check to run or not the modules.

Requires

  • module:lang/lang.js

Members

static,constantmodule:g.geometry_dataObject

main-loadfiles

Stores geometry data parsed from the files in g.geometry_filelist and by the function module:main_loadfiles~queue_geometry.

static,constantmodule:g.geometry_filelistObject

dev-defined

Lists the geojson files when provided locally and gives their address. For each admNX in module:g.medical_headerlist there must be a corresponding geometry file listed here.
Each element in the object is coded in the following way:

admNX: './data/admnx.geojson',

TODO
  • Should be rethought via a data parser that can take either files or request files via APIs such as ArcGIS Online or other geoservers.

static,constantmodule:g.geometry_keylistArray.<String>

main-loadfiles

Stores keys of each administrative level extracted from the module:g.geometry_filelist.
Processing triggered in module:main_loadfiles~read_commons.

static,constantmodule:g.geometry_levellistObject

main-loadfiles

Stores a number associate with administrative level (0 is the wider, and the bigger is the lowest/smaller).
Processing triggered in module:main_loadfiles~read_commons.

static,constantmodule:g.geometry_loclistsObject.<Array.<String>>

main-loadfiles

Stores the name of the administrative elements extracted from module:g.geometry_data by module:main_loadfiles~queue_geometry. Names are formatted in the following way: 'AdmN0', 'AdmN1',... in order to manage efficiently pyramids and possible duplicates at lowest administrative levels.
Each administrative level is stored in a different Object.
Processing triggered in module:main_loadfiles~read_commons.

static,constantmodule:g.geometry_subnumObject

main-loadfiles

Stores the number of lowest administrative level within a given administrative level (eg. number of AdmN3 in AdmN2, AdmN1 and AdmN0). This is used to compute completeness module:g.medical_completeness in module:module_datacheck~dataprocessing > module:module_datacheck~completenessCheck.
Processing triggered in module:main_loadfiles~read_commons.

static,constantmodule:g.mask_bypassObject

main-loadfiles

Checks whether module:g.mask_filelist has been defined or not, and thus decide whether necessary to bypass the extra layers parsing step.

static,constantmodule:g.mask_dataObject

main-loadfiles

Stores mask data parsed from the files in g.mask_filelist and by the function module:main_loadfiles~queue_mask.

static,constantmodule:g.mask_filelistObject

dev-defined

Other layers can be parsed here to be displayed on the map (masks, admin divisions, labels...).
The elements are coded in the following way:

layer_key: './data/layer.geojson'

TODO
  • Should be rethought via a data parser that can take either files or request files via APIs.

staticmodule:g.medical_completenessObject

module-datacheck

Stores a percentage of completeness for each combination of administrative level and epiweek. All the module:g.medical_data is browsed in module:module_datacheck~dataprocessing. Percentage calculation is performed by module:module_datacheck~completenessCheck, combining records counting and numbers of lowest administrative division per administrative division stored in module:g.geometry_subnum.
Each combination of administrative level and epiweek is stored in a different Object.
Processing triggered in module:module_datacheck~dataprocessing.

staticmodule:g.medical_currentdiseaseString

main-core

static,constantmodule:g.medical_dataObject

main-loadfiles

static,constantmodule:g.medical_datatypeString

dev-defined

Defines the type of medical data parsed in the dashboard.

Currently accepted values are:

  • surveillance (aggregated) or
  • outbreak (linelist).

static,constantmodule:g.medical_diseaseslistArray.<String>

dev-defined

Defines an array of Disease to be used as an inlist check in module:module_datacheck~dataprocessing. In case the list of disease to follow is not predefined, an empty array must be parsed and the list of diseases will be created in module:module_datacheck~dataprocessing.

static,constantmodule:g.medical_filecurrentString

main-loadfiles

Stores the name of the file currently being read. Starts with the first file in the module:g.medical_filelist and then module:main_loadfiles~generate_display gives the user the option to choose between all the available files.

static,constantmodule:g.medical_filelistArray.<String>

main-loadfiles

Lists files in the datafolder that matches the extension criteria (currently .txt | .TXT | .csv | .CSV) in the module:g.medical_filelist_raw.

static,constantmodule:g.medical_filelist_rawArray.<String>

main-loadfiles

Lists the medical data files in the module:g.medical_folder folder path (uses Node server-side capability).

static,constantmodule:g.medical_filetypecurrentString

main-loadfiles

Stores the type of the file about to be read from module:g.medical_filecurrent in order to use the correct parsing method in module:main_loadfiles~queue_medical.

static,constantmodule:g.medical_folderString

main-loadfiles

Gets the medical data folder path (uses Node server-side capability).

static,constantmodule:g.medical_headerlistObject

dev-defined

Lists the keys used to refer to specific module:g.medical_data fields. It makes the link between headers in the data files and unambiguous keys used in the code.
Each element in the object is coded in the following way:

key_in_dashboard: 'header_in_datafile',

Currently implemented keys are:

  • General keys
    • epiweek for epidemiological week: format YYYY-WW,
    • admNX for names of administrative/health division levels (X being replaced by 0, 1, 2...). Multiple instances allowed.
    • pop for absolute population figures.
  • Outbreak keys (not limited to outbreak module:g.medical_datatype but generally observed in this context)
    • age for patient age in years,
    • sex for patient sex (eg. 1 = Male, 2 = Female),
    • preg for pregnant patient (eg. 1 = Pregnant, 2 = Not Pregnant or N/A),
    • sev for patient dehydration severity (eg. A = Light, B = Moderate, C = Severe),
    • dur for patient stay duration in days,
    • out for patient stay outcome (eg. 1 = Cured, 2 = Dead, 3 = Interrupted F/U, 4 = Transfered).
  • Surveillance keys (not limited to surveillance module:g.medical_datatype but generally observed in this context)
    • disease for disease name,
    • fyo for under or over Five Year Old indicator (eg. u = Under, o = Over),
    • case for number of cases overall,
    • mcase for number of male cases,
    • fcase for number of female cases,
    • death for number of deaths overall,
    • mdeath for number of male deaths,
    • fdeath for number of female deaths,
Example

Example usage for ERU Dashboard (light surveillance).

g.medical_headerlist = {
    epiwk: 'epiweek',
    admN1: 'ZS',
    disease: 'disease',
    case: 'nb_cases'
 }; 

static,constantmodule:g.medical_keylistArray.<String>

main-loadfiles

Lists from module:g.medical_headerlist the keys used to refer to specific module:g.medical_data fields. Defined in the Dashboard (might be different from the headers in the data files) in user-defined module:g.medical_headerlist.

static,constantmodule:g.medical_loclistsObject.<Array.<String>>

module-datacheck

Stores the name of the administrative elements extracted from module:g.medical_data by module:module_datacheck~testvalue. Names are formatted in the following way: 'AdmN0', 'AdmN1',... in order to manage efficiently pyramids and possible duplicates at lowest administrative levels. They are matched against names in module:g.geometry_loclists and names not corresponding are discarded.
Each administrative level is stored in a different Object.
Processing triggered in module:module_datacheck~dataprocessing.

static,constantmodule:g.medical_readObject.<String, Object>

dev-defined

Lists the keys from module:g.medical_headerlist that require custom parsing (eg. translate numbers into words).
Each element in the object is coded in the following way:

key_in_dashboard: {category1_in_medicaldata: 'user-readable_output1', category2_in_medicaldata: 'user-readable_output2', ...},

Currently implemented keys are:
  • sexpreg which is a combination of sex and preg from the key list,
  • sev,
  • dur,
  • out,
  • fyo,

TODO
  • Why is it in a function?

staticmodule:g.medical_weeklistArray

module-datacheck

Stores the list of weeks from epiwk fields of module:g.medical_data.
Processing triggered in module:module_datacheck~dataprocessing.

staticmodule:g.medical_yearlistArray

module-datacheck

Stores the list of years from epiwk fields of module:g.medical_data.
Processing triggered in module:module_datacheck~dataprocessing.

staticmodule:g.module_chartwarperObject

module-chartwarper

Stores all the global variables used by the module:module_chartwarper. To simplify, variables in the 'sub-module' domain will only appear there.

staticmodule:g.module_colorscaleObject

module-colorscale

Stores all the global variables used by the module:module_colorscale. To simplify, variables in the 'sub-module' domain will only appear there.

staticmodule:g.module_datatableObject

module-datatable

Stores all the global variables used by the module:module_datatable. To simplify, variables in the 'sub-module' domain will only appear there.

staticmodule:g.module_interfaceObject

module-interface

Stores all the global variables used by the module:module_interface. To simplify, variables in the 'sub-module' domain will only appear there.

staticmodule:g.module_introObject

module-intro

Stores all the global variables used by the module:module_intro. To simplify, variables in the 'sub-module' domain will only appear there.

staticmodule:g.module_langObject

module-lang

Stores all the global variables used by the module:module_lang. To simplify, variables in the 'sub-module' domain will only appear there.

staticmodule:g.module_multiadmObject

module-multiadm

Stores all the global variables used by the module:module_multiadm. To simplify, variables in the 'sub-module' domain will only appear there.

static,constantmodule:g.population_bypassObject

main-loadfiles

Checks whether module:g.population_filelist has been defined or not, and thus decide whether necessary to bypass the population data parsing step.

static,constantmodule:g.population_dataObject

main-loadfiles

Stores population data parsed from the files in g.population_filelist and by the function module:main_loadfiles~queue_population.

static,constantmodule:g.population_filelistObject

dev-defined

Gives the population file when provided locally and give its address. If pop is included in module:g.medical_headerlist there must be a corresponding population file here.
The element is coded in the following way:

pop: './data/pop.csv'

TODO
  • Should be rethought via a data parser that can take either files or request files via APIs.

static,constantmodule:g.population_headerlistObject

dev-defined

Lists the keys used to refer to specific module:g.population_data fields. It makes the link between headers in the data files and unambiguous keys used in the code.
Each element in the object is coded in the following way:

key_in_dashboard: 'header_in_datafile',

Currently implemented keys are:
  • admNx for administrative or medical division name, format: Adm1_name, Adm2_name...,
  • pop for population.

static,constantmodule:g.population_keylistObject.<Array.<String>>

main-loadfiles

Stores keys of each administrative level extracted from the module:g.population_filelist.
Processing triggered in module:main_loadfiles~read_commons.

static,constantmodule:g.population_loclistsObject.<Array.<String>>

main-loadfiles

Stores the name of the administrative elements extracted from module:g.population_data. Names should already be formatted in the following way: 'AdmN0', 'AdmN1',... in the source file in order to manage efficiently pyramids and possible duplicates at lowest administrative levels.
Each administrative level is stored in a different Object.
Processing triggered in module:main_loadfiles~read_commons.

static,constantmodule:g.population_popdataObject.<Array.<String>>

main-loadfiles

Restores population figures from module:g.population_data in order that each administrative level is stored in a different Object.
Processing triggered in module:main_loadfiles~read_commons.

staticmodule:g.viz_currentvaluesObject

main-core

Stores values currently displayed on the map. One object per administrative division.
Defined in module:main_core~chartBuilder > multiadm and populated by module:main_core~valueAccessor.

static,constantmodule:g.viz_definitionObject.<Object>

dev-defined

Lists the charts and maps to be produced by module:main-core as well as defines their main characteristics.
Each element in the object contains the following sub-elements:

 chart_id:  {

    // Defined by the developer:
    domain_type: {String},             // 'custom_ordinal' or 'custom_linear' or 'none', 
    chart_type: {String},              // 'bar' or 'multiadm' or 'row' or 'stackedbar' or 'pie' or 'series' or 'table',
    dimension_type: {String},          // 'auto' or 'custom' or 'shared', 
    dimension_setup: {Array},          // [chart_id or dimkey,'auto' ot 'custom'] (mandatory if 'shared'),
    group_type: {String},              // 'auto' or 'custom' or 'none',
    group_setup: {Array},              // [datakey,datakeyopt] ('datakey' mandatory if 'surveillance', 'datakeyopt' if 'stackedbar'),
    display_axis: {Object},            // {x:'labelx',y:'labely'} (for x/y-type charts),
    display_colors: {Array.<Integer>}, // Refers to colors in g.color_domain,            
    display_intro: {String},           // 'top' or 'bottom' or 'right' or 'left' or 'none',
    display_idcontainer: {String},     // To display buttons on a div different from: chart-'chart_id' 
    buttons_list: {Array.<String>},    // ['reset','help'] - any, all or none of the two for most of charts plus 'expand','lockcolor' and 'parameters' for 'multiadm' charts,
    sync_to: {Array.<String>},         // ['chart_id's] - sync filtering with other charts

    // Processed by the dashboard:
    chart: {Object},                   // module:main\_core~chartInstancer & module:main\_core~chartBuilder
    dimension: {Object},               // module:main\_core~dimensionBuilder
    domain: {Array},                   // module:main\_core~domainBuilder
    group: {Object},                   // module:main\_core~groupBuilder

 }


Each element is detailed in the following.

  • chart_id, 'chart-'chart_id must match a div id in the index.html file (the dashboard layout).
  • domain_type Definitions in: module:main_core~domainBuilder.
    If =/= 'none', a custom domain is built. The chart_id is used to select the domain building method.

  • chart_type Definitions in: module:main_core~chartInstancer and module:main_core~chartBuilder (neither of these are properly declared as a method...).

  • dimension_type Can be: 'auto' or 'custom' or 'shared' - Definitions in module:main_core~dimensionBuilder.
    • If == 'auto' - the dimension is assumed not to be shared - that means that 'auto' is the dimension building method and chart_id is used to select the field to filter in module:g.medical_data.
    • If == 'custom' - the dimension is assumed not to be shared - that means that 'chart_id' is the dimension building method and it is used as well to select the field to filter in module:g.medical_data (when not overridden by the dimension builder definition).
    • If == 'shared' - dimension_setup parameter is compulsory.
      • dimension_setup[0] is the chart_id of the chart with which the dimension is shared or the common identifier for the dimension
      • dimension_setup[1] can be 'auto' or 'custom' (just like a non-'shared' dimension...)
        • If == 'auto' that means that 'auto' is the dimension building method and dimension_setup[0] is used to select the field to filter in module:g.medical_data.
        • If == 'custom' that means that dimension_setup[0] is the dimension building method and it is used as well to select the field to filter in module:g.medical_data (when not overridden by the dimension builder definition).
      Classical dimensions are stored under [chart_id].dimension in the module:g.viz_definition object. Whereas shared dimensions are stored under [dimension_setup[0]].dimension.

    • group_type Can be: 'auto' or 'custom' or 'shared' (or 'none' for the data table) - Definitions in module:main_core~groupBuilder.
      • If == 'auto', that means that 'auto' is the group building method.
      • If == 'custom', that means that 'chart_type' is the group building method.
      Groups building instruction are specific to each module:g.medical_datatype. If module:g.medical_datatype == 'surveillance' - group_setup parameter is compulsory. It is an Array where:
      • group_setup[0] is used to select the field to count or sum in module:g.medical_data. NB: In a 'outbreak' setting, records are counted from the patient list without a reference to a field.
      • group_setup[1] is used to select the field to create categories for stacked charts (chart_type == stackedbar. NB: Stacked chart have not been used yet in a 'outbreak' setting.

Example

Example usage for ERU Dashboard (light surveillance).

g.viz_definition = {
    multiadm: { 
        domain_type: 'none',            
        chart_type: 'multiadm',
        dimension_type: 'custom',  
        group_type: 'custom',
        group_setup: ['case'],
        display_colors: [0,1,2,3,4,5],  
        display_intro: 'bottom',
        buttons_list: ['reset','help','expand','lockcolor','parameters'],
    },
    disease:  { 
        domain_type: 'none',
        chart_type: 'row',
        dimension_type: 'custom',   
        group_type: 'custom',
        group_setup: ['case'],
        display_axis:   {
            x:g.module_lang.text[g.module_lang.current].chart_disease_labelx,
            y:g.module_lang.text[g.module_lang.current].chart_disease_labely
        },
        display_colors: [2],            
        display_intro: 'right',
        buttons_list: ['help'],
    },       
    case_bar:  {  
        domain_type: 'custom_ordinal',   
        chart_type: 'bar',
        dimension_type: 'custom',       
        dimension_setup: ['epiwk','auto','case'],
        group_type: 'auto',
        group_setup: ['case'],
        display_axis:   {
            x:g.module_lang.text[g.module_lang.current].chart_case_labelx,
            y:g.module_lang.text[g.module_lang.current].chart_case_labely
        },
        display_colors: [4,2],            
        display_intro: 'top',           
        display_idcontainer: 'chart-case_bar',
        buttons_list: ['reset','help'],
    },      
    case_lin:  {   
        domain_type: 'custom_linear',   
        chart_type: 'series',
        dimension_type: 'shared',       
        dimension_setup: ['epiwk_lin','custom','case'],
        group_type: 'auto',
        group_setup: ['case'],
        display_axis:   {
            x:g.module_lang.text[g.module_lang.current].chart_case_labelx,
            y:g.module_lang.text[g.module_lang.current].chart_case_labely
        },
        display_colors: [4,2],            
        display_intro: 'top',           
        display_idcontainer: 'chart-case_lin',
        buttons_list: ['help'],
    },
    year:    {   
        domain_type: 'none',            
        chart_type: 'pie',
        dimension_type: 'custom',       
        group_setup: ['case'],
        group_type: 'auto',
        display_intro: 'left',
        display_idcontainer: 'chart-year',
        buttons_list: ['reset','help'],
    },
    table:  {   
        domain_type: 'none',            
        chart_type: 'table',
        dimension_type: 'custom',       
        group_type: 'none',
        display_intro: 'top',
        buttons_list: ['help'],
    }
};

staticmodule:g.viz_keylistArray

main-core

Lists id_chart from module:g.viz_definition (defined in de/dev-defined.js).

static,constantmodule:g.viz_timelineString

dev-defined

Defines the chart used as a reference for time-related interactions.

static,constantmodule:g.viz_timeshareArray.<String>

dev-defined

Defines the charts that are using time dimensions and that should be synchronized with the reference defined with module:g.viz_timeline.