From 47635500863b0e62c5fdf9ba26b3c6fc5d66ae5d Mon Sep 17 00:00:00 2001 From: LaurenD Date: Sat, 6 Sep 2025 21:49:42 -0400 Subject: [PATCH 1/3] subjectGroup All evaluate option --- .../calculation/PopulationCalculation.tsx | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/components/calculation/PopulationCalculation.tsx b/components/calculation/PopulationCalculation.tsx index edb5c4b..bdc2fc9 100644 --- a/components/calculation/PopulationCalculation.tsx +++ b/components/calculation/PopulationCalculation.tsx @@ -186,13 +186,13 @@ export default function PopulationCalculation() { message: `Successfully sent data for ${resolvedIds.length} patients for measure ${evaluationMeasureId}`, //TODO: update to canonical, currently using evaluationMeasureId here whereas it will be used for $submit-data in the future color: 'green' }); - setSubjectData( - resolvedIds.map(idObj => { - return idObj - ? { value: idObj.postedId, label: getPatientNameString(idObj.testCaseInfo.patient) } - : { value: '', label: '' }; - }) - ); + const subjectData = resolvedIds.map(idObj => { + return idObj + ? { value: idObj.postedId, label: getPatientNameString(idObj.testCaseInfo.patient) } + : { value: '', label: '' }; + }); + subjectData.unshift({ value: 'All', label: 'All' }); + setSubjectData(subjectData); setEnableEvaluateButton(true); } else { showNotification({ @@ -239,10 +239,28 @@ export default function PopulationCalculation() { ] }; if (reportTypeValue === 'subject' && subjectValue) { - parameters.parameter?.push({ - name: 'subject', - valueString: `Patient/${subjectValue}` - }); + if (subjectValue === 'All') { + parameters.parameter?.push({ + name: 'subjectGroup', + resource: { + resourceType: 'Group', + type: 'person', + actual: true, + member: subjectData.slice(1).map(subjectInfo => { + return { + entity: { + reference: `Patient/${subjectInfo.value}` + } + }; + }) + } + }); + } else { + parameters.parameter?.push({ + name: 'subject', + valueString: `Patient/${subjectValue}` + }); + } } const response = await fetch(`${evaluationServiceUrl}/Measure/$evaluate`, { method: 'POST', From b85e0b9c8cb9e7731549912d8a3bccbb1eda9c88 Mon Sep 17 00:00:00 2001 From: LaurenD Date: Tue, 9 Sep 2025 11:42:41 -0400 Subject: [PATCH 2/3] Add subject group reference --- components/calculation/PopulationCalculation.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/calculation/PopulationCalculation.tsx b/components/calculation/PopulationCalculation.tsx index bdc2fc9..acdc5f1 100644 --- a/components/calculation/PopulationCalculation.tsx +++ b/components/calculation/PopulationCalculation.tsx @@ -40,6 +40,7 @@ import { useDisclosure } from '@mantine/hooks'; import { evaluationState } from '../../state/atoms/evaluation'; import { dataRequirementsLookupByType } from '../../state/selectors/dataRequirementsLookupByType'; import { minimizeTestCaseResources } from '../../util/ValueSetHelper'; +import { v4 as uuidv4 } from 'uuid'; export default function PopulationCalculation() { const router = useRouter(); @@ -240,10 +241,12 @@ export default function PopulationCalculation() { }; if (reportTypeValue === 'subject' && subjectValue) { if (subjectValue === 'All') { + const groupId = uuidv4(); parameters.parameter?.push({ name: 'subjectGroup', resource: { resourceType: 'Group', + id: groupId, type: 'person', actual: true, member: subjectData.slice(1).map(subjectInfo => { @@ -255,6 +258,10 @@ export default function PopulationCalculation() { }) } }); + parameters.parameter?.push({ + name: 'subject', + valueString: `Group/${groupId}` + }); } else { parameters.parameter?.push({ name: 'subject', From ba67962a9b76ce5238ee872e83bf138d059f876d Mon Sep 17 00:00:00 2001 From: LaurenD Date: Wed, 10 Sep 2025 22:10:53 -0400 Subject: [PATCH 3/3] Allow option for population/subjectGroup --- components/calculation/PopulationCalculation.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/calculation/PopulationCalculation.tsx b/components/calculation/PopulationCalculation.tsx index acdc5f1..aea5566 100644 --- a/components/calculation/PopulationCalculation.tsx +++ b/components/calculation/PopulationCalculation.tsx @@ -239,7 +239,7 @@ export default function PopulationCalculation() { } ] }; - if (reportTypeValue === 'subject' && subjectValue) { + if (subjectValue) { if (subjectValue === 'All') { const groupId = uuidv4(); parameters.parameter?.push({ @@ -547,8 +547,8 @@ export default function PopulationCalculation() { data={subjectData} value={subjectValue} onChange={setSubjectValue} - disabled={reportTypeValue === 'population'} searchable={true} + clearable />