crf-heat-map
Advanced tools
Comparing version 1.3.2 to 2.0.0
{ | ||
"name": "crf-heat-map", | ||
"description": "Heat Map showing database form status at different levels", | ||
"version": "1.3.2", | ||
"version": "2.0.0", | ||
"author": "Rho, Inc.", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -20,3 +20,3 @@ # CRF Heat Map | ||
d3.csv( | ||
'https://raw.githubusercontent.com/RhoInc/viz-library/master/data/dataCleaning/dmc_DataPage.csv', | ||
'https://raw.githubusercontent.com/RhoInc/data-library/master/data/clinical-trials/data-cleaning/forms.csv', | ||
function(data) { | ||
@@ -23,0 +23,0 @@ crfHeatMap('body', {}).init(data); |
@@ -19,3 +19,3 @@ var pkg = require('../package'), | ||
'\n\`\`\`\n' + | ||
JSON.stringify(setting.defaultObject, null, 2) + | ||
JSON.stringify(setting.default, null, 2) + | ||
`\n\`\`\``; | ||
@@ -22,0 +22,0 @@ } |
@@ -6,41 +6,37 @@ The most straightforward way to customize the CRF Heat Map is by using a configuration object whose properties describe the behavior and appearance of the table. Since the CRF Heat Map is a Webcharts `table` object, many default Webcharts settings are set in the [webchartsSettings.js file](https://github.com/RhoInc/crf-heat-map/blob/master/src/configuration/webchartsSettings.js) as [described below](#webcharts-settings). Refer to the [Webcharts documentation](https://github.com/RhoInc/Webcharts/wiki/Chart-Configuration) for more details on these settings. | ||
# Renderer-specific settings | ||
The sections below describe each crf-heat-map setting as of version 1.3.2. | ||
The sections below describe each crf-heat-map setting as of version 2.0.0. | ||
## settings.nestings | ||
`array` | ||
## settings.site_col | ||
`string` | ||
an array of objects specifying the variables to nest the data by for calculations | ||
Specifies Site variable for nesting | ||
**default:** | ||
``` | ||
undefined | ||
``` | ||
**default:** `"sitename"` | ||
### settings.nestings[].value_col | ||
## settings.id_col | ||
`string` | ||
Value Column | ||
Specifies Subject variable for nesting and subject-level export | ||
**default:** none | ||
**default:** `"subjectnameoridentifier"` | ||
### settings.nestings[].label | ||
## settings.visit_col | ||
`string` | ||
Label | ||
Specifies Visit variable for nesting | ||
**default:** none | ||
**default:** `"folderinstancename"` | ||
### settings.nestings[].default_nesting | ||
`boolean` | ||
Default Nesting | ||
**default:** none | ||
### settings.nestings[].role | ||
## settings.form_col | ||
`string` | ||
Specify Optional Role | ||
Specifies Form variable for nesting | ||
**default:** none | ||
**default:** `"ecrfpagename"` | ||
@@ -56,3 +52,54 @@ | ||
``` | ||
undefined | ||
[ | ||
{ | ||
"col": "is_partial_entry", | ||
"type": "crfs", | ||
"label": "Entered", | ||
"description": "Data have been submitted in the EDC system." | ||
}, | ||
{ | ||
"col": "verified", | ||
"type": "crfs", | ||
"denominator": "needs_verification", | ||
"label": "Source Data Verified", | ||
"description": "All required fields have source data verification complete in EDC." | ||
}, | ||
{ | ||
"col": "ready_for_freeze", | ||
"type": "crfs", | ||
"label": "Ready for Freeze", | ||
"description": "All required cleaning is complete (e.g. SDV, queries resolved) and data are ready to be frozen in EDC." | ||
}, | ||
{ | ||
"col": "is_frozen", | ||
"type": "crfs", | ||
"label": "Frozen", | ||
"description": "Data have been frozen in the EDC system." | ||
}, | ||
{ | ||
"col": "is_signed", | ||
"type": "crfs", | ||
"denominator": "needs_signature", | ||
"label": "Signed", | ||
"description": "Data have been signed in the EDC system." | ||
}, | ||
{ | ||
"col": "is_locked", | ||
"type": "crfs", | ||
"label": "Locked", | ||
"description": "Data have been locked in the EDC system." | ||
}, | ||
{ | ||
"col": "open_query_ct", | ||
"type": "queries", | ||
"label": "Open", | ||
"description": "Site has not responded to issue." | ||
}, | ||
{ | ||
"col": "answer_query_ct", | ||
"type": "queries", | ||
"label": "Answered", | ||
"description": "Site has responded to issue, DM needs to review." | ||
} | ||
] | ||
``` | ||
@@ -63,3 +110,3 @@ | ||
Variable Name | ||
Variable name | ||
@@ -71,3 +118,3 @@ **default:** none | ||
Variable Type | ||
Variable type | ||
@@ -79,3 +126,3 @@ **default:** none | ||
Denominator for Proportion Calculation | ||
Variable to subset proportion calculations with. Generally this impacts only the denominator (e.g. you want the % of signed forms out of those that needed to be signed, not out of any forms that could be signed). Only for use with type='crfs'. | ||
@@ -87,3 +134,3 @@ **default:** none | ||
Table Header Label | ||
Table header label | ||
@@ -95,3 +142,3 @@ **default:** none | ||
Description for Info Bubbles | ||
Variable description that appears when hovering over table header | ||
@@ -105,7 +152,47 @@ **default:** none | ||
variables in the data with which to filter the data | ||
Variables | ||
**default:** | ||
``` | ||
undefined | ||
[ | ||
{ | ||
"value_col": "sitename", | ||
"label": "Site" | ||
}, | ||
{ | ||
"value_col": "subjectnameoridentifier", | ||
"label": "Subject ID" | ||
}, | ||
{ | ||
"value_col": "foldername", | ||
"label": "Folder" | ||
}, | ||
{ | ||
"value_col": "architectformname", | ||
"label": "Form" | ||
}, | ||
{ | ||
"value_col": "status", | ||
"label": "Subject Status", | ||
"multiple": true, | ||
"subject_export": true | ||
}, | ||
{ | ||
"value_col": "subjfreezeflg", | ||
"label": "Subject Freeze Status", | ||
"subject_export": true | ||
}, | ||
{ | ||
"value_col": "subset1", | ||
"label": "Subset 1" | ||
}, | ||
{ | ||
"value_col": "subset2", | ||
"label": "Subset 2" | ||
}, | ||
{ | ||
"value_col": "subset3", | ||
"label": "Subset 3" | ||
} | ||
] | ||
``` | ||
@@ -132,3 +219,3 @@ | ||
**default:** none | ||
**default:** `false` | ||
@@ -140,3 +227,3 @@ ### settings.filter_cols[].subject_export | ||
**default:** none | ||
**default:** `false` | ||
@@ -148,3 +235,3 @@ | ||
Specifies variable for determining order of ID with Visit role | ||
Variable for determining order of Visit column | ||
@@ -158,3 +245,3 @@ **default:** `"folder_ordinal"` | ||
Specifies variable for determining order of ID with Form role | ||
Variable for determining order of Form column | ||
@@ -165,6 +252,21 @@ **default:** `"form_ordinal"` | ||
## settings.default_nesting | ||
`array` | ||
Variables to summarize chart by on initial rendering | ||
**default:** | ||
``` | ||
[ | ||
"site_col", | ||
"id_col" | ||
] | ||
``` | ||
## settings.display_cell_annotations | ||
`boolean` | ||
displays cell annotations always or only on hover | ||
Displays cell annotations always or only on hover | ||
@@ -178,3 +280,3 @@ **default:** `true` | ||
expands all nests so that no rows are hidden | ||
Expands all nests so that no rows are hidden | ||
@@ -197,17 +299,8 @@ **default:** `false` | ||
If the number of rows to be drawn exceeds this number when the user checks 'Expand All' they will be prompted for confirmation | ||
Number of rows above which the user will be prompted for confirmation when expanding rows | ||
**default:** `10000` | ||
## settings.nesting_filters | ||
`boolean` | ||
Adds filters for each of the nesting variables | ||
**default:** `true` | ||
# Webcharts settings | ||
The object below contains each Webcharts setting as of version 1.3.2. | ||
The object below contains each Webcharts setting as of version 2.0.0. | ||
@@ -214,0 +307,0 @@ ``` |
@@ -5,57 +5,29 @@ { | ||
"overview": "The most straightforward way to customize the CRF Heat Map is by using a configuration object whose properties describe the behavior and appearance of the table. Since the CRF Heat Map is a Webcharts `table` object, many default Webcharts settings are set in the [webchartsSettings.js file](https://github.com/RhoInc/crf-heat-map/blob/master/src/configuration/webchartsSettings.js) as [described below](#webcharts-settings). Refer to the [Webcharts documentation](https://github.com/RhoInc/Webcharts/wiki/Chart-Configuration) for more details on these settings.\nIn addition to the standard Webcharts settings several custom settings not available in the base Webcharts library have been added to the CRF Heat Map to facilitate data mapping and other custom functionality. These custom settings are described in detail below and are set in the [rendererSettings.js file](https://github.com/RhoInc/crf-heat-map/blob/master/src/configuration/rendererSettings.js). All defaults can be overwritten by the passed configuration object.", | ||
"version": "1.3.2", | ||
"version": "2.0.0", | ||
"type": "object", | ||
"properties": { | ||
"nestings": { | ||
"title": "Data Nesting", | ||
"description": "an array of objects specifying the variables to nest the data by for calculations", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties":{ | ||
"value_col":{ | ||
"title":"Value Column", | ||
"type":"string" | ||
}, | ||
"label":{ | ||
"title":"Label", | ||
"type":"string" | ||
}, | ||
"default_nesting":{ | ||
"title":"Default Nesting", | ||
"type":"boolean" | ||
}, | ||
"role":{ | ||
"title":"Specify Optional Role", | ||
"type":"string" | ||
} | ||
} | ||
}, | ||
"default": [ | ||
{ | ||
"value_col" : "sitename", | ||
"label": "Site", | ||
"default_nesting": true, | ||
"role": "site_col" | ||
}, | ||
{ | ||
"value_col" : "subjectnameoridentifier", | ||
"label": "Subject ID", | ||
"default_nesting": true, | ||
"role": "id_col" | ||
}, | ||
{ | ||
"value_col" : "folderinstancename", | ||
"label": "Folder", | ||
"default_nesting": false, | ||
"role": "visit_col" | ||
}, | ||
{ | ||
"value_col" : "ecrfpagename", | ||
"label": "Form", | ||
"default_nesting": false, | ||
"role": "form_col" | ||
} | ||
] | ||
}, | ||
"site_col" : { | ||
"title": "Site Column", | ||
"description": "Specifies Site variable for nesting", | ||
"type": "string", | ||
"default": "sitename" | ||
}, | ||
"id_col" : { | ||
"title": "Subject ID Column", | ||
"description": "Specifies Subject variable for nesting and subject-level export", | ||
"type": "string", | ||
"default": "subjectnameoridentifier" | ||
}, | ||
"visit_col" : { | ||
"title": "Visit Column", | ||
"description": "Specifies Visit variable for nesting", | ||
"type": "string", | ||
"default": "folderinstancename" | ||
}, | ||
"form_col" : { | ||
"title": "Form Column", | ||
"description": "Specifies Form variable for nesting", | ||
"type": "string", | ||
"default": "ecrfpagename" | ||
}, | ||
"value_cols": { | ||
@@ -69,19 +41,19 @@ "title": "CRF and Query Columns", | ||
"col":{ | ||
"title":"Variable Name", | ||
"title":"Variable name", | ||
"type":"string" | ||
}, | ||
"type":{ | ||
"title":"Variable Type", | ||
"title":"Variable type", | ||
"type":"string" | ||
}, | ||
"denominator":{ | ||
"title":"Denominator for Proportion Calculation", | ||
"title":"Variable to subset proportion calculations with. Generally this impacts only the denominator (e.g. you want the % of signed forms out of those that needed to be signed, not out of any forms that could be signed). Only for use with type='crfs'.", | ||
"type":"string" | ||
}, | ||
"label":{ | ||
"title":"Table Header Label", | ||
"title":"Table header label", | ||
"type":"string" | ||
}, | ||
"description":{ | ||
"title":"Description for Info Bubbles", | ||
"title":"Variable description that appears when hovering over table header", | ||
"type":"string" | ||
@@ -103,4 +75,4 @@ } | ||
"filter_cols": { | ||
"title": "Data Filters", | ||
"description": "variables in the data with which to filter the data", | ||
"title": "Variables to interactively filter chart with", | ||
"description": "Variables ", | ||
"type": "array", | ||
@@ -120,7 +92,9 @@ "items": { | ||
"title":"Multi-select", | ||
"type": "boolean" | ||
"type": "boolean", | ||
"default":false | ||
}, | ||
"subject_export":{ | ||
"title":"Include variable in subject-level export", | ||
"type":"boolean" | ||
"type":"boolean", | ||
"default":false | ||
} | ||
@@ -131,23 +105,39 @@ } | ||
{ | ||
"value_col": "subset1", | ||
"label": "Subset 1" | ||
"value_col": "sitename", | ||
"label": "Site" | ||
}, | ||
{ | ||
"value_col": "subset2", | ||
"label": "Subset 2" | ||
"value_col": "subjectnameoridentifier", | ||
"label": "Subject ID" | ||
}, | ||
{ | ||
"value_col": "subset3", | ||
"label": "Subset 3" | ||
"value_col": "foldername", | ||
"label": "Folder" | ||
}, | ||
{ | ||
"value_col": "subjfreezeflg", | ||
"label": "Subject Freeze Status", | ||
"subject_export" : true | ||
"value_col": "architectformname", | ||
"label": "Form" | ||
}, | ||
{ | ||
"value_col": "status", | ||
"label": "Subject Status", | ||
"multiple": true, | ||
"subject_export" : true | ||
"value_col": "status", | ||
"label": "Subject Status", | ||
"multiple": true, | ||
"subject_export": true | ||
}, | ||
{ | ||
"value_col": "subjfreezeflg", | ||
"label": "Subject Freeze Status", | ||
"subject_export": true | ||
}, | ||
{ | ||
"value_col": "subset1", | ||
"label": "Subset 1" | ||
}, | ||
{ | ||
"value_col": "subset2", | ||
"label": "Subset 2" | ||
}, | ||
{ | ||
"value_col": "subset3", | ||
"label": "Subset 3" | ||
} | ||
@@ -158,3 +148,3 @@ ] | ||
"title": "Visit Order Column", | ||
"description": "Specifies variable for determining order of ID with Visit role", | ||
"description": "Variable for determining order of Visit column", | ||
"type": "string", | ||
@@ -165,9 +155,18 @@ "default": "folder_ordinal" | ||
"title": "Form Order Column", | ||
"description": "Specifies variable for determining order of ID with Form role", | ||
"description": "Variable for determining order of Form column", | ||
"type": "string", | ||
"default": "form_ordinal" | ||
}, | ||
"default_nesting" : { | ||
"title": "Default Nesting", | ||
"description": "Variables to summarize chart by on initial rendering", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"default": ["site_col", "id_col"] | ||
}, | ||
"display_cell_annotations": { | ||
"title": "Display Cell Annotations", | ||
"description": "displays cell annotations always or only on hover", | ||
"description": "Displays cell annotations always or only on hover", | ||
"type": "boolean", | ||
@@ -178,3 +177,3 @@ "default": true | ||
"title": "Expand All Rows", | ||
"description": "expands all nests so that no rows are hidden", | ||
"description": "Expands all nests so that no rows are hidden", | ||
"type": "boolean", | ||
@@ -191,13 +190,7 @@ "default": false | ||
"title": "Maximum Number of Rows Before Warning User", | ||
"description": "If the number of rows to be drawn exceeds this number when the user checks 'Expand All' they will be prompted for confirmation", | ||
"description": "Number of rows above which the user will be prompted for confirmation when expanding rows", | ||
"type": "number", | ||
"default": 10000 | ||
}, | ||
"nesting_filters": { | ||
"title": "Enable Nesting Variables Filters", | ||
"description": "Adds filters for each of the nesting variables", | ||
"type": "boolean", | ||
"default": true | ||
} | ||
} | ||
} |
export default function rendererSettings() { | ||
return { | ||
nestings: [ | ||
{ | ||
value_col: 'sitename', | ||
label: 'Site', | ||
default_nesting: true, | ||
role: 'site_col' | ||
}, | ||
{ | ||
value_col: 'subjectnameoridentifier', | ||
label: 'Subject ID', | ||
default_nesting: true, | ||
role: 'id_col' | ||
}, | ||
{ | ||
value_col: 'folderinstancename', | ||
label: 'Folder', | ||
default_nesting: false, | ||
role: 'visit_col' | ||
}, | ||
{ | ||
value_col: 'ecrfpagename', | ||
label: 'Form', | ||
default_nesting: false, | ||
role: 'form_col' | ||
} | ||
], | ||
site_col: 'sitename', | ||
id_col: 'subjectnameoridentifier', | ||
visit_col: 'folderinstancename', | ||
form_col: 'ecrfpagename', | ||
value_cols: [ | ||
@@ -84,17 +62,16 @@ { | ||
{ | ||
value_col: 'subset1', | ||
label: 'Subset 1' | ||
value_col: 'sitename', | ||
label: 'Site' | ||
}, | ||
{ | ||
value_col: 'subset2', | ||
label: 'Subset 2' | ||
value_col: 'subjectnameoridentifier', | ||
label: 'Subject ID' | ||
}, | ||
{ | ||
value_col: 'subset3', | ||
label: 'Subset 3' | ||
value_col: 'foldername', | ||
label: 'Folder' | ||
}, | ||
{ | ||
value_col: 'subjfreezeflg', | ||
label: 'Subject Freeze Status', | ||
subject_export: true | ||
value_col: 'architectformname', | ||
label: 'Form' | ||
}, | ||
@@ -106,2 +83,19 @@ { | ||
subject_export: true | ||
}, | ||
{ | ||
value_col: 'subjfreezeflg', | ||
label: 'Subject Freeze Status', | ||
subject_export: true | ||
}, | ||
{ | ||
value_col: 'subset1', | ||
label: 'Subset 1' | ||
}, | ||
{ | ||
value_col: 'subset2', | ||
label: 'Subset 2' | ||
}, | ||
{ | ||
value_col: 'subset3', | ||
label: 'Subset 3' | ||
} | ||
@@ -111,8 +105,8 @@ ], | ||
form_order_col: 'form_ordinal', | ||
default_nesting: ['site_col', 'id_col'], | ||
display_cell_annotations: true, | ||
expand_all: false, | ||
sliders: false, | ||
max_rows_warn: 10000, | ||
nesting_filters: true | ||
max_rows_warn: 10000 | ||
}; | ||
} |
@@ -7,13 +7,38 @@ export default function syncSettings(settings) { | ||
// Assign nest variables with specfic roles to specific settings | ||
settings.nestings.map(function(d) { | ||
if (typeof d.role != 'undefined') settings[d.role] = d.value_col; | ||
}); | ||
// catch user providing too many nesting columns | ||
if (settings.default_nesting.length > 3) { | ||
throw 'More than three default nesting columns were provided [' + | ||
settings.default_nesting.join(', ') + | ||
']. Only three variables can be nested at a time. Please reduce the number of variables in the default_nesting setting.'; | ||
} | ||
//Define initial nesting variables. | ||
settings.id_cols = settings.nestings | ||
.filter(d => d.default_nesting === true) | ||
.map(f => f.value_col) | ||
.slice(0, 3); | ||
settings.key_cols = []; | ||
settings.default_nesting.forEach(function(d) { | ||
settings.key_cols.push(settings[d]); | ||
}); | ||
settings.nestings = [ | ||
{ | ||
settings_col: 'site_col', | ||
label: 'Site' | ||
}, | ||
{ | ||
settings_col: 'id_col', | ||
label: 'Subject ID' | ||
}, | ||
{ | ||
settings_col: 'visit_col', | ||
label: 'Folder' | ||
}, | ||
{ | ||
settings_col: 'form_col', | ||
label: 'Form' | ||
} | ||
]; | ||
settings.nestings.forEach(function(d) { | ||
d.value_col = settings[d.settings_col]; | ||
}); | ||
//Define table column variables. | ||
@@ -20,0 +45,0 @@ settings.cols = d3.merge([['id'], settings.value_cols.map(d => d.col)]); |
@@ -45,7 +45,7 @@ import redraw from '../onLayout/customizeFilters/redraw'; | ||
var levelNum = d3.select(this.parentNode).datum(); | ||
return d.value_col == config.id_cols[levelNum]; | ||
return d.value_col == config.key_cols[levelNum]; | ||
}); | ||
//ensure natural nest control options and behavior | ||
customizeNestOptions.call(this, config.id_cols); | ||
customizeNestOptions.call(this, config.key_cols); | ||
@@ -82,3 +82,3 @@ idSelects.on('change', function() { | ||
//Update nesting variables. | ||
context.table.config.id_cols = uniqueLevels; | ||
context.table.config.key_cols = uniqueLevels; | ||
@@ -85,0 +85,0 @@ //Maintain nest options logic |
@@ -1,6 +0,6 @@ | ||
export default function customizeNestOptions(id_cols) { | ||
export default function customizeNestOptions(key_cols) { | ||
// disable third nest level when the second is not chosen | ||
this.containers.main | ||
.selectAll('#chm-nest-control--3') | ||
.property('disabled', id_cols.length === 1 ? true : false); | ||
.property('disabled', key_cols.length === 1 ? true : false); | ||
@@ -12,3 +12,3 @@ // hide options that are selected in higher level nests | ||
.style('display', function(d) { | ||
var ids = id_cols.slice(0, d3.select(this.parentNode).datum()); | ||
var ids = key_cols.slice(0, d3.select(this.parentNode).datum()); | ||
return ids.includes(d.value_col) ? 'none' : null; | ||
@@ -22,3 +22,3 @@ }); | ||
.filter(d => d.label === 'None') | ||
.style('display', id_cols.length === 3 ? 'none' : null); | ||
.style('display', key_cols.length === 3 ? 'none' : null); | ||
} |
@@ -7,3 +7,3 @@ export default function customizeNestSelects(idSelects) { | ||
//case 1: Set second nest to None if its value is selected in the first nest and no third nest is present | ||
if (first_nest.value == second_nest.value && this.table.config.id_cols.length == 2) { | ||
if (first_nest.value == second_nest.value && this.table.config.key_cols.length == 2) { | ||
second_nest.value = 'None'; | ||
@@ -13,3 +13,3 @@ } | ||
// case 2: Set second nest to the third nest's value if its value is selected in the first nest. Set third nest to none. | ||
if (first_nest.value == second_nest.value && this.table.config.id_cols.length == 3) { | ||
if (first_nest.value == second_nest.value && this.table.config.key_cols.length == 3) { | ||
second_nest.value = third_nest.value; | ||
@@ -16,0 +16,0 @@ third_nest.value = 'None'; |
@@ -38,2 +38,3 @@ export const firstColumnWidth = 16; | ||
' line-height: normal;' + | ||
' max-width: 2200px;' + | ||
'}', | ||
@@ -146,18 +147,19 @@ '.crf-heat-map {' + | ||
' font-size: 20px;' + | ||
' margin-bottom: 5px;' + | ||
'}', | ||
'.chm-other-controls {' + | ||
'.chm-filters {' + | ||
' display: flex;' + | ||
' flex-wrap: wrap ;' + | ||
' justify-content: space-evenly;' + | ||
' border-bottom: 1px solid lightgray;' + | ||
' padding-bottom: 7px;' + | ||
'}', | ||
'.chm-nesting-filters {' + | ||
'.chm-other-controls {' + | ||
' margin-top: 10px;' + | ||
' display: flex;' + | ||
' flex-wrap: wrap ;' + | ||
' margin-top: 10px;' + | ||
' flex-wrap: wrap;' + | ||
' justify-content: space-evenly;' + | ||
'}', | ||
'.chm-nesting-filter {' + | ||
' width : 100px !important;' + | ||
' display : block !important;' + | ||
'}', | ||
//checkboxes | ||
@@ -279,2 +281,3 @@ '.chm-checkbox {' + | ||
' display: table;' + | ||
' width: 100%;' + | ||
'}', | ||
@@ -281,0 +284,0 @@ '.wc-table {' + |
@@ -23,10 +23,10 @@ import customizeRows from './onDraw/customizeRows'; | ||
if (id[2]) { | ||
d[config.id_cols[2]] = id[2]; | ||
d[config.id_cols[1]] = id[1]; | ||
d[config.id_cols[0]] = id[0]; | ||
d[config.key_cols[2]] = id[2]; | ||
d[config.key_cols[1]] = id[1]; | ||
d[config.key_cols[0]] = id[0]; | ||
} else if (id[1]) { | ||
d[config.id_cols[1]] = id[1]; | ||
d[config.id_cols[0]] = id[0]; | ||
d[config.key_cols[1]] = id[1]; | ||
d[config.key_cols[0]] = id[0]; | ||
} else { | ||
d[config.id_cols[0]] = id[0]; | ||
d[config.key_cols[0]] = id[0]; | ||
} | ||
@@ -33,0 +33,0 @@ }); |
@@ -13,3 +13,3 @@ import iterateNest from './addRowDisplayToggle/iterateNest'; | ||
chart.expandable_rows = this.rows.filter(function(d) { | ||
return d.nest_level < config.id_cols.length - 1; | ||
return d.nest_level < config.key_cols.length - 1; | ||
}); | ||
@@ -16,0 +16,0 @@ |
@@ -9,3 +9,3 @@ export default function iterateNest() { | ||
// get the highest id level | ||
var max_id_level = chart.config.id_cols.length - 2; | ||
var max_id_level = chart.config.key_cols.length - 2; | ||
@@ -17,3 +17,3 @@ // loop through levels of nest and develop a dictionary with children for parent keys | ||
.nest() | ||
.key(d => d[config.id_cols[id_level]]) | ||
.key(d => d[config.key_cols[id_level]]) | ||
.rollup(function(rows) { | ||
@@ -20,0 +20,0 @@ if (id_level + 1 <= max_id_level) { |
@@ -81,3 +81,3 @@ import customizeRows from '../customizeRows'; | ||
chart.expandable_rows = chart.rows.filter(function(d) { | ||
return d.nest_level < chart.config.id_cols.length - 1; | ||
return d.nest_level < chart.config.key_cols.length - 1; | ||
}); | ||
@@ -84,0 +84,0 @@ |
@@ -6,8 +6,8 @@ export default function customizeRows(chart, rows) { | ||
'chm-table-row--expandable', | ||
d => d.id.split(' |').length < chart.config.id_cols.length | ||
d => d.id.split(' |').length < chart.config.key_cols.length | ||
) | ||
.classed( | ||
'chm-table-row--collapsed', | ||
d => d.id.split(' |').length < chart.config.id_cols.length | ||
d => d.id.split(' |').length < chart.config.key_cols.length | ||
); | ||
} |
export default function deriveData() { | ||
var table = this; | ||
this.export = { | ||
nests: this.config.id_cols.map((id_col, i) => `Nest ${i + 1}: ${id_col}`), | ||
nests: this.config.key_cols.map((id_col, i) => `Nest ${i + 1}: ${id_col}`), | ||
filters: this.filters.map( | ||
@@ -17,3 +17,3 @@ filter => | ||
const subject_id_col_index = this.config.id_cols.indexOf(this.config.id_col); | ||
const subject_id_col_index = this.config.key_cols.indexOf(this.config.id_col); | ||
const subject_id_col = subject_id_col_index > -1; | ||
@@ -68,4 +68,4 @@ | ||
// Now "join" subject level information to export data | ||
if ((this.config.site_col || this.config.subject_export_cols) && this.config.id_col) { | ||
// // Now "join" subject level information to export data | ||
if ((this.config.site_col || this.config.subject_export_cols) && subject_id_col) { | ||
const subjectID = d[`Nest ${subject_id_col_index + 1}: ${this.config.id_col}`]; | ||
@@ -72,0 +72,0 @@ Object.assign(d, subjectMap[subjectID]); |
@@ -47,3 +47,3 @@ export default function xlsx() { | ||
return { | ||
wpx: value_cols.indexOf(col) > -1 ? 75 : i < this.config.id_cols.length ? 125 : 100 | ||
wpx: value_cols.indexOf(col) > -1 ? 75 : i < this.config.key_cols.length ? 125 : 100 | ||
}; | ||
@@ -50,0 +50,0 @@ }); |
@@ -12,7 +12,7 @@ import calculateStatistics from './summarizeData/calculateStatistics'; | ||
//Summarize data by each ID variable. | ||
this.config.id_cols.forEach((id_col, i) => { | ||
this.config.key_cols.forEach((id_col, i) => { | ||
//Define ID variable. Each ID variable needs to capture the value of the previous ID variable(s). | ||
this.data.initial_filtered.forEach(d => { | ||
d.nest_level = i; | ||
d.id = this.config.id_cols | ||
d.id = this.config.key_cols | ||
.slice(0, i + 1) | ||
@@ -25,3 +25,3 @@ .map(id_col1 => d[id_col1]) | ||
d.parents.push( | ||
this.config.id_cols | ||
this.config.key_cols | ||
.slice(0, 2) | ||
@@ -34,3 +34,3 @@ .map(id_col1 => d[id_col1]) | ||
d.parents.push( | ||
this.config.id_cols | ||
this.config.key_cols | ||
.slice(0, 1) | ||
@@ -37,0 +37,0 @@ .map(id_col1 => d[id_col1]) |
@@ -6,4 +6,4 @@ export default function sortRows() { | ||
this.data.summarized = d3.merge(this.data.summaries).sort(function(a, b) { | ||
const formIndex = context.config.id_cols.indexOf(context.initial_config.form_col); | ||
const visitIndex = context.config.id_cols.indexOf(context.initial_config.visit_col); | ||
const formIndex = context.config.key_cols.indexOf(context.initial_config.form_col); | ||
const visitIndex = context.config.key_cols.indexOf(context.initial_config.visit_col); | ||
@@ -14,3 +14,3 @@ if (formIndex > -1 || visitIndex > -1) { | ||
var i; | ||
for (i = 0; i < context.config.id_cols.length; i++) { | ||
for (i = 0; i < context.config.key_cols.length; i++) { | ||
if (aIds[i] === bIds[i]) { | ||
@@ -17,0 +17,0 @@ continue; |
export default function formatControls() { | ||
const context = this; | ||
// assign classes based on control type and if it's a nesting filter | ||
const nest_vars = this.initial_config.nestings.map(nesting => nesting.value_col); | ||
// assign classes based on control type and if it's a nesting filter | ||
this.controls.controlGroups = this.controls.wrap | ||
.selectAll('.control-group') | ||
.attr('class', d => `control-group chm-${d.type}`) | ||
.classed('chm-nesting-filter', d => nest_vars.includes(d.value_col)); | ||
.attr('class', d => `control-group chm-${d.type}`); | ||
if (this.initial_config.nesting_filters) { | ||
//Group nesting filters | ||
this.controls.filters = { | ||
container: this.controls.wrap | ||
.insert('div', '.chm-nesting-filter') | ||
.classed('chm-control-grouping chm-nesting-filters', true) | ||
}; | ||
//Group filters | ||
this.controls.filters = { | ||
container: this.controls.wrap | ||
.insert('div') | ||
.classed('chm-control-grouping chm-filters', true) | ||
}; | ||
this.controls.filters.container | ||
.append('div') | ||
.classed('chm-control-grouping--label', true) | ||
.text('Nesting Filters'); | ||
this.controls.filters.container | ||
.append('div') | ||
.classed('chm-control-grouping--label', true) | ||
.text('Filters'); | ||
this.controls.filters.controlGroups = this.controls.wrap.selectAll('.chm-nesting-filter'); | ||
this.controls.filters.labels = this.controls.filters.controlGroups.selectAll( | ||
'.wc-control-label' | ||
); | ||
this.controls.filters.selects = this.controls.filters.controlGroups.selectAll('.changer'); | ||
this.controls.filters.controlGroups.each(function(d) { | ||
context.controls.filters.container.node().appendChild(this); | ||
}); | ||
} | ||
this.controls.filters.controlGroups = this.controls.wrap.selectAll('.chm-subsetter'); | ||
this.controls.filters.labels = this.controls.filters.controlGroups.selectAll( | ||
'.wc-control-label' | ||
); | ||
this.controls.filters.selects = this.controls.filters.controlGroups.selectAll('.changer'); | ||
this.controls.filters.controlGroups.each(function(d) { | ||
context.controls.filters.container.node().appendChild(this); | ||
}); | ||
@@ -38,3 +33,3 @@ //Group other controls | ||
container: this.controls.wrap | ||
.insert('div', ':first-child') | ||
.insert('div') | ||
.classed('chm-control-grouping chm-other-controls', true) | ||
@@ -48,3 +43,3 @@ }; | ||
this.controls.otherControls.controlGroups = this.controls.wrap.selectAll( | ||
'.control-group:not(.chm-nesting-filter)' | ||
'.control-group:not(.chm-subsetter)' | ||
); | ||
@@ -51,0 +46,0 @@ this.controls.otherControls.labels = this.controls.otherControls.controlGroups.selectAll( |
@@ -46,2 +46,5 @@ //utility functions | ||
//stylesheet | ||
defineStyles.call(crfHeatMap); | ||
//controls | ||
@@ -70,6 +73,3 @@ crfHeatMap.controls = createControls( | ||
//stylesheet | ||
defineStyles.call(crfHeatMap); | ||
return crfHeatMap; | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
259827
5843