Skip to content

Commit

Permalink
remove details sync logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jwildfire committed May 20, 2019
1 parent 78e91a2 commit 14f36ea
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 104 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 0 additions & 55 deletions safetyOutlierExplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,61 +376,6 @@
settings.unscheduled_visit_regex = new RegExp(pattern, flags);
}

//Define default details.
var defaultDetails = [{ value_col: settings.id_col, label: 'Participant ID' }];
if (Array.isArray(settings.filters))
settings.filters
.filter(function(filter) {
return filter.value_col !== settings.id_col;
})
.forEach(function(filter) {
return defaultDetails.push({
value_col: filter.value_col ? filter.value_col : filter,
label: filter.label
? filter.label
: filter.value_col
? filter.value_col
: filter
});
});
defaultDetails.push({ value_col: settings.value_col, label: 'Result' });
if (settings.normal_col_low)
defaultDetails.push({
value_col: settings.normal_col_low,
label: 'Lower Limit of Normal'
});
if (settings.normal_col_high)
defaultDetails.push({
value_col: settings.normal_col_high,
label: 'Upper Limit of Normal'
});

//If [settings.details] is not specified:
if (!settings.details) settings.details = defaultDetails;
else {
//If [settings.details] is specified:
//Allow user to specify an array of columns or an array of objects with a column property
//and optionally a column label.
settings.details.forEach(function(detail) {
if (
defaultDetails
.map(function(d) {
return d.value_col;
})
.indexOf(detail.value_col ? detail.value_col : detail) === -1
)
defaultDetails.push({
value_col: detail.value_col ? detail.value_col : detail,
label: detail.label
? detail.label
: detail.value_col
? detail.value_col
: detail
});
});
settings.details = defaultDetails;
}

return settings;
}

Expand Down
48 changes: 0 additions & 48 deletions src/configuration/syncSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,53 +80,5 @@ export default function syncSettings(settings) {
settings.unscheduled_visit_regex = new RegExp(pattern, flags);
}

//Define default details.
let defaultDetails = [{ value_col: settings.id_col, label: 'Participant ID' }];
if (Array.isArray(settings.filters))
settings.filters
.filter(filter => filter.value_col !== settings.id_col)
.forEach(filter =>
defaultDetails.push({
value_col: filter.value_col ? filter.value_col : filter,
label: filter.label
? filter.label
: filter.value_col
? filter.value_col
: filter
})
);
defaultDetails.push({ value_col: settings.value_col, label: 'Result' });
if (settings.normal_col_low)
defaultDetails.push({ value_col: settings.normal_col_low, label: 'Lower Limit of Normal' });
if (settings.normal_col_high)
defaultDetails.push({
value_col: settings.normal_col_high,
label: 'Upper Limit of Normal'
});

//If [settings.details] is not specified:
if (!settings.details) settings.details = defaultDetails;
else {
//If [settings.details] is specified:
//Allow user to specify an array of columns or an array of objects with a column property
//and optionally a column label.
settings.details.forEach(detail => {
if (
defaultDetails
.map(d => d.value_col)
.indexOf(detail.value_col ? detail.value_col : detail) === -1
)
defaultDetails.push({
value_col: detail.value_col ? detail.value_col : detail,
label: detail.label
? detail.label
: detail.value_col
? detail.value_col
: detail
});
});
settings.details = defaultDetails;
}

return settings;
}

0 comments on commit 14f36ea

Please sign in to comment.