From c73ec5fcbd99edf50d25110766a622d1efeb61cb Mon Sep 17 00:00:00 2001 From: Rohit Kandimalla Date: Fri, 3 Nov 2023 09:48:26 -0400 Subject: [PATCH 1/3] MAT-6383 bug fix for saving QDM population Criteria --- .../populationCriteria/groups/QDM/QDMMeasureGroups.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx b/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx index d563d34b..6c2c5833 100644 --- a/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx +++ b/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx @@ -580,7 +580,7 @@ const MeasureGroups = (props: MeasureGroupProps) => { const orderingMeasureGroupObservations = (group: Group) => { return group.populations .map((population) => { - return group.measureObservations.find( + return group.measureObservations?.find( (observation) => population.id === observation.criteriaReference ); }) From 1a03d161cdaf03dc2c5d34a0ebadd06ca4b1ba82 Mon Sep 17 00:00:00 2001 From: Rohit Kandimalla Date: Fri, 3 Nov 2023 10:07:56 -0400 Subject: [PATCH 2/3] Additional Check to order obs only for ratio group --- .../populationCriteria/groups/QDM/QDMMeasureGroups.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx b/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx index 6c2c5833..27743c47 100644 --- a/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx +++ b/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx @@ -12,6 +12,7 @@ import { Population, MeasureObservation, Stratification, + MeasureScoring, } from "@madie/madie-models"; import { MenuItem as MuiMenuItem, Typography, Divider } from "@mui/material"; import { CqlAntlr } from "@madie/cql-antlr-parser/dist/src"; @@ -515,7 +516,9 @@ const MeasureGroups = (props: MeasureGroupProps) => { return; } } - group.measureObservations = orderingMeasureGroupObservations(group); + if (group.scoring === MeasureScoring.RATIO) { + group.measureObservations = orderingMeasureGroupObservations(group); + } if (measure?.groups && !(measureGroupNumber >= measure?.groups?.length)) { group.id = measure?.groups[measureGroupNumber].id; measureServiceApi From 67d752d59ad8566d029c305a283972cb5a538c14 Mon Sep 17 00:00:00 2001 From: Rohit Kandimalla Date: Fri, 3 Nov 2023 10:41:36 -0400 Subject: [PATCH 3/3] Updated function name and added the description --- .../populationCriteria/groups/QDM/QDMMeasureGroups.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx b/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx index 27743c47..f8739fd2 100644 --- a/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx +++ b/src/components/editMeasure/populationCriteria/groups/QDM/QDMMeasureGroups.tsx @@ -517,7 +517,7 @@ const MeasureGroups = (props: MeasureGroupProps) => { } } if (group.scoring === MeasureScoring.RATIO) { - group.measureObservations = orderingMeasureGroupObservations(group); + group.measureObservations = sortObservations(group); } if (measure?.groups && !(measureGroupNumber >= measure?.groups?.length)) { group.id = measure?.groups[measureGroupNumber].id; @@ -580,7 +580,8 @@ const MeasureGroups = (props: MeasureGroupProps) => { } }; - const orderingMeasureGroupObservations = (group: Group) => { + // sort observations to follow [denom observation, numer observation] order + const sortObservations = (group: Group) => { return group.populations .map((population) => { return group.measureObservations?.find(