From a029805c187ec0367c931a201ffac18aadd325f2 Mon Sep 17 00:00:00 2001 From: hadijahkyampeire Date: Thu, 30 May 2024 23:02:43 +0300 Subject: [PATCH] fix the duplicating issue --- __mocks__/encounter-tile.mock.ts | 2 - .../src/dashboard.meta.tsx | 2 +- .../esm-hiv-care-treatment-app/src/index.ts | 12 +-- .../src/routes.json | 4 +- ...dherence-counselling-summary.component.tsx | 35 -------- .../tabs/adherence-counselling.component.tsx | 20 ----- ...hanced-adherence-counselling.component.tsx | 20 ----- .../tabs/cd4-results.component.tsx | 3 +- .../hiv-baseline-summary.component.tsx | 86 ------------------- .../src/dashboard.meta.tsx | 2 +- ...e.component.tsx => hts-home.component.tsx} | 0 .../src/hts-root.component.tsx | 2 +- .../ohri-patient-tabs.component.tsx | 2 +- .../hts-summary-tiles.component.tsx | 2 +- ...re-in-last-14-days-list-tile.component.tsx | 3 +- ...ve-in-last-14-days-list-tile.component.tsx | 3 +- .../today-client-list-tile.component.tsx | 2 +- 17 files changed, 19 insertions(+), 181 deletions(-) delete mode 100644 packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/adherence-counselling-summary.component.tsx delete mode 100644 packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/tabs/adherence-counselling.component.tsx delete mode 100644 packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/tabs/enhanced-adherence-counselling.component.tsx delete mode 100644 packages/esm-hiv-care-treatment-app/src/views/hiv-baseline/hiv-baseline-summary.component.tsx rename packages/esm-hiv-prevention-app/src/{hiv-testing-services-home.component.tsx => hts-home.component.tsx} (100%) diff --git a/__mocks__/encounter-tile.mock.ts b/__mocks__/encounter-tile.mock.ts index b45838219..e247ea59a 100644 --- a/__mocks__/encounter-tile.mock.ts +++ b/__mocks__/encounter-tile.mock.ts @@ -1,5 +1,3 @@ -import { getObsFromEncounter } from '@ohri/openmrs-esm-ohri-commons-lib'; - export const headerTitle = 'HIV Monitoring'; export const patientUuid = 'b280078a-c0ce-443b-9997-3c66c63ec2f8'; diff --git a/packages/esm-hiv-care-treatment-app/src/dashboard.meta.tsx b/packages/esm-hiv-care-treatment-app/src/dashboard.meta.tsx index 9b6407ecd..00e2c950f 100644 --- a/packages/esm-hiv-care-treatment-app/src/dashboard.meta.tsx +++ b/packages/esm-hiv-care-treatment-app/src/dashboard.meta.tsx @@ -1,4 +1,4 @@ -import { Home, Pills } from '@carbon/react/icons'; +import { Home } from '@carbon/react/icons'; // Patient Chart Dashboards export const hivCareAndTreatmentDashboardDMeta = { diff --git a/packages/esm-hiv-care-treatment-app/src/index.ts b/packages/esm-hiv-care-treatment-app/src/index.ts index 633182857..cd60b113e 100644 --- a/packages/esm-hiv-care-treatment-app/src/index.ts +++ b/packages/esm-hiv-care-treatment-app/src/index.ts @@ -42,11 +42,6 @@ export function startupApp() { export const patientHIVStatusTag = getSyncLifecycle(PatientStatusBannerTag, options); -export const htsServiceSummaryList = getSyncLifecycle(ServiceSummaryOverviewList, { - featureName: 'hts-service-summary-list', - moduleName, -}); - export const hivCareAndTreatmentFolderLink = getSyncLifecycle( createOHRIDashboardLink(hivCareAndTreatmentFolderDashboardMeta), options, @@ -57,6 +52,13 @@ export const hivCareAndTreatmentDashboardLink = getSyncLifecycle( ); export const hivCareAndTreatmentDashboard = getSyncLifecycle(careAndTreatmentRootComponent, options); +// Patient chart + +export const hivServiceSummaryList = getSyncLifecycle(ServiceSummaryOverviewList, { + featureName: 'hiv-service-summary-list', + moduleName, +}); + export const patientChartHIVCareAndTreatmentDashboard = getSyncLifecycle( createDashboardGroup(hivCareAndTreatmentDashboardDMeta), options, diff --git a/packages/esm-hiv-care-treatment-app/src/routes.json b/packages/esm-hiv-care-treatment-app/src/routes.json index 41726a363..e57ffbff3 100644 --- a/packages/esm-hiv-care-treatment-app/src/routes.json +++ b/packages/esm-hiv-care-treatment-app/src/routes.json @@ -55,9 +55,9 @@ } }, { - "name": "hts-service-summary-list-ext", + "name": "hiv-service-summary-list-ext", "slot": "hiv-patient-summary-dashboard-slot", - "component": "htsServiceSummaryList" + "component": "hivServiceSummaryList" }, { "name": "program-management-summary", diff --git a/packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/adherence-counselling-summary.component.tsx b/packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/adherence-counselling-summary.component.tsx deleted file mode 100644 index 89579143e..000000000 --- a/packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/adherence-counselling-summary.component.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; -import styles from '../common.scss'; -import AdherenceCounsellingList from './tabs/adherence-counselling.component'; -import EnhancedAdherenceCounsellingList from './tabs/enhanced-adherence-counselling.component'; -import { useTranslation } from 'react-i18next'; - -interface OverviewListProps { - patientUuid: string; -} - -const AdherenceCounsellingSummary: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - - return ( -
- - - {t('adherenceCounselling', 'Adherence Counselling')} - {t('enhancedAdherenceCounselling', 'Enhanced Adherence Counselling')} - - - - - - - - - - -
- ); -}; - -export default AdherenceCounsellingSummary; diff --git a/packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/tabs/adherence-counselling.component.tsx b/packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/tabs/adherence-counselling.component.tsx deleted file mode 100644 index 7935a66bf..000000000 --- a/packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/tabs/adherence-counselling.component.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { EmptyState } from '@ohri/openmrs-esm-ohri-commons-lib'; - -interface AdherenceCounsellingListProps { - patientUuid: string; -} - -const AdherenceCounsellingList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const headerTitle = t('adherenceCounselling', 'Adherence Counselling'); - - return ( - <> - - - ); -}; - -export default AdherenceCounsellingList; diff --git a/packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/tabs/enhanced-adherence-counselling.component.tsx b/packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/tabs/enhanced-adherence-counselling.component.tsx deleted file mode 100644 index 777c8fa0f..000000000 --- a/packages/esm-hiv-care-treatment-app/src/views/adherence-counselling/tabs/enhanced-adherence-counselling.component.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { EmptyState } from '@ohri/openmrs-esm-ohri-commons-lib'; - -interface EnhancedAdherenceCounsellingListProps { - patientUuid: string; -} - -const EnhancedAdherenceCounsellingList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const headerTitle = t('enhancedAdherenceCounselling', 'Enhanced Adherence Counselling'); - - return ( - <> - - - ); -}; - -export default EnhancedAdherenceCounsellingList; diff --git a/packages/esm-hiv-care-treatment-app/src/views/care-and-treatment/lab-results/tabs/cd4-results.component.tsx b/packages/esm-hiv-care-treatment-app/src/views/care-and-treatment/lab-results/tabs/cd4-results.component.tsx index 0cabf768f..3be47983c 100644 --- a/packages/esm-hiv-care-treatment-app/src/views/care-and-treatment/lab-results/tabs/cd4-results.component.tsx +++ b/packages/esm-hiv-care-treatment-app/src/views/care-and-treatment/lab-results/tabs/cd4-results.component.tsx @@ -1,5 +1,4 @@ import React, { useEffect, useState, useCallback } from 'react'; -import styles from './patient-list.scss'; import { useTranslation } from 'react-i18next'; import { EmptyState, @@ -14,6 +13,8 @@ import { capitalize } from 'lodash-es'; import { Link, BrowserRouter as Router } from 'react-router-dom'; import { LabresultsFormViewer } from '../lab-results-form-viewer'; +import styles from './patient-list.scss'; + interface CD4ResultsListProps { patientUuid: string; } diff --git a/packages/esm-hiv-care-treatment-app/src/views/hiv-baseline/hiv-baseline-summary.component.tsx b/packages/esm-hiv-care-treatment-app/src/views/hiv-baseline/hiv-baseline-summary.component.tsx deleted file mode 100644 index 714b16d7e..000000000 --- a/packages/esm-hiv-care-treatment-app/src/views/hiv-baseline/hiv-baseline-summary.component.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import React, { useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { - getObsFromEncounter, - MultipleEncounterList, - MultipleEncounterListColumn, -} from '@ohri/openmrs-esm-ohri-commons-lib'; -import { useConfig } from '@openmrs/esm-framework'; - -interface HivBaselineTabListProps { - patientUuid: string; -} - -const HivBaselineTabList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - - const { obsConcepts, encounterTypes } = useConfig(); - - const encounters: Array = [ - encounterTypes.careAndTreatmentEncounterType, - encounterTypes.art_Therapy_EncounterUUID, - encounterTypes.clinicalVisitEncounterType, - ]; - const columns: MultipleEncounterListColumn[] = useMemo( - () => [ - { - key: 'hivDiagnosisDate', - header: t('hivDiagnosisDate', 'HIV Diagnosis Date'), - getValue: (encounters) => { - return getObsFromEncounter( - encounters[encounterTypes.careAndTreatmentEncounterType], - obsConcepts.dateOfHIVDiagnosisConcept, - true, - ); - }, - }, - { - key: 'enrollmentDate', - header: t('enrollmentDate', 'Enrollment Date'), - getValue: (encounters) => { - return getObsFromEncounter( - encounters[encounterTypes.careAndTreatmentEncounterType], - obsConcepts.enrolmentDate, - true, - ); - }, - }, - { - key: 'artStartDate', - header: t('artStartDate', 'ART Start Date'), - getValue: (encounters) => { - return getObsFromEncounter( - encounters[encounterTypes.art_Therapy_EncounterUUID], - obsConcepts.artTherapyDateTime_UUID, - true, - ); - }, - }, - { - key: 'tbScreening', - header: t('tbScreening', 'Current TB Screening'), - getValue: (encounters) => { - return getObsFromEncounter( - encounters[encounterTypes.clinicalVisitEncounterType], - obsConcepts.tbScreeningOutcome, - ); - }, - }, - ], - [], - ); - - const headerTitle = t('hivBaseline', 'HIV Baseline'); - - return ( - - ); -}; - -export default HivBaselineTabList; diff --git a/packages/esm-hiv-prevention-app/src/dashboard.meta.tsx b/packages/esm-hiv-prevention-app/src/dashboard.meta.tsx index cb2953d99..cd47940c8 100644 --- a/packages/esm-hiv-prevention-app/src/dashboard.meta.tsx +++ b/packages/esm-hiv-prevention-app/src/dashboard.meta.tsx @@ -1,4 +1,4 @@ -import { Home, Pills } from '@carbon/react/icons'; +import { Pills } from '@carbon/react/icons'; // Patient Chart Dashboards export const hivPreventionDashboardMeta = { diff --git a/packages/esm-hiv-prevention-app/src/hiv-testing-services-home.component.tsx b/packages/esm-hiv-prevention-app/src/hts-home.component.tsx similarity index 100% rename from packages/esm-hiv-prevention-app/src/hiv-testing-services-home.component.tsx rename to packages/esm-hiv-prevention-app/src/hts-home.component.tsx diff --git a/packages/esm-hiv-prevention-app/src/hts-root.component.tsx b/packages/esm-hiv-prevention-app/src/hts-root.component.tsx index 97d909e28..f709f26bb 100644 --- a/packages/esm-hiv-prevention-app/src/hts-root.component.tsx +++ b/packages/esm-hiv-prevention-app/src/hts-root.component.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { SWRConfig } from 'swr'; import { BrowserRouter, Route, Routes } from 'react-router-dom'; -import Home from './hiv-testing-services-home.component'; +import Home from './hts-home.component'; const swrConfiguration = { // Maximum number of retries when the backend returns an error diff --git a/packages/esm-hiv-prevention-app/src/views/testing-services/patient-tabs/ohri-patient-tabs.component.tsx b/packages/esm-hiv-prevention-app/src/views/testing-services/patient-tabs/ohri-patient-tabs.component.tsx index 2f5633fd5..b4e7dd40d 100644 --- a/packages/esm-hiv-prevention-app/src/views/testing-services/patient-tabs/ohri-patient-tabs.component.tsx +++ b/packages/esm-hiv-prevention-app/src/views/testing-services/patient-tabs/ohri-patient-tabs.component.tsx @@ -3,7 +3,7 @@ import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; import styles from './ohri-patient-tabs.scss'; import { CohortPatientList } from '@ohri/openmrs-esm-ohri-commons-lib'; import { useTranslation } from 'react-i18next'; -import { moduleName } from '../../../../../esm-hiv-care-treatment-app/src/index'; +import { moduleName } from '../../../index'; import { useConfig } from '@openmrs/esm-framework'; function OHRIPatientTabs() { diff --git a/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/hts-summary-tiles.component.tsx b/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/hts-summary-tiles.component.tsx index 6ca16921a..07f837a34 100644 --- a/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/hts-summary-tiles.component.tsx +++ b/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/hts-summary-tiles.component.tsx @@ -1,4 +1,4 @@ -import { Column, Row } from '@carbon/react'; +import { Row } from '@carbon/react'; import React, { useEffect, useState } from 'react'; import { OHRISummaryTile, diff --git a/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/linked-to-care-in-last-14-days-list-tile.component.tsx b/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/linked-to-care-in-last-14-days-list-tile.component.tsx index a3dc9ba03..48eda37d2 100644 --- a/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/linked-to-care-in-last-14-days-list-tile.component.tsx +++ b/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/linked-to-care-in-last-14-days-list-tile.component.tsx @@ -3,11 +3,10 @@ import { capitalize } from 'lodash-es'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { fetchPatientsFromObservationCodeConcept, - fetchTodayClients, TableEmptyState, filterFHIRPatientsByName, } from '@ohri/openmrs-esm-ohri-commons-lib'; -import { basePath } from '../../../../../esm-hiv-care-treatment-app/src/constants'; +import { basePath } from '../../../constants'; export const columns = [ { diff --git a/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/positive-in-last-14-days-list-tile.component.tsx b/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/positive-in-last-14-days-list-tile.component.tsx index ee3e755a0..e6ccf7c41 100644 --- a/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/positive-in-last-14-days-list-tile.component.tsx +++ b/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/positive-in-last-14-days-list-tile.component.tsx @@ -1,10 +1,9 @@ import { age, attach, detach, ExtensionSlot, useConfig } from '@openmrs/esm-framework'; import { capitalize } from 'lodash-es'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { basePath } from '../../../../../esm-hiv-care-treatment-app/src/constants'; +import { basePath } from '../../../constants'; import { fetchPatientsFromObservationCodeConcept, - fetchTodayClients, TableEmptyState, filterFHIRPatientsByName, } from '@ohri/openmrs-esm-ohri-commons-lib'; diff --git a/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/today-client-list-tile.component.tsx b/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/today-client-list-tile.component.tsx index ff22af9ee..a07d27bbc 100644 --- a/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/today-client-list-tile.component.tsx +++ b/packages/esm-hiv-prevention-app/src/views/testing-services/summary-tiles/today-client-list-tile.component.tsx @@ -2,7 +2,7 @@ import { age, attach, detach, ExtensionSlot } from '@openmrs/esm-framework'; import { capitalize } from 'lodash-es'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { TableEmptyState, fetchTodayClients, filterFHIRPatientsByName } from '@ohri/openmrs-esm-ohri-commons-lib'; -import { basePath } from '../../../../../esm-hiv-care-treatment-app/src/constants'; +import { basePath } from '../../../constants'; export const columns = [ {