Skip to content

Commit

Permalink
Fix overall option in ranking (#6250)
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnyama authored Jan 24, 2025
1 parent 55ce56b commit fb7da79
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const DOCUMENTATION_URL = 'https://documentation.terarium.ai/datasets/compare-da
export enum TimepointOption {
LAST = 'at the last timepoint',
FIRST = 'at the first timepoint',
OVERALL = 'for all timepoints'
OVERALL = 'at its peak'
}
export enum RankOption {
MINIMUM = 'minimum',
MAXIMUM = 'maximum'
MINIMUM = 'minimize',
MAXIMUM = 'maximize'
}

export enum PlotValue {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ export function generateRankingCharts(
let pointOfComparison: Record<string, number> = {};

if (card.timepoint === TimepointOption.OVERALL) {
const comparisonFunction = card.rank === RankOption.MAXIMUM ? Math.max : Math.min;
const resultSummary = cloneDeep(chartData.value.resultSummary); // Must clone to avoid modifying the original data

// Note that the reduce function here only compares the variable of interest
Expand All @@ -215,7 +214,7 @@ export function generateRankingCharts(
pointOfComparison = resultSummary.reduce((acc, val) =>
Object.keys(val).reduce((acc2, key) => {
if (key.includes(variableKey)) {
acc2[key] = comparisonFunction(acc[key], val[key]);
acc2[key] = Math.max(acc[key], val[key]);
}
return acc2;
}, acc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Button class="ml-auto" text icon="pi pi-trash" @click="emit('delete')" />
</header>
<p>
Rank the intervention policies that optimizes the
Rank the intervention policies that can
<Dropdown
:options="Object.values(RankOption)"
:model-value="card.rank"
Expand Down

0 comments on commit fb7da79

Please sign in to comment.