When you set the concept set on the 'root' criteria object, the nested criteria should say 'index is based on {concept set name}'
Actual behavior
It defaults to 'any condition' (for example), and never changes.
Steps to reproduce behavior
Create Cohort Definition
Add Condition Occurrence criteria
Add Nested Criteria
Change Root Condition Occurrence criteria to a new concept set.
Observe: nested criteria says 'index based on 'any condition'.
Solution
This is due to the lack of an observable being used in the view model. This is correctly implemented in ConditionEra, but not ConditionOccurrence.
Bad Code:
self.indexMessage = ko.i18nformat(
'components.conditionOccurrence.indexDataText',
'The index date refers to the condition occurrence of <%= conceptSetName %>.',
{
conceptSetName: utils.getConceptSetName(
self.Criteria.CodesetId,
self.expression.ConceptSets,
ko.i18n('components.conditionOccurrence.anyCondition', 'Any Condition')
),
}
);
Working Code:
self.indexMessage = ko.pureComputed(() => {
var anyCondition = ko.i18n('components.conditionEra.anyConditionButton', 'Any Condition');
var message = ko.i18n('components.conditionEra.returnText_1', 'The index date refers to the condition era of');
var conceptSetName = utils.getConceptSetName(
self.Criteria.CodesetId,
self.expression.ConceptSets,
anyCondition()
);
return `${message()} ${conceptSetName}.`;
});
The difference is the indexMessage is a computed observable that pulls in the value from the i18n and the concept set name. The bad code is returning the result of an ko.i18n result, which may be observable, but only changes when the localization changes.
Expected behavior
When you set the concept set on the 'root' criteria object, the nested criteria should say 'index is based on {concept set name}'
Actual behavior
It defaults to 'any condition' (for example), and never changes.
Steps to reproduce behavior
Solution
This is due to the lack of an observable being used in the view model. This is correctly implemented in ConditionEra, but not ConditionOccurrence.
Bad Code:
Working Code:
The difference is the indexMessage is a computed observable that pulls in the value from the i18n and the concept set name. The bad code is returning the result of an ko.i18n result, which may be observable, but only changes when the localization changes.