From 0678bf91af95a8f5fded96b955bb8b113e33085a Mon Sep 17 00:00:00 2001 From: lucille Date: Fri, 14 Jun 2024 15:22:35 +0300 Subject: [PATCH] ensure patient summary populates data --- .../src/utils/summary-card-config-builder.ts | 7 +++++-- .../views/patient-summary/tb-patient-summary.component.tsx | 2 +- .../tpt/patient-summary/patient-summary.component.tsx | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/esm-commons-lib/src/utils/summary-card-config-builder.ts b/packages/esm-commons-lib/src/utils/summary-card-config-builder.ts index c0d2ac72c..2d64cc0df 100644 --- a/packages/esm-commons-lib/src/utils/summary-card-config-builder.ts +++ b/packages/esm-commons-lib/src/utils/summary-card-config-builder.ts @@ -1,7 +1,10 @@ import { getObsFromEncounter, getConditionalConceptValue } from './encounter-list-utils'; +import { extractSchemaValues, replaceWithConfigDefaults } from './schema-manipulation'; -export const getSummaryCardProps = (schemaConfig) => { - const columns = schemaConfig.columns?.map((column) => ({ +export const getSummaryCardProps = (schemaConfig, config = null) => { + const configDefaults = extractSchemaValues(config); + const transformedSchemaConfig = replaceWithConfigDefaults(schemaConfig, configDefaults); + const columns = transformedSchemaConfig.columns?.map((column) => ({ key: column.id, header: column.title, concept: column.concept, diff --git a/packages/esm-tb-app/src/views/patient-summary/tb-patient-summary.component.tsx b/packages/esm-tb-app/src/views/patient-summary/tb-patient-summary.component.tsx index 619b156e7..a410ac49b 100644 --- a/packages/esm-tb-app/src/views/patient-summary/tb-patient-summary.component.tsx +++ b/packages/esm-tb-app/src/views/patient-summary/tb-patient-summary.component.tsx @@ -18,7 +18,7 @@ const TBSummaryOverviewList: React.FC = ({ patientUuid }) => const config = useConfig(); const previousCaseTabs = getMenuItemTabConfiguration(previousCasesConfigSchema, config); const tbVisitsTabs = getMenuItemTabConfiguration(tbVisitsConfigSchema, config); - const summaryCardColumns = getSummaryCardProps(recentTuberculosisConfigSchema); + const summaryCardColumns = getSummaryCardProps(recentTuberculosisConfigSchema, config); return ( <> diff --git a/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx b/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx index f02fbfaa8..4c5ce14c2 100644 --- a/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx +++ b/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx @@ -18,7 +18,7 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { const config = useConfig(); const previousCaseTabs = getMenuItemTabConfiguration(tptPreviousCasesConfigSchema, config); const tbVisitsTabs = getMenuItemTabConfiguration(tptVisitsConfigSchema, config); - const summaryCardColumns = getSummaryCardProps(recentTptConfigSchema); + const summaryCardColumns = getSummaryCardProps(recentTptConfigSchema, config); return ( <>