From 0467d2c8e90f335882f569994ce429f953b61d3b Mon Sep 17 00:00:00 2001 From: Chris Knoll Date: Tue, 29 Nov 2022 10:48:03 -0500 Subject: [PATCH] Added date-offset UI elements to cohort builder. Added DateAdjustment UI component. --- .../cohortbuilder/CriteriaTypes/Criteria.js | 3 +- .../InputTypes/DateAdjustment.js | 17 ++++++++ js/components/cohortbuilder/components.js | 3 ++ .../cohortbuilder/components/ConditionEra.js | 10 ++++- .../components/ConditionEraTemplate.html | 7 ++++ .../components/ConditionOccurrence.js | 9 ++++ .../ConditionOccurrenceTemplate.html | 7 ++++ .../components/DateAdjustment.js | 27 ++++++++++++ .../components/DateAdjustmentTemplate.html | 8 ++++ .../cohortbuilder/components/Death.js | 11 ++++- .../components/DeathTemplate.html | 7 ++++ .../components/DeviceExposure.js | 9 ++++ .../components/DeviceExposureTemplate.html | 7 ++++ .../cohortbuilder/components/DoseEra.js | 10 ++++- .../components/DoseEraTemplate.html | 7 ++++ .../cohortbuilder/components/DrugEra.js | 10 ++++- .../components/DrugEraTemplate.html | 7 ++++ .../cohortbuilder/components/DrugExposure.js | 9 ++++ .../components/DrugExposureTemplate.html | 7 ++++ .../cohortbuilder/components/Measurement.js | 11 ++++- .../components/MeasurementTemplate.html | 7 ++++ .../cohortbuilder/components/Observation.js | 10 ++++- .../components/ObservationPeriod.js | 10 ++++- .../components/ObservationPeriodTemplate.html | 7 ++++ .../components/ObservationTemplate.html | 7 ++++ .../components/PayerPlanPeriod.js | 42 +++++++++++-------- .../components/PayerPlanPeriodTemplate.html | 7 ++++ .../components/ProcedureOccurrence.js | 11 ++++- .../ProcedureOccurrenceTemplate.html | 7 ++++ .../cohortbuilder/components/Specimen.js | 10 ++++- .../components/SpecimenTemplate.html | 7 ++++ .../cohortbuilder/components/VisitDetail.js | 9 ++++ .../components/VisitDetailTemplate.html | 7 ++++ .../components/VisitOccurrence.js | 9 ++++ .../components/VisitOccurrenceTemplate.html | 7 ++++ js/components/cohortbuilder/const.js | 29 +++++++++++-- 36 files changed, 338 insertions(+), 34 deletions(-) create mode 100644 js/components/cohortbuilder/InputTypes/DateAdjustment.js create mode 100644 js/components/cohortbuilder/components/DateAdjustment.js create mode 100644 js/components/cohortbuilder/components/DateAdjustmentTemplate.html diff --git a/js/components/cohortbuilder/CriteriaTypes/Criteria.js b/js/components/cohortbuilder/CriteriaTypes/Criteria.js index 14ed44de4..e204c5851 100644 --- a/js/components/cohortbuilder/CriteriaTypes/Criteria.js +++ b/js/components/cohortbuilder/CriteriaTypes/Criteria.js @@ -1,4 +1,4 @@ -define(['require', 'knockout', '../InputTypes/Range','conceptpicker/InputTypes/Concept', '../InputTypes/Text', '../CriteriaGroup'], function (require, ko, Range, Concept, Text) { +define(['require', 'knockout', '../InputTypes/Range','conceptpicker/InputTypes/Concept', '../InputTypes/Text', '../InputTypes/DateAdjustment', '../CriteriaGroup'], function (require, ko, Range, Concept, Text, DateAdjustment) { function Criteria (data, conceptSets) { var self = this; @@ -7,6 +7,7 @@ define(['require', 'knockout', '../InputTypes/Range','conceptpicker/InputTypes/C var CriteriaGroup = require('../CriteriaGroup'); self.CorrelatedCriteria = ko.observable(data.CorrelatedCriteria && new CriteriaGroup(data.CorrelatedCriteria, conceptSets)); + self.DateAdjustment = ko.observable(data.DateAdjustment && new DateAdjustment(data.DateAdjustment)); } diff --git a/js/components/cohortbuilder/InputTypes/DateAdjustment.js b/js/components/cohortbuilder/InputTypes/DateAdjustment.js new file mode 100644 index 000000000..f43e38c1c --- /dev/null +++ b/js/components/cohortbuilder/InputTypes/DateAdjustment.js @@ -0,0 +1,17 @@ +define(['knockout'], function (ko) { + var debug = false; + function DateAdjustment(data) { + var self = this; + data = data || {}; + + self.StartWith = ko.observable(data.StartWith || DateAdjustment.START_DATE); + 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"; + DateAdjustment.END_DATE = "END_DATE"; + + return DateAdjustment; +}); \ No newline at end of file diff --git a/js/components/cohortbuilder/components.js b/js/components/cohortbuilder/components.js index 97f7da836..f4591c826 100644 --- a/js/components/cohortbuilder/components.js +++ b/js/components/cohortbuilder/components.js @@ -68,6 +68,9 @@ define(function (require, exports) { var dateRange = require('./components/DateRange'); ko.components.register('date-range', dateRange); + var dateAdjustment = require('./components/DateAdjustment'); + ko.components.register('date-adjustment', dateAdjustment); + var windowInput = require('./components/WindowInput'); ko.components.register('window-input',windowInput); diff --git a/js/components/cohortbuilder/components/ConditionEra.js b/js/components/cohortbuilder/components/ConditionEra.js index c3d0a72c9..5bc184440 100644 --- a/js/components/cohortbuilder/components/ConditionEra.js +++ b/js/components/cohortbuilder/components/ConditionEra.js @@ -3,10 +3,11 @@ define([ "../options", "../utils", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../CriteriaGroup", "text!./ConditionEraTemplate.html", "../const", -], function (ko, options, utils, Range, CriteriaGroup, template, constants) { +], function (ko, options, utils, Range, DateAdjustment, CriteriaGroup, template, constants) { function ConditionEraViewModel(params) { var self = this; self.expression = ko.utils.unwrapObservable(params.expression); @@ -80,6 +81,13 @@ define([ ); }, }, + { + ...constants.eraAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.eraAttributes.addConditonCount, selected: false, diff --git a/js/components/cohortbuilder/components/ConditionEraTemplate.html b/js/components/cohortbuilder/components/ConditionEraTemplate.html index bcc8bb948..3a86f338f 100644 --- a/js/components/cohortbuilder/components/ConditionEraTemplate.html +++ b/js/components/cohortbuilder/components/ConditionEraTemplate.html @@ -35,6 +35,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/ConditionOccurrence.js b/js/components/cohortbuilder/components/ConditionOccurrence.js index e62706459..ae4f03837 100644 --- a/js/components/cohortbuilder/components/ConditionOccurrence.js +++ b/js/components/cohortbuilder/components/ConditionOccurrence.js @@ -4,6 +4,7 @@ define([ "../utils", "../InputTypes/Range", "../InputTypes/Text", + "../InputTypes/DateAdjustment", "../CriteriaGroup", "text!./ConditionOccurrenceTemplate.html", "../const", @@ -14,6 +15,7 @@ define([ utils, Range, Text, + DateAdjustment, CriteriaGroup, template, constants @@ -90,6 +92,13 @@ define([ ); }, }, + { + ...constants.occurrenceAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.occurrenceAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/ConditionOccurrenceTemplate.html b/js/components/cohortbuilder/components/ConditionOccurrenceTemplate.html index 4058e2887..412cabad9 100644 --- a/js/components/cohortbuilder/components/ConditionOccurrenceTemplate.html +++ b/js/components/cohortbuilder/components/ConditionOccurrenceTemplate.html @@ -34,6 +34,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/DateAdjustment.js b/js/components/cohortbuilder/components/DateAdjustment.js new file mode 100644 index 000000000..cf211392a --- /dev/null +++ b/js/components/cohortbuilder/components/DateAdjustment.js @@ -0,0 +1,27 @@ +define(["knockout", "text!./DateAdjustmentTemplate.html", "../InputTypes/DateAdjustment"], function ( + ko, + componentTemplate, + DateAdjustment + ) { + function DateAdjustmentViewModel(params) { + var self = this; + self.DateAdjustment = params.DateAdjustment; + self.dateOptions = [ + { + id: DateAdjustment.START_DATE, + name: ko.i18n('options.startDate', 'start date'), + }, + { + id: DateAdjustment.END_DATE, + name: ko.i18n('options.endDate', 'end date'), + } + ]; + } + + // return compoonent definition + return { + viewModel: DateAdjustmentViewModel, + template: componentTemplate, + }; + }); + \ No newline at end of file diff --git a/js/components/cohortbuilder/components/DateAdjustmentTemplate.html b/js/components/cohortbuilder/components/DateAdjustmentTemplate.html new file mode 100644 index 000000000..51ce683a5 --- /dev/null +++ b/js/components/cohortbuilder/components/DateAdjustmentTemplate.html @@ -0,0 +1,8 @@ +starting with ++ days +and ending with ++ days \ No newline at end of file diff --git a/js/components/cohortbuilder/components/Death.js b/js/components/cohortbuilder/components/Death.js index 74e07ac30..6391b8395 100644 --- a/js/components/cohortbuilder/components/Death.js +++ b/js/components/cohortbuilder/components/Death.js @@ -3,7 +3,7 @@ define([ "../options", "../utils", "../InputTypes/Range", - "../InputTypes/Text", + "../InputTypes/DateAdjustment", "../CriteriaGroup", "text!./DeathTemplate.html", "../const", @@ -12,7 +12,7 @@ define([ options, utils, Range, - Text, + DateAdjustment, CriteriaGroup, template, constants @@ -48,6 +48,13 @@ define([ ); }, }, + { + ...constants.deathAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.deathAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/DeathTemplate.html b/js/components/cohortbuilder/components/DeathTemplate.html index e197778ac..4bbedf593 100644 --- a/js/components/cohortbuilder/components/DeathTemplate.html +++ b/js/components/cohortbuilder/components/DeathTemplate.html @@ -35,6 +35,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/DeviceExposure.js b/js/components/cohortbuilder/components/DeviceExposure.js index 6135d7282..e00896efb 100644 --- a/js/components/cohortbuilder/components/DeviceExposure.js +++ b/js/components/cohortbuilder/components/DeviceExposure.js @@ -4,6 +4,7 @@ define([ "../utils", "../InputTypes/Range", "../InputTypes/Text", + "../InputTypes/DateAdjustment", "../CriteriaGroup", "text!./DeviceExposureTemplate.html", "../const", @@ -13,6 +14,7 @@ define([ utils, Range, Text, + DateAdjustment, CriteriaGroup, template, constants @@ -78,6 +80,13 @@ define([ ); }, }, + { + ...constants.deviceAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.deviceAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/DeviceExposureTemplate.html b/js/components/cohortbuilder/components/DeviceExposureTemplate.html index 1d17c57de..c8882a68f 100644 --- a/js/components/cohortbuilder/components/DeviceExposureTemplate.html +++ b/js/components/cohortbuilder/components/DeviceExposureTemplate.html @@ -35,6 +35,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/DoseEra.js b/js/components/cohortbuilder/components/DoseEra.js index dbba2fdc8..36aebadfc 100644 --- a/js/components/cohortbuilder/components/DoseEra.js +++ b/js/components/cohortbuilder/components/DoseEra.js @@ -3,10 +3,11 @@ define([ "../options", "../utils", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../CriteriaGroup", "text!./DoseEraTemplate.html", "../const", -], function (ko, options, utils, Range, CriteriaGroup, template, constants) { +], function (ko, options, utils, Range, DateAdjustment, CriteriaGroup, template, constants) { function DoseEraViewModel(params) { var self = this; self.expression = ko.utils.unwrapObservable(params.expression); @@ -68,6 +69,13 @@ define([ ); }, }, + { + ...constants.doseAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.doseAttributes.addUnit, selected: false, diff --git a/js/components/cohortbuilder/components/DoseEraTemplate.html b/js/components/cohortbuilder/components/DoseEraTemplate.html index 1a65545c2..165394abb 100644 --- a/js/components/cohortbuilder/components/DoseEraTemplate.html +++ b/js/components/cohortbuilder/components/DoseEraTemplate.html @@ -33,6 +33,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/DrugEra.js b/js/components/cohortbuilder/components/DrugEra.js index c48f6d687..282dce517 100644 --- a/js/components/cohortbuilder/components/DrugEra.js +++ b/js/components/cohortbuilder/components/DrugEra.js @@ -3,10 +3,11 @@ define([ "../options", "../utils", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../CriteriaGroup", "text!./DrugEraTemplate.html", "../const", -], function (ko, options, utils, Range, CriteriaGroup, template, constants) { +], function (ko, options, utils, Range, DateAdjustment, CriteriaGroup, template, constants) { function DrugEraViewModel(params) { var self = this; self.expression = ko.utils.unwrapObservable(params.expression); @@ -68,6 +69,13 @@ define([ ); }, }, + { + ...constants.eraAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.drugAttributes.addLength, selected: false, diff --git a/js/components/cohortbuilder/components/DrugEraTemplate.html b/js/components/cohortbuilder/components/DrugEraTemplate.html index df69d4f28..84b1c6992 100644 --- a/js/components/cohortbuilder/components/DrugEraTemplate.html +++ b/js/components/cohortbuilder/components/DrugEraTemplate.html @@ -32,6 +32,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/DrugExposure.js b/js/components/cohortbuilder/components/DrugExposure.js index bd9d5c895..17d8c241b 100644 --- a/js/components/cohortbuilder/components/DrugExposure.js +++ b/js/components/cohortbuilder/components/DrugExposure.js @@ -3,6 +3,7 @@ define([ "../options", "../utils", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../InputTypes/Text", "../CriteriaGroup", "text!./DrugExposureTemplate.html", @@ -12,6 +13,7 @@ define([ options, utils, Range, + DateAdjustment, Text, CriteriaGroup, template, @@ -77,6 +79,13 @@ define([ ); }, }, + { + ...constants.drugexposureAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.drugexposureAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/DrugExposureTemplate.html b/js/components/cohortbuilder/components/DrugExposureTemplate.html index abdd0b7df..45d7bb539 100644 --- a/js/components/cohortbuilder/components/DrugExposureTemplate.html +++ b/js/components/cohortbuilder/components/DrugExposureTemplate.html @@ -36,6 +36,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/Measurement.js b/js/components/cohortbuilder/components/Measurement.js index c2c56f02c..311acd4e2 100644 --- a/js/components/cohortbuilder/components/Measurement.js +++ b/js/components/cohortbuilder/components/Measurement.js @@ -3,11 +3,11 @@ define([ "../options", "../utils", "../InputTypes/Range", - "../InputTypes/Text", + "../InputTypes/DateAdjustment", "../CriteriaGroup", "text!./MeasurementTemplate.html", "../const" -], function (ko, options, utils, Range, Text, CriteriaGroup, template, constants) { +], function (ko, options, utils, Range, DateAdjustment, CriteriaGroup, template, constants) { function MeasurementViewModel(params) { var self = this; @@ -50,6 +50,13 @@ define([ ); }, }, + { + ...constants.measurementAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.measurementAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/MeasurementTemplate.html b/js/components/cohortbuilder/components/MeasurementTemplate.html index d4cd6dba9..59f426932 100644 --- a/js/components/cohortbuilder/components/MeasurementTemplate.html +++ b/js/components/cohortbuilder/components/MeasurementTemplate.html @@ -29,6 +29,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/Observation.js b/js/components/cohortbuilder/components/Observation.js index 347f29bbd..de060496c 100644 --- a/js/components/cohortbuilder/components/Observation.js +++ b/js/components/cohortbuilder/components/Observation.js @@ -3,11 +3,12 @@ define([ "../options", "../utils", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../InputTypes/Text", "../CriteriaGroup", "text!./ObservationTemplate.html", "../const" -], function (ko, options, utils, Range, Text, CriteriaGroup, template, constants) { +], function (ko, options, utils, Range, DateAdjustment, Text, CriteriaGroup, template, constants) { function ObservationViewModel(params) { var self = this; self.addActions = [ @@ -45,6 +46,13 @@ define([ ); }, }, + { + ...constants.observationAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.observationAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/ObservationPeriod.js b/js/components/cohortbuilder/components/ObservationPeriod.js index ca9f8b78b..a1d4229af 100644 --- a/js/components/cohortbuilder/components/ObservationPeriod.js +++ b/js/components/cohortbuilder/components/ObservationPeriod.js @@ -2,11 +2,12 @@ define([ "knockout", "../options", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../InputTypes/Period", "../CriteriaGroup", "text!./ObservationPeriodTemplate.html", "../const" -], function (ko, options, Range, Period, CriteriaGroup, template, constants) { +], function (ko, options, Range, DateAdjustment, Period, CriteriaGroup, template, constants) { function ObservationPeriodViewModel(params) { var self = this; @@ -70,6 +71,13 @@ define([ ); }, }, + { + ...constants.observationPeriodAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.observationPeriodAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/ObservationPeriodTemplate.html b/js/components/cohortbuilder/components/ObservationPeriodTemplate.html index b6c997117..29161da04 100644 --- a/js/components/cohortbuilder/components/ObservationPeriodTemplate.html +++ b/js/components/cohortbuilder/components/ObservationPeriodTemplate.html @@ -29,6 +29,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/ObservationTemplate.html b/js/components/cohortbuilder/components/ObservationTemplate.html index 175911545..c86740763 100644 --- a/js/components/cohortbuilder/components/ObservationTemplate.html +++ b/js/components/cohortbuilder/components/ObservationTemplate.html @@ -31,6 +31,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/PayerPlanPeriod.js b/js/components/cohortbuilder/components/PayerPlanPeriod.js index 23d3785b0..3709dfb4c 100644 --- a/js/components/cohortbuilder/components/PayerPlanPeriod.js +++ b/js/components/cohortbuilder/components/PayerPlanPeriod.js @@ -2,11 +2,12 @@ define([ "knockout", "../options", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../InputTypes/Period", "../CriteriaGroup", "text!./PayerPlanPeriodTemplate.html", "../const" -], function (ko, options, Range, Period, CriteriaGroup, template, constants) { +], function (ko, options, Range, DateAdjustment, Period, CriteriaGroup, template, constants) { function PayerPlanPeriodViewModel(params) { var self = this; @@ -38,22 +39,6 @@ define([ self.Criteria.AgeAtEnd(new Range()); }, }, - { - ...constants.payerPlanAttributes.addLength, - selected: false, - action: function () { - if (self.Criteria.PeriodLength() == null) - self.Criteria.PeriodLength(new Range()); - }, - }, - { - ...constants.payerPlanAttributes.addGender, - selected: false, - action: function () { - if (self.Criteria.Gender() == null) - self.Criteria.Gender(ko.observableArray()); - }, - }, { ...constants.payerPlanAttributes.addUserDefined, selected: false, @@ -86,6 +71,29 @@ define([ ); }, }, + { + ...constants.payerPlanAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, + { + ...constants.payerPlanAttributes.addLength, + selected: false, + action: function () { + if (self.Criteria.PeriodLength() == null) + self.Criteria.PeriodLength(new Range()); + }, + }, + { + ...constants.payerPlanAttributes.addGender, + selected: false, + action: function () { + if (self.Criteria.Gender() == null) + self.Criteria.Gender(ko.observableArray()); + }, + }, { ...constants.payerPlanAttributes.addPayerConcept, selected: false, diff --git a/js/components/cohortbuilder/components/PayerPlanPeriodTemplate.html b/js/components/cohortbuilder/components/PayerPlanPeriodTemplate.html index 353a645a2..a0ff1f774 100644 --- a/js/components/cohortbuilder/components/PayerPlanPeriodTemplate.html +++ b/js/components/cohortbuilder/components/PayerPlanPeriodTemplate.html @@ -29,6 +29,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/ProcedureOccurrence.js b/js/components/cohortbuilder/components/ProcedureOccurrence.js index b0b3ff203..41941ac91 100644 --- a/js/components/cohortbuilder/components/ProcedureOccurrence.js +++ b/js/components/cohortbuilder/components/ProcedureOccurrence.js @@ -3,7 +3,7 @@ define([ "../options", "../utils", "../InputTypes/Range", - "../InputTypes/Text", + "../InputTypes/DateAdjustment", "../CriteriaGroup", "text!./ProcedureOccurrenceTemplate.html", "../const", @@ -12,7 +12,7 @@ define([ options, utils, Range, - Text, + DateAdjustment, CriteriaGroup, template, constants @@ -54,6 +54,13 @@ define([ ); }, }, + { + ...constants.procedureOccurrenceAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.procedureOccurrenceAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/ProcedureOccurrenceTemplate.html b/js/components/cohortbuilder/components/ProcedureOccurrenceTemplate.html index c007838d6..8b1495076 100644 --- a/js/components/cohortbuilder/components/ProcedureOccurrenceTemplate.html +++ b/js/components/cohortbuilder/components/ProcedureOccurrenceTemplate.html @@ -34,6 +34,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/Specimen.js b/js/components/cohortbuilder/components/Specimen.js index 33c7056c3..789fc0e93 100644 --- a/js/components/cohortbuilder/components/Specimen.js +++ b/js/components/cohortbuilder/components/Specimen.js @@ -3,11 +3,12 @@ define([ "../options", "../utils", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../InputTypes/Text", "../CriteriaGroup", "text!./SpecimenTemplate.html", "../const" -], function (ko, options, utils, Range, Text, CriteriaGroup, template, constants) { +], function (ko, options, utils, Range, DateAdjustment, Text, CriteriaGroup, template, constants) { function SpecimenViewModel(params) { var self = this; self.expression = ko.utils.unwrapObservable(params.expression); @@ -49,6 +50,13 @@ define([ ); }, }, + { + ...constants.specimenAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.specimenAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/SpecimenTemplate.html b/js/components/cohortbuilder/components/SpecimenTemplate.html index ae1ea2e18..6280bf455 100644 --- a/js/components/cohortbuilder/components/SpecimenTemplate.html +++ b/js/components/cohortbuilder/components/SpecimenTemplate.html @@ -31,6 +31,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/VisitDetail.js b/js/components/cohortbuilder/components/VisitDetail.js index 22787b052..b28f240da 100644 --- a/js/components/cohortbuilder/components/VisitDetail.js +++ b/js/components/cohortbuilder/components/VisitDetail.js @@ -4,6 +4,7 @@ define([ "../options", "../utils", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../InputTypes/ConceptSetSelection", "../CriteriaGroup", "text!./VisitDetailTemplate.html", @@ -14,6 +15,7 @@ define([ options, utils, Range, + DateAdjustment, ConceptSetSelection, CriteriaGroup, template, @@ -69,6 +71,13 @@ define([ ); }, }, + { + ...constants.visitDetailAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.visitDetailAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/VisitDetailTemplate.html b/js/components/cohortbuilder/components/VisitDetailTemplate.html index 3b5f64cbc..7c7dfc865 100644 --- a/js/components/cohortbuilder/components/VisitDetailTemplate.html +++ b/js/components/cohortbuilder/components/VisitDetailTemplate.html @@ -31,6 +31,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/components/VisitOccurrence.js b/js/components/cohortbuilder/components/VisitOccurrence.js index f5a488ce7..250f4a537 100644 --- a/js/components/cohortbuilder/components/VisitOccurrence.js +++ b/js/components/cohortbuilder/components/VisitOccurrence.js @@ -4,6 +4,7 @@ define([ "../options", "../utils", "../InputTypes/Range", + "../InputTypes/DateAdjustment", "../CriteriaGroup", "text!./VisitOccurrenceTemplate.html", "../const", @@ -13,6 +14,7 @@ define([ options, utils, Range, + DateAdjustment, CriteriaGroup, template, constants @@ -66,6 +68,13 @@ define([ ); }, }, + { + ...constants.visitAttributes.addDateAdjustment, + selected: false, + action: function () { + if (self.Criteria.DateAdjustment() == null) self.Criteria.DateAdjustment(new DateAdjustment()); + }, + }, { ...constants.visitAttributes.addType, selected: false, diff --git a/js/components/cohortbuilder/components/VisitOccurrenceTemplate.html b/js/components/cohortbuilder/components/VisitOccurrenceTemplate.html index 45b40f04c..8d01f05bd 100644 --- a/js/components/cohortbuilder/components/VisitOccurrenceTemplate.html +++ b/js/components/cohortbuilder/components/VisitOccurrenceTemplate.html @@ -31,6 +31,13 @@ + + + + + + + diff --git a/js/components/cohortbuilder/const.js b/js/components/cohortbuilder/const.js index 097ad089d..755a2ddd2 100644 --- a/js/components/cohortbuilder/const.js +++ b/js/components/cohortbuilder/const.js @@ -522,6 +522,12 @@ define(["knockout"], function (ko) { descriptionDemographic: 'const.eventsList.addEndDate.desc_demographic', defaultDescriptionDemographic: 'Filter events based by End Date.', }, + addDateAdjustment: { + title: 'const.eventsList.addDateAdjust.title', + defaultTitle: "Modify Event Start/End", + description: "const.eventsList.addDateAdjust.description", + defaultDescription: 'Modify the start and end date of the event by a specified offset.' + }, addUnit: { titleDose: 'const.eventsList.addUnit.title_dose', defaultTitleDose: 'Add Dose Unit Criteria', @@ -1067,10 +1073,10 @@ define(["knockout"], function (ko) { let attrT = titleAttr.toLowerCase().replace(titleAttr.charAt(0), titleAttr.charAt(0).toUpperCase()); let attrD = descriptionAttr.toLowerCase().replace(descriptionAttr.charAt(0), descriptionAttr.charAt(0).toUpperCase()); flatList[elem] = { - title: criteriaItem[`title${attrT ? attrT : ''}`], - defaultTitle: criteriaItem[`defaultTitle${attrT ? attrT : ''}`], - description: criteriaItem[`description${attrD ? attrD : ''}`], - defaultDescription: criteriaItem[`defaultDescription${attrD ? attrD : ''}`] + title: criteriaItem[`title${attrT ? attrT : ''}`] || criteriaItem["title"], + defaultTitle: criteriaItem[`defaultTitle${attrT ? attrT : ''}`] || criteriaItem["defaultTitle"], + description: criteriaItem[`description${attrD ? attrD : ''}`] || criteriaItem["description"], + defaultDescription: criteriaItem[`defaultDescription${attrD ? attrD : ''}`] || criteriaItem["defaultDescription"] }; }); @@ -1138,6 +1144,7 @@ define(["knockout"], function (ko) { 'addFirstDiagnosis', 'addAgeAtStart', 'addAgeAtEnd', + "addDateAdjustment", 'addGender', 'addStartDate', 'addEndDate', @@ -1152,6 +1159,7 @@ define(["knockout"], function (ko) { 'addConditionStatus', 'addStartDate', 'addEndDate', + 'addDateAdjustment', 'addType', 'addVisit', 'addStopReason', @@ -1160,6 +1168,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const deathAttributesList = [ + 'addDateAdjustment', 'addAge', 'addGender', 'addDate', @@ -1168,6 +1177,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const deviceAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addAge', 'addGender', @@ -1182,6 +1192,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const doseAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addAgeAtStart', 'addAgeAtEnd', @@ -1194,6 +1205,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const drugAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addAgeAtStart', 'addAgeAtEnd', @@ -1205,6 +1217,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const measurementAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addAge', 'addGender', @@ -1225,6 +1238,7 @@ define(["knockout"], function (ko) { 'addNested' ]; const drugexposureAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addAge', 'addGender', @@ -1245,6 +1259,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const observationAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addAge', 'addGender', @@ -1261,6 +1276,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const observationPeriodAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addAgeAtStart', 'addAgeAtEnd', @@ -1272,6 +1288,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const payerPlanAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addAgeAtStart', 'addAgeAtEnd', @@ -1291,6 +1308,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const procedureOccurrenceAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addVisit', 'addGender', @@ -1304,6 +1322,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const specimenAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addGender', 'addNested', @@ -1317,6 +1336,7 @@ define(["knockout"], function (ko) { 'addSourceId', ]; const visitAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addGender', 'addStartDate', @@ -1332,6 +1352,7 @@ define(["knockout"], function (ko) { 'addNested', ]; const visitDetailAttributesList = [ + 'addDateAdjustment', 'addFirstDiagnosis', 'addGender', 'addStartDate',