From ba299f78cbc32eda7e11796d5a8ebc3c8a923935 Mon Sep 17 00:00:00 2001 From: Juan Carlos Namendi Pineda Date: Mon, 15 Jan 2024 13:58:31 -0600 Subject: [PATCH 01/22] adjust filter cohort definitions with add more options of timer filter --- .../cohortbuilder/CohortExpression.js | 13 ++++++- .../EndStrategies/CustomEraStrategy.js | 28 ++++++++++++++- .../EndStrategies/DateOffsetStrategy.js | 12 +++++++ .../cohortbuilder/InputTypes/Window.js | 30 ++++++++++++++-- .../CohortExpressionEditorTemplate.html | 16 ++++++--- .../components/CustomEraStrategyTemplate.html | 30 ++++++++++------ .../DateOffsetStrategyTemplate.html | 16 +++++---- .../components/WindowInputTemplate.html | 36 ++++++++++++------- js/components/cohortbuilder/options.js | 12 +++++++ 9 files changed, 155 insertions(+), 38 deletions(-) diff --git a/js/components/cohortbuilder/CohortExpression.js b/js/components/cohortbuilder/CohortExpression.js index e5df5af3a..0389f4643 100644 --- a/js/components/cohortbuilder/CohortExpression.js +++ b/js/components/cohortbuilder/CohortExpression.js @@ -27,10 +27,21 @@ define(function (require, exports) { self.CensoringCriteria = ko.observableArray(data.CensoringCriteria && data.CensoringCriteria.map(function (criteria) { return CriteriaTypes.GetCriteriaFromObject(criteria, self.ConceptSets); })); - self.CollapseSettings = {CollapseType: ko.observable(data.CollapseSettings && data.CollapseSettings.CollapseType || "ERA"), EraPad: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPad || 0 ) } + self.CollapseSettings = { CollapseType: ko.observable(data.CollapseSettings && data.CollapseSettings.CollapseType || "ERA"), EraPad: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPad || 0 ), EraPadUnitValue: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPadUnitValue || 0), EraPadUnit: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPadUnit || 'day') } self.CensorWindow = ko.observable(new Period(data.CensorWindow)); self.cdmVersionRange = data.cdmVersionRange || null; + + self.CollapseSettings.EraPadUnitValue.subscribe(function (newValue){ + const insertValue = newValue.toString().replace(/[\D\.]/g, ''); + self.CollapseSettings.EraPadUnitValue(insertValue ? Number(insertValue) : 0); + self.CollapseSettings.EraPadUnit() === 'day' && self.CollapseSettings.EraPad(insertValue ? Number(insertValue) : 0); + }) + + self.CollapseSettings.EraPadUnit.subscribe(function (newValue){ + self.CollapseSettings.EraPad(newValue === 'day' ? self.CollapseSettings.EraPadUnitValue() : 0); + }) + } return CohortExpression; }); \ No newline at end of file diff --git a/js/components/cohortbuilder/EndStrategies/CustomEraStrategy.js b/js/components/cohortbuilder/EndStrategies/CustomEraStrategy.js index 4a6addddb..b78d4fe81 100644 --- a/js/components/cohortbuilder/EndStrategies/CustomEraStrategy.js +++ b/js/components/cohortbuilder/EndStrategies/CustomEraStrategy.js @@ -6,7 +6,11 @@ define(['knockout'], function (ko) { self.DrugCodesetId = ko.observable(data.DrugCodesetId); self.GapDays = ko.observable(data.GapDays || 0); + self.GapUnit = ko.observable(data.GapUnit || 'day'); + self.GapUnitValue = ko.observable(data.GapUnitValue || 0); self.Offset = ko.observable(data.Offset || 0); + self.OffsetUnitValue = ko.observable(data.OffsetUnitValue || 0); + self.OffsetUnit = ko.observable(data.OffsetUnit || 'day'); self.DaysSupplyOverride = ko.observable(data.DaysSupplyOverride); // set up subscription to update DrugCodesetId if the item is removed from conceptSets @@ -17,7 +21,29 @@ define(['knockout'], function (ko) { self.DrugCodesetId(null); } }); - }, null, "arrayChange"); + }, null, "arrayChange"); + + self.OffsetUnitValue.subscribe(function (newValue){ + const insertValue = newValue.toString().replace(/[\D\.]/g, ''); + self.OffsetUnitValue(insertValue ? Number(insertValue) : 0); + self.OffsetUnit() === 'day' && self.Offset(insertValue ? Number(insertValue) : 0); + }) + + self.OffsetUnit.subscribe(function (newValue){ + self.GapUnit(newValue); + self.Offset(newValue === 'day' ? self.OffsetUnitValue() : 0); + }) + + self.GapUnitValue.subscribe(function (newValue){ + const insertValue = newValue.toString().replace(/[\D\.]/g, ''); + self.GapUnitValue(insertValue ? Number(insertValue) : 0); + self.GapUnit() === 'day' && self.GapDays(insertValue ? Number(insertValue) : 0); + }) + + self.GapUnit.subscribe(function (newValue){ + self.OffsetUnit(newValue); + self.GapDays(newValue === 'day' ? self.GapUnitValue() : 0); + }) } CustomEraStrategy.prototype.toJSON = function () { diff --git a/js/components/cohortbuilder/EndStrategies/DateOffsetStrategy.js b/js/components/cohortbuilder/EndStrategies/DateOffsetStrategy.js index ce5ce53bc..a0c8f8b69 100644 --- a/js/components/cohortbuilder/EndStrategies/DateOffsetStrategy.js +++ b/js/components/cohortbuilder/EndStrategies/DateOffsetStrategy.js @@ -6,6 +6,18 @@ define(['knockout'], function (ko) { self.DateField = ko.observable(data.DateField || "StartDate"); self.Offset = ko.observable(data.Offset || 0); + self.OffsetUnitValue = ko.observable(data.OffsetUnitValue || 0); + self.OffsetUnit = ko.observable(data.OffsetUnit || 'day'); + + self.OffsetUnitValue.subscribe(function (newValue){ + const insertValue = newValue.toString().replace(/[\D\.]/g, ''); + self.OffsetUnitValue(insertValue ? Number(insertValue) : 0); + self.OffsetUnit() === 'day' && self.Offset(insertValue ? Number(insertValue) : 0); + }) + + self.OffsetUnit.subscribe(function (newValue){ + self.Offset(newValue === 'day' ? self.OffsetUnitValue() : 0); + }) } DateOffsetStrategy.prototype.toJSON = function () { diff --git a/js/components/cohortbuilder/InputTypes/Window.js b/js/components/cohortbuilder/InputTypes/Window.js index 11c750566..37cc1037f 100644 --- a/js/components/cohortbuilder/InputTypes/Window.js +++ b/js/components/cohortbuilder/InputTypes/Window.js @@ -6,16 +6,42 @@ define(['knockout'], function (ko) { self.Start = { Days: ko.observable((data.Start && data.Start.Days) === 0 ? 0 : (data.Start && data.Start.Days) || null), - Coeff: ko.observable((data.Start && data.Start.Coeff) === 0 ? 0 : (data.Start && data.Start.Coeff) || -1) + Coeff: ko.observable((data.Start && data.Start.Coeff) === 0 ? 0 : (data.Start && data.Start.Coeff) || -1), + TimeUnit: ko.observable((data.Start && data.Start.TimeUnit) || 'day'), + TimeUnitValue: ko.observable((data.Start && data.Start.TimeUnitValue) || null), }; self.End = { Days: ko.observable((data.End && data.End.Days) === 0 ? 0 : (data.End && data.End.Days) || null), - Coeff: ko.observable((data.End && data.End.Coeff) === 0 ? 0 : (data.End && data.End.Coeff) || 1) + Coeff: ko.observable((data.End && data.End.Coeff) === 0 ? 0 : (data.End && data.End.Coeff) || 1), + TimeUnit: ko.observable((data.End && data.End.TimeUnit) || 'day'), + TimeUnitValue: ko.observable((data.End && data.End.TimeUnitValue) || null), }; self.UseIndexEnd = ko.observable(data.UseIndexEnd || false); self.UseEventEnd = ko.observable(data.UseEventEnd || false); + + self.Start.TimeUnitValue.subscribe(function (newValue){ + const insertValue = newValue ? newValue.toString().replace(/[\D\.]/g, '') : null; + self.Start.TimeUnitValue(insertValue ? Number(insertValue) : null); + self.Start.TimeUnit() === 'day' && self.Start.Days(insertValue ? Number(insertValue) : null); + }) + + self.End.TimeUnitValue.subscribe(function (newValue){ + const insertValue = newValue ? newValue.toString().replace(/[\D\.]/g, '') : null; + self.End.TimeUnitValue(insertValue ? Number(insertValue) : null); + self.End.TimeUnit() === 'day' && self.End.Days(insertValue ? Number(insertValue) : null); + }) + + self.Start.TimeUnit.subscribe(function (newValue){ + self.End.TimeUnit(newValue); + self.Start.Days(newValue === 'day' ? self.Start.TimeUnitValue() : null); + }) + + self.End.TimeUnit.subscribe(function (newValue){ + self.Start.TimeUnit(newValue); + self.End.Days(newValue === 'day' ? self.End.TimeUnitValue() : null); + }) } diff --git a/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html b/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html index ead0c21bd..aaca4f9f2 100644 --- a/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html +++ b/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html @@ -196,13 +196,19 @@
+
+
  • + + + +
  • +
      -
    • - - - -
    • diff --git a/js/components/cohortbuilder/components/CustomEraStrategyTemplate.html b/js/components/cohortbuilder/components/CustomEraStrategyTemplate.html index 8a1930bd0..334b1a409 100644 --- a/js/components/cohortbuilder/components/CustomEraStrategyTemplate.html +++ b/js/components/cohortbuilder/components/CustomEraStrategyTemplate.html @@ -1,9 +1,9 @@ -
      +

      + data-bind="text: ko.i18nformat('components.customEraStrategy.customEraStrategyText_20', 'Specify a concept set that contains one or more drugs. A drug era will be derived from all drug exposure events for any of the drugs within the concept set, using the specified persistence window as a maximum allowable gap in <%=unitFilter%> between successive exposure events and adding a specified surveillance window to the final exposure event. If no exposure event end date is provided, then an exposure event end date is inferred to be event start date + <%=unitFilter%> supply in cases when <%=unitFilter%> supply is available or event start date + 1 <%=addUnitFilter%> otherwise. This event persistence assures that the cohort end date will be no greater than the drug era end date.', {unitFilter: $component.options.windowTimeOptions.find(option => option.value === OffsetUnit())?.name(), addUnitFilter: $component.options.windowTimeOptions.find(option => option.value === OffsetUnit())?.lessName()})">
        -
      • +
      • - + data-bind="htmlValue: GapUnitValue, eventType:'blur', ko_autocomplete: { value: GapUnitValue, source: $component.options.dayOptions, minLength: 0, maxShowItems: 10, scroll: true }"> +
      • -
      • +
      • + data-bind="htmlValue: OffsetUnitValue, eventType:'blur', ko_autocomplete: { value: OffsetUnitValue, source: $component.options.dayOptions, minLength: 0, maxShowItems: 10, scroll: true }"> + + data-bind="text: ko.i18n('components.customEraStrategy.customEraStrategyText_21', 'to the end of the era of persistence exposure as an additional period of surveillance prior to cohort exit.')">
      • -
      • +
      • + data-bind="text: ko.i18nformat('components.customEraStrategy.customEraStrategyText_22', 'Use <%=unitFilter%> supply and exposure end date for exposure duration. ', {unitFilter: $component.options.windowTimeOptions.find(option => option.value === OffsetUnit())?.name()})"> diff --git a/js/components/cohortbuilder/components/DateOffsetStrategyTemplate.html b/js/components/cohortbuilder/components/DateOffsetStrategyTemplate.html index 48839d017..32d4f06c2 100644 --- a/js/components/cohortbuilder/components/DateOffsetStrategyTemplate.html +++ b/js/components/cohortbuilder/components/DateOffsetStrategyTemplate.html @@ -3,8 +3,8 @@
      -
      - +
      +
        @@ -13,12 +13,16 @@ +
      diff --git a/js/components/cohortbuilder/components/WindowInputTemplate.html b/js/components/cohortbuilder/components/WindowInputTemplate.html index 4f56bb2e1..120a68e55 100644 --- a/js/components/cohortbuilder/components/WindowInputTemplate.html +++ b/js/components/cohortbuilder/components/WindowInputTemplate.html @@ -1,18 +1,30 @@ - + - + +
      + +
      + +
    • +
      -
    • - - - -
    • diff --git a/js/components/cohortbuilder/components/CustomEraStrategyTemplate.html b/js/components/cohortbuilder/components/CustomEraStrategyTemplate.html index 8a1930bd0..578b5f52c 100644 --- a/js/components/cohortbuilder/components/CustomEraStrategyTemplate.html +++ b/js/components/cohortbuilder/components/CustomEraStrategyTemplate.html @@ -1,9 +1,9 @@ -
      +

      + data-bind="text: ko.i18nformat('components.customEraStrategy.customEraStrategyText_20', 'Specify a concept set that contains one or more drugs. A drug era will be derived from all drug exposure events for any of the drugs within the concept set, using the specified persistence window as a maximum allowable gap in <%=unitFilter%> between successive exposure events and adding a specified surveillance window to the final exposure event. If no exposure event end date is provided, then an exposure event end date is inferred to be event start date + <%=unitFilter%> supply in cases when <%=unitFilter%> supply is available or event start date + 1 <%=addUnitFilter%> otherwise. This event persistence assures that the cohort end date will be no greater than the drug era end date.', {unitFilter: $component.options.windowTimeOptions.find(option => option.value === OffsetUnit())?.name(), addUnitFilter: $component.options.windowTimeOptions.find(option => option.value === OffsetUnit())?.lessName()})">
        -
      • +
      • - + data-bind="htmlValue: GapUnitValue, eventType:'blur', ko_autocomplete: { value: GapUnitValue, source: $component.options.dayOptions, minLength: 0, maxShowItems: 10, scroll: true }"> +
      • -
      • +
      • + data-bind="htmlValue: OffsetUnitValue, eventType:'blur', ko_autocomplete: { value: OffsetUnitValue, source: $component.options.dayOptions, minLength: 0, maxShowItems: 10, scroll: true }"> + + data-bind="text: ko.i18n('components.customEraStrategy.customEraStrategyText_21', 'to the end of the era of persistence exposure as an additional period of surveillance prior to cohort exit.')">
      • -
      • +
      • + data-bind="text: ko.i18nformat('components.customEraStrategy.customEraStrategyText_22', 'Use <%=unitFilter%> supply and exposure end date for exposure duration. ', {unitFilter: $component.options.windowTimeOptions.find(option => option.value === OffsetUnit())?.name()})"> diff --git a/js/components/cohortbuilder/components/DateOffsetStrategyTemplate.html b/js/components/cohortbuilder/components/DateOffsetStrategyTemplate.html index 48839d017..32d4f06c2 100644 --- a/js/components/cohortbuilder/components/DateOffsetStrategyTemplate.html +++ b/js/components/cohortbuilder/components/DateOffsetStrategyTemplate.html @@ -3,8 +3,8 @@
      -
      - +
      +
        @@ -13,12 +13,16 @@ +
      diff --git a/js/components/cohortbuilder/components/WindowInputTemplate.html b/js/components/cohortbuilder/components/WindowInputTemplate.html index 4f56bb2e1..ddcdfbae7 100644 --- a/js/components/cohortbuilder/components/WindowInputTemplate.html +++ b/js/components/cohortbuilder/components/WindowInputTemplate.html @@ -1,18 +1,30 @@ - + - + +
      + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    + + +
    + + +
    + + +
    Date: Fri, 2 Feb 2024 15:51:40 +0300 Subject: [PATCH 14/22] rename UseDatetime expression attribute --- js/components/cohortbuilder/CohortExpression.js | 2 +- .../cohortbuilder/components/CohortExpressionEditor.js | 2 +- .../components/CohortExpressionEditorTemplate.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/components/cohortbuilder/CohortExpression.js b/js/components/cohortbuilder/CohortExpression.js index 631c0d4c6..c9348b19d 100644 --- a/js/components/cohortbuilder/CohortExpression.js +++ b/js/components/cohortbuilder/CohortExpression.js @@ -42,7 +42,7 @@ define(function (require, exports) { self.CollapseSettings.EraPad(newValue === 'day' ? self.CollapseSettings.EraPadUnitValue() : 0); }) - self.useDateTime = ko.observable(!!data.useDateTime); + self.UseDatetime = ko.observable(!!data.UseDatetime); } return CohortExpression; diff --git a/js/components/cohortbuilder/components/CohortExpressionEditor.js b/js/components/cohortbuilder/components/CohortExpressionEditor.js index c724a7719..59051e0c2 100644 --- a/js/components/cohortbuilder/components/CohortExpressionEditor.js +++ b/js/components/cohortbuilder/components/CohortExpressionEditor.js @@ -39,7 +39,7 @@ define([ self.expression = params.expression; self.options = options; - self.useDateTime = self.expression().useDateTime; + self.useDateTime = self.expression().UseDatetime; // self.useDateTime.subscribe(val => self.expression().useDateTime = val); self.showCensorWindow = ko.observable( self.expression().CensorWindow().StartDate() || diff --git a/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html b/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html index b14599ddd..d888d0814 100644 --- a/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html +++ b/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html @@ -44,7 +44,7 @@
    - +
    From 862fa1e36fc20fe4bfb755c60936cde5cef52e28 Mon Sep 17 00:00:00 2001 From: fedor_glushchenko Date: Thu, 6 Jun 2024 11:23:31 +0300 Subject: [PATCH 15/22] issues-2886: Fix elder gohortdefinition import --- js/components/cohortbuilder/InputTypes/DateAdjustment.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/components/cohortbuilder/InputTypes/DateAdjustment.js b/js/components/cohortbuilder/InputTypes/DateAdjustment.js index f43e38c1c..8fbe4c48f 100644 --- a/js/components/cohortbuilder/InputTypes/DateAdjustment.js +++ b/js/components/cohortbuilder/InputTypes/DateAdjustment.js @@ -8,6 +8,7 @@ define(['knockout'], function (ko) { self.StartOffset = ko.observable(data.StartOffset || 0); self.EndWith = ko.observable(data.EndWith || DateAdjustment.END_DATE); self.EndOffset = ko.observable(data.EndOffset || 0); + } DateAdjustment.START_DATE = "START_DATE"; From 07485c2a7eb75011530a738ccd70e85415c534f5 Mon Sep 17 00:00:00 2001 From: fedor_glushchenko Date: Thu, 6 Jun 2024 11:24:41 +0300 Subject: [PATCH 16/22] isseus-2886: Fix elder cohortdefinitions import --- js/components/cohortbuilder/InputTypes/Window.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/components/cohortbuilder/InputTypes/Window.js b/js/components/cohortbuilder/InputTypes/Window.js index 17f84854f..a7f64ba6d 100644 --- a/js/components/cohortbuilder/InputTypes/Window.js +++ b/js/components/cohortbuilder/InputTypes/Window.js @@ -8,14 +8,14 @@ define(['knockout'], function (ko) { Days: ko.observable((data.Start && data.Start.Days) === 0 ? 0 : (data.Start && data.Start.Days) || null), Coeff: ko.observable((data.Start && data.Start.Coeff) === 0 ? 0 : (data.Start && data.Start.Coeff) || -1), TimeUnit: ko.observable((data.Start && data.Start.TimeUnit) || 'day'), - TimeUnitValue: ko.observable((data.Start && data.Start.TimeUnitValue) === 0 ? 0 : (data.Start && data.Start.TimeUnitValue)|| null) + TimeUnitValue: ko.observable((data.Start && data.Start.TimeUnitValue) === 0 ? 0 : ((data.Start && data.Start.TimeUnitValue) ? data.Start.TimeUnitValue : (data.Start.Days || null))) }; self.End = { Days: ko.observable((data.End && data.End.Days) === 0 ? 0 : (data.End && data.End.Days) || null), Coeff: ko.observable((data.End && data.End.Coeff) === 0 ? 0 : (data.End && data.End.Coeff) || 1), TimeUnit: ko.observable((data.End && data.End.TimeUnit) || 'day'), - TimeUnitValue: ko.observable((data.End && data.End.TimeUnitValue) === 0 ? 0 : (data.End && data.End.TimeUnitValue) || null) + TimeUnitValue: ko.observable((data.End && data.End.TimeUnitValue) === 0 ? 0 : ((data.End && data.End.TimeUnitValue) ? data.End.TimeUnitValue : (data.End.Days || null))) }; self.UseIndexEnd = ko.observable(data.UseIndexEnd || false); From 23546ff3ce319d8fc2752e41dc07432bf0799130 Mon Sep 17 00:00:00 2001 From: fedor_glushchenko Date: Fri, 7 Jun 2024 21:46:21 +0300 Subject: [PATCH 17/22] issues-2886: correct timeUnitValue set --- js/components/cohortbuilder/InputTypes/Window.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/js/components/cohortbuilder/InputTypes/Window.js b/js/components/cohortbuilder/InputTypes/Window.js index a7f64ba6d..4e1f7b664 100644 --- a/js/components/cohortbuilder/InputTypes/Window.js +++ b/js/components/cohortbuilder/InputTypes/Window.js @@ -8,14 +8,14 @@ define(['knockout'], function (ko) { Days: ko.observable((data.Start && data.Start.Days) === 0 ? 0 : (data.Start && data.Start.Days) || null), Coeff: ko.observable((data.Start && data.Start.Coeff) === 0 ? 0 : (data.Start && data.Start.Coeff) || -1), TimeUnit: ko.observable((data.Start && data.Start.TimeUnit) || 'day'), - TimeUnitValue: ko.observable((data.Start && data.Start.TimeUnitValue) === 0 ? 0 : ((data.Start && data.Start.TimeUnitValue) ? data.Start.TimeUnitValue : (data.Start.Days || null))) + TimeUnitValue: ko.observable(setTimeUnitValue(data.Start)) }; self.End = { Days: ko.observable((data.End && data.End.Days) === 0 ? 0 : (data.End && data.End.Days) || null), Coeff: ko.observable((data.End && data.End.Coeff) === 0 ? 0 : (data.End && data.End.Coeff) || 1), TimeUnit: ko.observable((data.End && data.End.TimeUnit) || 'day'), - TimeUnitValue: ko.observable((data.End && data.End.TimeUnitValue) === 0 ? 0 : ((data.End && data.End.TimeUnitValue) ? data.End.TimeUnitValue : (data.End.Days || null))) + TimeUnitValue: ko.observable(setTimeUnitValue(data.End)) }; self.UseIndexEnd = ko.observable(data.UseIndexEnd || false); @@ -44,5 +44,17 @@ define(['knockout'], function (ko) { } + function setTimeUnitValue(value) { + if (value) { + if (value.TimeUnitValue === 0) { + return 0; + } else if (value.TimeUnitValue) { + return value.TimeUnitValue; + } else if (value.Days) { + return value.Days; + } + } + } + return Window; }); \ No newline at end of file From 151f8dc4b3bff87ff1fd2fbf7d34d88e551b4b8c Mon Sep 17 00:00:00 2001 From: oleg-odysseus Date: Thu, 13 Jun 2024 16:37:59 +0200 Subject: [PATCH 18/22] minor fix to avoid having undefined value for TimeUnit value on widget load --- js/components/cohortbuilder/CohortExpression.js | 7 ++++++- js/components/cohortbuilder/InputTypes/Window.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/js/components/cohortbuilder/CohortExpression.js b/js/components/cohortbuilder/CohortExpression.js index c9348b19d..625de0bbf 100644 --- a/js/components/cohortbuilder/CohortExpression.js +++ b/js/components/cohortbuilder/CohortExpression.js @@ -27,7 +27,12 @@ define(function (require, exports) { self.CensoringCriteria = ko.observableArray(data.CensoringCriteria && data.CensoringCriteria.map(function (criteria) { return CriteriaTypes.GetCriteriaFromObject(criteria, self.ConceptSets); })); - self.CollapseSettings = {CollapseType: ko.observable(data.CollapseSettings && data.CollapseSettings.CollapseType || "ERA"), EraPad: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPad || 0 ), EraPadUnitValue: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPadUnitValue || 0), EraPadUnit: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPadUnit || 'day')} + self.CollapseSettings = { + CollapseType: ko.observable(data.CollapseSettings && data.CollapseSettings.CollapseType || "ERA"), + EraPad: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPad || 0 ), + EraPadUnitValue: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPadUnitValue || data.CollapseSettings && data.CollapseSettings.EraPad || 0), + EraPadUnit: ko.observable(data.CollapseSettings && data.CollapseSettings.EraPadUnit || 'day') + } self.CensorWindow = ko.observable(new Period(data.CensorWindow)); self.cdmVersionRange = data.cdmVersionRange || null; diff --git a/js/components/cohortbuilder/InputTypes/Window.js b/js/components/cohortbuilder/InputTypes/Window.js index 4e1f7b664..24c94e110 100644 --- a/js/components/cohortbuilder/InputTypes/Window.js +++ b/js/components/cohortbuilder/InputTypes/Window.js @@ -54,6 +54,7 @@ define(['knockout'], function (ko) { return value.Days; } } + return 'All'; } return Window; From da3bdc878e302165740cf8649a228150d1b9aee7 Mon Sep 17 00:00:00 2001 From: fedor_glushchenko Date: Thu, 27 Jun 2024 19:57:33 +0300 Subject: [PATCH 19/22] issues-2886: Fix for days setting --- .../cohortbuilder/InputTypes/Window.js | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/js/components/cohortbuilder/InputTypes/Window.js b/js/components/cohortbuilder/InputTypes/Window.js index 24c94e110..b31c2195c 100644 --- a/js/components/cohortbuilder/InputTypes/Window.js +++ b/js/components/cohortbuilder/InputTypes/Window.js @@ -5,14 +5,14 @@ define(['knockout'], function (ko) { data = data || {}; self.Start = { - Days: ko.observable((data.Start && data.Start.Days) === 0 ? 0 : (data.Start && data.Start.Days) || null), + Days: ko.observable(setDays(data.Start)), Coeff: ko.observable((data.Start && data.Start.Coeff) === 0 ? 0 : (data.Start && data.Start.Coeff) || -1), TimeUnit: ko.observable((data.Start && data.Start.TimeUnit) || 'day'), TimeUnitValue: ko.observable(setTimeUnitValue(data.Start)) }; self.End = { - Days: ko.observable((data.End && data.End.Days) === 0 ? 0 : (data.End && data.End.Days) || null), + Days: ko.observable(setDays(data.End)), Coeff: ko.observable((data.End && data.End.Coeff) === 0 ? 0 : (data.End && data.End.Coeff) || 1), TimeUnit: ko.observable((data.End && data.End.TimeUnit) || 'day'), TimeUnitValue: ko.observable(setTimeUnitValue(data.End)) @@ -44,14 +44,31 @@ define(['knockout'], function (ko) { } - function setTimeUnitValue(value) { - if (value) { - if (value.TimeUnitValue === 0) { + function setDays(dateValue) { + if (dateValue) { + if (dateValue.Days === 0) { return 0; - } else if (value.TimeUnitValue) { - return value.TimeUnitValue; - } else if (value.Days) { - return value.Days; + } else if (dateValue.Days) { + return dateValue.Days; + } else if (dateValue.TimeUnitValue === 0) { + return 0; + }else if (dateValue.TimeUnitValue) { + return dateValue.TimeUnitValue; + } + } + return null; + } + + function setTimeUnitValue(dateValue) { + if (dateValue) { + if (dateValue.TimeUnitValue === 0) { + return 0; + } else if (dateValue.TimeUnitValue) { + return dateValue.TimeUnitValue; + } else if (dateValue.Days === 0) { + return 0; + } else if (dateValue.Days) { + return dateValue.Days; } } return 'All'; From 6a6aba68edeb89d8f976fdef0cafde6c05d1cb09 Mon Sep 17 00:00:00 2001 From: fedor_glushchenko Date: Fri, 28 Jun 2024 13:55:48 +0300 Subject: [PATCH 20/22] issues-2886: Save error fix --- js/components/cohortbuilder/InputTypes/Window.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/components/cohortbuilder/InputTypes/Window.js b/js/components/cohortbuilder/InputTypes/Window.js index b31c2195c..b9506ed76 100644 --- a/js/components/cohortbuilder/InputTypes/Window.js +++ b/js/components/cohortbuilder/InputTypes/Window.js @@ -35,11 +35,11 @@ define(['knockout'], function (ko) { self.Start.TimeUnit.subscribe(function (newValue){ self.End.TimeUnit(newValue); - self.Start.Days(newValue === 'day' ? self.Start.TimeUnitValue() : null); + self.Start.Days(newValue === 'day' ? (self.Start.TimeUnitValue() === 'All' ? null : self.Start.TimeUnitValue()) : null); }) self.End.TimeUnit.subscribe(function (newValue){ - self.End.Days(newValue === 'day' ? self.End.TimeUnitValue() : null); + self.End.Days(newValue === 'day' ? (self.End.TimeUnitValue() === 'All' ? null : self.End.TimeUnitValue()) : null); }) } @@ -52,7 +52,7 @@ define(['knockout'], function (ko) { return dateValue.Days; } else if (dateValue.TimeUnitValue === 0) { return 0; - }else if (dateValue.TimeUnitValue) { + } else if (dateValue.TimeUnitValue && dateValue.TimeUnitValue !== 'All') { return dateValue.TimeUnitValue; } } @@ -63,7 +63,7 @@ define(['knockout'], function (ko) { if (dateValue) { if (dateValue.TimeUnitValue === 0) { return 0; - } else if (dateValue.TimeUnitValue) { + } else if (dateValue.TimeUnitValue && dateValue.TimeUnitValue !== 'All') { return dateValue.TimeUnitValue; } else if (dateValue.Days === 0) { return 0; @@ -71,7 +71,7 @@ define(['knockout'], function (ko) { return dateValue.Days; } } - return 'All'; + return null; } return Window; From ba37495c2dfeae0db41371d86fea0ce6bd94bf02 Mon Sep 17 00:00:00 2001 From: fedor_glushchenko Date: Mon, 12 Aug 2024 14:53:15 +0300 Subject: [PATCH 21/22] Changed datetime to chackbox --- .../components/CohortExpressionEditorTemplate.html | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html b/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html index d888d0814..1adf14c7e 100644 --- a/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html +++ b/js/components/cohortbuilder/components/CohortExpressionEditorTemplate.html @@ -39,13 +39,9 @@
    Options
    - +
    -
    - - -
    From 9a7f8ac74f5bd62f994c5f8136ebfd801700cbac Mon Sep 17 00:00:00 2001 From: alex-odysseus Date: Mon, 9 Dec 2024 20:20:27 +0100 Subject: [PATCH 22/22] "proposed fix for non-reacting observable" by oleg-odysseus --- .../cohortbuilder/components/CohortExpressionEditor.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/components/cohortbuilder/components/CohortExpressionEditor.js b/js/components/cohortbuilder/components/CohortExpressionEditor.js index 59051e0c2..0e9c0f094 100644 --- a/js/components/cohortbuilder/components/CohortExpressionEditor.js +++ b/js/components/cohortbuilder/components/CohortExpressionEditor.js @@ -39,8 +39,11 @@ define([ self.expression = params.expression; self.options = options; - self.useDateTime = self.expression().UseDatetime; - // self.useDateTime.subscribe(val => self.expression().useDateTime = val); + self.useDateTime = ko.observable(self.expression().UseDatetime()); + self.useDateTime.subscribe(function (newValue) { + self.expression().UseDatetime(newValue); + }); + self.showCensorWindow = ko.observable( self.expression().CensorWindow().StartDate() || self.expression().CensorWindow().EndDate()