Skip to content

Commit 4c30d91

Browse files
alex-odysseuswiverngitOleg KuzikOleg Kuzik
authored
Temporal annual distribution functionality and temporal FeatureExtraction capability enablement (#2950)
--------- Co-authored-by: wivern <[email protected]> Co-authored-by: git <[email protected]> Co-authored-by: Oleg Kuzik <[email protected]> Co-authored-by: Oleg Kuzik <[email protected]> Co-authored-by: Chris Knoll <[email protected]> Co-authored-by: oleg-odysseus <[email protected]>
1 parent 061e9c3 commit 4c30d91

22 files changed

+438
-3
lines changed

js/const.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ define([
8383
data: 'description',
8484
className: context.classes('col-feature-descr'),
8585
},
86+
{
87+
title: ko.i18n('columns.supportsAnnual', 'Supports annual'),
88+
// data: 'supportsAnnual',
89+
render: context.renderSupportsAnnual(),
90+
className: context.classes('col-supports-annual'),
91+
},
92+
{
93+
title: ko.i18n('columns.supportsTemporal', 'Supports temporal'),
94+
render: context.renderSupportsTemporal(),
95+
className: context.classes('col-supports-temporal'),
96+
},
8697
... context.isEditPermitted() ? [{
8798
title: ko.i18n('columns.actions', 'Actions'),
8899
render: context.getRemoveCell('removeFeature'),

js/pages/characterizations/components/characterizations/CharacterizationAnalysis.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ define(function(require, exports){
1313
this.defaultName = ko.unwrap(constants.newEntityNames.characterization);
1414
this.name = ko.observable(data.name || this.defaultName);
1515
this.cohorts = ko.observableArray(data.cohorts);
16-
this.featureAnalyses = ko.observableArray(data.featureAnalyses);
16+
this.featureAnalyses = ko.observableArray(data.featureAnalyses || []);
17+
data.featureAnalyses && data.featureAnalyses.forEach(fa => {
18+
fa["includeAnnual"] = ko.observable(fa.includeAnnual);
19+
fa['includeTemporal'] = ko.observable(fa.includeTemporal);
20+
});
1721
this.parameters = ko.observableArray(data.parameters);
1822
this.strataConceptSets = ko.observableArray((data.strataConceptSets && data.strataConceptSets.map(cs => new ConceptSet(cs))) || []);
1923
this.strataOnly = ko.observable(data.strataOnly);

js/pages/characterizations/components/characterizations/characterization-view-edit/characterization-design.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
removeFeature: $component.removeFeature,
1818
isEditPermitted: $component.isEditPermitted
1919
"></linked-entity-list>
20+
<div><input type="checkbox" data-bind="enable: $component.isEditPermitted, checked: $component.includeAnnual"><span data-bind="css: classes('include-annual-option')">Include Prevalence Annual Distribution</span></div>
21+
<div><input type="checkbox" data-bind="enable: $component.isEditPermitted, checked: $component.includeTemporal"><span data-bind="css: classes('include-temporal-option')">Include Temporal Distribution</span></div>
2022
</div>
2123
<div data-bind="css: {'linked-entities':true, 'edit-disabled': !$component.isEditPermitted()}, eventListener: [
2224
{ event: 'click', selector: '.conceptset_import', callback:$component.handleConceptSetImport},

js/pages/characterizations/components/characterizations/characterization-view-edit/characterization-design.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,18 @@ define([
8181
data: ko.pureComputed(() => params.design() && params.design().parameters() || [])
8282
};
8383

84+
this.includeAnnual = ko.observable(this.featureAnalyses.data().reduce((a, b) => a || !!ko.unwrap(b.includeAnnual), false));
85+
this.includeAnnual.subscribe((newVal) => this.featureAnalyses.data().forEach(fa => fa.supportsAnnual && fa.includeAnnual(newVal)));
86+
this.includeTemporal = ko.observable(this.featureAnalyses.data().reduce((a, b) => a || !!ko.unwrap(b.includeTemporal), false));
87+
this.includeTemporal.subscribe((newVal) => this.featureAnalyses.data().forEach(fa => fa.supportsTemporal && fa.includeTemporal(newVal)));
88+
8489
this.showFeatureAnalysesBrowser = ko.observable(false);
8590

8691
this.isParameterCreateModalShown = ko.observable(false);
8792
this.showConceptSetBrowser = ko.observable(false);
8893
this.criteriaContext = ko.observable();
8994
this.tableOptions = commonUtils.getTableOptions('M');
95+
9096
}
9197

9298
checkStrataNames(data, event) {
@@ -110,6 +116,14 @@ define([
110116
}
111117
}
112118

119+
renderSupportsAnnual() {
120+
return (s, p, d) => ko.unwrap(d.supportsAnnual ? ko.i18n('options.yes', 'Yes') : ko.i18n('options.no', 'No'));
121+
}
122+
123+
renderSupportsTemporal() {
124+
return (s, p, d) => ko.unwrap(d.supportsTemporal ? ko.i18n('options.yes', 'Yes') : ko.i18n('options.no', 'No'));
125+
}
126+
113127
showFeatureBrowser() {
114128
this.showFeatureAnalysesBrowser(true);
115129
}
@@ -121,7 +135,8 @@ define([
121135
onSelect(data = []) {
122136
this.closeFeatureBrowser();
123137
const ccDesign = this.design();
124-
const featureAnalyses = data.map(item => lodash.pick(item, ['id', 'name', 'description']));
138+
const featureAnalyses = data.map(item => lodash.pick(item, ['id', 'name', 'description', 'supportsAnnual', 'supportsTemporal']))
139+
.map(item => { return { ...item, includeAnnual: ko.observable(ko.unwrap(this.includeAnnual)), includeTemporal: ko.observable(ko.unwrap(this.includeTemporal)) }});
125140
ccDesign.featureAnalyses(featureAnalyses);
126141
}
127142

js/pages/characterizations/components/characterizations/characterization-view-edit/characterization-design.less

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,12 @@
132132
}
133133
}
134134

135+
&__include-annual-option {
136+
margin-left: 0.5rem;
137+
}
138+
139+
&__include-temporal-option {
140+
margin-left: 0.5rem;
141+
}
142+
135143
}

js/pages/characterizations/components/characterizations/characterization-view-edit/characterization-results.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,13 @@ <h4 class="legend-header">Cohort Legend</h4>
212212
">
213213
<explore-prevalence params="explore: explore"></explore-prevalence>
214214
</atlas-modal>
215+
<atlas-modal params="
216+
showModal: $component.isTemporalShown,
217+
title: $component.exploreTemporalTitle,
218+
data: {
219+
temporalData: $component.exploreTemporalData(),
220+
}
221+
">
222+
<explore-temporal-cohort params="temporal: temporalData"></explore-temporal-cohort>
223+
</atlas-modal>
215224
</div>

js/pages/characterizations/components/characterizations/characterization-view-edit/characterization-results.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ define([
2727
'utils/ExceptionUtils',
2828
'services/file',
2929
'./explore-prevalence',
30+
'./explore-temporal-cohort',
3031
'less!./characterization-results.less',
3132
'components/visualizations/filter-panel/filter-panel',
3233
'components/visualizations/line-chart',
@@ -84,6 +85,7 @@ define([
8485
this.executionId = params.executionId;
8586
this.loadedExecutionId = null;
8687
this.data = ko.observable([]);
88+
this.temporal = [];
8789
this.domains = ko.observableArray();
8890
this.filterList = ko.observableArray([]);
8991
this.selectedItems = ko.pureComputed(() => filterUtils.getSelectedFilterValues(this.filterList()));
@@ -112,6 +114,10 @@ define([
112114
this.tableOptions = commonUtils.getTableOptions('M');
113115
this.datatableLanguage = ko.i18n('datatable.language');
114116

117+
this.isTemporalShown = ko.observable(false);
118+
this.exploreTemporalTitle = ko.observable();
119+
this.exploreTemporalData = ko.observable();
120+
115121
this.subscriptions.push(this.executionId.subscribe(id => id && this.loadData()));
116122
this.loadData();
117123
}
@@ -187,6 +193,12 @@ define([
187193
this.isExplorePrevalenceShown(true);
188194
}
189195

196+
exploreTemporal({temporal, temporalAnnual, temporalDataByCohort}, title) {
197+
this.exploreTemporalTitle(title);
198+
this.exploreTemporalData({temporal, temporalAnnual, temporalDataByCohort});
199+
this.isTemporalShown(true);
200+
}
201+
190202
async createNewSet(analysis) {
191203
this.loading(true);
192204
const conceptIds = this.extractConceptIds(analysis);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<div class="explore-temporal-cohort">
2+
<div class="upper-tabs" data-bind="foreach: tabs">
3+
<div data-bind="css: { active: $component.selectedTabKey() === key },
4+
click: $component.selectedTabKey.bind($component, key)">
5+
<span data-bind="text: title"></span>
6+
</div>
7+
</div>
8+
<div data-bind="with: $component.tabs.find(t => t.key === $component.selectedTabKey())">
9+
<div data-bind="component: { name: 'explore-temporal', params: componentParams }"></div>
10+
</div>
11+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
define([
2+
"knockout",
3+
"utils/CommonUtils",
4+
"components/Component",
5+
"utils/AutoBind",
6+
"text!./explore-temporal-cohort.html",
7+
"less!./explore-temporal-cohort.less",
8+
'components/tabs',
9+
'./explore-temporal',
10+
], function (ko, commonUtils, Component, AutoBind, view, tabs) {
11+
12+
class ExploreTemporalCohort extends AutoBind(Component) {
13+
constructor(params) {
14+
super(params);
15+
const temporal = params.temporal || {};
16+
this.temporalDataByCohort = temporal.temporalDataByCohort || {};
17+
18+
this.tabs = this.temporalDataByCohort.map(cohort => ({
19+
title: cohort.cohortName,
20+
key: cohort.cohortName,
21+
componentParams: { data: cohort.temporalInfo },
22+
}));
23+
this.selectedTabKey = ko.observable(this.tabs.length > 0 ? this.tabs[0].key : null);
24+
}
25+
}
26+
27+
commonUtils.build('explore-temporal-cohort', ExploreTemporalCohort, view);
28+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.explore-temporal-cohort {
2+
.upper-tabs {
3+
display: flex;
4+
justify-content: space-between;
5+
6+
div {
7+
flex: 1;
8+
border: 1px solid grey;
9+
padding: 5px;
10+
cursor: pointer;
11+
12+
&.active {
13+
background-color: lightgrey;
14+
}
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)