-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cohort Definition Calculation Designer
- Loading branch information
Showing
14 changed files
with
154 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
define([ | ||
"knockout", | ||
"../CriteriaTypes/Measurement", | ||
"../CriteriaTypes", | ||
"../InputTypes/Range", | ||
], function ( | ||
ko, | ||
Measurement, | ||
CriteriaTypes, | ||
Range, | ||
){ | ||
function Calculation(data, conceptSets) { | ||
var self = this; | ||
data = data || {}; | ||
|
||
// var measurement = new Measurement((data.Measurement && data.Measurement.Measurement) ? data.Measurement.Measurement : {}, conceptSets); | ||
// self.Measurement = ko.observable({Measurement: measurement}); | ||
self.Measurement = ko.observable({ Measurement: new CriteriaTypes.Measurement((data.Measurement && data.Measurement.Measurement) ? data.Measurement.Measurement : {}, conceptSets) }); | ||
self.Operator = ko.observable(data.Operator || "-"); | ||
self.Limit = ko.observable(data.Limit || "First"); | ||
self.SameVisit = ko.observable(!!data.SameVisit); | ||
self.ValueAsNumber = ko.observable(new Range(data.ValueAsNumber)); | ||
} | ||
|
||
return Calculation; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
js/components/cohortbuilder/components/MeasurementOperand.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
define([ | ||
"knockout", | ||
"../options", | ||
"text!./MeasurementOperandTemplate.html", | ||
"less!./MeasurementOperand.less", | ||
], function ( | ||
ko, | ||
options, | ||
template, | ||
) { | ||
|
||
function MeasurementOperandViewModel(params) { | ||
var self = this; | ||
self.expression = ko.unwrap(params.expression); | ||
var criteria = ko.unwrap(params.criteria); | ||
self.Measurement = criteria.Measurement; | ||
self.Operator = criteria.Operator; | ||
self.Limit = criteria.Limit; | ||
self.SameVisit = criteria.SameVisit; | ||
self.ValueAsNumber = criteria.ValueAsNumber; | ||
self.options = options; | ||
} | ||
|
||
return { | ||
viewModel: MeasurementOperandViewModel, | ||
template: template, | ||
}; | ||
}); |
3 changes: 3 additions & 0 deletions
3
js/components/cohortbuilder/components/MeasurementOperand.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.measurement-operand { | ||
margin-bottom: 0.5rem; | ||
} |
15 changes: 15 additions & 0 deletions
15
js/components/cohortbuilder/components/MeasurementOperandTemplate.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div class="criteriaSection"> | ||
<div class="measurement-operand"> | ||
<select data-bind="options: $component.options.operatorOptions, value: $component.Operator"></select> | ||
<select data-bind="options: $component.options.eventsLimit, optionsText: 'name', optionsValue: 'id', value: $component.Limit"></select> | ||
<span data-bind="text: ko.i18n('components.conditionMeasurement.conditionMeasurement_32', 'of')">of</span> | ||
</div> | ||
<measurement-criteria params="{ criteria: ko.unwrap($component.Measurement), expression: ko.unwrap($component.expression) }"></measurement-criteria> | ||
<div class="measurement-operand"> | ||
<span data-bind="text: ko.i18n('components.conditionMeasurement.conditionMeasurementText_31', 'restricted to the same visit')"></span> <input type="checkbox" data-bind="checked: $component.SameVisit" /> | ||
</div> | ||
<div> | ||
<span data-bind="text: ko.i18n('components.conditionMeasurement.conditionMeasurementText_6', 'with calculated value as number')"></span> | ||
<numeric-range params="Range: ValueAsNumber"></numeric-range> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
js/components/cohortdefinitionviewer/components/MeasurementOperand.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
define([ | ||
"knockout", | ||
"text!./MeasurementOperandTemplate.html", | ||
], function ( | ||
ko, | ||
template, | ||
){ | ||
function MeasurementOperandViewModel(params) { | ||
var self = this; | ||
|
||
self.expression = ko.unwrap(params.expression); | ||
var criteria = ko.unwrap(params.criteria); | ||
self.Criteria = criteria; | ||
const measurement = criteria.Measurement; | ||
self.CodesetId = measurement.Measurement && measurement.Measurement.CodesetId; | ||
self.ValueAsNumber = criteria.ValueAsNumber; | ||
} | ||
|
||
return { | ||
viewModel: MeasurementOperandViewModel, | ||
template: template, | ||
}; | ||
}); |
9 changes: 9 additions & 0 deletions
9
js/components/cohortdefinitionviewer/components/MeasurementOperandTemplate.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- ko with: Criteria --> | ||
<span data-bind="text: Operator"></span> <span data-bind="text: ko.i18n('components.conditionMeasurement.conditionMeasurementText_1', 'a measurement of')"></span> | ||
<conceptset-reference params="{conceptSetId: $component.CodesetId, conceptSets: $component.expression.ConceptSets, defaultName: ko.i18n('components.conditionMeasurement.anyMeasurement', 'Any Measurement')}"></conceptset-reference> | ||
<!-- ko if: SameVisit --> | ||
<span data-bind="text:ko.i18n('components.conditionMeasurement.conditionMeasurementText_30', 'at the same visit')"></span> | ||
<!-- /ko --> | ||
<span data-bind="text: ko.i18n('components.conditionMeasurement.conditionMeasurementText_6', 'with value as number')"></span> | ||
<numeric-range-viewer params="Range: $component.ValueAsNumber"></numeric-range-viewer> | ||
<!-- /ko --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters