-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add demographic reports to cohort generation. (#2959)
* Add demographics column, demographics tab --------- Co-authored-by: hernaldo.urbina <[email protected]> Co-authored-by: oleg-odysseus <[email protected]> Co-authored-by: Chris Knoll <[email protected]>
- Loading branch information
1 parent
30acf8a
commit 3561f67
Showing
22 changed files
with
1,864 additions
and
18 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
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
86 changes: 86 additions & 0 deletions
86
...finitions/components/reporting/cohort-reports/conversion/BaseDistributionStatConverter.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,86 @@ | ||
define([ | ||
'knockout', | ||
'./BaseStatConverter', | ||
'./DistributionStat', | ||
], function ( | ||
ko, | ||
BaseStatConverter, | ||
DistributionStat, | ||
) { | ||
|
||
class BaseDistributionStatConverter extends BaseStatConverter { | ||
|
||
constructor(classes) { | ||
super(classes); | ||
} | ||
|
||
convertAnalysisToTabularData(analysis, stratas = null) { | ||
|
||
const result = super.convertAnalysisToTabularData(analysis, stratas); | ||
stratas && stratas.filter(s => result.data.findIndex(row => row.strataId === s.strataId) < 0) | ||
.forEach(s => result.data.push(this.getResultObject( | ||
{ | ||
analysisId: analysis.analysisId, | ||
analysisName: analysis.analysisName, | ||
domainId: analysis.domainId, | ||
cohorts: [], | ||
strataId: s.strataId, | ||
strataName: s.strataName, | ||
} | ||
))); | ||
return result; | ||
} | ||
|
||
getRowId(stat) { | ||
return stat.strataId * 100000 + stat.covariateId; | ||
} | ||
|
||
getResultObject(stat) { | ||
return new DistributionStat(stat); | ||
} | ||
|
||
extractStrata(stat) { | ||
return { strataId: 0, strataName: '' }; | ||
} | ||
|
||
getDefaultColumns(analysis) { | ||
return [{ | ||
title: ko.i18n('columns.strata', 'Strata'), | ||
data: 'strataName', | ||
className: this.classes('col-distr-title'), | ||
xssSafe:false, | ||
}, | ||
{ | ||
title: 'Covariate', | ||
data: 'covariateName', | ||
className: this.classes('col-distr-cov'), | ||
xssSafe: false, | ||
}, | ||
{ | ||
title: 'Value field', | ||
data: (row, type) => { | ||
let data = (row.faType === 'CRITERIA_SET' && row.aggregateName) || "Events count" ; | ||
if (row.missingMeansZero) { | ||
data = data + "*"; | ||
} | ||
return data; | ||
} | ||
}]; | ||
} | ||
|
||
convertFields(result, strataId, cohortId, stat, prefix) { | ||
result.strataName = stat.strataName; | ||
['count', 'avg', 'pct', 'stdDev', 'median', 'max', 'min', 'p10', 'p25', 'p75', 'p90'].forEach(field => { | ||
const statName = prefix ? prefix + field.charAt(0).toUpperCase() + field.slice(1) : field; | ||
this.setNestedValue(result, field, strataId, cohortId, stat[statName]); | ||
}); | ||
} | ||
|
||
convertCompareFields(result, strataId, stat) { | ||
this.convertFields(result, strataId, stat.targetCohortId, stat, "target"); | ||
this.convertFields(result, strataId, stat.comparatorCohortId, stat, "comparator"); | ||
} | ||
} | ||
|
||
return BaseDistributionStatConverter; | ||
}); |
Oops, something went wrong.