From d580dab0697d7443f9eec7b56850a45eb30a06e7 Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Fri, 19 Jan 2024 14:51:55 +0300 Subject: [PATCH 01/50] Added auth for publish to npm (#1775) --- .github/workflows/node.master.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.master.js.yml b/.github/workflows/node.master.js.yml index 7bcf8df56..0671686b6 100644 --- a/.github/workflows/node.master.js.yml +++ b/.github/workflows/node.master.js.yml @@ -79,7 +79,7 @@ jobs: run: yarn install --immutable - name: Publish to NPM - run: yarn run ci:publish + run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn run ci:publish env: NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} From e236785ee1a3e723f87c54e3da81ec53a3e6ad53 Mon Sep 17 00:00:00 2001 From: AJAL ODORA JONATHAN <43242517+ODORA0@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:12:23 +0300 Subject: [PATCH 02/50] OHRI-2122 Add Program Management under the TPT Program (#1779) * OHRI-2122 Add Program Management under the TPT Program * Tab Naming * Add default translation values --- packages/esm-tb-app/src/dashboard.meta.tsx | 16 ++++++++- packages/esm-tb-app/src/index.ts | 14 ++++++++ packages/esm-tb-app/src/routes.json | 34 +++++++++++++++++++ .../tabs/tpt-enrolment.component.tsx | 21 ++++++++++++ .../tabs/tpt-treatment.component copy.tsx | 21 ++++++++++++ .../tpt-program-management.tsx | 31 +++++++++++++++++ packages/esm-tb-app/translations/en.json | 4 ++- 7 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx create mode 100644 packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component copy.tsx create mode 100644 packages/esm-tb-app/src/views/tpt/program-management/tpt-program-management.tsx diff --git a/packages/esm-tb-app/src/dashboard.meta.tsx b/packages/esm-tb-app/src/dashboard.meta.tsx index 0be3c3498..a7977d3a3 100644 --- a/packages/esm-tb-app/src/dashboard.meta.tsx +++ b/packages/esm-tb-app/src/dashboard.meta.tsx @@ -51,4 +51,18 @@ export const tbCasesDashboardMeta = { config: { columns: 1, type: 'grid', programme: 'tb', dashboardTitle: 'TB Treatment', icon: PillsAdd }, title: 'TB Treatment', dashboardIcon: PillsAdd, -}; \ No newline at end of file +}; + +export const tptPatientChartMeta = { + title: 'TPT Program', + slotName: 'ohri-tpt-slot', + isExpanded: false, +}; + +export const tptProgramManagementDashboardMeta = { + slot: 'tpt-program-management-summary-slot', + columns: 1, + title: 'Program Management', + path: 'tpt-program-management', + layoutMode: 'anchored', +}; diff --git a/packages/esm-tb-app/src/index.ts b/packages/esm-tb-app/src/index.ts index a41ab50ad..117ab7df8 100644 --- a/packages/esm-tb-app/src/index.ts +++ b/packages/esm-tb-app/src/index.ts @@ -9,6 +9,8 @@ import { tbTreatmentFollowUpDashboardMeta, tbClinicalViewDashboardMeta, tbCasesDashboardMeta, + tptProgramManagementDashboardMeta, + tptPatientChartMeta, } from './dashboard.meta'; import { configSchema } from './config-schema'; import TBSummaryOverviewList from './views/patient-summary/tb-patient-summary.component'; @@ -17,6 +19,7 @@ import TbTreatmentFollowUpList from './views/treatment-and-follow-up/tb-treatmen import TbContactTracingList from './views/tb-contact-listing/tb-contact-list.component'; import TbSummaryTiles from './views/dashboard/summary-tiles/tb-summary-tiles.component'; import TbHomePatientTabs from './views/dashboard/patient-list-tabs/tb-patient-list-tabs.component'; +import tptProgramManagementSummary from './views/tpt/program-management/tpt-program-management'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -35,6 +38,8 @@ export function startupApp() { export const patientChartTbDashboard = getSyncLifecycle(createDashboardGroup(tbPatientChartMeta), options); +export const patientChartTptDashboard = getSyncLifecycle(createDashboardGroup(tptPatientChartMeta), options); + export const tbPatientSummaryDashboardLink = getSyncLifecycle( createDashboardLink({ ...tbPatientSummaryDashboardMeta, moduleName }), options, @@ -84,6 +89,15 @@ export const tbDashboardTabs = getSyncLifecycle(TbHomePatientTabs, { moduleName, }); +export const tptProgramManagementDashboardLink = getSyncLifecycle( + createDashboardLink({ ...tptProgramManagementDashboardMeta, moduleName }), + options, +); +export const tptProgramManagementDashboard = getSyncLifecycle(tptProgramManagementSummary, { + featureName: 'tpt-program-management-summary', + moduleName, +}); + // OHRI HOME export const tbClinicalViewDashboardLink = getSyncLifecycle( createOHRIDashboardLink(tbClinicalViewDashboardMeta), diff --git a/packages/esm-tb-app/src/routes.json b/packages/esm-tb-app/src/routes.json index 2fd34a6b9..9e1d3cbeb 100644 --- a/packages/esm-tb-app/src/routes.json +++ b/packages/esm-tb-app/src/routes.json @@ -22,6 +22,23 @@ "component": "patientChartTbDashboard", "order": 24 }, + + { + "name": "tpt-dashboard-link", + "slot": "dashboard-slot", + "component": "tptFolderLink", + "meta": { + "slot": "ohri-tpt-dashboard-slot", + "isFolder": true, + "title": "TPT Program" + } + }, + { + "name": "ohri-tpt", + "slot": "patient-chart-dashboard-slot", + "component": "patientChartTptDashboard", + "order": 24 + }, { "name": "tb-summary-dashboard", @@ -57,6 +74,23 @@ "component": "tbProgramManagementDashboard" }, + { + "name": "tpt-program-management-summary", + "slot": "ohri-tpt-slot", + "component": "tptProgramManagementDashboardLink", + "meta": { + "slot": "tpt-program-management-summary-slot", + "columns": 1, + "path": "tpt-program-management", + "layoutMode": "anchored" + } + }, + { + "name": "tpt-program-management-summary-ext", + "slot": "tpt-program-management-summary-slot", + "component": "tptProgramManagementDashboard" + }, + { "name": "tb-treatment-follow-up-summary", "slot": "ohri-tb-slot", diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx new file mode 100644 index 000000000..060be006c --- /dev/null +++ b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib'; + +interface TptEnrolmentListProps { + patientUuid: string; +} + +const TptEnrolmentList: React.FC = ({ patientUuid }) => { + const { t } = useTranslation(); + + const headerTitle = t('tptEnrolment', 'TPT Enrolment'); + + return ( + <> + + + ); +}; + +export default TptEnrolmentList; diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component copy.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component copy.tsx new file mode 100644 index 000000000..81612d276 --- /dev/null +++ b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component copy.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib'; + +interface TptTreatmentListProps { + patientUuid: string; +} + +const TptTreatmentList: React.FC = ({ patientUuid }) => { + const { t } = useTranslation(); + + const headerTitle = t('tptTreatment', 'TPT Treatment'); + + return ( + <> + + + ); +}; + +export default TptTreatmentList; diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tpt-program-management.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tpt-program-management.tsx new file mode 100644 index 000000000..113903bb7 --- /dev/null +++ b/packages/esm-tb-app/src/views/tpt/program-management/tpt-program-management.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; +import styles from '../../common.scss'; +import { useTranslation } from 'react-i18next'; +import TptTreatmentList from './tabs/tpt-treatment.component copy'; +import TptEnrolmentList from './tabs/tpt-enrolment.component'; +import { PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib'; + +const TptProgramManagementSummary: React.FC = ({ patientUuid }) => { + const { t } = useTranslation(); + return ( +
+ + + {t('tptEnrolment', 'TPT Enrolment')} + {t('tptTreatment', 'TPT Treatment')} + + + + + + + + + + +
+ ); +}; + +export default TptProgramManagementSummary; diff --git a/packages/esm-tb-app/translations/en.json b/packages/esm-tb-app/translations/en.json index 24a0c4408..f91cd2062 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -28,5 +28,7 @@ "nextAppointment": "Next Appointment", "siteOfTb": "Site of TB", "appointmentDate": "Appointment Date", - "editFollowUpForm": "Edit TB Follow-up Form" + "editFollowUpForm": "Edit TB Follow-up Form", + "tptEnrolment": "TPT Enrolment", + "tptTreatment": "TPT Treatment" } From 33319e42d8422b01bd1fb29b04bf4505e11608e1 Mon Sep 17 00:00:00 2001 From: AJAL ODORA JONATHAN <43242517+ODORA0@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:40:47 +0300 Subject: [PATCH 03/50] OHRI-2117 Add TPT program menu (#1781) --- packages/esm-tb-app/src/dashboard.meta.tsx | 8 +++++++ packages/esm-tb-app/src/index.ts | 12 +++++++++++ packages/esm-tb-app/src/routes.json | 18 ++++++++++++++++ .../patient-summary.component.tsx | 21 +++++++++++++++++++ packages/esm-tb-app/translations/en.json | 3 ++- 5 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx diff --git a/packages/esm-tb-app/src/dashboard.meta.tsx b/packages/esm-tb-app/src/dashboard.meta.tsx index a7977d3a3..1858b5668 100644 --- a/packages/esm-tb-app/src/dashboard.meta.tsx +++ b/packages/esm-tb-app/src/dashboard.meta.tsx @@ -59,6 +59,14 @@ export const tptPatientChartMeta = { isExpanded: false, }; +export const tptPatientSummaryMeta = { + slot: 'tpt-patient-summary-slot', + columns: 1, + title: 'Patient Summary', + path: 'tpt-patient-summary', + layoutMode: 'anchored', +}; + export const tptProgramManagementDashboardMeta = { slot: 'tpt-program-management-summary-slot', columns: 1, diff --git a/packages/esm-tb-app/src/index.ts b/packages/esm-tb-app/src/index.ts index 117ab7df8..0d1ed63c5 100644 --- a/packages/esm-tb-app/src/index.ts +++ b/packages/esm-tb-app/src/index.ts @@ -11,6 +11,7 @@ import { tbCasesDashboardMeta, tptProgramManagementDashboardMeta, tptPatientChartMeta, + tptPatientSummaryMeta, } from './dashboard.meta'; import { configSchema } from './config-schema'; import TBSummaryOverviewList from './views/patient-summary/tb-patient-summary.component'; @@ -20,6 +21,7 @@ import TbContactTracingList from './views/tb-contact-listing/tb-contact-list.com import TbSummaryTiles from './views/dashboard/summary-tiles/tb-summary-tiles.component'; import TbHomePatientTabs from './views/dashboard/patient-list-tabs/tb-patient-list-tabs.component'; import tptProgramManagementSummary from './views/tpt/program-management/tpt-program-management'; +import tptPatientSummary from './views/tpt/patient-summary/patient-summary.component'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -89,6 +91,16 @@ export const tbDashboardTabs = getSyncLifecycle(TbHomePatientTabs, { moduleName, }); + +export const tptPatientSummaryDashboardLink = getSyncLifecycle( + createDashboardLink({ ...tptPatientSummaryMeta, moduleName }), + options, +); +export const tptPatientSummaryDashboard = getSyncLifecycle(tptPatientSummary, { + featureName: 'tpt-patient-summary', + moduleName, +}); + export const tptProgramManagementDashboardLink = getSyncLifecycle( createDashboardLink({ ...tptProgramManagementDashboardMeta, moduleName }), options, diff --git a/packages/esm-tb-app/src/routes.json b/packages/esm-tb-app/src/routes.json index 9e1d3cbeb..95736f443 100644 --- a/packages/esm-tb-app/src/routes.json +++ b/packages/esm-tb-app/src/routes.json @@ -74,6 +74,24 @@ "component": "tbProgramManagementDashboard" }, + + { + "name": "tpt-patient-summary", + "slot": "ohri-tpt-slot", + "component": "tptPatientSummaryDashboardLink", + "meta": { + "slot": "tpt-patient-summary-slot", + "columns": 1, + "path": "tpt-patient-summary", + "layoutMode": "anchored" + } + }, + { + "name": "tpt-patient-summary-ext", + "slot": "tpt-patient-summary-slot", + "component": "tptPatientSummaryDashboard" + }, + { "name": "tpt-program-management-summary", "slot": "ohri-tpt-slot", 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 new file mode 100644 index 000000000..ac9e64b03 --- /dev/null +++ b/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib'; + +interface TptPatientSummaryProps { + patientUuid: string; +} + +const TptPatientSummary: React.FC = ({ patientUuid }) => { + const { t } = useTranslation(); + + const headerTitle = t('patientSummary', 'Patient Summary'); + + return ( + <> + + + ); +}; + +export default TptPatientSummary; diff --git a/packages/esm-tb-app/translations/en.json b/packages/esm-tb-app/translations/en.json index f91cd2062..d377886da 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -30,5 +30,6 @@ "appointmentDate": "Appointment Date", "editFollowUpForm": "Edit TB Follow-up Form", "tptEnrolment": "TPT Enrolment", - "tptTreatment": "TPT Treatment" + "tptTreatment": "TPT Treatment", + "patientSummary": "Patient Summary" } From 3fa36b76c16492833ff35238b9de006b9e8dc786 Mon Sep 17 00:00:00 2001 From: Pius Rubangakene Date: Tue, 23 Jan 2024 11:43:25 +0300 Subject: [PATCH 04/50] (chore) remove condition for release on master push (#1778) --- .github/workflows/node.master.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.master.js.yml b/.github/workflows/node.master.js.yml index 0671686b6..d2a2a9181 100644 --- a/.github/workflows/node.master.js.yml +++ b/.github/workflows/node.master.js.yml @@ -57,7 +57,7 @@ jobs: needs: build - if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} + if: ${{ github.event_name == 'release' }} steps: - uses: actions/checkout@v3 From 9786b9b5d09795254186823cb49c82aaab31af32 Mon Sep 17 00:00:00 2001 From: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:20:53 +0300 Subject: [PATCH 05/50] =?UTF-8?q?OHRI-2109=20=20Add=20TB=20Prevention=20li?= =?UTF-8?q?nk=20under=20Tuberculosis=20program=20in=20the=20clinical=20per?= =?UTF-8?q?=E2=80=A6=20(#1782)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add TB Prevention link under Tuberculosis program in the clinical perspectives * renaming * renaming --- packages/esm-tb-app/src/dashboard.meta.tsx | 10 +++- packages/esm-tb-app/src/index.ts | 21 +++++++- packages/esm-tb-app/src/routes.json | 50 ++++++++++++++++++- .../tpt-patient-list-tabs.component.tsx | 23 +++++++++ .../tpt-summary-tiles.component.tsx | 22 ++++++++ packages/esm-tb-app/translations/en.json | 6 ++- 6 files changed, 125 insertions(+), 7 deletions(-) create mode 100644 packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component.tsx create mode 100644 packages/esm-tb-app/src/views/dashboard/summary-tiles/tpt-summary-tiles.component.tsx diff --git a/packages/esm-tb-app/src/dashboard.meta.tsx b/packages/esm-tb-app/src/dashboard.meta.tsx index 1858b5668..97b834dfe 100644 --- a/packages/esm-tb-app/src/dashboard.meta.tsx +++ b/packages/esm-tb-app/src/dashboard.meta.tsx @@ -48,9 +48,15 @@ export const tbClinicalViewDashboardMeta = { export const tbCasesDashboardMeta = { name: 'tb-cases', slot: 'tb-cases-dashboard-slot', - config: { columns: 1, type: 'grid', programme: 'tb', dashboardTitle: 'TB Treatment', icon: PillsAdd }, + config: { columns: 1, type: 'grid', programme: 'tb', dashboardTitle: 'TB Treatment' }, title: 'TB Treatment', - dashboardIcon: PillsAdd, +}; + +export const tbPreventionDashboardMeta = { + name: 'tb-prevention', + slot: 'tb-prevention-dashboard-slot', + config: { columns: 1, type: 'grid', programme: 'tpt', dashboardTitle: 'TB Prevention'}, + title: 'TB Prevention', }; export const tptPatientChartMeta = { diff --git a/packages/esm-tb-app/src/index.ts b/packages/esm-tb-app/src/index.ts index 0d1ed63c5..0845760dd 100644 --- a/packages/esm-tb-app/src/index.ts +++ b/packages/esm-tb-app/src/index.ts @@ -12,6 +12,7 @@ import { tptProgramManagementDashboardMeta, tptPatientChartMeta, tptPatientSummaryMeta, + tbPreventionDashboardMeta, } from './dashboard.meta'; import { configSchema } from './config-schema'; import TBSummaryOverviewList from './views/patient-summary/tb-patient-summary.component'; @@ -22,6 +23,8 @@ import TbSummaryTiles from './views/dashboard/summary-tiles/tb-summary-tiles.com import TbHomePatientTabs from './views/dashboard/patient-list-tabs/tb-patient-list-tabs.component'; import tptProgramManagementSummary from './views/tpt/program-management/tpt-program-management'; import tptPatientSummary from './views/tpt/patient-summary/patient-summary.component'; +import TptPreventionSummaryTiles from './views/dashboard/summary-tiles/tpt-summary-tiles.component'; +import TptPatientListTabs from './views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -90,7 +93,18 @@ export const tbDashboardTabs = getSyncLifecycle(TbHomePatientTabs, { featureName: 'tb-home-tabs', moduleName, }); - +export const tptDashboardHeader = getSyncLifecycle(OHRIWelcomeSection, { + featureName: 'tpt-home-header', + moduleName, +}); +export const tptDashboardTiles = getSyncLifecycle(TptPreventionSummaryTiles, { + featureName: 'tpt-home-tiles', + moduleName, +}); +export const tptDashboardTabs = getSyncLifecycle(TptPatientListTabs, { + featureName: 'tpt-home-tabs', + moduleName, +}); export const tptPatientSummaryDashboardLink = getSyncLifecycle( createDashboardLink({ ...tptPatientSummaryMeta, moduleName }), @@ -120,3 +134,8 @@ export const tbCasesDashboard = getSyncLifecycle(OHRIHome, { featureName: 'tb cases dashboard', moduleName, }); +export const tbPreventionDashboardLink = getSyncLifecycle(createOHRIDashboardLink(tbPreventionDashboardMeta), options); +export const tbPreventionDashboard = getSyncLifecycle(OHRIHome, { + featureName: 'tpt cases dashboard', + moduleName, +}); diff --git a/packages/esm-tb-app/src/routes.json b/packages/esm-tb-app/src/routes.json index 95736f443..6477df2f6 100644 --- a/packages/esm-tb-app/src/routes.json +++ b/packages/esm-tb-app/src/routes.json @@ -39,7 +39,7 @@ "component": "patientChartTptDashboard", "order": 24 }, - + { "name": "tb-summary-dashboard", "slot": "ohri-tb-slot", @@ -197,6 +197,52 @@ "name": "tb-home-tabs-ext", "slot": "tb-home-tabs-slot", "component": "tbDashboardTabs" - } + }, + { + "name": "tb-prevention-dashboard-ext", + "slot": "tb-clinical-dashboard-slot", + "component": "tbPreventionDashboardLink", + "meta": { + "name": "tb-prevention", + "slot": "tb-prevention-dashboard-slot", + "config": { + "columns": 1, + "type": "grid", + "programme": "tpt", + "dashboardTitle": "TB Prevention" + }, + "title": "TB Prevention" + } + }, + { + "name": "tb-prevention-dashboard", + "slot": "tb-prevention-dashboard-slot", + "component": "tbPreventionDashboard", + "meta": { + "name": "tb-prevention", + "slot": "tb-prevention-dashboard-slot", + "config": { + "columns": 1, + "programme": "tpt", + "dashboardTitle": "TB Prevention" + }, + "title": "TB Prevention" + } + }, + { + "name": "tpt-home-header-ext", + "slot": "tpt-home-header-slot", + "component": "tptDashboardHeader" + }, + { + "name": "tpt-home-tiles-ext", + "slot": "tpt-home-tiles-slot", + "component": "tptDashboardTiles" + }, + { + "name": "tpt-home-tabs-ext", + "slot": "tpt-home-tabs-slot", + "component": "tptDashboardTabs" + } ] } diff --git a/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component.tsx b/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component.tsx new file mode 100644 index 000000000..6eb852e58 --- /dev/null +++ b/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component.tsx @@ -0,0 +1,23 @@ +import React from 'react'; +import { Tabs, Tab, TabPanels, TabPanel, TabList } from '@carbon/react'; +import { useTranslation } from 'react-i18next'; + +interface OverviewListProps { + patientUuid: string; +} + +const TptPatientListTabs: React.FC = ({ }) => { + const { t } = useTranslation(); + return ( + + + {t('allTptClients', 'All TPT Clients')} + + + + + + ); +}; + +export default TptPatientListTabs; diff --git a/packages/esm-tb-app/src/views/dashboard/summary-tiles/tpt-summary-tiles.component.tsx b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tpt-summary-tiles.component.tsx new file mode 100644 index 000000000..06e839afb --- /dev/null +++ b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tpt-summary-tiles.component.tsx @@ -0,0 +1,22 @@ +import { OHRIProgrammeSummaryTiles } from '@ohri/openmrs-esm-ohri-commons-lib'; +import React, { useMemo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; + +function TptPreventionSummaryTiles({}) { + const { t } = useTranslation(); + const [activeTptClientsCount] = useState(78); + const tiles = useMemo( + () => [ + { + title: t('allTptClients', 'All TPT Clients'), + linkAddress: '#', + subTitle: t('currentTptClients', 'Clients Currently on TPT'), + value: activeTptClientsCount, + }, + ], + [], + ); + return ; +} + +export default TptPreventionSummaryTiles; diff --git a/packages/esm-tb-app/translations/en.json b/packages/esm-tb-app/translations/en.json index d377886da..7275f3a44 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -29,7 +29,9 @@ "siteOfTb": "Site of TB", "appointmentDate": "Appointment Date", "editFollowUpForm": "Edit TB Follow-up Form", - "tptEnrolment": "TPT Enrolment", + "tptEnrolment": "TPT Enrolment", "tptTreatment": "TPT Treatment", - "patientSummary": "Patient Summary" + "patientSummary": "Patient Summary", + "allTptClients": "All TPT Clients", + "currentTptClients": "Clients Currently on TPT" } From 8397b2c724dff3116ee6c438c4658e9632e869e8 Mon Sep 17 00:00:00 2001 From: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Date: Wed, 24 Jan 2024 22:24:47 +0300 Subject: [PATCH 06/50] OHRI-2119: Populate the Recent TPT tiles on the TPT patient summary board (#1783) * Populate the Recent TPT tiles on the TPT patient summary board * update * Update patient-summary.component.tsx * Update patient-summary.component.tsx * small update --- packages/esm-tb-app/src/config-schema.ts | 8 ++ .../patient-summary.component.tsx | 86 +++++++++++++++++-- packages/esm-tb-app/translations/en.json | 9 +- 3 files changed, 93 insertions(+), 10 deletions(-) diff --git a/packages/esm-tb-app/src/config-schema.ts b/packages/esm-tb-app/src/config-schema.ts index f3a3121c0..ffd5ccb47 100644 --- a/packages/esm-tb-app/src/config-schema.ts +++ b/packages/esm-tb-app/src/config-schema.ts @@ -16,6 +16,8 @@ export const configSchema = { tbPatientTracing: '98c938e9-fb3e-4982-ae22-0305cbd12f8c', tbProgramEnrollment: '9a199b59-b185-485b-b9b3-a9754e65ae57', tbTreatmentAndFollowUp: '1881304a-4854-4927-b0b1-a6231d61e43c', + tptCaseEnrollment: 'dc6ce80c-83f8-4ace-a638-21df78542551', + tptTreatmentAndFollowUp: '1ac3de3f-8fc2-43a7-addb-e805c393ecae', }, }, obsConcepts: { @@ -47,6 +49,12 @@ export const configSchema = { tBEnrollmentType: '163775AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', dsTBEnrollment: '160541AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', dRTBEnrollment: '160052AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptTreatmentId: '162727AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptEnrollmentDate: '164852AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptIndication: '162276AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptRegimen: '1264AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptAppointmentDate: '5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptAdherence: '164075AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', }, }, cohorts: { 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 ac9e64b03..012205e1c 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 @@ -1,19 +1,87 @@ -import React from 'react'; +import { + EmptyStateComingSoon, + EncounterList, + EncounterListColumn, + PatientChartProps, + SummaryCard, + SummaryCardColumn, + getObsFromEncounter, +} from '@ohri/openmrs-esm-ohri-commons-lib'; +import { useConfig } from '@openmrs/esm-framework'; +import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { moduleName } from '../../..'; -interface TptPatientSummaryProps { - patientUuid: string; -} - -const TptPatientSummary: React.FC = ({ patientUuid }) => { +const TptPatientSummary: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); + const { obsConcepts, encounterTypes } = useConfig(); + + const headerRecentTPT = t('recentTptCases', 'Recent TPT Cases'); + const headerPreviousCases = t('previousTptCases', 'Previous TPT Cases'); - const headerTitle = t('patientSummary', 'Patient Summary'); + const recentTbPreventionColumns: SummaryCardColumn[] = useMemo( + () => [ + { + key: 'tptTreatmentId', + header: t('tptTreatmentId', 'TPT Treatment ID'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getObsValue: async ([encounter]) => { + return getObsFromEncounter(encounter, obsConcepts.tptTreatmentId); + }, + }, + { + key: 'tptEnrollmentDate', + header: t('enrollmentDate', 'Enrollment Date'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getObsValue: async ([encounter]) => { + return getObsFromEncounter(encounter, obsConcepts.tptEnrollmentDate, true); + }, + }, + { + key: 'tptIndication', + header: t('indication', 'Indication'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getObsValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptIndication); + }, + }, + { + key: 'tptRegimen', + header: t('regimen', 'Regimen'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getObsValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptRegimen); + }, + }, + { + key: 'tptAdherence', + header: t('tptAdherence', 'Adherence'), + encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], + getObsValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptAdherence); + }, + }, + { + key: 'tptAppointmentDate', + header: t('nextAppointmentDate', 'Next Appointment Date'), + encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], + getObsValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptAppointmentDate, true); + }, + }, + ], + [], + ); return ( <> - + + ); }; diff --git a/packages/esm-tb-app/translations/en.json b/packages/esm-tb-app/translations/en.json index 7275f3a44..be686e76e 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -33,5 +33,12 @@ "tptTreatment": "TPT Treatment", "patientSummary": "Patient Summary", "allTptClients": "All TPT Clients", - "currentTptClients": "Clients Currently on TPT" + "currentTptClients": "Clients Currently on TPT", + "tptTreatmentId": "TPT Treatment ID", + "indication": "Indication", + "tptAdherence": "Adherence", + "nextAppointmentDate": "Next Appointment Date", + "previousCases": "Previous TPT Cases", + "previousTptCases": "Recent TPT Cases" + } From 7edc0fed381a3d1e7485c282487aa5aa200e591f Mon Sep 17 00:00:00 2001 From: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Date: Thu, 25 Jan 2024 18:11:03 +0300 Subject: [PATCH 07/50] OHRI-2109: Add TB Prevention link under Tuberculosis program in the clinical perspectives (#1787) * slight modification - the TB Prevention link comes first followed by TB Treatment * update on the translator * Update en.json * Update en.json * Update en.json --- packages/esm-tb-app/src/dashboard.meta.tsx | 13 +++-- packages/esm-tb-app/src/routes.json | 62 +++++++++++----------- packages/esm-tb-app/translations/en.json | 4 +- 3 files changed, 39 insertions(+), 40 deletions(-) diff --git a/packages/esm-tb-app/src/dashboard.meta.tsx b/packages/esm-tb-app/src/dashboard.meta.tsx index 97b834dfe..e9e5fe372 100644 --- a/packages/esm-tb-app/src/dashboard.meta.tsx +++ b/packages/esm-tb-app/src/dashboard.meta.tsx @@ -44,6 +44,12 @@ export const tbClinicalViewDashboardMeta = { isFolder: true, title: 'Tuberculosis', }; +export const tbPreventionDashboardMeta = { + name: 'tb-prevention', + slot: 'tb-prevention-dashboard-slot', + config: { columns: 1, type: 'grid', programme: 'tpt', dashboardTitle: 'TB Prevention'}, + title: 'TB Prevention', +}; export const tbCasesDashboardMeta = { name: 'tb-cases', @@ -52,13 +58,6 @@ export const tbCasesDashboardMeta = { title: 'TB Treatment', }; -export const tbPreventionDashboardMeta = { - name: 'tb-prevention', - slot: 'tb-prevention-dashboard-slot', - config: { columns: 1, type: 'grid', programme: 'tpt', dashboardTitle: 'TB Prevention'}, - title: 'TB Prevention', -}; - export const tptPatientChartMeta = { title: 'TPT Program', slotName: 'ohri-tpt-slot', diff --git a/packages/esm-tb-app/src/routes.json b/packages/esm-tb-app/src/routes.json index 6477df2f6..53154a6a4 100644 --- a/packages/esm-tb-app/src/routes.json +++ b/packages/esm-tb-app/src/routes.json @@ -152,6 +152,37 @@ "title": "Tuberculosis" } }, + { + "name": "tb-prevention-dashboard-ext", + "slot": "tb-clinical-dashboard-slot", + "component": "tbPreventionDashboardLink", + "meta": { + "name": "tb-prevention", + "slot": "tb-prevention-dashboard-slot", + "config": { + "columns": 1, + "type": "grid", + "programme": "tpt", + "dashboardTitle": "TB Prevention" + }, + "title": "TB Prevention" + } + }, + { + "name": "tb-prevention-dashboard", + "slot": "tb-prevention-dashboard-slot", + "component": "tbPreventionDashboard", + "meta": { + "name": "tb-prevention", + "slot": "tb-prevention-dashboard-slot", + "config": { + "columns": 1, + "programme": "tpt", + "dashboardTitle": "TB Prevention" + }, + "title": "TB Prevention" + } + }, { "name": "tb-cases-dashboard-ext", "slot": "tb-clinical-dashboard-slot", @@ -198,37 +229,6 @@ "slot": "tb-home-tabs-slot", "component": "tbDashboardTabs" }, - { - "name": "tb-prevention-dashboard-ext", - "slot": "tb-clinical-dashboard-slot", - "component": "tbPreventionDashboardLink", - "meta": { - "name": "tb-prevention", - "slot": "tb-prevention-dashboard-slot", - "config": { - "columns": 1, - "type": "grid", - "programme": "tpt", - "dashboardTitle": "TB Prevention" - }, - "title": "TB Prevention" - } - }, - { - "name": "tb-prevention-dashboard", - "slot": "tb-prevention-dashboard-slot", - "component": "tbPreventionDashboard", - "meta": { - "name": "tb-prevention", - "slot": "tb-prevention-dashboard-slot", - "config": { - "columns": 1, - "programme": "tpt", - "dashboardTitle": "TB Prevention" - }, - "title": "TB Prevention" - } - }, { "name": "tpt-home-header-ext", "slot": "tpt-home-header-slot", diff --git a/packages/esm-tb-app/translations/en.json b/packages/esm-tb-app/translations/en.json index be686e76e..af0431c55 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -38,7 +38,7 @@ "indication": "Indication", "tptAdherence": "Adherence", "nextAppointmentDate": "Next Appointment Date", - "previousCases": "Previous TPT Cases", - "previousTptCases": "Recent TPT Cases" + "previousTptCases": "Previous TPT Cases", + "recentTptCases": "Recent TPT Cases" } From bec22f3e64b990fe001bd5badf9d57137017bfd7 Mon Sep 17 00:00:00 2001 From: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Date: Fri, 26 Jan 2024 12:44:36 +0300 Subject: [PATCH 08/50] OHRI-2011: Add a table of all enrolled clients in TPT Program (#1789) * Add TB Prevention link under Tuberculosis program in the clinical perspectives * Add a table of all enrolled clients in TPT Program * Add a table of all enrolled clients in TPT Program --- .../cohort-patient-list.component.tsx | 3 + .../cohort-patient-list/helpers.tsx | 49 +++++++++++++ .../ohri-patient-list-tabs.component.tsx | 1 + packages/esm-tb-app/src/config-schema.ts | 1 + .../tpt-patient-list-tabs.component.tsx | 69 ++++++++++++++----- packages/esm-tb-app/translations/en.json | 4 +- 6 files changed, 108 insertions(+), 19 deletions(-) diff --git a/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx b/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx index 564c1096c..0a407051b 100644 --- a/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx +++ b/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx @@ -24,6 +24,7 @@ interface CohortPatientListProps { queryParams?: Array; associatedEncounterType?: string; viewPatientProgramSummary?: boolean; + viewTptPatientProgramSummary?: boolean; addPatientToListOptions?: { isEnabled: boolean; excludeCohorts?: Array }; launchableForm?: { name: string; @@ -54,6 +55,7 @@ export const CohortPatientList: React.FC = ({ extraAssociatedEncounterTypes, moduleName, viewPatientProgramSummary, + viewTptPatientProgramSummary, }) => { const [isLoading, setIsLoading] = useState(true); const [hasLoadedPatients, setHasLoadedPatients] = useState(false); @@ -147,6 +149,7 @@ export const CohortPatientList: React.FC = ({ ...addPatientToListOptions, displayText: t('moveToListSideNav', 'Move to list'), }, + viewTptPatientProgramSummary, viewPatientProgramSummary, }), }; diff --git a/packages/esm-commons-lib/src/components/cohort-patient-list/helpers.tsx b/packages/esm-commons-lib/src/components/cohort-patient-list/helpers.tsx index 5119f74df..4d30c467e 100644 --- a/packages/esm-commons-lib/src/components/cohort-patient-list/helpers.tsx +++ b/packages/esm-commons-lib/src/components/cohort-patient-list/helpers.tsx @@ -18,6 +18,7 @@ interface PatientMetaConfig { moduleName: string; addPatientToListOptions: { isEnabled: boolean; excludeCohorts?: Array; displayText: string }; viewPatientProgramSummary?: boolean; + viewTptPatientProgramSummary?: boolean; } export interface PatientListColumn { @@ -112,7 +113,44 @@ export const ViewSummaryMenuItem = ({ patientUuid, ViewSummary, encounterType }) ); }; +export const ViewTptSummaryMenuItem = ({ patientUuid, ViewTptSummary, encounterType }) => { + const [actionText, setActionText] = useState(ViewTptSummary.actionText); + const [encounterUuid, setEncounterUuid] = useState(null); + const [isLoading, setIsLoading] = useState(false); + const viewTptSummaryActionText = ViewTptSummary.actionText || 'View Summary '; + useEffect(() => { + if (ViewTptSummary.editLatestEncounter && encounterType && !encounterUuid) { + setIsLoading(true); + fetchPatientLastEncounter(patientUuid, encounterType).then((latestEncounter) => { + if (latestEncounter) { + setActionText(viewTptSummaryActionText); + setEncounterUuid(latestEncounter.uuid); + } + setIsLoading(false); + }); + } else { + setIsLoading(false); + } + }, []); + + return ( + <> + {isLoading ? ( + + ) : ( + { + navigate({ + to: `/openmrs/spa/patient/${patientUuid}/chart/tpt-patient-summary`, + }); + }} + /> + )} + + ); +}; export function consolidatatePatientMeta(rawPatientMeta, form, config: PatientMetaConfig) { const { isDynamicCohort, @@ -122,6 +160,7 @@ export function consolidatatePatientMeta(rawPatientMeta, form, config: PatientMe moduleName, addPatientToListOptions, viewPatientProgramSummary, + viewTptPatientProgramSummary, } = config; const patientUuid = !isDynamicCohort ? rawPatientMeta.patient.uuid : rawPatientMeta.person.uuid; dayjs.extend(localizedFormat); @@ -155,6 +194,16 @@ export function consolidatatePatientMeta(rawPatientMeta, form, config: PatientMe excludeCohorts={addPatientToListOptions?.excludeCohorts || []} /> )} + {viewTptPatientProgramSummary ? ( + + ) : ( + <> + )} {viewPatientProgramSummary ? ( ); diff --git a/packages/esm-tb-app/src/config-schema.ts b/packages/esm-tb-app/src/config-schema.ts index ffd5ccb47..d89b7f853 100644 --- a/packages/esm-tb-app/src/config-schema.ts +++ b/packages/esm-tb-app/src/config-schema.ts @@ -62,6 +62,7 @@ export const configSchema = { _description: 'TB Cohort uuid.', _default: { clientsEnrolledForTb: '98fd11ba-cb4d-46f7-9b82-40d49949c7ef', + clientsEnrolledForTpt: '5f28254f-0a80-4d15-ad91-68c6cf5ea715', }, }, }; diff --git a/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component.tsx b/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component.tsx index 6eb852e58..15f20b8bb 100644 --- a/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component.tsx +++ b/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component.tsx @@ -1,23 +1,58 @@ -import React from 'react'; -import { Tabs, Tab, TabPanels, TabPanel, TabList } from '@carbon/react'; +import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; +import { getObsFromEncounter, OHRIPatientListTabs } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { moduleName } from '../../../index'; +import { useConfig } from '@openmrs/esm-framework'; -interface OverviewListProps { - patientUuid: string; -} - -const TptPatientListTabs: React.FC = ({ }) => { +function TptPatientListTabs() { const { t } = useTranslation(); - return ( - - - {t('allTptClients', 'All TPT Clients')} - - - - - + const { obsConcepts, encounterTypes, cohorts } = useConfig(); + + const tabsConfigs = useMemo( + () => [ + { + label: t('allTptClients', 'All TPT Clients'), + cohortId: cohorts.clientsEnrolledForTpt, + isReportingCohort: true, + cohortSlotName: 'clients-assessed-for-tpt', + launchableForm: { + editActionText: t('editTptFollowUpForm', 'Edit TPT Follow-up form'), + editLatestEncounter: true, + targetDashboard: 'tb-assessments', + name: 'TPT Followup & Treatment form', + }, + associatedEncounterType: encounterTypes.tptCaseEnrollment, + excludeColumns: ['timeAddedToList', 'waitingTime', 'location', 'phoneNumber', 'hivResult'], + otherColumns: [ + { + key: 'tptTreatmentId', + header: t('tptTreatmentId', 'TPT Treatment ID'), + getValue: ({ latestEncounter }) => { + return getObsFromEncounter(latestEncounter, obsConcepts.tptTreatmentId); + }, + index: 1, + }, + { + key: 'EnrolmentDate', + header: t('EnrolmentDate', 'Enrolment Date'), + getValue: ({ latestEncounter }) => { + return getObsFromEncounter(latestEncounter, obsConcepts.tptEnrollmentDate, true); + }, + }, + { + key: 'indication', + header: t('indication', 'Indication'), + getValue: ({ latestEncounter }) => { + return getObsFromEncounter(latestEncounter, obsConcepts.tptIndication); + }, + }, + ], + viewTptPatientProgramSummary: true, + }, + ], + [], ); -}; + return ; +} export default TptPatientListTabs; diff --git a/packages/esm-tb-app/translations/en.json b/packages/esm-tb-app/translations/en.json index af0431c55..40562144b 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -39,6 +39,6 @@ "tptAdherence": "Adherence", "nextAppointmentDate": "Next Appointment Date", "previousTptCases": "Previous TPT Cases", - "recentTptCases": "Recent TPT Cases" - + "recentTptCases": "Recent TPT Cases", + "editTptFollowUpForm": "Edit TPT Follow-up form" } From c1d068c41f874def1df42f2408d1cb28c9dfcc8e Mon Sep 17 00:00:00 2001 From: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Date: Mon, 29 Jan 2024 11:13:27 +0300 Subject: [PATCH 09/50] Add the Previous TPT Cases Table on the patient summary board (#1790) --- packages/esm-tb-app/src/config-schema.ts | 2 + .../patient-summary.component.tsx | 88 ++++++++++++++++--- packages/esm-tb-app/translations/en.json | 3 +- 3 files changed, 82 insertions(+), 11 deletions(-) diff --git a/packages/esm-tb-app/src/config-schema.ts b/packages/esm-tb-app/src/config-schema.ts index d89b7f853..46d0bfb0e 100644 --- a/packages/esm-tb-app/src/config-schema.ts +++ b/packages/esm-tb-app/src/config-schema.ts @@ -55,6 +55,8 @@ export const configSchema = { tptRegimen: '1264AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', tptAppointmentDate: '5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', tptAdherence: '164075AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptOutcome: '1266AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptDateOutcome: '163284AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', }, }, cohorts: { 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 012205e1c..f6d9e076b 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 @@ -17,7 +17,8 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { const { obsConcepts, encounterTypes } = useConfig(); const headerRecentTPT = t('recentTptCases', 'Recent TPT Cases'); - const headerPreviousCases = t('previousTptCases', 'Previous TPT Cases'); + const headerPreviousTptCases = t('previousTptCases', 'Previous TPT Cases'); + const headerVisit = t('visits', 'Visits'); const recentTbPreventionColumns: SummaryCardColumn[] = useMemo( () => [ @@ -53,14 +54,14 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { return getObsFromEncounter(encounter, obsConcepts.tptRegimen); }, }, - { - key: 'tptAdherence', - header: t('tptAdherence', 'Adherence'), - encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], - getObsValue: (encounter) => { - return getObsFromEncounter(encounter, obsConcepts.tptAdherence); - }, - }, + { + key: 'tptAdherence', + header: t('tptAdherence', 'Adherence'), + encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], + getObsValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptAdherence); + }, + }, { key: 'tptAppointmentDate', header: t('nextAppointmentDate', 'Next Appointment Date'), @@ -73,6 +74,60 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { [], ); + const previousTptCasesColumns: EncounterListColumn[] = useMemo( + () => [ + { + key: 'tptTreatmentId', + header: t('tptTreatmentId', 'TPT Treatment ID'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptTreatmentId); + }, + }, + { + key: 'tptEnrollmentDate', + header: t('enrollmentDate', 'Enrollment Date'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptEnrollmentDate, true); + }, + }, + { + key: 'indication', + header: t('indication', 'Indication'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.indication); + }, + }, + { + key: 'tptRegimen', + header: t('regimen', 'Regimen'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptRegimen); + }, + }, + { + key: 'tptOutcome', + header: t('outcome', 'Outcome'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptOutcome); + }, + }, + { + key: 'tptDateOutcome', + header: t('dateOutcome', 'Date of Outcome'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptDateOutcome, true); + }, + }, + ], + [], + ); + return ( <> = ({ patientUuid }) => { columns={recentTbPreventionColumns} maxRowItems={4} /> - + + ); }; diff --git a/packages/esm-tb-app/translations/en.json b/packages/esm-tb-app/translations/en.json index 40562144b..c14edd9e7 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -40,5 +40,6 @@ "nextAppointmentDate": "Next Appointment Date", "previousTptCases": "Previous TPT Cases", "recentTptCases": "Recent TPT Cases", - "editTptFollowUpForm": "Edit TPT Follow-up form" + "editTptFollowUpForm": "Edit TPT Follow-up form", + "dateOutcome": "Date of Outcome" } From 9cce5164b3a16fb27f475914c5ba32c41ac00e96 Mon Sep 17 00:00:00 2001 From: AJAL ODORA JONATHAN <43242517+ODORA0@users.noreply.github.com> Date: Mon, 29 Jan 2024 13:20:48 +0300 Subject: [PATCH 10/50] OHRI-2123 TPT Enrolment List (#1786) * OHRI-2123 TPT Enrolment List * Exclude Intents in the formList prop * Update config-schema.ts --- packages/esm-tb-app/src/config-schema.ts | 11 ++ .../tabs/tpt-enrolment.component.tsx | 107 +++++++++++++++++- 2 files changed, 113 insertions(+), 5 deletions(-) diff --git a/packages/esm-tb-app/src/config-schema.ts b/packages/esm-tb-app/src/config-schema.ts index 46d0bfb0e..c4771d9d3 100644 --- a/packages/esm-tb-app/src/config-schema.ts +++ b/packages/esm-tb-app/src/config-schema.ts @@ -55,7 +55,9 @@ export const configSchema = { tptRegimen: '1264AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', tptAppointmentDate: '5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', tptAdherence: '164075AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptTreatmentStartDate: '162320AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', tptOutcome: '1266AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptOutcomeDate: '163284AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', tptDateOutcome: '163284AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', }, }, @@ -67,10 +69,19 @@ export const configSchema = { clientsEnrolledForTpt: '5f28254f-0a80-4d15-ad91-68c6cf5ea715', }, }, + formNames: { + _type: Type.Object, + _description: 'TPT Form Names.', + _default: { + TptOutcomeFormName: 'TPT outcome form', + TptCaseEnrolmentFormName: 'TPT Case Enrolment form', + }, + }, }; export interface ConfigObject { identifiers: Object; encounterTypes: Object; obsConcepts: Object; + formNames: Object; } diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx index 060be006c..0e4c339af 100644 --- a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx +++ b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx @@ -1,6 +1,8 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { EncounterList, EncounterListColumn, getObsFromEncounter } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { moduleName } from '../../../..'; +import { useConfig } from '@openmrs/esm-framework'; interface TptEnrolmentListProps { patientUuid: string; @@ -8,13 +10,108 @@ interface TptEnrolmentListProps { const TptEnrolmentList: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); + const { obsConcepts, encounterTypes, formNames } = useConfig(); const headerTitle = t('tptEnrolment', 'TPT Enrolment'); + const columns: EncounterListColumn[] = useMemo( + () => [ + { + key: 'enrollmentDate', + header: t('enrollmentDate', 'Enrollment Date'), + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptEnrollmentDate, true); + }, + }, + { + key: 'tptTreatmentID', + header: t('tptTreatmentID', 'TPT Treatment ID'), + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptTreatmentId); + }, + }, + { + key: 'indication', + header: t('indication', 'Indication'), + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptIndication); + }, + }, + { + key: 'treatmentStartDate', + header: t('treatmentStartDate', 'Treatment start date'), + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptTreatmentStartDate, true); + }, + }, + { + key: 'regimen', + header: t('regimen', 'Regimen'), + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptRegimen); + }, + }, + { + key: 'tptOutcome', + header: t('tptOutcome', 'Outcome'), + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptOutcome); + }, + }, + { + key: 'dateOfOutcome', + header: t('dateOfOutcome', 'Date of Outcome'), + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptOutcomeDate, true); + }, + }, + { + key: 'actions', + header: t('actions', 'Actions'), + getValue: (encounter) => [ + { + form: { name: formNames.TptCaseEnrolmentFormName }, + encounterUuid: encounter.uuid, + intent: '*', + label: t('viewDetails', 'View Details'), + mode: 'view', + }, + { + form: { name: formNames.TptCaseEnrolmentFormName }, + encounterUuid: encounter.uuid, + intent: '*', + label: t('editForm', 'Edit Form'), + mode: 'edit', + }, + { + form: { name: formNames.TptOutcomeFormName }, + encounterUuid: encounter.uuid, + intent: '*', + label: t('editForm', 'Add/Edit Outcome'), + mode: 'edit', + }, + ], + }, + ], + [], + ); + return ( - <> - - + ); }; From 6aa732e2d41945c053ae542e7dfc19088976cc33 Mon Sep 17 00:00:00 2001 From: Hero Date: Tue, 30 Jan 2024 11:02:09 +0200 Subject: [PATCH 11/50] =?UTF-8?q?OHRI-1916=20:=20Maternal=20visits=20list?= =?UTF-8?q?=20should=20indicate=20HIV=20Test=20status=20not=20=E2=80=A6=20?= =?UTF-8?q?(#1791)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * OHRI-1916 : Maternal visits list should indicate HIV Test status not HIV test result * add hivTestStatus to transilation --- .../views/maternal-health/tabs/antenatal-care.component.tsx | 6 +++--- packages/esm-ohri-pmtct-app/translations/en.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/antenatal-care.component.tsx b/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/antenatal-care.component.tsx index b0287a1dd..9466ca146 100644 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/antenatal-care.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/antenatal-care.component.tsx @@ -31,10 +31,10 @@ const AntenatalCareList: React.FC = ({ patientUuid }) => }, }, { - key: 'hivTestResults', - header: t('hivTestResults', 'HIV Test Results'), + key: 'hivTestStatus', + header: t('hivTestStatus', 'HIV Test Status'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.hivTestResultConcept); + return getObsFromEncounter(encounter, config.obsConcepts.hivTestStatus); }, }, { diff --git a/packages/esm-ohri-pmtct-app/translations/en.json b/packages/esm-ohri-pmtct-app/translations/en.json index ddcf1dc3a..ed118c825 100644 --- a/packages/esm-ohri-pmtct-app/translations/en.json +++ b/packages/esm-ohri-pmtct-app/translations/en.json @@ -39,6 +39,7 @@ "hivMonitoring": "HIV Monitoring", "hivStatus": "HIV Status", "hivTestResults": "HIV Test Results", + "hivTestStatus": "HIV Test Status", "infantPostnatalCare": "Infant Postnatal Care", "infantPostnatalVisit": "Infant Postnatal Visit", "infantStatus": "Infant Status at Birth", From d8cab5c20c012052c86412e15b1e0c828bfc947a Mon Sep 17 00:00:00 2001 From: AJAL ODORA JONATHAN <43242517+ODORA0@users.noreply.github.com> Date: Tue, 30 Jan 2024 12:27:46 +0300 Subject: [PATCH 12/50] Fix hyperlink on empty table list (#1792) --- packages/esm-tb-app/src/tb-helper.ts | 42 +++++++++---------- .../tabs/tpt-enrolment.component.tsx | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/esm-tb-app/src/tb-helper.ts b/packages/esm-tb-app/src/tb-helper.ts index edb424557..52901e00e 100644 --- a/packages/esm-tb-app/src/tb-helper.ts +++ b/packages/esm-tb-app/src/tb-helper.ts @@ -3,30 +3,30 @@ import { getConfig } from '@openmrs/esm-framework'; import { moduleName } from '.'; export async function getTbRegimen(encounter: any, tBEnrollmentType: string) { - const config = await getConfig(moduleName); - const regimen = - tBEnrollmentType === config.obsConcepts.dsTBEnrollment - ? config.obsConcepts.dSregimen - : config.obsConcepts.dRregimen; + const config = await getConfig(moduleName); + const regimen = + tBEnrollmentType === config.obsConcepts.dsTBEnrollment + ? config.obsConcepts.dSregimen + : config.obsConcepts.dRregimen; - return getObsFromEncounter(encounter, regimen); + return getObsFromEncounter(encounter, regimen); } -export async function getTbTreatmentStartDate(encounter: any, tBEnrollmentType: string){ - const config = await getConfig(moduleName); - const tBTreatmentStartDateConcept = - tBEnrollmentType === config.obsConcepts.dsTBEnrollment - ? config.obsConcepts.dSTreatmentStartDate - : config.obsConcepts.dRTreatmentStartDate; +export async function getTbTreatmentStartDate(encounter: any, tBEnrollmentType: string) { + const config = await getConfig(moduleName); + const tBTreatmentStartDateConcept = + tBEnrollmentType === config.obsConcepts.dsTBEnrollment + ? config.obsConcepts.dSTreatmentStartDate + : config.obsConcepts.dRTreatmentStartDate; - return getObsFromEncounter(encounter, tBTreatmentStartDateConcept, true); + return getObsFromEncounter(encounter, tBTreatmentStartDateConcept, true); } -export async function getTbTreatmentId(encounter: any, tBEnrollmentType: string){ - const config = await getConfig(moduleName); - const treatmentId = - tBEnrollmentType === config.obsConcepts.dsTBEnrollment - ? config.obsConcepts.dSTreatmentId - : config.obsConcepts.dRTreatmentId; - return getObsFromEncounter(encounter, treatmentId); -} \ No newline at end of file +export async function getTbTreatmentId(encounter: any, tBEnrollmentType: string) { + const config = await getConfig(moduleName); + const treatmentId = + tBEnrollmentType === config.obsConcepts.dsTBEnrollment + ? config.obsConcepts.dSTreatmentId + : config.obsConcepts.dRTreatmentId; + return getObsFromEncounter(encounter, treatmentId); +} diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx index 0e4c339af..33d2b0a98 100644 --- a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx +++ b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx @@ -101,8 +101,8 @@ const TptEnrolmentList: React.FC = ({ patientUuid }) => { patientUuid={patientUuid} encounterType={encounterTypes.tptCaseEnrollment} formList={[ - { name: formNames.TptOutcomeFormName, excludedIntents: ['*'] }, { name: formNames.TptCaseEnrolmentFormName }, + { name: formNames.TptOutcomeFormName, excludedIntents: ['*'] }, ]} columns={columns} description={headerTitle} From 2cee2b915ceb98d82b8ab244dfe0589b8b6f2f6d Mon Sep 17 00:00:00 2001 From: AJAL ODORA JONATHAN <43242517+ODORA0@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:13:49 +0300 Subject: [PATCH 13/50] OHRI-2130 Patient Visits table on the TPT patient summary (#1796) --- .../patient-summary.component.tsx | 76 +++++++++++++++++-- 1 file changed, 71 insertions(+), 5 deletions(-) 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 f6d9e076b..0707b09b7 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 @@ -42,7 +42,7 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { key: 'tptIndication', header: t('indication', 'Indication'), encounterTypes: [encounterTypes.tptCaseEnrollment], - getObsValue: (encounter) => { + getObsValue: ([encounter]) => { return getObsFromEncounter(encounter, obsConcepts.tptIndication); }, }, @@ -50,7 +50,7 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { key: 'tptRegimen', header: t('regimen', 'Regimen'), encounterTypes: [encounterTypes.tptCaseEnrollment], - getObsValue: (encounter) => { + getObsValue: ([encounter]) => { return getObsFromEncounter(encounter, obsConcepts.tptRegimen); }, }, @@ -58,7 +58,7 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { key: 'tptAdherence', header: t('tptAdherence', 'Adherence'), encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], - getObsValue: (encounter) => { + getObsValue: ([encounter]) => { return getObsFromEncounter(encounter, obsConcepts.tptAdherence); }, }, @@ -66,7 +66,7 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { key: 'tptAppointmentDate', header: t('nextAppointmentDate', 'Next Appointment Date'), encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], - getObsValue: (encounter) => { + getObsValue: ([encounter]) => { return getObsFromEncounter(encounter, obsConcepts.tptAppointmentDate, true); }, }, @@ -128,6 +128,60 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { [], ); + const TptVisitsColumns: EncounterListColumn[] = useMemo( + () => [ + { + key: 'caseID', + header: t('caseID', 'Case ID'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptTreatmentId); + }, + }, + { + key: 'visitDate', + header: t('visitDate', 'Visit Date'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptEnrollmentDate, true); + }, + }, + { + key: 'tptIndication', + header: t('indication', 'Indication'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptIndication); + }, + }, + { + key: 'regimen', + header: t('regimen', 'Regimen'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptRegimen); + }, + }, + { + key: 'adherence', + header: t('adherence', 'Adherence'), + encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptAdherence); + }, + }, + { + key: 'nextAppointmentDate', + header: t('nextAppointmentDate', 'Next Appointment Date'), + encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], + getValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptAppointmentDate, true); + }, + }, + ], + [], + ); + return ( <> = ({ patientUuid }) => { moduleName: moduleName, }} /> - + ); }; From a59761b622f687e721357a577acd9231a460db40 Mon Sep 17 00:00:00 2001 From: Lars Albino Lemos Date: Tue, 6 Feb 2024 08:48:24 +0200 Subject: [PATCH 14/50] (chore) Bump `@openmrs/openmrs-form-engine-lib` (#1797) * (chore) bump-form-engine * (chore) Bump `@openmrs/openmrs-form-engine-lib` --------- Co-authored-by: GitHub Actions Co-authored-by: pirupius --- packages/esm-commons-lib/package.json | 2 +- packages/esm-form-render-app/package.json | 2 +- yarn.lock | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/esm-commons-lib/package.json b/packages/esm-commons-lib/package.json index 5fba32ac2..f66ca59f6 100644 --- a/packages/esm-commons-lib/package.json +++ b/packages/esm-commons-lib/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next", + "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.525", "fuzzy": "^0.1.3", "lodash-es": "^4.17.15", "systemjs-webpack-interop": "^2.3.7", diff --git a/packages/esm-form-render-app/package.json b/packages/esm-form-render-app/package.json index e9db3380f..84f0b068f 100644 --- a/packages/esm-form-render-app/package.json +++ b/packages/esm-form-render-app/package.json @@ -39,7 +39,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next", + "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.525", "ace-builds": "^1.4.12", "react-ace": "^9.4.4" }, diff --git a/yarn.lock b/yarn.lock index 68e494330..45d175c99 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2742,7 +2742,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-commons-lib@workspace:packages/esm-commons-lib" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.525" enzyme: "npm:^3.11.0" enzyme-adapter-react-16: "npm:^1.15.6" fuzzy: "npm:^0.1.3" @@ -2799,7 +2799,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-form-render-app@workspace:packages/esm-form-render-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.525" ace-builds: "npm:^1.4.12" react-ace: "npm:^9.4.4" webpack: "npm:^5.88.2" @@ -3205,9 +3205,9 @@ __metadata: languageName: node linkType: hard -"@openmrs/openmrs-form-engine-lib@npm:next": - version: 1.0.0-pre.518 - resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.518" +"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.525": + version: 1.0.0-pre.525 + resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.525" dependencies: ace-builds: "npm:^1.4.12" enzyme: "npm:^3.11.0" @@ -3230,7 +3230,7 @@ __metadata: react: 18.x react-i18next: 11.x rxjs: 6.x - checksum: 37088760b74381d7ead87465080b33f6a912fc855f8080fda4bcec2e2e9f26f8bb86885fb66426482bf7882d3bde7739e1a2d6a5defbfba2c7f65db968ccee48 + checksum: 470137f5bbf6a9744bd578d282839022dcc17671436a13a6e42c5cbc0b8e3795973e06bd770a5d1bdd01ea91a3e883524f72f0af44d45b5d950092839b395c82 languageName: node linkType: hard From 565f7765269eb21aaa9d76951e2a2b96773d0809 Mon Sep 17 00:00:00 2001 From: AJAL ODORA JONATHAN <43242517+ODORA0@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:46:08 +0300 Subject: [PATCH 15/50] (Chore) Bump FE Version (#1798) * (Chore) Bump FE Version * run yarn install --- packages/esm-commons-lib/package.json | 2 +- packages/esm-form-render-app/package.json | 2 +- yarn.lock | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/esm-commons-lib/package.json b/packages/esm-commons-lib/package.json index f66ca59f6..5fba32ac2 100644 --- a/packages/esm-commons-lib/package.json +++ b/packages/esm-commons-lib/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.525", + "@openmrs/openmrs-form-engine-lib": "next", "fuzzy": "^0.1.3", "lodash-es": "^4.17.15", "systemjs-webpack-interop": "^2.3.7", diff --git a/packages/esm-form-render-app/package.json b/packages/esm-form-render-app/package.json index 84f0b068f..e9db3380f 100644 --- a/packages/esm-form-render-app/package.json +++ b/packages/esm-form-render-app/package.json @@ -39,7 +39,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.525", + "@openmrs/openmrs-form-engine-lib": "next", "ace-builds": "^1.4.12", "react-ace": "^9.4.4" }, diff --git a/yarn.lock b/yarn.lock index 45d175c99..762a178ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2742,7 +2742,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-commons-lib@workspace:packages/esm-commons-lib" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.525" + "@openmrs/openmrs-form-engine-lib": "npm:next" enzyme: "npm:^3.11.0" enzyme-adapter-react-16: "npm:^1.15.6" fuzzy: "npm:^0.1.3" @@ -2799,7 +2799,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-form-render-app@workspace:packages/esm-form-render-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.525" + "@openmrs/openmrs-form-engine-lib": "npm:next" ace-builds: "npm:^1.4.12" react-ace: "npm:^9.4.4" webpack: "npm:^5.88.2" @@ -3205,7 +3205,7 @@ __metadata: languageName: node linkType: hard -"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.525": +"@openmrs/openmrs-form-engine-lib@npm:next": version: 1.0.0-pre.525 resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.525" dependencies: From 3dc48ddc32345c4a2f57be78f733795640207237 Mon Sep 17 00:00:00 2001 From: AJAL ODORA JONATHAN <43242517+ODORA0@users.noreply.github.com> Date: Tue, 6 Feb 2024 13:54:26 +0300 Subject: [PATCH 16/50] OHRI-2121 (fix) Load Previous Cases on patient summary (#1799) --- .../views/tpt/patient-summary/patient-summary.component.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0707b09b7..c43ef492a 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 @@ -97,7 +97,7 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { header: t('indication', 'Indication'), encounterTypes: [encounterTypes.tptCaseEnrollment], getValue: (encounter) => { - return getObsFromEncounter(encounter, obsConcepts.indication); + return getObsFromEncounter(encounter, obsConcepts.tptIndication); }, }, { @@ -192,7 +192,7 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { /> Date: Thu, 8 Feb 2024 09:39:13 +0300 Subject: [PATCH 17/50] Ohri 2124-Added tptTreatment tab on the program management link board. (#1801) * visits tables added the visits tables under tpt patient summary * added tpt treatment tab * committed * OHRI-2124 Added tptTreatment tab on the program management link board. * OHRI-2124 updated launchOptions. * OHRI-2024:UPDATE UPDATED LAUNCH OPTIONS. --- packages/esm-tb-app/src/config-schema.ts | 2 + .../tabs/tpt-treatment.component copy.tsx | 21 ----- .../tabs/tpt-treatment.component.tsx | 85 +++++++++++++++++++ .../tpt-program-management.tsx | 2 +- 4 files changed, 88 insertions(+), 22 deletions(-) delete mode 100644 packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component copy.tsx create mode 100644 packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component.tsx diff --git a/packages/esm-tb-app/src/config-schema.ts b/packages/esm-tb-app/src/config-schema.ts index c4771d9d3..84700b840 100644 --- a/packages/esm-tb-app/src/config-schema.ts +++ b/packages/esm-tb-app/src/config-schema.ts @@ -59,6 +59,7 @@ export const configSchema = { tptOutcome: '1266AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', tptOutcomeDate: '163284AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', tptDateOutcome: '163284AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + treatmentPlan: '1265AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', }, }, cohorts: { @@ -75,6 +76,7 @@ export const configSchema = { _default: { TptOutcomeFormName: 'TPT outcome form', TptCaseEnrolmentFormName: 'TPT Case Enrolment form', + TptTreatmentFormName: 'TPT Followup & Treatment form', }, }, }; diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component copy.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component copy.tsx deleted file mode 100644 index 81612d276..000000000 --- a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component copy.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib'; - -interface TptTreatmentListProps { - patientUuid: string; -} - -const TptTreatmentList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - - const headerTitle = t('tptTreatment', 'TPT Treatment'); - - return ( - <> - - - ); -}; - -export default TptTreatmentList; diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component.tsx new file mode 100644 index 000000000..630e4c7a4 --- /dev/null +++ b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component.tsx @@ -0,0 +1,85 @@ +import React, { useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; +import { useConfig } from '@openmrs/esm-framework'; +import { EncounterList, EncounterListColumn, getObsFromEncounter } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { moduleName } from '../../../..'; + +interface TptTreatmentListProps { + patientUuid: string; +} + +const TptTreatmentList: React.FC = ({ patientUuid }) => { + const { t } = useTranslation(); + const { obsConcepts, encounterTypes, formNames } = useConfig(); + const headerTitle = t('tptTreatment', 'TPT Treatment'); + const columns: EncounterListColumn[] = useMemo( + () => [ + { + key: 'caseId', + header: t('caseId', 'Case Id'), + getValue: (encounter: any) => { + return getObsFromEncounter(encounter, obsConcepts.caseID); + }, + }, + { + key: 'Adherence', + header: t('Adherence', 'Adherence'), + getValue: (encounter: any) => { + return getObsFromEncounter(encounter, obsConcepts.tptAdherence); + }, + }, + { + key: 'treatmentPlan', + header: t('treatmentPlan', 'Treatment Plan'), + getValue: (encounter: any) => { + return getObsFromEncounter(encounter, obsConcepts.treatmentPlan); + }, + }, + { + key: 'nextAppointment', + header: t('nextAppointment', 'Next Appointment'), + getValue: (encounter: any) => { + return getObsFromEncounter(encounter, obsConcepts.tptAppointmentDate, true); + }, + }, + { + key: 'actions', + header: t('actions', 'Actions'), + getValue: (encounter) => [ + { + form: { name: formNames.TptTreatmentFormName }, + encounterUuid: encounter.uuid, + intent: '*', + label: t('viewDetails', 'View Details'), + mode: 'view', + }, + { + form: { name: formNames.TptTreatmentFormName }, + encounterUuid: encounter.uuid, + intent: '*', + label: t('editForm', 'Edit Form'), + mode: 'edit', + }, + ], + }, + ], + [], + ); + + return ( + + ); +}; + +export default TptTreatmentList; diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tpt-program-management.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tpt-program-management.tsx index 113903bb7..8e391916c 100644 --- a/packages/esm-tb-app/src/views/tpt/program-management/tpt-program-management.tsx +++ b/packages/esm-tb-app/src/views/tpt/program-management/tpt-program-management.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; import styles from '../../common.scss'; import { useTranslation } from 'react-i18next'; -import TptTreatmentList from './tabs/tpt-treatment.component copy'; +import TptTreatmentList from './tabs/tpt-treatment.component'; import TptEnrolmentList from './tabs/tpt-enrolment.component'; import { PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib'; From 1b72f2269f4cc452da9b89b4cbab875eaf3ad698 Mon Sep 17 00:00:00 2001 From: Hero Date: Wed, 14 Feb 2024 12:49:14 +0200 Subject: [PATCH 18/50] Restore the MNCH Module in the Clinical Views (#1805) * Restore the MNCH Module in the Clinical Views * change form engine to next --- packages/esm-ohri-pmtct-app/package.json | 3 ++- yarn.lock | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/esm-ohri-pmtct-app/package.json b/packages/esm-ohri-pmtct-app/package.json index 474ee974f..edc000bb1 100644 --- a/packages/esm-ohri-pmtct-app/package.json +++ b/packages/esm-ohri-pmtct-app/package.json @@ -36,7 +36,8 @@ "url": "https://github.com/UCSF-IGHS/openmrs-esm-ohri/issues" }, "dependencies": { - "@carbon/react": "^1.13.0" + "@carbon/react": "^1.13.0", + "@openmrs/openmrs-form-engine-lib": "next" }, "peerDependencies": { "@openmrs/esm-framework": "5.x", diff --git a/yarn.lock b/yarn.lock index 762a178ba..b41a5364c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2833,6 +2833,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app" dependencies: "@carbon/react": "npm:^1.13.0" + "@openmrs/openmrs-form-engine-lib": "npm:next" webpack: "npm:^5.88.2" peerDependencies: "@openmrs/esm-framework": 5.x From 8fcc4ca884d638608124ddf7ff0577866c664eba Mon Sep 17 00:00:00 2001 From: Hero Date: Thu, 15 Feb 2024 11:58:24 +0200 Subject: [PATCH 19/50] OHRI-1916: Maternal visits list should indicate HIV Test status not HIV test result (#1806) --- .../maternal-health/tabs/labour-delivery.component.tsx | 6 +++--- .../views/maternal-health/tabs/postnatal-care.component.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/labour-delivery.component.tsx b/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/labour-delivery.component.tsx index f72328d62..96fe7446c 100644 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/labour-delivery.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/labour-delivery.component.tsx @@ -38,10 +38,10 @@ const LabourDeliveryList: React.FC = ({ patientUuid }) }, }, { - key: 'hivTestResults', - header: t('hivTestResults', 'HIV Test Results'), + key: 'hivTestStatus', + header: t('hivTestStatus', 'HIV Test Status'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.ancHivResultConcept); + return getObsFromEncounter(encounter, config.obsConcepts.hivTestStatus); }, }, { diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/postnatal-care.component.tsx b/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/postnatal-care.component.tsx index 23d01277b..5a348d569 100644 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/postnatal-care.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/postnatal-care.component.tsx @@ -34,7 +34,7 @@ const PostnatalCareList: React.FC = ({ patientUuid }) => key: 'currentHivStatus', header: t('currentHivStatus', 'Current HIV Status'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.MotherHivStatus); + return getObsFromEncounter(encounter, config.obsConcepts.hivTestStatus); }, }, { From 3b00935a46a78498a49ea84807b2041cc37608de Mon Sep 17 00:00:00 2001 From: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:37:40 +0300 Subject: [PATCH 20/50] OHRI-2144: Setup e2e Tests in OHRI (#1773) * E2E test environment with playwright * .env file added * Rename ex.env to .env * Update test and rename register.spec.ts to registration.spec.ts * update the test * Ignore the e2e directory containing Playwright tests * GitHub Action to run your Playwright tests in the E2E Tests * including the e2e * updates * corrected YML file * update the yml * yml jobs * excluding the e2e in the jest config * yarn test-e2e * update the e2e test * yml * login.spec.ts * updates --- .env | 6 ++ .github/workflows/e2e.yml | 63 ++++++++++++++ .github/workflows/node.dev.js.yml | 18 +++- .gitignore | 7 ++ e2e/README.md | 117 +++++++++++++++++++++++++ e2e/commands/index.ts | 2 + e2e/commands/patient-operations.ts | 105 +++++++++++++++++++++++ e2e/commands/visit-operations.ts | 31 +++++++ e2e/core/global-setup.ts | 32 +++++++ e2e/core/index.ts | 1 + e2e/core/test.ts | 20 +++++ e2e/fixtures/api.ts | 26 ++++++ e2e/fixtures/index.ts | 1 + e2e/pages/chart-page.ts | 11 +++ e2e/pages/home-page.ts | 11 +++ e2e/pages/index.ts | 3 + e2e/pages/visits-page.ts | 9 ++ e2e/specs/registration-test.spec.ts | 40 +++++++++ jest.config.js | 4 + package.json | 7 +- playwright.config.ts | 33 ++++++++ yarn.lock | 127 ++++++++++++++++++++++++++-- 22 files changed, 666 insertions(+), 8 deletions(-) create mode 100644 .env create mode 100644 .github/workflows/e2e.yml create mode 100644 e2e/README.md create mode 100644 e2e/commands/index.ts create mode 100644 e2e/commands/patient-operations.ts create mode 100644 e2e/commands/visit-operations.ts create mode 100644 e2e/core/global-setup.ts create mode 100644 e2e/core/index.ts create mode 100644 e2e/core/test.ts create mode 100644 e2e/fixtures/api.ts create mode 100644 e2e/fixtures/index.ts create mode 100644 e2e/pages/chart-page.ts create mode 100644 e2e/pages/home-page.ts create mode 100644 e2e/pages/index.ts create mode 100644 e2e/pages/visits-page.ts create mode 100644 e2e/specs/registration-test.spec.ts create mode 100644 playwright.config.ts diff --git a/.env b/.env new file mode 100644 index 000000000..666a53f01 --- /dev/null +++ b/.env @@ -0,0 +1,6 @@ +# This is an environment file for configuring dynamic values. +E2E_BASE_URL=https://ohri-dev.globalhealthapp.net/openmrs +E2E_USER_ADMIN_USERNAME=admin +E2E_USER_ADMIN_PASSWORD=Admin123 +E2E_LOGIN_DEFAULT_LOCATION_UUID=44c3efb0-2583-4c80-a79e-1f756a03c0a1 +# The above location UUID is for the "Outpatient Clinic" location in the reference application diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 000000000..26ebd77d9 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,63 @@ +name: E2E Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Copy test environment variables + run: | + cp example.env .env + sed -i 's/8080/8180/g' .env + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Cache dependencies + id: cache + uses: actions/cache@v3 + with: + path: '**/node_modules' + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: yarn install --immutable + + - name: Install Playwright Browsers + run: npx playwright install chromium --with-deps + + - name: Run dev server + run: yarn start --sources 'packages/esm-*-app/' --port 8180 & # Refer to O3-1994 + + - name: Run E2E tests + run: yarn playwright test + + - name: Upload Report + uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 + + github-action: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Run Playwright tests with GitHub Action + run: yarn playwright test \ No newline at end of file diff --git a/.github/workflows/node.dev.js.yml b/.github/workflows/node.dev.js.yml index d04b86994..308ae9a0f 100644 --- a/.github/workflows/node.dev.js.yml +++ b/.github/workflows/node.dev.js.yml @@ -48,8 +48,24 @@ jobs: with: name: packages path: | - packages/**/dist + packages/**/dist + + run_e2e_tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + - name: Install dependencies + run: yarn install --immutable + - name: Install Playwright Browsers + run: npx playwright install chromium --with-deps + - name: Run Playwright tests + run: yarn test-e2e + pre_release: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 110fa84c7..5f4e45d03 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,10 @@ build/** # vscode .vscode + +# Playwright and e2e tests +/test-results/ +/playwright-report/ +/playwright/.cache/ +e2e/storageState.json +.env \ No newline at end of file diff --git a/e2e/README.md b/e2e/README.md new file mode 100644 index 000000000..32a0d90c3 --- /dev/null +++ b/e2e/README.md @@ -0,0 +1,117 @@ +# E2E Tests + +This directory contains an E2E test suite using the [Playwright](https://playwright.dev) +framework. + +## Getting Started + +Please ensure that you have followed the basic installation guide in the [root README](../README.md). Once everything is set up, make sure the dev server is running by using: + +```sh +yarn start +``` + +Then, in a separate terminal, run: + +```sh +yarn test-e2e --headed +``` + +By default, the test suite will run against the http://localhost:8080. You can override this by exporting `E2E_BASE_URL` environment variables beforehand: + +```sh +# Ex: Set the server URL to dev3: +export E2E_BASE_URL=https://dev3.openmrs.org/openmrs + +# Run all e2e tests: + +```sh +yarn test-e2e --headed +``` + +To run a specific test by title: + +```sh +yarn test-e2e --headed -g "title of the test" +``` + +Check [this documentation](https://playwright.dev/docs/running-tests#command-line) for more running options. + +It is also highly recommended to install the companion VS Code extension: +https://playwright.dev/docs/getting-started-vscode + +## Writing New Tests + +In general, it is recommended to read through the official [Playwright docs](https://playwright.dev/docs/intro) +before writing new test cases. The project uses the official Playwright test runner and, +generally, follows a very simple project structure: + +``` +e2e +|__ commands +| ^ Contains "commands" (simple reusable functions) that can be used in test cases/specs, +| e.g. generate a random patient. +|__ core +| ^ Contains code related to the test runner itself, e.g. setting up the custom fixtures. +| You probably need to touch this infrequently. +|__ fixtures +| ^ Contains fixtures (https://playwright.dev/docs/test-fixtures) which are used +| to run reusable setup/teardown tasks +|__ pages +| ^ Contains page object model classes for interacting with the frontend. +| See https://playwright.dev/docs/test-pom for details. +|__ specs +| ^ Contains the actual test cases/specs. New tests should be placed in this folder. +|__ support + ^ Contains support files that requires to run e2e tests, e.g. docker compose files. +``` + +When you want to write a new test case, start by creating a new spec in `./specs`. +Depending on what you want to achieve, you might want to create new fixtures and/or +page object models. To see examples, have a look at the existing code to see how these +different concepts play together. + +## Open reports from GitHub Actions / Bamboo + +To download the report from the GitHub action/Bamboo plan, follow these steps: + +1. Go to the artifact section of the action/plan and locate the report file. +2. Download the report file and unzip it using a tool of your choice. +3. Open the index.html file in a web browser to view the report. + +The report will show you a full summary of your tests, including information on which +tests passed, failed, were skipped, or were flaky. You can filter the report by browser +and explore the details of individual tests, including any errors or failures, video +recordings, and the steps involved in each test. Simply click on a test to view its details. + +## Debugging Tests + +Refer to [this documentation](https://playwright.dev/docs/debug) on how to debug a test. + +## Configuration + +This is very much underdeveloped/WIP. At the moment, there exists a (git-shared) `.env` +file which can be used for configuring certain test attributes. This is most likely +about to change in the future. Stay tuned for updates! + +## Github Actions integration + +The e2e.yml workflow is made up of two jobs: one for running on pull requests (PRs) and +one for running on commits. + +1. When running on PRs, the workflow will start the dev server, use dev3.openmrs.org as the backend, +and run tests only on chromium. This is done in order to quickly provide feedback to the developer. +The tests are designed to generate their own data and clean up after themselves once they are finished. +This ensures that the tests will have minimum effect from changes made to dev3 by other developers. +In the future, we plan to use a docker container to run the tests in an isolated environment once we +figure out a way to spin up the container within a small amount of time. +2. When running on commits, the workflow will spin up a docker container and run the dev server against +it in order to provide a known and isolated environment. In addition, tests will be run on multiple +browsers (chromium, firefox, and WebKit) to ensure compatibility. + +## Troubleshooting tips + +On MacOS, you might run into the following error: +```browserType.launch: Executable doesn't exist at /Users//Library/Caches/ms-playwright/chromium-1015/chrome-mac/Chromium.app/Contents/MacOS/Chromium``` +In order to fix this, you can attempt to force the browser reinstallation by running: +```PLAYWRIGHT_BROWSERS_PATH=/Users/$USER/Library/Caches/ms-playwright npx playwright install``` diff --git a/e2e/commands/index.ts b/e2e/commands/index.ts new file mode 100644 index 000000000..a3640e32c --- /dev/null +++ b/e2e/commands/index.ts @@ -0,0 +1,2 @@ +export * from './patient-operations'; +export * from './visit-operations'; diff --git a/e2e/commands/patient-operations.ts b/e2e/commands/patient-operations.ts new file mode 100644 index 000000000..f04171b57 --- /dev/null +++ b/e2e/commands/patient-operations.ts @@ -0,0 +1,105 @@ +import { APIRequestContext, expect } from '@playwright/test'; + +export interface Patient { + uuid: string; + identifiers: Identifier[]; + display: string; + person: { + uuid: string; + display: string; + gender: string; + age: number; + birthdate: string; + birthdateEstimated: boolean; + dead: boolean; + deathDate?: string; + causeOfDeath?: string; + preferredAddress: { + address1: string; + cityVillage: string; + country: string; + postalCode: string; + stateProvince: string; + countyDistrict: string; + }; + attributes: Array>; + voided: boolean; + birthtime?: string; + deathdateEstimated: boolean; + resourceVersion: string; + }; + attributes: { value: string; attributeType: { uuid: string; display: string } }[]; + voided: boolean; +} + +export interface Address { + preferred: boolean; + address1: string; + cityVillage: string; + country: string; + postalCode: string; + stateProvince: string; +} + +export interface Identifier { + uuid: string; + display: string; +} + +export const generateRandomPatient = async (api: APIRequestContext): Promise => { + const identifierRes = await api.post('idgen/identifiersource/8549f706-7e85-4c1d-9424-217d50a2988b/identifier', { + data: {}, + }); + await expect(identifierRes.ok()).toBeTruthy(); + const { identifier } = await identifierRes.json(); + + const patientRes = await api.post('patient', { + // TODO: This is not configurable right now. It probably should be. + data: { + identifiers: [ + { + identifier, + identifierType: '05a29f94-c0ed-11e2-94be-8c13b969e334', + location: '44c3efb0-2583-4c80-a79e-1f756a03c0a1', + preferred: true, + }, + ], + person: { + addresses: [ + { + address1: 'Bom Jesus Street', + address2: '', + cityVillage: 'Recife', + country: 'Brazil', + postalCode: '50030-310', + stateProvince: 'Pernambuco', + }, + ], + attributes: [], + birthdate: '2020-2-1', + birthdateEstimated: true, + dead: false, + gender: 'M', + names: [ + { + familyName: `Smith${Math.floor(Math.random() * 10000)}`, + givenName: `John${Math.floor(Math.random() * 10000)}`, + middleName: '', + preferred: true, + }, + ], + }, + }, + }); + await expect(patientRes.ok()).toBeTruthy(); + return await patientRes.json(); +}; + +export const getPatient = async (api: APIRequestContext, uuid: string): Promise => { + const patientRes = await api.get(`patient/${uuid}?v=full`); + return await patientRes.json(); +}; + +export const deletePatient = async (api: APIRequestContext, uuid: string) => { + await api.delete(`patient/${uuid}`, { data: {} }); +}; diff --git a/e2e/commands/visit-operations.ts b/e2e/commands/visit-operations.ts new file mode 100644 index 000000000..5aff42094 --- /dev/null +++ b/e2e/commands/visit-operations.ts @@ -0,0 +1,31 @@ +import { APIRequestContext, expect } from '@playwright/test'; +import { Visit } from '@openmrs/esm-framework'; +import dayjs from 'dayjs'; + +export const startVisit = async (api: APIRequestContext, patientId: string): Promise => { + const visitRes = await api.post('visit', { + data: { + startDatetime: dayjs().subtract(1, 'D').format('YYYY-MM-DDTHH:mm:ss.SSSZZ'), + patient: patientId, + location: process.env.E2E_LOGIN_DEFAULT_LOCATION_UUID, + visitType: '7b0f5697-27e3-40c4-8bae-f4049abfb4ed', + attributes: [], + }, + }); + + await expect(visitRes.ok()).toBeTruthy(); + return await visitRes.json(); +}; + +export const endVisit = async (api: APIRequestContext, uuid: string) => { + const visitRes = await api.post(`visit/${uuid}`, { + data: { + location: process.env.E2E_LOGIN_DEFAULT_LOCATION_UUID, + startDatetime: dayjs().subtract(1, 'D').format('YYYY-MM-DDTHH:mm:ss.SSSZZ'), + visitType: '7b0f5697-27e3-40c4-8bae-f4049abfb4ed', + stopDatetime: dayjs().format('YYYY-MM-DDTHH:mm:ss.SSSZZ'), + }, + }); + + return await visitRes.json(); +}; diff --git a/e2e/core/global-setup.ts b/e2e/core/global-setup.ts new file mode 100644 index 000000000..8d8bae0af --- /dev/null +++ b/e2e/core/global-setup.ts @@ -0,0 +1,32 @@ +import { request } from '@playwright/test'; +import * as dotenv from 'dotenv'; + +dotenv.config(); + +/** + * This configuration is to reuse the signed-in state in the tests + * by log in only once using the API and then skip the log in step for all the tests. + * + * https://playwright.dev/docs/auth#reuse-signed-in-state + */ + +async function globalSetup() { + const requestContext = await request.newContext(); + const token = Buffer.from(`${process.env.E2E_USER_ADMIN_USERNAME}:${process.env.E2E_USER_ADMIN_PASSWORD}`).toString( + 'base64', + ); + await requestContext.post(`${process.env.E2E_BASE_URL}/ws/rest/v1/session`, { + data: { + sessionLocation: process.env.E2E_LOGIN_DEFAULT_LOCATION_UUID, + locale: 'en', + }, + headers: { + Accept: 'application/json', + Authorization: `Basic ${token}`, + }, + }); + await requestContext.storageState({ path: 'e2e/storageState.json' }); + await requestContext.dispose(); +} + +export default globalSetup; \ No newline at end of file diff --git a/e2e/core/index.ts b/e2e/core/index.ts new file mode 100644 index 000000000..607718c2a --- /dev/null +++ b/e2e/core/index.ts @@ -0,0 +1 @@ +export * from './test'; diff --git a/e2e/core/test.ts b/e2e/core/test.ts new file mode 100644 index 000000000..dd3e40bb4 --- /dev/null +++ b/e2e/core/test.ts @@ -0,0 +1,20 @@ +import { APIRequestContext, Page, test as base } from '@playwright/test'; +import { api } from '../fixtures'; + +// This file sets up our custom test harness using the custom fixtures. +// See https://playwright.dev/docs/test-fixtures#creating-a-fixture for details. +// If a spec intends to use one of the custom fixtures, the special `test` function +// exported from this file must be used instead of the default `test` function +// provided by playwright. + +export interface CustomTestFixtures { + loginAsAdmin: Page; +} + +export interface CustomWorkerFixtures { + api: APIRequestContext; +} + +export const test = base.extend({ + api: [api, { scope: 'worker' }], +}); diff --git a/e2e/fixtures/api.ts b/e2e/fixtures/api.ts new file mode 100644 index 000000000..6afd8d59e --- /dev/null +++ b/e2e/fixtures/api.ts @@ -0,0 +1,26 @@ +import { APIRequestContext, PlaywrightWorkerArgs, WorkerFixture } from '@playwright/test'; + +/** + * A fixture which initializes an [`APIRequestContext`](https://playwright.dev/docs/api/class-apirequestcontext) + * that is bound to the configured OpenMRS API server. The context is automatically authenticated + * using the configured admin account. + * + * Use the request context like this: + * ```ts + * test('your test', async ({ api }) => { + * const res = await api.get('patient/1234'); + * await expect(res.ok()).toBeTruthy(); + * }); + * ``` + */ +export const api: WorkerFixture = async ({ playwright }, use) => { + const ctx = await playwright.request.newContext({ + baseURL: `${process.env.E2E_BASE_URL}/ws/rest/v1/`, + httpCredentials: { + username: process.env.E2E_USER_ADMIN_USERNAME, + password: process.env.E2E_USER_ADMIN_PASSWORD, + }, + }); + + await use(ctx); +}; diff --git a/e2e/fixtures/index.ts b/e2e/fixtures/index.ts new file mode 100644 index 000000000..b1c13e734 --- /dev/null +++ b/e2e/fixtures/index.ts @@ -0,0 +1 @@ +export * from './api'; diff --git a/e2e/pages/chart-page.ts b/e2e/pages/chart-page.ts new file mode 100644 index 000000000..cd5191a41 --- /dev/null +++ b/e2e/pages/chart-page.ts @@ -0,0 +1,11 @@ +import { type Page } from '@playwright/test'; + +export class ChartPage { + constructor(readonly page: Page) {} + + readonly formsTable = () => this.page.getByRole('table', { name: /forms/i }); + + async goTo(patientUuid: string) { + await this.page.goto('/openmrs/spa/patient/' + patientUuid + '/chart'); + } +} diff --git a/e2e/pages/home-page.ts b/e2e/pages/home-page.ts new file mode 100644 index 000000000..c38ae88f2 --- /dev/null +++ b/e2e/pages/home-page.ts @@ -0,0 +1,11 @@ +import { Page } from '@playwright/test'; + +export class HomePage { + constructor(readonly page: Page) {} + + async gotoHome() { + await this.page.goto('/openmrs/spa/home'); + + } +} + diff --git a/e2e/pages/index.ts b/e2e/pages/index.ts new file mode 100644 index 000000000..d591c5ed3 --- /dev/null +++ b/e2e/pages/index.ts @@ -0,0 +1,3 @@ +export * from './home-page'; +export * from './chart-page'; +export * from './visits-page'; diff --git a/e2e/pages/visits-page.ts b/e2e/pages/visits-page.ts new file mode 100644 index 000000000..91b36bf65 --- /dev/null +++ b/e2e/pages/visits-page.ts @@ -0,0 +1,9 @@ +import { type Page } from '@playwright/test'; + +export class VisitsPage { + constructor(readonly page: Page) {} + + async goTo(patientUuid: string) { + await this.page.goto(`patient/${patientUuid}/chart/Visits`); + } +} diff --git a/e2e/specs/registration-test.spec.ts b/e2e/specs/registration-test.spec.ts new file mode 100644 index 000000000..4b3f0c5e8 --- /dev/null +++ b/e2e/specs/registration-test.spec.ts @@ -0,0 +1,40 @@ +import { test } from '../core'; +import { expect } from '@playwright/test'; +import { HomePage, ChartPage } from '../pages'; +import { type Patient, generateRandomPatient, startVisit } from '../commands'; +import { Visit } from '@openmrs/esm-framework'; + +let patient: Patient; +let visit: Visit; + +test.beforeEach(async ({ api }) => { + patient = await generateRandomPatient(api); + visit = await startVisit(api, patient.uuid); +}); + +test('Go to homepage and register patient', async ({ page }) => { + const homePage = new HomePage(page); + + await test.step('When I visit the home page', async () => { + await homePage.gotoHome(); + }); + + await test.step('Then should be at the home page', async () => { + await expect(page).toHaveURL(`${process.env.E2E_BASE_URL}/spa/dashboard/home`); + }); + + await page.getByLabel('Add Patient').click(); + await page.getByLabel('First Name').click(); + await page.getByLabel('First Name').fill('daisy'); + await page.getByLabel('Family Name').click(); + await page.getByLabel('Family Name').fill('daisy'); + await page.getByText('Female').click(); + await page.getByRole('tab', { name: 'No' }).nth(1).click(); + await page.getByLabel('Estimated age in years').click(); + await page.getByLabel('Estimated age in years').fill('20'); + + // Click on register patient button + + await page.getByRole('button', { name: 'Register Patient' }).click(); + +}); diff --git a/jest.config.js b/jest.config.js index d87388e8c..82b65f646 100644 --- a/jest.config.js +++ b/jest.config.js @@ -35,6 +35,10 @@ const config = { '^react-i18next$': path.resolve(__dirname, '__mocks__', 'react-i18next.js'), }, testEnvironment: 'jsdom', + testPathIgnorePatterns: [ + "/node_modules/", + "/e2e/" // Ignore the e2e directory containing Playwright tests + ] }; module.exports = config; diff --git a/package.json b/package.json index 9f3a39da4..bd997b6ce 100644 --- a/package.json +++ b/package.json @@ -32,11 +32,13 @@ "coverage": "yarn test --coverage", "badges": "yarn coverage && yarn jest-coverage-badges --output './badges' ", "extract-translations": "turbo extract-translations -- --config ../../tools/i18next-parser.config.js", - "ci:bump-form-engine-lib": "yarn up @openmrs/openmrs-form-engine-lib@next" + "ci:bump-form-engine-lib": "yarn up @openmrs/openmrs-form-engine-lib@next", + "test-e2e": "playwright test" }, "devDependencies": { "@openmrs/esm-framework": "next", "@openmrs/esm-patient-common-lib": "next", + "@playwright/test": "^1.30.0", "@swc/cli": "^0.1.57", "@swc/core": "^1.2.189", "@swc/jest": "^0.2.29", @@ -60,6 +62,7 @@ "cross-env": "^7.0.3", "css-loader": "^6.8.1", "dayjs": "^1.11.10", + "dotenv": "^16.0.3", "eslint": "^8.55.0", "eslint-config-prettier": "^9.1.0", "eslint-config-ts-react-important-stuff": "^3.0.0", @@ -95,7 +98,7 @@ "webpack": "^5.88.2", "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.10.0", - "webpack-dev-server": "^4.8.1" + "webpack-dev-server ": "^4.8.1" }, "resolutions": { "@carbon/react": "1.17.0", diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 000000000..a41bf5b25 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,33 @@ +/* eslint-disable prettier/prettier */ +import { devices, PlaywrightTestConfig } from '@playwright/test'; +import * as dotenv from 'dotenv'; +dotenv.config(); + +// See https://playwright.dev/docs/test-configuration. +const config: PlaywrightTestConfig = { + testDir: './e2e/specs', + timeout: 3 * 60 * 1000, + expect: { + timeout: 40 * 1000, + }, + fullyParallel: true, + forbidOnly: !!process.env.CI, + retries: 0, + reporter: process.env.CI ? [['junit', { outputFile: 'results.xml' }], ['html']] : [['html']], + globalSetup: require.resolve('./e2e/core/global-setup'), + use: { + baseURL: `${process.env.E2E_BASE_URL}/spa/`, + storageState: 'e2e/storageState.json', + video: 'retain-on-failure', + }, + projects: [ + { + name: 'chromium', + use: { + ...devices['Desktop Chrome'], + }, + }, + ], +}; + +export default config; diff --git a/yarn.lock b/yarn.lock index b41a5364c..25fc43bc4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2867,6 +2867,7 @@ __metadata: dependencies: "@openmrs/esm-framework": "npm:next" "@openmrs/esm-patient-common-lib": "npm:next" + "@playwright/test": "npm:^1.30.0" "@swc/cli": "npm:^0.1.57" "@swc/core": "npm:^1.2.189" "@swc/jest": "npm:^0.2.29" @@ -2890,6 +2891,7 @@ __metadata: cross-env: "npm:^7.0.3" css-loader: "npm:^6.8.1" dayjs: "npm:^1.11.10" + dotenv: "npm:^16.0.3" eslint: "npm:^8.55.0" eslint-config-prettier: "npm:^9.1.0" eslint-config-ts-react-important-stuff: "npm:^3.0.0" @@ -2925,7 +2927,7 @@ __metadata: webpack: "npm:^5.88.2" webpack-bundle-analyzer: "npm:^4.4.0" webpack-cli: "npm:^4.10.0" - webpack-dev-server: "npm:^4.8.1" + "webpack-dev-server ": "npm:^4.8.1" languageName: unknown linkType: soft @@ -3265,6 +3267,17 @@ __metadata: languageName: node linkType: hard +"@playwright/test@npm:^1.30.0": + version: 1.41.2 + resolution: "@playwright/test@npm:1.41.2" + dependencies: + playwright: "npm:1.41.2" + bin: + playwright: cli.js + checksum: e87405987fa024f75acc223c47fcb2da0a66b2fa0cd9a583ca5b02aac12be353d0c262bf6a22b9bc40550c86c8b7629e70cd27f508ec370d9c92bb72f74581e7 + languageName: node + linkType: hard + "@pnpm/config.env-replace@npm:^1.0.0": version: 1.0.0 resolution: "@pnpm/config.env-replace@npm:1.0.0" @@ -5250,6 +5263,15 @@ __metadata: languageName: node linkType: hard +"@types/ws@npm:^8.5.5": + version: 8.5.10 + resolution: "@types/ws@npm:8.5.10" + dependencies: + "@types/node": "npm:*" + checksum: 9b414dc5e0b6c6f1ea4b1635b3568c58707357f68076df9e7cd33194747b7d1716d5189c0dbdd68c8d2521b148e88184cf881bac7429eb0e5c989b001539ed31 + languageName: node + linkType: hard + "@types/yargs-parser@npm:*": version: 21.0.0 resolution: "@types/yargs-parser@npm:21.0.0" @@ -8372,6 +8394,13 @@ __metadata: languageName: node linkType: hard +"dotenv@npm:^16.0.3": + version: 16.4.3 + resolution: "dotenv@npm:16.4.3" + checksum: f07db902c62c239aef7a7b696b21dfab8e95bf5883bcf23c6b9b55f42578d18b842e6257b4f4ecfdbd024a3ee9949fbaaa4c84807de7ba037c74fe3c70785198 + languageName: node + linkType: hard + "downshift@npm:5.2.1": version: 5.2.1 resolution: "downshift@npm:5.2.1" @@ -9605,7 +9634,7 @@ __metadata: languageName: node linkType: hard -"fsevents@npm:^2.3.2, fsevents@npm:~2.3.2": +"fsevents@npm:2.3.2, fsevents@npm:^2.3.2, fsevents@npm:~2.3.2": version: 2.3.2 resolution: "fsevents@npm:2.3.2" dependencies: @@ -9615,7 +9644,7 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@npm%3A^2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin": +"fsevents@patch:fsevents@npm%3A2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A^2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin": version: 2.3.2 resolution: "fsevents@patch:fsevents@npm%3A2.3.2#optional!builtin::version=2.3.2&hash=df0bf1" dependencies: @@ -11977,6 +12006,16 @@ __metadata: languageName: node linkType: hard +"launch-editor@npm:^2.6.0": + version: 2.6.1 + resolution: "launch-editor@npm:2.6.1" + dependencies: + picocolors: "npm:^1.0.0" + shell-quote: "npm:^1.8.1" + checksum: e06d193075ac09f7f8109f10cabe464a211bf7ed4cbe75f83348d6f67bf4d9f162f06e7a1ab3e1cd7fc250b5342c3b57080618aff2e646dc34248fe499227601 + languageName: node + linkType: hard + "lazystream@npm:^1.0.0": version: 1.0.1 resolution: "lazystream@npm:1.0.1" @@ -13892,6 +13931,30 @@ __metadata: languageName: node linkType: hard +"playwright-core@npm:1.41.2": + version: 1.41.2 + resolution: "playwright-core@npm:1.41.2" + bin: + playwright-core: cli.js + checksum: 77ff881ebb9cc0654edd00c5ff202f5f61aee7a5318e1f12a82e30a3636de21e8b5982fae6138e5bb90115ae509c15a640cf85b10b3e2daebb2bb286da54fd4c + languageName: node + linkType: hard + +"playwright@npm:1.41.2": + version: 1.41.2 + resolution: "playwright@npm:1.41.2" + dependencies: + fsevents: "npm:2.3.2" + playwright-core: "npm:1.41.2" + dependenciesMeta: + fsevents: + optional: true + bin: + playwright: cli.js + checksum: 272399f622dc2df90fbef147b9b1cfab5d7a78cc364bdfa98d2bf08faa9894346f58629fe4fef41b108ca2cb203b3970d7886b7f392cb0399c75b521478e2920 + languageName: node + linkType: hard + "pngjs@npm:^3.0.0, pngjs@npm:^3.3.3": version: 3.4.0 resolution: "pngjs@npm:3.4.0" @@ -15780,6 +15843,13 @@ __metadata: languageName: node linkType: hard +"shell-quote@npm:^1.8.1": + version: 1.8.1 + resolution: "shell-quote@npm:1.8.1" + checksum: af19ab5a1ec30cb4b2f91fd6df49a7442d5c4825a2e269b3712eded10eedd7f9efeaab96d57829880733fc55bcdd8e9b1d8589b4befb06667c731d08145e274d + languageName: node + linkType: hard + "side-channel@npm:^1.0.4": version: 1.0.4 resolution: "side-channel@npm:1.0.4" @@ -17587,7 +17657,54 @@ __metadata: languageName: node linkType: hard -"webpack-dev-server@npm:^4.10.1, webpack-dev-server@npm:^4.8.1": +"webpack-dev-server @npm:^4.8.1": + version: 4.15.1 + resolution: "webpack-dev-server @npm:4.15.1::__archiveUrl=https%3A%2F%2Fregistry.npmjs.org%2Fwebpack-dev-server%2F-%2Fwebpack-dev-server-4.15.1.tgz" + dependencies: + "@types/bonjour": "npm:^3.5.9" + "@types/connect-history-api-fallback": "npm:^1.3.5" + "@types/express": "npm:^4.17.13" + "@types/serve-index": "npm:^1.9.1" + "@types/serve-static": "npm:^1.13.10" + "@types/sockjs": "npm:^0.3.33" + "@types/ws": "npm:^8.5.5" + ansi-html-community: "npm:^0.0.8" + bonjour-service: "npm:^1.0.11" + chokidar: "npm:^3.5.3" + colorette: "npm:^2.0.10" + compression: "npm:^1.7.4" + connect-history-api-fallback: "npm:^2.0.0" + default-gateway: "npm:^6.0.3" + express: "npm:^4.17.3" + graceful-fs: "npm:^4.2.6" + html-entities: "npm:^2.3.2" + http-proxy-middleware: "npm:^2.0.3" + ipaddr.js: "npm:^2.0.1" + launch-editor: "npm:^2.6.0" + open: "npm:^8.0.9" + p-retry: "npm:^4.5.0" + rimraf: "npm:^3.0.2" + schema-utils: "npm:^4.0.0" + selfsigned: "npm:^2.1.1" + serve-index: "npm:^1.9.1" + sockjs: "npm:^0.3.24" + spdy: "npm:^4.0.2" + webpack-dev-middleware: "npm:^5.3.1" + ws: "npm:^8.13.0" + peerDependencies: + webpack: ^4.37.0 || ^5.0.0 + peerDependenciesMeta: + webpack: + optional: true + webpack-cli: + optional: true + bin: + webpack-dev-server: bin/webpack-dev-server.js + checksum: 10b499185e723c33a6932c805a5dfff6af1b01bd138598ca17ba7c2a545ad7cbc24da45ad8134d2692ddf57e0d27cb26656e3c1528f78354ee4a165e4f935251 + languageName: node + linkType: hard + +"webpack-dev-server@npm:^4.10.1": version: 4.11.1 resolution: "webpack-dev-server@npm:4.11.1" dependencies: @@ -18356,7 +18473,7 @@ __metadata: languageName: node linkType: hard -"ws@npm:^8.11.0": +"ws@npm:^8.11.0, ws@npm:^8.13.0": version: 8.16.0 resolution: "ws@npm:8.16.0" peerDependencies: From 015847121cae00ca73116edd440c679673c3ad1a Mon Sep 17 00:00:00 2001 From: Pius Rubangakene Date: Mon, 19 Feb 2024 12:09:15 +0300 Subject: [PATCH 21/50] (chore) remove spacing in package name (#1808) --- package.json | 2 +- yarn.lock | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index bd997b6ce..e42e8c7fb 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "webpack": "^5.88.2", "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.10.0", - "webpack-dev-server ": "^4.8.1" + "webpack-dev-server": "^4.8.1" }, "resolutions": { "@carbon/react": "1.17.0", diff --git a/yarn.lock b/yarn.lock index 25fc43bc4..ef834122b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2927,7 +2927,7 @@ __metadata: webpack: "npm:^5.88.2" webpack-bundle-analyzer: "npm:^4.4.0" webpack-cli: "npm:^4.10.0" - "webpack-dev-server ": "npm:^4.8.1" + webpack-dev-server: "npm:^4.8.1" languageName: unknown linkType: soft @@ -17657,9 +17657,9 @@ __metadata: languageName: node linkType: hard -"webpack-dev-server @npm:^4.8.1": - version: 4.15.1 - resolution: "webpack-dev-server @npm:4.15.1::__archiveUrl=https%3A%2F%2Fregistry.npmjs.org%2Fwebpack-dev-server%2F-%2Fwebpack-dev-server-4.15.1.tgz" +"webpack-dev-server@npm:^4.10.1": + version: 4.11.1 + resolution: "webpack-dev-server@npm:4.11.1" dependencies: "@types/bonjour": "npm:^3.5.9" "@types/connect-history-api-fallback": "npm:^1.3.5" @@ -17667,7 +17667,7 @@ __metadata: "@types/serve-index": "npm:^1.9.1" "@types/serve-static": "npm:^1.13.10" "@types/sockjs": "npm:^0.3.33" - "@types/ws": "npm:^8.5.5" + "@types/ws": "npm:^8.5.1" ansi-html-community: "npm:^0.0.8" bonjour-service: "npm:^1.0.11" chokidar: "npm:^3.5.3" @@ -17680,7 +17680,6 @@ __metadata: html-entities: "npm:^2.3.2" http-proxy-middleware: "npm:^2.0.3" ipaddr.js: "npm:^2.0.1" - launch-editor: "npm:^2.6.0" open: "npm:^8.0.9" p-retry: "npm:^4.5.0" rimraf: "npm:^3.0.2" @@ -17690,23 +17689,21 @@ __metadata: sockjs: "npm:^0.3.24" spdy: "npm:^4.0.2" webpack-dev-middleware: "npm:^5.3.1" - ws: "npm:^8.13.0" + ws: "npm:^8.4.2" peerDependencies: webpack: ^4.37.0 || ^5.0.0 peerDependenciesMeta: - webpack: - optional: true webpack-cli: optional: true bin: webpack-dev-server: bin/webpack-dev-server.js - checksum: 10b499185e723c33a6932c805a5dfff6af1b01bd138598ca17ba7c2a545ad7cbc24da45ad8134d2692ddf57e0d27cb26656e3c1528f78354ee4a165e4f935251 + checksum: 469d99694527b91a13d1f979c9a0a6e1c06d02ff8ca0169335b79332f319a5f8b37e74ef1a784a75e8fdd7e4b58c0dc1fa5db878ded66b77b9de61949c5c06b2 languageName: node linkType: hard -"webpack-dev-server@npm:^4.10.1": - version: 4.11.1 - resolution: "webpack-dev-server@npm:4.11.1" +"webpack-dev-server@npm:^4.8.1": + version: 4.15.1 + resolution: "webpack-dev-server@npm:4.15.1" dependencies: "@types/bonjour": "npm:^3.5.9" "@types/connect-history-api-fallback": "npm:^1.3.5" @@ -17714,7 +17711,7 @@ __metadata: "@types/serve-index": "npm:^1.9.1" "@types/serve-static": "npm:^1.13.10" "@types/sockjs": "npm:^0.3.33" - "@types/ws": "npm:^8.5.1" + "@types/ws": "npm:^8.5.5" ansi-html-community: "npm:^0.0.8" bonjour-service: "npm:^1.0.11" chokidar: "npm:^3.5.3" @@ -17727,6 +17724,7 @@ __metadata: html-entities: "npm:^2.3.2" http-proxy-middleware: "npm:^2.0.3" ipaddr.js: "npm:^2.0.1" + launch-editor: "npm:^2.6.0" open: "npm:^8.0.9" p-retry: "npm:^4.5.0" rimraf: "npm:^3.0.2" @@ -17736,15 +17734,17 @@ __metadata: sockjs: "npm:^0.3.24" spdy: "npm:^4.0.2" webpack-dev-middleware: "npm:^5.3.1" - ws: "npm:^8.4.2" + ws: "npm:^8.13.0" peerDependencies: webpack: ^4.37.0 || ^5.0.0 peerDependenciesMeta: + webpack: + optional: true webpack-cli: optional: true bin: webpack-dev-server: bin/webpack-dev-server.js - checksum: 469d99694527b91a13d1f979c9a0a6e1c06d02ff8ca0169335b79332f319a5f8b37e74ef1a784a75e8fdd7e4b58c0dc1fa5db878ded66b77b9de61949c5c06b2 + checksum: fd6dfb6c71eb94696b21930ea4c2f25e95ba85fac1bbc15aa5d03af0a90712eba057901fa9131ed3e901665c95b2379208279aca61e9c48e7cda276c3caa95dd languageName: node linkType: hard From 4de8f40da8ca85513738505fc798a5ce869cafd2 Mon Sep 17 00:00:00 2001 From: Ian <52504170+ibacher@users.noreply.github.com> Date: Thu, 22 Feb 2024 23:04:38 -0500 Subject: [PATCH 22/50] Fix the pmtct app on newer framework (#1810) --- packages/esm-ohri-pmtct-app/src/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/esm-ohri-pmtct-app/src/index.ts b/packages/esm-ohri-pmtct-app/src/index.ts index 3b2300081..aac321fa9 100644 --- a/packages/esm-ohri-pmtct-app/src/index.ts +++ b/packages/esm-ohri-pmtct-app/src/index.ts @@ -1,4 +1,4 @@ -import { defineConfigSchema, getSyncLifecycle } from '@openmrs/esm-framework'; +import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework'; import MaternalSummary from './views/mch-summary/mch-summary.component'; import MaternalHealthList from './views/maternal-health/maternal-health.component'; import ChildHealthList from './views/child-health/child-health.component'; @@ -49,7 +49,10 @@ export function startupApp() { name: 'ArtSubmissionAction', load: () => import('./post-submission-actions/art-linkage-action'), }); - registerExpressionHelper('customGenerateInfantPTrackerId', generateInfantPTrackerId); + + import('./utils/pmtct-helpers').then(({ generateInfantPTrackerId }) => { + registerExpressionHelper('customGenerateInfantPTrackerId', generateInfantPTrackerId); + }); } export const mchDashboard = getSyncLifecycle(createConditionalDashboardGroup(mchFolderMeta), options); @@ -58,7 +61,7 @@ export const mchSummaryDashboardLink = getSyncLifecycle( options, ); -export const mchSummaryDashboard = getSyncLifecycle(MaternalSummary, { +export const mchSummaryDashboard = getAsyncLifecycle(() => import('./views/mch-summary/mch-summary.component'), { featureName: 'mch-summary', moduleName, }); From 82664f85eddd60299aa35c68fbd73a3dfbc7d7c1 Mon Sep 17 00:00:00 2001 From: Pius Rubangakene Date: Wed, 28 Feb 2024 14:54:22 +0300 Subject: [PATCH 23/50] (fix) rename wrongly saved components (#1811) --- packages/esm-covid-app/src/index.ts | 6 +++--- ...nt.encounter-lists.tsx => case-assessment.component.tsx} | 0 ...omes.encounter-list.tsx => covid-outcomes.component.tsx} | 0 ....encounter-list.tsx => covid-vaccinations.component.tsx} | 0 ...results.encounter-list.tsx => lab-results.component.tsx} | 0 5 files changed, 3 insertions(+), 3 deletions(-) rename packages/esm-covid-app/src/views/{case-assessment.encounter-lists.tsx => case-assessment.component.tsx} (100%) rename packages/esm-covid-app/src/views/{covid-outcomes.encounter-list.tsx => covid-outcomes.component.tsx} (100%) rename packages/esm-covid-app/src/views/{covid-vaccinations.encounter-list.tsx => covid-vaccinations.component.tsx} (100%) rename packages/esm-covid-app/src/views/{lab-results.encounter-list.tsx => lab-results.component.tsx} (100%) diff --git a/packages/esm-covid-app/src/index.ts b/packages/esm-covid-app/src/index.ts index af05108d3..13ee9af19 100644 --- a/packages/esm-covid-app/src/index.ts +++ b/packages/esm-covid-app/src/index.ts @@ -1,7 +1,7 @@ import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework'; -import CovidVaccinations from './views/covid-vaccinations.encounter-list'; -import CovidLabResults from './views/lab-results.encounter-list'; -import CovidAssessment from './views/case-assessment.encounter-lists'; +import CovidVaccinations from './views/covid-vaccinations.component'; +import CovidLabResults from './views/lab-results.component'; +import CovidAssessment from './views/case-assessment.component'; import CovidHomePatientTabs from './views/dashboard/patient-list-tabs/covid-patient-list-tabs.component'; import CovidSummaryTiles from './views/dashboard/summary-tiles/covid-summary-tiles.component'; import { diff --git a/packages/esm-covid-app/src/views/case-assessment.encounter-lists.tsx b/packages/esm-covid-app/src/views/case-assessment.component.tsx similarity index 100% rename from packages/esm-covid-app/src/views/case-assessment.encounter-lists.tsx rename to packages/esm-covid-app/src/views/case-assessment.component.tsx diff --git a/packages/esm-covid-app/src/views/covid-outcomes.encounter-list.tsx b/packages/esm-covid-app/src/views/covid-outcomes.component.tsx similarity index 100% rename from packages/esm-covid-app/src/views/covid-outcomes.encounter-list.tsx rename to packages/esm-covid-app/src/views/covid-outcomes.component.tsx diff --git a/packages/esm-covid-app/src/views/covid-vaccinations.encounter-list.tsx b/packages/esm-covid-app/src/views/covid-vaccinations.component.tsx similarity index 100% rename from packages/esm-covid-app/src/views/covid-vaccinations.encounter-list.tsx rename to packages/esm-covid-app/src/views/covid-vaccinations.component.tsx diff --git a/packages/esm-covid-app/src/views/lab-results.encounter-list.tsx b/packages/esm-covid-app/src/views/lab-results.component.tsx similarity index 100% rename from packages/esm-covid-app/src/views/lab-results.encounter-list.tsx rename to packages/esm-covid-app/src/views/lab-results.component.tsx From f10038136a460a301e677973512861e7959a3cc6 Mon Sep 17 00:00:00 2001 From: Jovan Ssebaggala Date: Thu, 29 Feb 2024 17:00:43 +0300 Subject: [PATCH 24/50] encounter date proof of concept (#1812) * encounter date proof of concept * bump FE --- packages/esm-commons-lib/package.json | 2 +- packages/esm-form-render-app/package.json | 2 +- .../tabs/transfer-out-tab.component.tsx | 8 ++++++-- packages/esm-ohri-pmtct-app/package.json | 2 +- yarn.lock | 14 +++++++------- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/esm-commons-lib/package.json b/packages/esm-commons-lib/package.json index 5fba32ac2..55a0d36c1 100644 --- a/packages/esm-commons-lib/package.json +++ b/packages/esm-commons-lib/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next", + "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544", "fuzzy": "^0.1.3", "lodash-es": "^4.17.15", "systemjs-webpack-interop": "^2.3.7", diff --git a/packages/esm-form-render-app/package.json b/packages/esm-form-render-app/package.json index e9db3380f..fec2f599a 100644 --- a/packages/esm-form-render-app/package.json +++ b/packages/esm-form-render-app/package.json @@ -39,7 +39,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next", + "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544", "ace-builds": "^1.4.12", "react-ace": "^9.4.4" }, diff --git a/packages/esm-hiv-app/src/views/program-management/tabs/transfer-out-tab.component.tsx b/packages/esm-hiv-app/src/views/program-management/tabs/transfer-out-tab.component.tsx index f3d782bfb..d48708084 100644 --- a/packages/esm-hiv-app/src/views/program-management/tabs/transfer-out-tab.component.tsx +++ b/packages/esm-hiv-app/src/views/program-management/tabs/transfer-out-tab.component.tsx @@ -9,7 +9,7 @@ import { } from '@ohri/openmrs-esm-ohri-commons-lib'; import { moduleName } from '../../../index'; -import { useConfig } from '@openmrs/esm-framework'; +import { formatDate, parseDate, useConfig } from '@openmrs/esm-framework'; interface TransferOutTabListProps { patientUuid: string; @@ -25,7 +25,11 @@ const TransferOutTabList: React.FC = ({ patientUuid }) key: 'visitDate', header: t('visitDate', 'Visit Date'), getValue: (encounter) => { - return getObsFromEncounter(encounter, obsConcepts.dateOfEncounterConcept, true); + const obsVisitDate = getObsFromEncounter(encounter, obsConcepts.dateOfEncounterConcept, true); + const encounterDate = encounter.encounterDatetime; + return obsVisitDate === '--' && encounterDate + ? formatDate(parseDate(encounterDate), { mode: 'wide' }) + : obsVisitDate; }, }, { diff --git a/packages/esm-ohri-pmtct-app/package.json b/packages/esm-ohri-pmtct-app/package.json index edc000bb1..082921de4 100644 --- a/packages/esm-ohri-pmtct-app/package.json +++ b/packages/esm-ohri-pmtct-app/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next" + "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544" }, "peerDependencies": { "@openmrs/esm-framework": "5.x", diff --git a/yarn.lock b/yarn.lock index ef834122b..1b47d30aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2742,7 +2742,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-commons-lib@workspace:packages/esm-commons-lib" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" enzyme: "npm:^3.11.0" enzyme-adapter-react-16: "npm:^1.15.6" fuzzy: "npm:^0.1.3" @@ -2799,7 +2799,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-form-render-app@workspace:packages/esm-form-render-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" ace-builds: "npm:^1.4.12" react-ace: "npm:^9.4.4" webpack: "npm:^5.88.2" @@ -2833,7 +2833,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" webpack: "npm:^5.88.2" peerDependencies: "@openmrs/esm-framework": 5.x @@ -3208,9 +3208,9 @@ __metadata: languageName: node linkType: hard -"@openmrs/openmrs-form-engine-lib@npm:next": - version: 1.0.0-pre.525 - resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.525" +"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544": + version: 1.0.0-pre.544 + resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544" dependencies: ace-builds: "npm:^1.4.12" enzyme: "npm:^3.11.0" @@ -3233,7 +3233,7 @@ __metadata: react: 18.x react-i18next: 11.x rxjs: 6.x - checksum: 470137f5bbf6a9744bd578d282839022dcc17671436a13a6e42c5cbc0b8e3795973e06bd770a5d1bdd01ea91a3e883524f72f0af44d45b5d950092839b395c82 + checksum: 47b0c8579c345e5b85ab2e5ca1d6f91cf94f861c023fd1f3fc967dd2865353c0745cb99e1c0256a606a2b83a85ba5905e305ca2772f9c1850513beb0367d6e11 languageName: node linkType: hard From 903bd0a765f47756a8d040d85e2833d001012958 Mon Sep 17 00:00:00 2001 From: Jovan Ssebaggala Date: Fri, 1 Mar 2024 16:57:34 +0300 Subject: [PATCH 25/50] upgrade esm-patient-commons-lib, fix workspace issue (#1813) --- .../src/workspace/ohri-workspace-utils.ts | 2 +- yarn.lock | 198 +++++++++--------- 2 files changed, 100 insertions(+), 100 deletions(-) diff --git a/packages/esm-commons-lib/src/workspace/ohri-workspace-utils.ts b/packages/esm-commons-lib/src/workspace/ohri-workspace-utils.ts index 9c797dc52..826eb323a 100644 --- a/packages/esm-commons-lib/src/workspace/ohri-workspace-utils.ts +++ b/packages/esm-commons-lib/src/workspace/ohri-workspace-utils.ts @@ -20,7 +20,7 @@ export const launchOHRIWorkSpace = (props: WorkspaceContextProps) => { const workspaceName = props.workspaceName || 'ohri-forms-' + counter++; const close = () => { - return closeWorkspace(workspaceName, true); + return closeWorkspace(workspaceName, { ignoreChanges: true }); }; const onFormSubmit = () => { props.state?.updateParent?.(); diff --git a/yarn.lock b/yarn.lock index 1b47d30aa..c96f1c452 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2931,9 +2931,9 @@ __metadata: languageName: unknown linkType: soft -"@openmrs/esm-api@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-api@npm:5.3.3-pre.1395" +"@openmrs/esm-api@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-api@npm:5.4.1-pre.1592" dependencies: "@types/fhir": "npm:0.0.31" lodash-es: "npm:^4.17.21" @@ -2942,17 +2942,17 @@ __metadata: "@openmrs/esm-error-handling": 5.x "@openmrs/esm-navigation": 5.x "@openmrs/esm-offline": 5.x - checksum: c3efcaad08f44f83e46c02b73c1fa14efa38bf73854dc66e2cab22b2dd1d1caea9dfae29ebeaf89e9fc5b30bdcf6218a38d86cc3af193f7d41fab729b35b7503 + checksum: 2e8ef75d8ac6f7edd582b7acd4a470f45812faf9122c93c256365b0b101d7012dffdb33eee5d1d41cb28e7638b751f5a92b34779ca5d908dbed94c95db3bb58d languageName: node linkType: hard -"@openmrs/esm-app-shell@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-app-shell@npm:5.3.3-pre.1395" +"@openmrs/esm-app-shell@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-app-shell@npm:5.4.1-pre.1592" dependencies: "@carbon/react": "npm:~1.37.0" - "@openmrs/esm-framework": "npm:5.3.3-pre.1395" - "@openmrs/esm-styleguide": "npm:5.3.3-pre.1395" + "@openmrs/esm-framework": "npm:5.4.1-pre.1592" + "@openmrs/esm-styleguide": "npm:5.4.1-pre.1592" dayjs: "npm:^1.10.4" dexie: "npm:^3.0.3" html-webpack-plugin: "npm:^5.5.0" @@ -2977,44 +2977,44 @@ __metadata: workbox-strategies: "npm:^6.1.5" workbox-webpack-plugin: "npm:^6.1.5" workbox-window: "npm:^6.1.5" - checksum: 74e96cf8387f7bc686636e1657063520a01f1f0492a9710cadea8a58a9a806e39986829f76604ee89e6ef60dccc51457ba2fbb0a782d2a84edecb57e2d8017c5 + checksum: d77f0fab8bc41a8678ef9855d64bbca9639e66bcfd74723e5ba92e5c563390bfe549b04f97c2144e1655a7a68e76156fa943374959b6ddfc78c4460e1e99ae11 languageName: node linkType: hard -"@openmrs/esm-config@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-config@npm:5.3.3-pre.1395" +"@openmrs/esm-config@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-config@npm:5.4.1-pre.1592" dependencies: ramda: "npm:^0.26.1" peerDependencies: "@openmrs/esm-globals": 5.x "@openmrs/esm-state": 5.x single-spa: 5.x - checksum: 60fabd46c693bf483fe8e3575cf130829f2ce909835385b826758382ea1ea963c2ea512a0cf08cda1f91e8ddc25da3373922d1bc6d2e481be072f0097ad71bd8 + checksum: 1226a6533127483b6639957c04f641851791f3c41492ef4704184d270845dfe74834f7fbcf0633cec32ae4bd2acf0cf2ec9a58a8395fa8431fa8994927a8e98c languageName: node linkType: hard -"@openmrs/esm-dynamic-loading@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-dynamic-loading@npm:5.3.3-pre.1395" +"@openmrs/esm-dynamic-loading@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-dynamic-loading@npm:5.4.1-pre.1592" peerDependencies: "@openmrs/esm-globals": 5.x - checksum: 5811fda2953f4da06f485bed804a4c2795e31ff4166bae61cf8e14c3035114b268d0e4f8395ef98188850315b68975a9c084f6174b745475166dcc567dbe6c48 + checksum: ca18b905a31d6a66ec1dced69ed62e348ab24983ba50bb1afebd34ec2924fecbb2ac2e02564fce7656c53fb363dd789f42d0d65fa289c6310e0eec9a11a2c00c languageName: node linkType: hard -"@openmrs/esm-error-handling@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-error-handling@npm:5.3.3-pre.1395" +"@openmrs/esm-error-handling@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-error-handling@npm:5.4.1-pre.1592" peerDependencies: "@openmrs/esm-globals": 5.x - checksum: a58bc9520deec498dc6b3dd5085fe8e8030ce1d4341b3c39ad6c7300cdd01a0064ad5c1c156bb4b8c70249189c28970550331495e3a59016ad25d4f7768306d8 + checksum: 0f1c750f4a17c2e0b12f7b2439091837edda8226cdbb3676e292736dfa43b4a252f02cc7fdf27510b7e388aad16076f21ff17be2c1604db4725adc9db04f9073 languageName: node linkType: hard -"@openmrs/esm-extensions@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-extensions@npm:5.3.3-pre.1395" +"@openmrs/esm-extensions@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-extensions@npm:5.4.1-pre.1592" dependencies: lodash-es: "npm:^4.17.21" peerDependencies: @@ -3023,41 +3023,41 @@ __metadata: "@openmrs/esm-feature-flags": 5.x "@openmrs/esm-state": 5.x single-spa: 5.x - checksum: 9e9a810316b3355b0e23be8944efc47df384bdf043df52a1adcf68274c9c13069e9f747a1919004b578118d40d9197783b544f71f241c274aa176ed1da20fc40 + checksum: aa6fc0e6704cc675142937ca65d17e99f751f879523031a4106934d11ea3ce0265126efa4c7659a2d2bfba61fe0b1ea3f8ccd54b5a67f9306aa2b655c7844f81 languageName: node linkType: hard -"@openmrs/esm-feature-flags@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-feature-flags@npm:5.3.3-pre.1395" +"@openmrs/esm-feature-flags@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-feature-flags@npm:5.4.1-pre.1592" dependencies: ramda: "npm:^0.26.1" peerDependencies: "@openmrs/esm-globals": 5.x "@openmrs/esm-state": 5.x single-spa: 5.x - checksum: 80ac9d2403b1b2042e0933c6eaa687c5ca81c251ced324296c7e523ae84e6d8315ef7e6ea16a64707c53bfed1975397b4c9dcc4fa0c69b119ead3ff5779a7170 - languageName: node - linkType: hard - -"@openmrs/esm-framework@npm:5.3.3-pre.1395, @openmrs/esm-framework@npm:next": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-framework@npm:5.3.3-pre.1395" - dependencies: - "@openmrs/esm-api": "npm:5.3.3-pre.1395" - "@openmrs/esm-config": "npm:5.3.3-pre.1395" - "@openmrs/esm-dynamic-loading": "npm:5.3.3-pre.1395" - "@openmrs/esm-error-handling": "npm:5.3.3-pre.1395" - "@openmrs/esm-extensions": "npm:5.3.3-pre.1395" - "@openmrs/esm-feature-flags": "npm:5.3.3-pre.1395" - "@openmrs/esm-globals": "npm:5.3.3-pre.1395" - "@openmrs/esm-navigation": "npm:5.3.3-pre.1395" - "@openmrs/esm-offline": "npm:5.3.3-pre.1395" - "@openmrs/esm-react-utils": "npm:5.3.3-pre.1395" - "@openmrs/esm-routes": "npm:5.3.3-pre.1395" - "@openmrs/esm-state": "npm:5.3.3-pre.1395" - "@openmrs/esm-styleguide": "npm:5.3.3-pre.1395" - "@openmrs/esm-utils": "npm:5.3.3-pre.1395" + checksum: fcdc422e4301c38664c826b524f4db52bfa76d23a08e7e337ea8a6c515ed6ebff3f5252a5dba2d7473af5aedc4251f3a531a6c51f49057fe997f0a69245ca993 + languageName: node + linkType: hard + +"@openmrs/esm-framework@npm:5.4.1-pre.1592, @openmrs/esm-framework@npm:next": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-framework@npm:5.4.1-pre.1592" + dependencies: + "@openmrs/esm-api": "npm:5.4.1-pre.1592" + "@openmrs/esm-config": "npm:5.4.1-pre.1592" + "@openmrs/esm-dynamic-loading": "npm:5.4.1-pre.1592" + "@openmrs/esm-error-handling": "npm:5.4.1-pre.1592" + "@openmrs/esm-extensions": "npm:5.4.1-pre.1592" + "@openmrs/esm-feature-flags": "npm:5.4.1-pre.1592" + "@openmrs/esm-globals": "npm:5.4.1-pre.1592" + "@openmrs/esm-navigation": "npm:5.4.1-pre.1592" + "@openmrs/esm-offline": "npm:5.4.1-pre.1592" + "@openmrs/esm-react-utils": "npm:5.4.1-pre.1592" + "@openmrs/esm-routes": "npm:5.4.1-pre.1592" + "@openmrs/esm-state": "npm:5.4.1-pre.1592" + "@openmrs/esm-styleguide": "npm:5.4.1-pre.1592" + "@openmrs/esm-utils": "npm:5.4.1-pre.1592" dayjs: "npm:^1.10.7" peerDependencies: dayjs: 1.x @@ -3068,33 +3068,33 @@ __metadata: rxjs: 6.x single-spa: 5.x swr: 2.x - checksum: 6b149ed922e31028fec8850c73b51a1de86226d22510a76e31553640c2210e9f916569d606d3f772782a2371192e9ca78cdbbb813f80f1facd8b8d7661a00da4 + checksum: e6493e7e47b2cb3859664d75143c03bb4f16bfdc2ed079158a1700acd0c0b681edb462f67152bfc90e7b7b115519431065ef34eea00413c2bd150722c286284d languageName: node linkType: hard -"@openmrs/esm-globals@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-globals@npm:5.3.3-pre.1395" +"@openmrs/esm-globals@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-globals@npm:5.4.1-pre.1592" peerDependencies: single-spa: 5.x - checksum: c28e59ab2627f8054d1a16c51fe3079a8de70deb7d4bb926924c21ae09251c224bcc5862c19e7d00e680bf09d0891e8d7354816829205e7e1414a19b84ad627f + checksum: c9f2daf8d10a7c7776af2ea92379c1e18d9ee628cafd0d717e4cefd2107f9c762d0f7acbb19755cb2f6fa9f73b301decf67618cfcbedf89fa24a97e53c2ff661 languageName: node linkType: hard -"@openmrs/esm-navigation@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-navigation@npm:5.3.3-pre.1395" +"@openmrs/esm-navigation@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-navigation@npm:5.4.1-pre.1592" dependencies: path-to-regexp: "npm:6.1.0" peerDependencies: "@openmrs/esm-state": 5.x - checksum: abca35fa744f0b15947229f177c4cb064e2c0b8ed10b2f7651fd3868d562c2911d54f347dcd40a738d7626ba763ef5299fae7b4f1ad160206a40611bc1fbf221 + checksum: 948fd7990a9a7c3b08f330e2aa0e08cd0e9f4ffa3b83560cbdd6916cd24023c2fcc0299bea8887dfe07b50cdd17f699adf18d76e712ec3899e07e7b5d871703e languageName: node linkType: hard -"@openmrs/esm-offline@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-offline@npm:5.3.3-pre.1395" +"@openmrs/esm-offline@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-offline@npm:5.4.1-pre.1592" dependencies: dexie: "npm:^3.0.3" lodash-es: "npm:^4.17.21" @@ -3106,28 +3106,28 @@ __metadata: "@openmrs/esm-state": 5.x "@openmrs/esm-styleguide": 5.x rxjs: 6.x - checksum: 072efc04330b8489a86f7ea099e93b83e4d9ce1fa8c5cf2bb27a2b395b205b95aa796a5c0fdbe879fb0d7f427f699fc1389a74ddaa2949744b9d0d3cb5badff1 + checksum: 2da01830be4ee8585ea99a24fd213e286da370fdaed14941edac945a59a37a255a32e84d4902668e45592e4b2c2d75b23d27662f7aba9891009e63b5962874de languageName: node linkType: hard "@openmrs/esm-patient-common-lib@npm:next": - version: 5.0.1-pre.2527 - resolution: "@openmrs/esm-patient-common-lib@npm:5.0.1-pre.2527" + version: 7.0.2-pre.3907 + resolution: "@openmrs/esm-patient-common-lib@npm:7.0.2-pre.3907" dependencies: "@carbon/react": "npm:^1.12.0" - lodash-es: "npm:^4.17.15" + lodash-es: "npm:^4.17.21" uuid: "npm:^8.3.2" peerDependencies: "@openmrs/esm-framework": 5.x react: 18.x - single-spa: 5.x - checksum: 6ac7077c598ed2e9c81ea5990a8650bd7b712352621671999633de50a2c47f0a1c93ba832a824ceba2bbb0f9983bc221adc893519857c29ec9def3a76bbcca0d + single-spa: 6.x + checksum: 4cb67ef137936ca83ddca6b754077aeb1995be4f5c92461a6db73ac3c9d4a4e6e626dab7787aa38461bd2c5903a79cbb9238c719c3a3e05177717bb43c505f82 languageName: node linkType: hard -"@openmrs/esm-react-utils@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-react-utils@npm:5.3.3-pre.1395" +"@openmrs/esm-react-utils@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-react-utils@npm:5.4.1-pre.1592" dependencies: lodash-es: "npm:^4.17.21" single-spa-react: "npm:^6.0.0" @@ -3145,34 +3145,34 @@ __metadata: react-i18next: 11.x rxjs: 6.x swr: 2.x - checksum: eb54ad85ac01ac83511cb92df7e466b4d583d92ad29eb56d1db238a46735e7de8eb00270c66b91dc12ab22c7b2535417b0df86b5f64ebfbac0adf6aedbfb28b0 + checksum: 85543b1064fb44fa5ea28a19d1222efc95cbe5f2751eec2e4c8bc721c11f32c4db1b3c6b763e7cdd9e63bc8591aa471bb6a16616fdf38d4b72c6878f8d6b2d41 languageName: node linkType: hard -"@openmrs/esm-routes@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-routes@npm:5.3.3-pre.1395" +"@openmrs/esm-routes@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-routes@npm:5.4.1-pre.1592" peerDependencies: "@openmrs/esm-globals": 5.x "@openmrs/esm-utils": 5.x - checksum: 2bfc6572174b5ee0ae10b90483c53f8b1e375135b2d808ad5aaa1c5a9bda13216e08eb1178777e1780599b7ee54fb49d7e413290eeba8139e1b240e0987f50e6 + checksum: d30f49230b951e210b21b26556a2d55942592c312379e9df81fb984503397f5b21ab0712f623c9245031e2d58a0d08ad9880d537b17d1f75b711fc04a37be9d8 languageName: node linkType: hard -"@openmrs/esm-state@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-state@npm:5.3.3-pre.1395" +"@openmrs/esm-state@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-state@npm:5.4.1-pre.1592" dependencies: zustand: "npm:^4.3.6" peerDependencies: "@openmrs/esm-globals": 5.x - checksum: 6f34a9e33e58808223092344a6b55def718c191e7d9a0385d689a2ef857b7dadf356dc5c8db249efba64ffac3a9dca0a6a60a763a1e8c3164035b7661be4666f + checksum: d33f5527a42ea9653b431b31b788bbc62d07ff648d35bd0f0a61a52187f0877b26f7134f5e34c1f2fe38724e7ffe8e026571f07ed0dc5adc80d669ffb29cbd33 languageName: node linkType: hard -"@openmrs/esm-styleguide@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-styleguide@npm:5.3.3-pre.1395" +"@openmrs/esm-styleguide@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-styleguide@npm:5.4.1-pre.1592" dependencies: "@carbon/charts": "npm:^1.12.0" "@carbon/react": "npm:~1.37.0" @@ -3191,24 +3191,24 @@ __metadata: react: 18.x react-dom: 18.x rxjs: 6.x - checksum: 0bd5f3de552ffaf5a29f8420ec9777de5f74fcb3c7819d52390e0314502a6f9f77aeb92d10a6b1b1d154352fd266930006cf193a5d13cca54ff11f4bf203818b + checksum: 3a94d832aa47e0603a3f147a7354cbdd8649b2f0d47838e17874423246425f0b930b0c0dad9dc78857c62b756cd95fe5ff3d5b2ed4339fd305d826e6fe499ebc languageName: node linkType: hard -"@openmrs/esm-utils@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/esm-utils@npm:5.3.3-pre.1395" +"@openmrs/esm-utils@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/esm-utils@npm:5.4.1-pre.1592" dependencies: semver: "npm:7.3.2" peerDependencies: dayjs: 1.x i18next: 19.x rxjs: 6.x - checksum: f9a78efd3c4e2d78cda218632101de52b4a5f9785143659139abe1aa6a498a5726f2736b482171db70ecabf37e1bc51acd2bd46293e52465d80db4aa0599e4fd + checksum: eec5a59e5f3c9b63d6704e0dba6aea9b4fd8d7ff70333d443804bba816aaee6c3d76cf551da165e5c38f55e2cdae37bd127023749a2bfa33bf8693eba0bdbd86 languageName: node linkType: hard -"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544": +"@openmrs/openmrs-form-engine-lib@npm:next": version: 1.0.0-pre.544 resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544" dependencies: @@ -3237,9 +3237,9 @@ __metadata: languageName: node linkType: hard -"@openmrs/webpack-config@npm:5.3.3-pre.1395": - version: 5.3.3-pre.1395 - resolution: "@openmrs/webpack-config@npm:5.3.3-pre.1395" +"@openmrs/webpack-config@npm:5.4.1-pre.1592": + version: 5.4.1-pre.1592 + resolution: "@openmrs/webpack-config@npm:5.4.1-pre.1592" dependencies: "@swc/core": "npm:^1.3.58" clean-webpack-plugin: "npm:^4.0.0" @@ -3256,7 +3256,7 @@ __metadata: webpack-stats-plugin: "npm:^1.0.3" peerDependencies: webpack: 5.x - checksum: 14948eaa76ab07089632310d3aa25f36d96522b1509f5360b66af89c07c90fbeacd5a37576bb2e26dd76c5aedc7c859854d3d1fe68dc2ec06c5b4daf13400cc9 + checksum: 0eab1ab88d23d0ce82f9ab0e2f99bf1947bf8b590f534b558ccd001b36a6450eb7aa19779f9b822a32e17ef14003616ea5fd42405a66b1433a35f40f4ea568ae languageName: node linkType: hard @@ -13491,12 +13491,12 @@ __metadata: linkType: hard "openmrs@npm:next": - version: 5.3.3-pre.1395 - resolution: "openmrs@npm:5.3.3-pre.1395" + version: 5.4.1-pre.1592 + resolution: "openmrs@npm:5.4.1-pre.1592" dependencies: "@carbon/icons-react": "npm:11.26.0" - "@openmrs/esm-app-shell": "npm:5.3.3-pre.1395" - "@openmrs/webpack-config": "npm:5.3.3-pre.1395" + "@openmrs/esm-app-shell": "npm:5.4.1-pre.1592" + "@openmrs/webpack-config": "npm:5.4.1-pre.1592" "@pnpm/npm-conf": "npm:^2.1.0" "@swc/core": "npm:^1.3.58" autoprefixer: "npm:^10.4.2" @@ -13527,7 +13527,7 @@ __metadata: yargs: "npm:^17.6.2" bin: openmrs: ./dist/cli.js - checksum: 79e2b78bae6d5022f3656ab2f58b9f402a8d5429199267f7c526f73e3485a4ce27e00acc3c0376cf93e07608a64a5126afdfa2c7ad228eeb90f2d44ee24528b5 + checksum: 6a02311734010b6695d58a21785528b3ec168145cdd935c6949e93540e243b02ba6bb062927e1a99250643a7638fbc8eef620fd7ca6b0abf81473716f63bfcfe languageName: node linkType: hard From be1cf08ee0c3a8102414cfb09bfd00fdc6e5cc24 Mon Sep 17 00:00:00 2001 From: Jovan Ssebaggala Date: Fri, 1 Mar 2024 17:14:33 +0300 Subject: [PATCH 26/50] (feat) Upgrade patient commons lib, fix workspace isse (#1814) From eaef92e8576a8c5fad4e225b14fe7302a6ac73b0 Mon Sep 17 00:00:00 2001 From: Jovan Ssebaggala Date: Tue, 5 Mar 2024 13:21:06 +0300 Subject: [PATCH 27/50] (feat)Upgrade patient commons lib, fix workspace issue (#1815) * fix yarn lock e2e test issue * fix FE dependencies --- packages/esm-commons-lib/package.json | 2 +- packages/esm-ohri-pmtct-app/package.json | 2 +- yarn.lock | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/esm-commons-lib/package.json b/packages/esm-commons-lib/package.json index 55a0d36c1..5fba32ac2 100644 --- a/packages/esm-commons-lib/package.json +++ b/packages/esm-commons-lib/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544", + "@openmrs/openmrs-form-engine-lib": "next", "fuzzy": "^0.1.3", "lodash-es": "^4.17.15", "systemjs-webpack-interop": "^2.3.7", diff --git a/packages/esm-ohri-pmtct-app/package.json b/packages/esm-ohri-pmtct-app/package.json index 082921de4..edc000bb1 100644 --- a/packages/esm-ohri-pmtct-app/package.json +++ b/packages/esm-ohri-pmtct-app/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544" + "@openmrs/openmrs-form-engine-lib": "next" }, "peerDependencies": { "@openmrs/esm-framework": "5.x", diff --git a/yarn.lock b/yarn.lock index c96f1c452..e7caaf27d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2742,7 +2742,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-commons-lib@workspace:packages/esm-commons-lib" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" + "@openmrs/openmrs-form-engine-lib": "npm:next" enzyme: "npm:^3.11.0" enzyme-adapter-react-16: "npm:^1.15.6" fuzzy: "npm:^0.1.3" @@ -2833,7 +2833,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" + "@openmrs/openmrs-form-engine-lib": "npm:next" webpack: "npm:^5.88.2" peerDependencies: "@openmrs/esm-framework": 5.x @@ -3208,7 +3208,7 @@ __metadata: languageName: node linkType: hard -"@openmrs/openmrs-form-engine-lib@npm:next": +"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544, @openmrs/openmrs-form-engine-lib@npm:next": version: 1.0.0-pre.544 resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544" dependencies: From 418491bb71829a89722b173f36a3e5ff343c67f4 Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Tue, 5 Mar 2024 14:15:22 +0300 Subject: [PATCH 28/50] Changed to the form-engine version for form-render-app (#1818) * Changed to the form-engine version for form-render-app * Standardize form-engine version in packages --------- Co-authored-by: Amos Laboso --- packages/esm-commons-lib/package.json | 2 +- packages/esm-ohri-pmtct-app/package.json | 2 +- yarn.lock | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/esm-commons-lib/package.json b/packages/esm-commons-lib/package.json index 5fba32ac2..55a0d36c1 100644 --- a/packages/esm-commons-lib/package.json +++ b/packages/esm-commons-lib/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next", + "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544", "fuzzy": "^0.1.3", "lodash-es": "^4.17.15", "systemjs-webpack-interop": "^2.3.7", diff --git a/packages/esm-ohri-pmtct-app/package.json b/packages/esm-ohri-pmtct-app/package.json index edc000bb1..082921de4 100644 --- a/packages/esm-ohri-pmtct-app/package.json +++ b/packages/esm-ohri-pmtct-app/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next" + "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544" }, "peerDependencies": { "@openmrs/esm-framework": "5.x", diff --git a/yarn.lock b/yarn.lock index e7caaf27d..90d85c4e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2742,7 +2742,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-commons-lib@workspace:packages/esm-commons-lib" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" enzyme: "npm:^3.11.0" enzyme-adapter-react-16: "npm:^1.15.6" fuzzy: "npm:^0.1.3" @@ -2833,7 +2833,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" webpack: "npm:^5.88.2" peerDependencies: "@openmrs/esm-framework": 5.x @@ -3208,7 +3208,7 @@ __metadata: languageName: node linkType: hard -"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544, @openmrs/openmrs-form-engine-lib@npm:next": +"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544": version: 1.0.0-pre.544 resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544" dependencies: From 85c2a47f89ada7c0f0a728a8141023b4f13d18f3 Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Tue, 5 Mar 2024 15:27:26 +0300 Subject: [PATCH 29/50] Dev (#1820) * Changed to the form-engine version for form-render-app * Standardize form-engine version in packages * Harmonize build cache and pre_release cache_key --------- Co-authored-by: Amos Laboso --- .github/workflows/node.dev.js.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/node.dev.js.yml b/.github/workflows/node.dev.js.yml index 308ae9a0f..5f7a05b3d 100644 --- a/.github/workflows/node.dev.js.yml +++ b/.github/workflows/node.dev.js.yml @@ -27,7 +27,7 @@ jobs: uses: actions/cache@v3 with: path: '**/node_modules' - key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' @@ -48,8 +48,8 @@ jobs: with: name: packages path: | - packages/**/dist - + packages/**/dist + run_e2e_tests: runs-on: ubuntu-latest @@ -65,7 +65,7 @@ jobs: run: npx playwright install chromium --with-deps - name: Run Playwright tests run: yarn test-e2e - + pre_release: runs-on: ubuntu-latest From 4cad7f2e1bc1e477bddc4deefd30d8266cccab55 Mon Sep 17 00:00:00 2001 From: Hero Date: Tue, 5 Mar 2024 14:56:13 +0200 Subject: [PATCH 30/50] OHRI-2156:Remove error 400 on ohri-namibia-working (#1816) * OHRI-2156:Remove error 400 on ohri-namibia-working * fixed the build * update on the build fix * removed the unused import --------- Co-authored-by: Amos Laboso --- packages/esm-ohri-pmtct-app/package.json | 2 +- packages/esm-ohri-pmtct-app/src/config-schema.ts | 11 +++++++++-- .../src/post-submission-actions/art-linkage-action.ts | 9 ++++----- .../current-ptracker-action.ts | 10 +++++++--- .../mch-summary/tabs/hiv-exposed-infant.component.tsx | 2 +- yarn.lock | 4 ++-- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/packages/esm-ohri-pmtct-app/package.json b/packages/esm-ohri-pmtct-app/package.json index 082921de4..edc000bb1 100644 --- a/packages/esm-ohri-pmtct-app/package.json +++ b/packages/esm-ohri-pmtct-app/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544" + "@openmrs/openmrs-form-engine-lib": "next" }, "peerDependencies": { "@openmrs/esm-framework": "5.x", diff --git a/packages/esm-ohri-pmtct-app/src/config-schema.ts b/packages/esm-ohri-pmtct-app/src/config-schema.ts index 621ed759a..51e378113 100644 --- a/packages/esm-ohri-pmtct-app/src/config-schema.ts +++ b/packages/esm-ohri-pmtct-app/src/config-schema.ts @@ -8,6 +8,14 @@ export const configSchema = { preferredIdentifierSource: '8549f706-7e85-4c1d-9424-217d50a2988b', }, }, + identifiersTypes: { + _type: Type.Object, + _description: 'Identifier types for PMTCT.', + _default: { + ptrackerIdentifierType: '4da0a3fe-e546-463f-81fa-084f098ff06c', + artUniqueNumberType: '9d6d1eec-2cd6-4637-a981-4a46b4b8b41f', + }, + }, formNames: { _type: Type.Object, _description: 'List of forms for PMTCT.', @@ -25,8 +33,6 @@ export const configSchema = { laborAndDelivery: '6dc5308d-27c9-4d49-b16f-2c5e3c759757', infantPostnatal: 'af1f1b24-d2e8-4282-b308-0bf79b365584', motherPostnatal: '269bcc7f-04f8-4ddc-883d-7a3a0d569aad', - PTrackerIdentifierType: '4da0a3fe-e546-463f-81fa-084f098ff06c', - artUniqueNumberType: '9d6d1eec-2cd6-4637-a981-4a46b4b8b41f', mchEncounterType: '12de5bc5-352e-4faf-9961-a2125085a75c', }, }, @@ -89,6 +95,7 @@ export const configSchema = { export interface ConfigObject { identifiers: Object; + identifiersTypes: Object; encounterTypes: Object; obsConcepts: Object; formNames: Object; diff --git a/packages/esm-ohri-pmtct-app/src/post-submission-actions/art-linkage-action.ts b/packages/esm-ohri-pmtct-app/src/post-submission-actions/art-linkage-action.ts index 6e20c5a72..fa2062bfb 100644 --- a/packages/esm-ohri-pmtct-app/src/post-submission-actions/art-linkage-action.ts +++ b/packages/esm-ohri-pmtct-app/src/post-submission-actions/art-linkage-action.ts @@ -13,9 +13,8 @@ const ArtSubmissionAction: PostSubmissionAction = { return; } - let artNumber = encounter.obs.find( - (observation) => observation.concept.uuid === config.obsConcepts.artNoConcept, - )?.value; + let artNumber = encounter.obs.find((observation) => observation.concept.uuid === config.obsConcepts.artNoConcept) + ?.value; if (!artNumber) { return; } @@ -26,7 +25,7 @@ const ArtSubmissionAction: PostSubmissionAction = { //Patient can only have one ART No. const patientIdentifiers = await fetchPatientIdentifiers(patient.id); const existingArtNumbers = patientIdentifiers.filter( - (id) => id.identifierType.uuid === config.encounterTypes.artUniqueNumberType, + (id) => id.identifierType.uuid === config.identifiersTypes.artUniqueNumberType, ); if (existingArtNumbers.length > 0) { return; @@ -35,7 +34,7 @@ const ArtSubmissionAction: PostSubmissionAction = { //add current art number to identities const currentArtNumberObject: PatientIdentifier = { identifier: artNumber, - identifierType: config.encounterTypes.artUniqueNumberType, + identifierType: config.identifiersTypes.artUniqueNumberType, location: encounterLocation, preferred: false, }; diff --git a/packages/esm-ohri-pmtct-app/src/post-submission-actions/current-ptracker-action.ts b/packages/esm-ohri-pmtct-app/src/post-submission-actions/current-ptracker-action.ts index de7a54fd0..214d4ecde 100644 --- a/packages/esm-ohri-pmtct-app/src/post-submission-actions/current-ptracker-action.ts +++ b/packages/esm-ohri-pmtct-app/src/post-submission-actions/current-ptracker-action.ts @@ -18,12 +18,16 @@ export const PTrackerSubmissionAction: PostSubmissionAction = { export async function updatePatientPtracker(encounter, encounterLocation, patientUuid) { const config = await getConfig('@ohri/openmrs-esm-ohri-pmtct'); - const inComingPTrackerID = encounter.obs.find((observation) => observation.concept.uuid === config.obsConcepts.pTrackerIdConcept)?.value; + const inComingPTrackerID = encounter.obs.find( + (observation) => observation.concept.uuid === config.obsConcepts.pTrackerIdConcept, + )?.value; if (!inComingPTrackerID) { return; } const patientIdentifiers = await fetchPatientIdentifiers(patientUuid); - const existingPTrackers = patientIdentifiers.filter((id) => id.identifierType.uuid === config.encounterTypes.PTrackerIdentifierType); + const existingPTrackers = patientIdentifiers.filter( + (id) => id.identifierType.uuid === config.identifiersTypes.ptrackerIdentifierType, + ); if (existingPTrackers.some((ptracker) => ptracker.identifier === inComingPTrackerID)) { return; } @@ -31,7 +35,7 @@ export async function updatePatientPtracker(encounter, encounterLocation, patien //add current ptracker to identities const currentPTrackerObject: PatientIdentifier = { identifier: inComingPTrackerID, - identifierType: config.encounterTypes.PTrackerIdentifierType, + identifierType: config.identifiersTypes.ptrackerIdentifierType, location: encounterLocation, preferred: false, }; diff --git a/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/hiv-exposed-infant.component.tsx b/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/hiv-exposed-infant.component.tsx index 369f9f550..14e3b58a9 100644 --- a/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/hiv-exposed-infant.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/hiv-exposed-infant.component.tsx @@ -148,7 +148,7 @@ const HivExposedInfant: React.FC<{ const identifiers = await fetchPatientIdentifiers(patientUuid); if (identifiers) { pTrackerMap.pTrackerId = identifiers.find( - (id) => id.identifierType.uuid === config.encounterTypes.PTrackerIdentifierType, + (id) => id.identifierType.uuid === config.identifiersTypes.ptrackerIdentifierType, ).identifier; pTrackerMap.patientId = patientUuid; } diff --git a/yarn.lock b/yarn.lock index 90d85c4e9..9e9183d69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2833,7 +2833,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" + "@openmrs/openmrs-form-engine-lib": "npm:next" webpack: "npm:^5.88.2" peerDependencies: "@openmrs/esm-framework": 5.x @@ -3208,7 +3208,7 @@ __metadata: languageName: node linkType: hard -"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544": +"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544, @openmrs/openmrs-form-engine-lib@npm:next": version: 1.0.0-pre.544 resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544" dependencies: From 3a481c72e5668ff65ede943ba05ca56b29704450 Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Tue, 5 Mar 2024 16:09:45 +0300 Subject: [PATCH 31/50] Dev (#1821) * Changed to the form-engine version for form-render-app * Standardize form-engine version in packages * Harmonize build cache and pre_release cache_key * update form-engine dependencies to for all packages and updated ci cache_dependency resolution --------- Co-authored-by: Amos Laboso --- .github/workflows/node.dev.js.yml | 5 +---- packages/esm-commons-lib/package.json | 2 +- packages/esm-form-render-app/package.json | 2 +- yarn.lock | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/node.dev.js.yml b/.github/workflows/node.dev.js.yml index 5f7a05b3d..8559a8f23 100644 --- a/.github/workflows/node.dev.js.yml +++ b/.github/workflows/node.dev.js.yml @@ -85,10 +85,7 @@ jobs: id: cache uses: actions/cache@v3 with: - path: | - **/node_modules - **/yarn.lock - + path: '**/node_modules' key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- diff --git a/packages/esm-commons-lib/package.json b/packages/esm-commons-lib/package.json index 55a0d36c1..5fba32ac2 100644 --- a/packages/esm-commons-lib/package.json +++ b/packages/esm-commons-lib/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544", + "@openmrs/openmrs-form-engine-lib": "next", "fuzzy": "^0.1.3", "lodash-es": "^4.17.15", "systemjs-webpack-interop": "^2.3.7", diff --git a/packages/esm-form-render-app/package.json b/packages/esm-form-render-app/package.json index fec2f599a..e9db3380f 100644 --- a/packages/esm-form-render-app/package.json +++ b/packages/esm-form-render-app/package.json @@ -39,7 +39,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.544", + "@openmrs/openmrs-form-engine-lib": "next", "ace-builds": "^1.4.12", "react-ace": "^9.4.4" }, diff --git a/yarn.lock b/yarn.lock index 9e9183d69..c0f86de35 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2742,7 +2742,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-commons-lib@workspace:packages/esm-commons-lib" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" + "@openmrs/openmrs-form-engine-lib": "npm:next" enzyme: "npm:^3.11.0" enzyme-adapter-react-16: "npm:^1.15.6" fuzzy: "npm:^0.1.3" @@ -2799,7 +2799,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-form-render-app@workspace:packages/esm-form-render-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.544" + "@openmrs/openmrs-form-engine-lib": "npm:next" ace-builds: "npm:^1.4.12" react-ace: "npm:^9.4.4" webpack: "npm:^5.88.2" From 6fcfc8cfbf8c515288b56bfca0f585095657e260 Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Tue, 5 Mar 2024 17:29:28 +0300 Subject: [PATCH 32/50] Dev - update yarn lock file (#1822) * Changed to the form-engine version for form-render-app * Standardize form-engine version in packages * Harmonize build cache and pre_release cache_key * update form-engine dependencies to for all packages and updated ci cache_dependency resolution * yarn lock file --------- Co-authored-by: Amos Laboso --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index c0f86de35..a539ba384 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3208,7 +3208,7 @@ __metadata: languageName: node linkType: hard -"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544, @openmrs/openmrs-form-engine-lib@npm:next": +"@openmrs/openmrs-form-engine-lib@npm:next": version: 1.0.0-pre.544 resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544" dependencies: From 7958ed1c94df08bceab2e70c280fe3b9256c985f Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Wed, 13 Mar 2024 11:19:54 +0300 Subject: [PATCH 33/50] (refactor) Switch form launcher workspace to OpenMRS forms workspace (#1807) * (refactor) Switch form launcher workspace from custom to openmrs forms workspace * Add covis and tb form uuids in config * Add hiv and tpt form uuids in config * Add additional props as part of different view modes --- .../src/config-schema.ts | 9 +++ .../tabs/cacx-registration.component.tsx | 4 +- .../tabs/cacx-treatment.component.tsx | 4 +- .../encounter-list.component.tsx | 46 +++++++++++-- .../src/components/encounter-list/helpers.ts | 37 ++++++----- packages/esm-covid-app/src/config-schema.ts | 16 +++++ .../src/views/case-assessment.component.tsx | 16 ++++- .../src/views/covid-outcomes.component.tsx | 4 +- .../views/covid-vaccinations.component.tsx | 4 +- .../src/views/lab-results.component.tsx | 36 +++++++--- packages/esm-hiv-app/src/config-schema.ts | 24 +++++++ ...linical-visit-encounter-list.component.tsx | 4 +- .../tabs/disclosure.component.tsx | 4 +- .../intimate-partner-violence.component.tsx | 4 +- .../mental-health-assessment.component.tsx | 4 +- .../tab-list/hts-overview-list.component.tsx | 3 +- .../cd4/cd4-encounter-list.component.tsx | 4 +- .../lab-results-encounter-list.component.tsx | 4 +- .../partner-notification.component.tsx | 4 +- .../tabs/contact-tracing.component.tsx | 4 +- .../tabs/patient-tracing.component.tsx | 4 +- .../tabs/art-therapy-tab.component.tsx | 4 +- .../tabs/death-tab.component.tsx | 4 +- .../tabs/hiv-enrolment-tab.component.tsx | 4 +- .../tabs/service-delivery-tab.component.tsx | 4 +- .../tabs/transfer-out-tab.component.tsx | 4 +- ...ice-enrolment-encounter-list.component.tsx | 4 +- .../tabs/clinical-visit-tab.component.tsx | 4 +- packages/esm-ohri-core-app/README.md | 4 +- .../src/dashboard.meta.utils.ts | 2 +- .../esm-ohri-pmtct-app/src/config-schema.ts | 11 ++++ .../tabs/infant-postnatal-care.component.tsx | 6 +- .../tabs/antenatal-care.component.tsx | 6 +- .../tabs/labour-delivery.component.tsx | 6 +- .../tabs/postnatal-care.component.tsx | 6 +- .../tabs/current-pregnancy.component.tsx | 8 +-- .../tabs/hiv-exposed-infant.component.tsx | 40 +++++------ packages/esm-tb-app/src/config-schema.ts | 15 +++++ .../tb-patient-summary.component.tsx | 66 +++++++++---------- .../tabs/mdr-tb.component.tsx | 24 +++---- .../tabs/tb-patient-tracing.component.tsx | 10 +-- .../tb-contact-list.component.tsx | 10 +-- .../patient-summary.component.tsx | 6 +- .../tabs/tpt-enrolment.component.tsx | 6 +- .../tabs/tpt-treatment.component.tsx | 4 +- .../tb-treatment-follow-up.component.tsx | 16 ++--- 46 files changed, 333 insertions(+), 180 deletions(-) diff --git a/packages/esm-cervical-cancer-app/src/config-schema.ts b/packages/esm-cervical-cancer-app/src/config-schema.ts index c4a3612b7..8160ac0a7 100644 --- a/packages/esm-cervical-cancer-app/src/config-schema.ts +++ b/packages/esm-cervical-cancer-app/src/config-schema.ts @@ -33,6 +33,14 @@ export const configSchema = { cervicalCancerRegistrationForm: 'Cervical Cancer Registration Form', }, }, + formUuids: { + _type: Type.Object, + _description: 'List of uuids of forms related to Cacx.', + _default: { + screeningAndCancerTreatmentFormUuid: '9e3ec2a7-ad26-3f43-9677-82e318996eec', + cervicalCancerRegistrationFormUuid: '12f41bfe-6430-3d8c-9edf-2d1b7c904f0f', + }, + }, }; export interface ConfigObject { @@ -40,4 +48,5 @@ export interface ConfigObject { encounterTypes: Object; obsConcepts: Object; formNames: Object; + formUuids: Object; } diff --git a/packages/esm-cervical-cancer-app/src/views/cacx-visits/tabs/cacx-registration.component.tsx b/packages/esm-cervical-cancer-app/src/views/cacx-visits/tabs/cacx-registration.component.tsx index a471915c0..db64f392c 100644 --- a/packages/esm-cervical-cancer-app/src/views/cacx-visits/tabs/cacx-registration.component.tsx +++ b/packages/esm-cervical-cancer-app/src/views/cacx-visits/tabs/cacx-registration.component.tsx @@ -20,6 +20,8 @@ export const CacxRegistration: React.FC = ({ patientUuid const { cervicalCancerRegistrationForm } = config.formNames; + const { cervicalCancerRegistrationFormUuid } = config.formUuids; + const columnsLab: EncounterListColumn[] = useMemo( () => [ { @@ -77,7 +79,7 @@ export const CacxRegistration: React.FC = ({ patientUuid = ({ patientUuid }) => const { screeningAndCancerTreatmentForm } = config.formNames; + const { screeningAndCancerTreatmentFormUuid } = config.formUuids; + const columnsLab: EncounterListColumn[] = useMemo( () => [ { @@ -100,7 +102,7 @@ export const CacxTreatment: React.FC = ({ patientUuid }) => ; fixedIntent?: string; isDefault?: boolean; @@ -83,7 +84,7 @@ export const EncounterList: React.FC = ({ form: { name: forms[0]?.name, }, - mode: 'view', + mode: 'edit', intent: '*', }, ], @@ -145,6 +146,7 @@ export const EncounterList: React.FC = ({ encounter.uuid, null, workspaceWindowSize, + patientUuid, ), viewEncounter: () => launchEncounterForm( @@ -156,6 +158,7 @@ export const EncounterList: React.FC = ({ encounter.uuid, null, workspaceWindowSize, + patientUuid, ), }; // process columns @@ -196,6 +199,7 @@ export const EncounterList: React.FC = ({ encounter.uuid, actionItem.intent, workspaceWindowSize, + patientUuid, ); }} /> @@ -206,7 +210,7 @@ export const EncounterList: React.FC = ({ }); setPaginatedRows(rows); }, - [columns, defaultActions, forms, moduleName, workspaceWindowSize], + [columns, defaultActions, forms, moduleName, workspaceWindowSize, patientUuid, onFormSave], ); useEffect(() => { @@ -226,7 +230,17 @@ export const EncounterList: React.FC = ({ iconDescription="Add " onClick={(e) => { e.preventDefault(); - launchEncounterForm(forms[0], moduleName, 'add', onFormSave, null, null, null, workspaceWindowSize); + launchEncounterForm( + forms[0], + moduleName, + 'add', + onFormSave, + null, + null, + null, + workspaceWindowSize, + patientUuid, + ); }}> {displayText} @@ -236,13 +250,23 @@ export const EncounterList: React.FC = ({ - launchEncounterForm(formJson, moduleName, 'add', onFormSave, null, null, intent, workspaceWindowSize) + launchEncounterForm( + formJson, + moduleName, + 'add', + onFormSave, + null, + null, + intent, + workspaceWindowSize, + patientUuid, + ) } title={displayText} /> ); } - }, [forms, hideFormLauncher, isDead, displayText, moduleName, workspaceWindowSize]); + }, [forms, hideFormLauncher, isDead, displayText, moduleName, workspaceWindowSize, onFormSave, patientUuid]); return ( <> @@ -273,7 +297,17 @@ export const EncounterList: React.FC = ({ displayText={description} headerTitle={headerTitle} launchForm={() => - launchEncounterForm(forms[0], moduleName, 'add', onFormSave, null, null, '*', workspaceWindowSize) + launchEncounterForm( + forms[0], + moduleName, + 'add', + onFormSave, + null, + null, + '*', + workspaceWindowSize, + patientUuid, + ) } launchFormComponent={formLauncher} hideFormLauncher={hideFormLauncher ?? isDead} diff --git a/packages/esm-commons-lib/src/components/encounter-list/helpers.ts b/packages/esm-commons-lib/src/components/encounter-list/helpers.ts index 04730dd31..8deff2354 100644 --- a/packages/esm-commons-lib/src/components/encounter-list/helpers.ts +++ b/packages/esm-commons-lib/src/components/encounter-list/helpers.ts @@ -1,8 +1,7 @@ -import { OHRIFormSchema, SessionMode } from '@openmrs/openmrs-form-engine-lib'; -import { launchForm } from '../../utils/ohri-forms-commons'; -import { capitalize } from 'lodash-es'; +import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib'; +import { OHRIFormSchema } from '@openmrs/openmrs-form-engine-lib'; -type LaunchAction = 'add' | 'view' | 'edit'; +type LaunchAction = 'add' | 'view' | 'edit' | 'embedded-view'; export function launchEncounterForm( form: OHRIFormSchema, @@ -13,16 +12,24 @@ export function launchEncounterForm( encounterUuid?: string, intent: string = '*', workspaceWindowSize?: 'minimized' | 'maximized', + patientUuid?: string, + mutateform?: () => void, ) { - const defaultTitle = capitalize(action) + ' ' + form.name; - launchForm( - form, - action === 'add' ? 'enter' : action, - moduleName, - title || defaultTitle, - encounterUuid, - intent, - onFormSave, - workspaceWindowSize, - ); + launchPatientWorkspace('patient-form-entry-workspace', { + workspaceTitle: form.name, + mutateform: mutateform, + formInfo: { + encounterUuid, + formUuid: form.uuid, + patientUuid: patientUuid, + visitTypeUuid: '', + visitUuid: '', + visitStartDatetime: '', + visitStopDatetime: '', + additionalProps: { + mode: action === 'add' ? 'enter' : action, + formSessionIntent: intent, + }, + }, + }); } diff --git a/packages/esm-covid-app/src/config-schema.ts b/packages/esm-covid-app/src/config-schema.ts index 69f38ff8b..853afe612 100644 --- a/packages/esm-covid-app/src/config-schema.ts +++ b/packages/esm-covid-app/src/config-schema.ts @@ -97,6 +97,21 @@ export const configSchema = { CovidLabOrderFormName: 'COVID Lab Order Form', }, }, + formUuids: { + _type: Type.Object, + _description: 'Covid Form Uuids.', + _default: { + covidCaseFormUuid: 'c0fd71bd-37bc-3c8d-b2ff-149c0ff4d6f0', + covidAssessmentFormUuid: 'f5fb6bc4-6fc3-3462-a191-2fff0896bab3', + covidOutcomeFormUuid: '6515d898-439c-11ec-9103-238295f2dfd7', + covidVaccinationFormUuid: '3ae3a031-2e24-357d-81b3-205d5187090a', + covidLabTestFormUuid: 'e92fe922-4863-11ec-99cc-1fdd2d4e9d88', + covidLabResultFormUuid: 'cf8cd756-baef-38df-b84d-92968b42c113', + covidLabCancellationFormUuid: 'd38bc949-c95b-39eb-a2c5-08b82a36409c', + covidSampleCollectionFormUuid: '371d19b6-485f-11ec-99cc-1fdd2d4e9d88', + covidLabOrderFormUuid: 'f5fb6bc4-6fc3-3462-a191-2fff0896bab3', + }, + }, }; export interface ConfigObject { @@ -104,4 +119,5 @@ export interface ConfigObject { obsConcepts: Object; formNames: object; cohorts: object; + formUuids: Object; } diff --git a/packages/esm-covid-app/src/views/case-assessment.component.tsx b/packages/esm-covid-app/src/views/case-assessment.component.tsx index 2ad5d718e..e2be890ba 100644 --- a/packages/esm-covid-app/src/views/case-assessment.component.tsx +++ b/packages/esm-covid-app/src/views/case-assessment.component.tsx @@ -17,6 +17,8 @@ const CovidAssessment: React.FC = ({ patientUuid }) const { t } = useTranslation(); const config = useConfig(); + const { covidAssessmentFormUuid, covidCaseFormUuid, covidOutcomeFormUuid } = config.formUuids; + const columns: EncounterListColumn[] = useMemo( () => [ { @@ -104,9 +106,17 @@ const CovidAssessment: React.FC = ({ patientUuid }) patientUuid={patientUuid} encounterType={config.encounterTypes.covid_Assessment_EncounterUUID} formList={[ - { name: config.formNames.CovidAssessmentFormName, excludedIntents: ['COVID_LAB_ASSESSMENT_EMBED'] }, - { name: config.formNames.CovidCaseFormName }, - { name: config.formNames.CovidOutcomeFormName, excludedIntents: ['COVID_OUTCOME_EMBED', '*'] }, + { + name: config.formNames.CovidAssessmentFormName, + excludedIntents: ['COVID_LAB_ASSESSMENT_EMBED'], + uuid: covidAssessmentFormUuid, + }, + { name: config.formNames.CovidCaseFormName, uuid: covidCaseFormUuid }, + { + name: config.formNames.CovidOutcomeFormName, + excludedIntents: ['COVID_OUTCOME_EMBED', '*'], + uuid: covidOutcomeFormUuid, + }, ]} columns={columns} description={displayText} diff --git a/packages/esm-covid-app/src/views/covid-outcomes.component.tsx b/packages/esm-covid-app/src/views/covid-outcomes.component.tsx index bc3f7d38a..1a48cbe90 100644 --- a/packages/esm-covid-app/src/views/covid-outcomes.component.tsx +++ b/packages/esm-covid-app/src/views/covid-outcomes.component.tsx @@ -19,6 +19,8 @@ const CovidOutcomes: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); const config = useConfig(); + const { covidCaseFormUuid } = config.formUuids; + const columns: EncounterListColumn[] = useMemo( () => [ { @@ -69,7 +71,7 @@ const CovidOutcomes: React.FC = ({ patientUuid }) => { = ({ patientUuid const { t } = useTranslation(); const config = useConfig(); + const { covidVaccinationFormUuid } = config.formUuids; + const columns: EncounterListColumn[] = useMemo( () => [ //TODO: Add Vaccination Status concept @@ -98,7 +100,7 @@ const CovidVaccinations: React.FC = ({ patientUuid = ({ patientUuid }) => { const { t } = useTranslation(); const config = useConfig(); + const { + covidLabOrderFormUuid, + covidLabResultFormUuid, + covidLabTestFormUuid, + covidSampleCollectionFormUuid, + covidLabCancellationFormUuid, + } = config.formUuids; + const columnsLab: EncounterListColumn[] = useMemo( () => [ { @@ -223,16 +231,26 @@ const CovidLabResults: React.FC = ({ patientUuid }) => { patientUuid={patientUuid} encounterType={config.encounterTypes.covidLabOrderEncounterType_UUID} formList={[ - { name: config.formNames.CovidLabOrderFormName, excludedIntents: ['COVID_LAB_ORDER_EMBED'] }, - { name: config.formNames.CovidLabResultFormName, excludedIntents: ['COVID_LAB_RESULT_EMBED'] }, - { name: config.formNames.CovidLabTestFormName, excludedIntents: ['*'] }, + { + name: config.formNames.CovidLabOrderFormName, + excludedIntents: ['COVID_LAB_ORDER_EMBED'], + uuid: covidLabOrderFormUuid, + }, + { + name: config.formNames.CovidLabResultFormName, + excludedIntents: ['COVID_LAB_RESULT_EMBED'], + uuid: covidLabResultFormUuid, + }, + { name: config.formNames.CovidLabTestFormName, excludedIntents: ['*'], uuid: covidLabTestFormUuid }, { name: config.formNames.CovidLabCancellationFormName, excludedIntents: ['*', 'COVID_LAB_CANCELLATION_EMBED'], + uuid: covidLabCancellationFormUuid, }, { name: config.formNames.CovidSampleCollectionFormName, excludedIntents: ['*', 'COVID_SAMPLE_COLLECTION_EMBED'], + uuid: covidSampleCollectionFormUuid, }, ]} columns={columnsLab} @@ -249,12 +267,12 @@ const CovidLabResults: React.FC = ({ patientUuid }) => { patientUuid={patientUuid} encounterType={config.encounterTypes.covidLabOrderEncounterType_UUID} formList={[ - { name: config.formNames.CovidLabTestFormName }, - { name: config.formNames.CovidLabTestFormName }, - { name: config.formNames.CovidLabResultFormName }, - { name: config.formNames.CovidLabCancellationFormName }, - { name: config.formNames.CovidSampleCollectionFormName }, - { name: config.formNames.CovidLabOrderFormName }, + { name: config.formNames.CovidLabTestFormName, uuid: covidLabTestFormUuid }, + { name: config.formNames.CovidLabTestFormName, uuid: covidLabTestFormUuid }, + { name: config.formNames.CovidLabResultFormName, uuid: covidLabResultFormUuid }, + { name: config.formNames.CovidLabCancellationFormName, uuid: covidLabCancellationFormUuid }, + { name: config.formNames.CovidSampleCollectionFormName, uuid: covidSampleCollectionFormUuid }, + { name: config.formNames.CovidLabOrderFormName, uuid: covidLabOrderFormUuid }, ]} columns={columnsPending} description={headerTitlePending} diff --git a/packages/esm-hiv-app/src/config-schema.ts b/packages/esm-hiv-app/src/config-schema.ts index 61947960f..fcc648714 100644 --- a/packages/esm-hiv-app/src/config-schema.ts +++ b/packages/esm-hiv-app/src/config-schema.ts @@ -134,6 +134,29 @@ export const configSchema = { ExpressVisitFormName: 'POC Express Visit Form', }, }, + formUuids: { + _type: Type.Object, + _description: 'HIV Form Uuids', + _default: { + serviceEnrolmentFormUuid: '8f713e0e-94a0-3c57-9024-69520933802a', + clinicalVisitFormUuid: 'b3abc4ce-c5ac-3c40-b8e7-442b163670f1', + hivTestingFormUuid: '43ffea77-49dc-3ebd-8d83-c2aedb654030', + htsPreTestFormUuid: 'a7645e21-a9f7-3abc-af2e-2f477ee74e69', + artTherapyFormUuid: 'f99fadd8-feb7-321c-ab58-7569805668e7', + deathFormUuid: '41af2def-841d-38b7-8d2e-df25bdd0b73f', + transferOutFormUuid: 'a969288d-6605-361b-b01c-42f6ef25c0f5', + patientTracingFormUuid: '71f3febd-dd11-322b-9c18-2a8a07d87af1', + intimatePartnerFormUuid: '5c37314f-c558-3720-8780-d123c70f4e23', + contactTracingFormUuid: '94a911a8-8da1-3c12-b696-2f3e78c2e87c', + serviceDeliveryFormUuid: '1e14f841-b42b-3273-93db-807927ca9a82', + disclosureFormUuid: 'cb30cea5-3166-3e88-befb-9141e5f3769d', + partnerNotificationFormUuid: '8c48efc5-dd85-3795-9f58-8eb436a4edcc', + mentalHealthFormUuid: '2069bd57-d534-3de9-ae24-f1d4e4b2de83', + cd4LabResultsFormUuid: 'a66197de-419a-3223-8691-f70d36b1524b', + viralLoadRequestFormUuid: '717eed11-55bb-3adb-9be4-3e92efcea2c8', + expressVisitFormUuid: 'ea1efef5-33cf-363f-9e59-5d0b6563ec7c', + }, + }, }; export interface ConfigObject { @@ -141,4 +164,5 @@ export interface ConfigObject { encounterTypes: Object; obsConcepts: Object; formNames: Object; + formUuids: Object; } diff --git a/packages/esm-hiv-app/src/views/clinical-visit/encounter-list/clinical-visit-encounter-list.component.tsx b/packages/esm-hiv-app/src/views/clinical-visit/encounter-list/clinical-visit-encounter-list.component.tsx index 25e26dac2..3b3aaa6a0 100644 --- a/packages/esm-hiv-app/src/views/clinical-visit/encounter-list/clinical-visit-encounter-list.component.tsx +++ b/packages/esm-hiv-app/src/views/clinical-visit/encounter-list/clinical-visit-encounter-list.component.tsx @@ -11,7 +11,7 @@ interface ClinicalVisitWidgetProps { const ClinicalVisitWidget: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -70,7 +70,7 @@ const ClinicalVisitWidget: React.FC = ({ patientUuid } = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -67,7 +67,7 @@ const DisclosureList: React.FC = ({ patientUuid }) => { patientUuid={patientUuid} filter={disclosureFilter} encounterType={encounterTypes.PeadsDisclosureEncounterType_UUID} - formList={[{ name: formNames.DisclosureFormName }]} + formList={[{ name: formNames.DisclosureFormName, uuid: formUuids.disclosureFormUuid }]} columns={columns} description={headerTitle} headerTitle={headerTitle} diff --git a/packages/esm-hiv-app/src/views/general-counselling/tabs/intimate-partner-violence.component.tsx b/packages/esm-hiv-app/src/views/general-counselling/tabs/intimate-partner-violence.component.tsx index 27c494b11..53d06b8a2 100644 --- a/packages/esm-hiv-app/src/views/general-counselling/tabs/intimate-partner-violence.component.tsx +++ b/packages/esm-hiv-app/src/views/general-counselling/tabs/intimate-partner-violence.component.tsx @@ -10,7 +10,7 @@ interface IntimatePartnerViolenceListProps { const IntimatePartnerViolenceList: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -76,7 +76,7 @@ const IntimatePartnerViolenceList: React.FC = patientUuid={patientUuid} filter={intimatePartnerFilter} encounterType={encounterTypes.IntimatePartnerEncounterType_UUID} - formList={[{ name: formNames.IntimatePartnerFormName }]} + formList={[{ name: formNames.IntimatePartnerFormName, uuid: formUuids.intimatePartnerFormUuid }]} columns={columns} description={displayText} headerTitle={headerTitle} diff --git a/packages/esm-hiv-app/src/views/general-counselling/tabs/mental-health-assessment.component.tsx b/packages/esm-hiv-app/src/views/general-counselling/tabs/mental-health-assessment.component.tsx index f2bfbc214..c9afe0d35 100644 --- a/packages/esm-hiv-app/src/views/general-counselling/tabs/mental-health-assessment.component.tsx +++ b/packages/esm-hiv-app/src/views/general-counselling/tabs/mental-health-assessment.component.tsx @@ -11,7 +11,7 @@ interface MentalHealthAssessmentListProps { const MentalHealthAssessmentList: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -86,7 +86,7 @@ const MentalHealthAssessmentList: React.FC = ({ patientUuid={patientUuid} filter={mentalHealthFilter} encounterType={encounterTypes.MentalHealthAssessmentEncounter_UUID} - formList={[{ name: formNames.MentalHealthFormName }]} + formList={[{ name: formNames.MentalHealthFormName, uuid: formUuids.mentalHealthFormUuid }]} columns={columns} description={displayText} headerTitle={headerTitle} diff --git a/packages/esm-hiv-app/src/views/hiv-testing-services/tab-list/hts-overview-list.component.tsx b/packages/esm-hiv-app/src/views/hiv-testing-services/tab-list/hts-overview-list.component.tsx index c3dac3dac..f093916fe 100644 --- a/packages/esm-hiv-app/src/views/hiv-testing-services/tab-list/hts-overview-list.component.tsx +++ b/packages/esm-hiv-app/src/views/hiv-testing-services/tab-list/hts-overview-list.component.tsx @@ -14,7 +14,7 @@ const HtsOverviewList: React.FC = ({ patientUuid }) => { const htsRetrospectiveTypeUUID = '79c1f50f-f77d-42e2-ad2a-d29304dde2fe'; // HTS Retrospective const forceComponentUpdate = () => setCounter(counter + 1); const headerTitle = t('hivTesting', 'HIV Testing'); - const { obsConcepts, formNames } = useConfig(); + const { obsConcepts, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -83,6 +83,7 @@ const HtsOverviewList: React.FC = ({ patientUuid }) => { name: formNames.HIVTestingFormName, fixedIntent: '*', excludedIntents: ['HTS_PRE_TEST', 'HTS_TEST', 'HTS_POST_TEST'], + uuid: formUuids.hivTestingFormUuid, }, ]} columns={columns} diff --git a/packages/esm-hiv-app/src/views/lab-results/cd4/cd4-encounter-list.component.tsx b/packages/esm-hiv-app/src/views/lab-results/cd4/cd4-encounter-list.component.tsx index 318b4b614..2bcfa04bd 100644 --- a/packages/esm-hiv-app/src/views/lab-results/cd4/cd4-encounter-list.component.tsx +++ b/packages/esm-hiv-app/src/views/lab-results/cd4/cd4-encounter-list.component.tsx @@ -11,7 +11,7 @@ interface CD4OverviewListProps { const CD4OverviewList: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); const headerTitle = t('cd4', 'CD4'); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -72,7 +72,7 @@ const CD4OverviewList: React.FC = ({ patientUuid }) => { patientUuid={patientUuid} filter={cd4LabResultsFilter} encounterType={encounterTypes.CD4LabResultsEncounter_UUID} - formList={[{ name: formNames.CD4LabResultsFormName }]} + formList={[{ name: formNames.CD4LabResultsFormName, uuid: formUuids.cd4LabResultsFormUuid }]} columns={columns} description={headerTitle} headerTitle={headerTitle} diff --git a/packages/esm-hiv-app/src/views/lab-results/encounter-list/lab-results-encounter-list.component.tsx b/packages/esm-hiv-app/src/views/lab-results/encounter-list/lab-results-encounter-list.component.tsx index 7d18fdeb0..ad0f4a410 100644 --- a/packages/esm-hiv-app/src/views/lab-results/encounter-list/lab-results-encounter-list.component.tsx +++ b/packages/esm-hiv-app/src/views/lab-results/encounter-list/lab-results-encounter-list.component.tsx @@ -15,7 +15,7 @@ interface LabResultsOverviewListProps { const LabResultsOverviewList: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -86,7 +86,7 @@ const LabResultsOverviewList: React.FC = ({ patient patientUuid={patientUuid} filter={viralLoadRequestFilter} encounterType={encounterTypes.ViralLoadResultsEncounter_UUID} - formList={[{ name: formNames.ViralLoadRequestFormName }]} + formList={[{ name: formNames.ViralLoadRequestFormName, uuid: formUuids.viralLoadRequestFormUuid }]} columns={columns} description={displayText} headerTitle={headerTitle} diff --git a/packages/esm-hiv-app/src/views/partner-notification-services/partner-notification.component.tsx b/packages/esm-hiv-app/src/views/partner-notification-services/partner-notification.component.tsx index 09dad0ccb..b330551e3 100644 --- a/packages/esm-hiv-app/src/views/partner-notification-services/partner-notification.component.tsx +++ b/packages/esm-hiv-app/src/views/partner-notification-services/partner-notification.component.tsx @@ -17,7 +17,7 @@ interface PartnerNotificationListProps { const PartnerNotificationList: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -97,7 +97,7 @@ const PartnerNotificationList: React.FC = ({ patie patientUuid={patientUuid} filter={partnerNotificationFilter} encounterType={encounterTypes.PatnerNotificationEncounterType_UUID} - formList={[{ name: formNames.PartnerNotificationFormName }]} + formList={[{ name: formNames.PartnerNotificationFormName, uuid: formUuids.partnerNotificationFormUuid }]} columns={columns} description={headerTitle} headerTitle={headerTitle} diff --git a/packages/esm-hiv-app/src/views/partner-notification-services/tabs/contact-tracing.component.tsx b/packages/esm-hiv-app/src/views/partner-notification-services/tabs/contact-tracing.component.tsx index 7f9b383ac..2bdf7df75 100644 --- a/packages/esm-hiv-app/src/views/partner-notification-services/tabs/contact-tracing.component.tsx +++ b/packages/esm-hiv-app/src/views/partner-notification-services/tabs/contact-tracing.component.tsx @@ -11,7 +11,7 @@ interface ContactTracingListProps { const ContactTracingList: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columnsLab: EncounterListColumn[] = useMemo( () => [ @@ -70,7 +70,7 @@ const ContactTracingList: React.FC = ({ patientUuid }) = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columnsLab: EncounterListColumn[] = useMemo( () => [ @@ -70,7 +70,7 @@ const PatientTracingList: React.FC = ({ patientUuid }) = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const artConcepts = useMemo( () => @@ -189,7 +189,7 @@ const ArtTherapyTabList: React.FC = ({ patientUuid }) => = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columnsLab: EncounterListColumn[] = useMemo( () => [ @@ -67,7 +67,7 @@ const DeathTabList: React.FC = ({ patientUuid }) => { = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -95,7 +95,7 @@ const HIVEnrolmentTabList: React.FC = ({ patientUuid } = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -70,7 +70,7 @@ const ServiceDeliveryTabList: React.FC = ({ patient = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columnsLab: EncounterListColumn[] = useMemo( () => [ @@ -89,7 +89,7 @@ const TransferOutTabList: React.FC = ({ patientUuid }) = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -75,7 +75,7 @@ const ServiceEnrolmentWidget: React.FC = ({ patientUuid } = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const headerTitle = t('clinicalVisit', 'Clinical Visit'); const displayText = t('clinicalVisit', 'Clinical Visit'); @@ -82,7 +82,7 @@ const ClinicalVisitList: React.FC = ({ patientUuid }) => { return htsPages.map((htsPage) => ({ diff --git a/packages/esm-ohri-pmtct-app/src/config-schema.ts b/packages/esm-ohri-pmtct-app/src/config-schema.ts index 51e378113..606180cb6 100644 --- a/packages/esm-ohri-pmtct-app/src/config-schema.ts +++ b/packages/esm-ohri-pmtct-app/src/config-schema.ts @@ -23,6 +23,17 @@ export const configSchema = { antenatal: 'Antenatal Form', labourAndDelivery: 'Labour & Delivery Form', motherPostnatal: 'Mother - Postnatal Form', + infantPostnatal: 'Infant - Postanal Form', + }, + }, + formUuids: { + _type: Type.Object, + _description: 'List of uuids for PMTCT forms.', + _default: { + antenatal: '', + labourAndDelivery: '1e5614d6-5306-11e6-beb8-9e71128cae77', + motherPostnatal: 'e6b67aa4-6c59-4470-8ad5-b994efeda553', + infantPostnatal: '5022c5d7-ea45-47ce-bd65-1ba1d8ad2467', }, }, encounterTypes: { diff --git a/packages/esm-ohri-pmtct-app/src/views/child-health/tabs/infant-postnatal-care.component.tsx b/packages/esm-ohri-pmtct-app/src/views/child-health/tabs/infant-postnatal-care.component.tsx index 4c4f7b9a4..922cc67fd 100644 --- a/packages/esm-ohri-pmtct-app/src/views/child-health/tabs/infant-postnatal-care.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/child-health/tabs/infant-postnatal-care.component.tsx @@ -17,7 +17,7 @@ const InfantPostnatalList: React.FC = ({ patientUuid } const { t } = useTranslation(); const config = useConfig(); const headerTitle = t('hivExposedInfant', 'HIV Exposed Infant'); - const InfantPNCEncounterTypeUUID = config.encounterTypes.infantPostnatal; + const { encounterTypes, formNames, formUuids } = useConfig(); async function fetchMotherName() { let motherName = '--'; @@ -105,8 +105,8 @@ const InfantPostnatalList: React.FC = ({ patientUuid } return ( = ({ patientUuid }) => const { t } = useTranslation(); const config = useConfig(); const headerTitle = t('antenatalCare', 'Antenatal Care'); - const ANCEncounterTypeUUID = config.encounterTypes.antenatal; + const { encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -99,8 +99,8 @@ const AntenatalCareList: React.FC = ({ patientUuid }) => return ( = ({ patientUuid }) const { t } = useTranslation(); const config = useConfig(); const headerTitle = t('labourAndDelivery', 'Labour and Delivery'); - const LNDEncounterTypeUUID = config.encounterTypes.laborAndDelivery; + const { encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -85,8 +85,8 @@ const LabourDeliveryList: React.FC = ({ patientUuid }) return ( = ({ patientUuid }) => const { t } = useTranslation(); const config = useConfig(); const headerTitle = t('postnatalCare', 'Postnatal Care'); - const MotherPNCEncounterTypeUUID = config.encounterTypes.motherPostnatal; + const { encounterTypes, formNames, formUuids } = useConfig(); const columns: EncounterListColumn[] = useMemo( () => [ @@ -85,8 +85,8 @@ const PostnatalCareList: React.FC = ({ patientUuid }) => return ( = ({ patientUuid }) => { const [relativeToIdentifierMap, setRelativeToIdentifierMap] = useState([]); const [pregnancyOutcomes, setPregnancyOutcomes] = useState([]); const [infantOutcomes, setInfantOutcomes] = useState([]); - const { formNames, encounterTypes, obsConcepts } = useConfig(); + const { formNames, encounterTypes, obsConcepts, formUuids } = useConfig(); const headersFamily = [ { @@ -466,9 +466,9 @@ const CurrentPregnancy: React.FC = ({ patientUuid }) => { description={previousVisitsTitle} headerTitle={previousVisitsTitle} formList={[ - { name: formNames.antenatal }, - { name: formNames.labourAndDelivery }, - { name: formNames.motherPostnatal }, + { name: formNames.antenatal, uuid: '' }, + { name: formNames.labourAndDelivery, uuid: formUuids.labourAndDelivery }, + { name: formNames.motherPostnatal, uuid: formUuids.motherPostnatal }, ]} launchOptions={{ hideFormLauncher: true, diff --git a/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/hiv-exposed-infant.component.tsx b/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/hiv-exposed-infant.component.tsx index 14e3b58a9..5d10e26ff 100644 --- a/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/hiv-exposed-infant.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/hiv-exposed-infant.component.tsx @@ -22,9 +22,9 @@ const HivExposedInfant: React.FC<{ dateOfBirth: string; }> = ({ patientUuid, dateOfBirth }) => { const { t } = useTranslation(); - const config = useConfig(); const [relatives, setRelatives] = useState([]); const [relativeToIdentifierMap, setRelativeToIdentifierMap] = useState([]); + const { formNames, formUuids, encounterTypes, obsConcepts } = useConfig(); useEffect(() => { getParentRelationships(); @@ -35,33 +35,33 @@ const HivExposedInfant: React.FC<{ { key: 'artProphylaxisStatus', header: t('artProphylaxisStatus', 'ART Prophylaxis Status'), - encounterTypes: [config.encounterTypes.infantPostnatal], + encounterTypes: [encounterTypes.infantPostnatal], getObsValue: ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.artProphylaxisStatus); + return getObsFromEncounter(encounter, obsConcepts.artProphylaxisStatus); }, }, { key: 'breastfeeding', header: t('breastfeeding', 'Breastfeeding'), - encounterTypes: [config.encounterTypes.infantPostnatal], + encounterTypes: [encounterTypes.infantPostnatal], getObsValue: ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.breastfeedingStatus); + return getObsFromEncounter(encounter, obsConcepts.breastfeedingStatus); }, }, { key: 'hivStatus', header: t('hivStatus', 'HIV Status'), - encounterTypes: [config.encounterTypes.infantPostnatal], + encounterTypes: [encounterTypes.infantPostnatal], getObsValue: ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.finalTestResults); + return getObsFromEncounter(encounter, obsConcepts.finalTestResults); }, }, { key: 'finalOutcome', header: t('finalOutcome', 'Final Outcome'), - encounterTypes: [config.encounterTypes.infantPostnatal], + encounterTypes: [encounterTypes.infantPostnatal], getObsValue: ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.outcomeStatus); + return getObsFromEncounter(encounter, obsConcepts.outcomeStatus); }, }, ], @@ -74,21 +74,21 @@ const HivExposedInfant: React.FC<{ key: 'date', header: t('date', 'Date'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.artStartDate, true); + return getObsFromEncounter(encounter, obsConcepts.artStartDate, true); }, }, { key: 'testType', header: t('testType', 'Test Type'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.testTypeConcept); + return getObsFromEncounter(encounter, obsConcepts.testTypeConcept); }, }, { key: 'ageAtTimeOfTest', header: t('ageAtTimeOfTest', 'Age at time of test'), getValue: (encounter) => { - const artDate = getObsFromEncounter(encounter, config.obsConcepts.artStartDate); + const artDate = getObsFromEncounter(encounter, obsConcepts.artStartDate); return artDate ? dayjs().diff(dayjs(artDate), 'day') : '--'; }, }, @@ -96,7 +96,7 @@ const HivExposedInfant: React.FC<{ key: 'hivStatus', header: t('hivStatus', 'HIV Status'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.finalTestResults); + return getObsFromEncounter(encounter, obsConcepts.finalTestResults); }, }, ]; @@ -148,7 +148,7 @@ const HivExposedInfant: React.FC<{ const identifiers = await fetchPatientIdentifiers(patientUuid); if (identifiers) { pTrackerMap.pTrackerId = identifiers.find( - (id) => id.identifierType.uuid === config.identifiersTypes.ptrackerIdentifierType, + (id) => id.identifierType.uuid === encounterTypes.PTrackerIdentifierType, ).identifier; pTrackerMap.patientId = patientUuid; } @@ -193,7 +193,7 @@ const HivExposedInfant: React.FC<{ key: 'visitDate', header: t('visitDate', 'Visit date'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.infantVisitDate, true); + return getObsFromEncounter(encounter, obsConcepts.infantVisitDate, true); }, }, { @@ -207,7 +207,7 @@ const HivExposedInfant: React.FC<{ key: 'nextFollowUpDate', header: t('nextFollowUpDate', 'Next Follow-up date'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.followUpDateConcept, true); + return getObsFromEncounter(encounter, obsConcepts.followUpDateConcept, true); }, }, { @@ -239,8 +239,8 @@ const HivExposedInfant: React.FC<{ = ({ patientUuid }) => { const { t } = useTranslation(); - const config = useConfig(); const headerRecentTB = t('recentTuberculosis', 'Recent Tuberculosis'); const headerPreviousCases = t('previousCases', 'Previous Cases'); const headerVisit = t('visits', 'Visits'); + const { formNames, formUuids, encounterTypes, obsConcepts } = useConfig(); const recentTuberclosisColumns: SummaryCardColumn[] = useMemo( () => [ { key: 'caseID', header: t('caseID', 'Case ID'), - encounterTypes: [config.encounterTypes.tbProgramEnrollment], + encounterTypes: [encounterTypes.tbProgramEnrollment], getObsValue: async ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.caseID); + return getObsFromEncounter(encounter, obsConcepts.caseID); }, }, { key: 'enrollmentDate', header: t('enrollmentDate', 'Enrollment Date'), - encounterTypes: [config.encounterTypes.tbProgramEnrollment], + encounterTypes: [encounterTypes.tbProgramEnrollment], getObsValue: async ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.enrollmentDate, true); + return getObsFromEncounter(encounter, obsConcepts.enrollmentDate, true); }, }, { key: 'type', header: t('type', 'Type'), - encounterTypes: [config.encounterTypes.tbProgramEnrollment], + encounterTypes: [encounterTypes.tbProgramEnrollment], getObsValue: ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.type); + return getObsFromEncounter(encounter, obsConcepts.type); }, }, { key: 'site', header: t('site', 'Site'), - encounterTypes: [config.encounterTypes.tbProgramEnrollment], + encounterTypes: [encounterTypes.tbProgramEnrollment], getObsValue: ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.site); + return getObsFromEncounter(encounter, obsConcepts.site); }, }, { key: 'drugSensitivity', header: t('drugSensitivity', 'Drug Sensitivity'), - encounterTypes: [config.encounterTypes.tbProgramEnrollment], + encounterTypes: [encounterTypes.tbProgramEnrollment], getObsValue: ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.drugSensitivity); + return getObsFromEncounter(encounter, obsConcepts.drugSensitivity); }, }, { key: 'regimen', header: t('regimen', 'Regimen'), - encounterTypes: [config.encounterTypes.tbProgramEnrollment], + encounterTypes: [encounterTypes.tbProgramEnrollment], getObsValue: ([encounter]) => { - const tBEnrollmentType = findObs(encounter, config.obsConcepts.tBEnrollmentType)?.value?.uuid; + const tBEnrollmentType = findObs(encounter, obsConcepts.tBEnrollmentType)?.value?.uuid; return getTbRegimen(encounter, tBEnrollmentType); }, }, { key: 'hivStatus', header: t('hivStatus', 'HIV Status'), - encounterTypes: [config.encounterTypes.tbProgramEnrollment], + encounterTypes: [encounterTypes.tbProgramEnrollment], getObsValue: ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.hivStatus); + return getObsFromEncounter(encounter, obsConcepts.hivStatus); }, }, { key: 'outcome', header: t('outcome', 'Outcome'), - encounterTypes: [config.encounterTypes.tbProgramEnrollment], + encounterTypes: [encounterTypes.tbProgramEnrollment], getObsValue: ([encounter]) => { - return getObsFromEncounter(encounter, config.obsConcepts.outcome); + return getObsFromEncounter(encounter, obsConcepts.outcome); }, }, ], @@ -99,35 +99,35 @@ const TBSummaryOverviewList: React.FC = ({ patientUuid }) => key: 'caseID', header: t('caseID', 'Case ID'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.caseID); + return getObsFromEncounter(encounter, obsConcepts.caseID); }, }, { key: 'enrollmentDate', header: t('enrollmentDate', 'Enrollment Date'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.enrollmentDate, true); + return getObsFromEncounter(encounter, obsConcepts.enrollmentDate, true); }, }, { key: 'type', header: t('type', 'Type'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.type); + return getObsFromEncounter(encounter, obsConcepts.type); }, }, { key: 'site', header: t('site', 'Site'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.site); + return getObsFromEncounter(encounter, obsConcepts.site); }, }, { key: 'regimen', header: t('regimen', 'Regimen'), getValue: (encounter) => { - const tBEnrollmentType = findObs(encounter, config.obsConcepts.tBEnrollmentType)?.value?.uuid; + const tBEnrollmentType = findObs(encounter, obsConcepts.tBEnrollmentType)?.value?.uuid; return getTbRegimen(encounter, tBEnrollmentType); }, }, @@ -135,7 +135,7 @@ const TBSummaryOverviewList: React.FC = ({ patientUuid }) => key: 'outcome', header: t('outcome', 'Outcome'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.outcome); + return getObsFromEncounter(encounter, obsConcepts.outcome); }, }, ], @@ -148,42 +148,42 @@ const TBSummaryOverviewList: React.FC = ({ patientUuid }) => key: 'caseID', header: t('caseID', 'Case ID'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.caseID); + return getObsFromEncounter(encounter, obsConcepts.caseID); }, }, { key: 'dateOfVisit', header: t('dateOfVisit', 'Date of Visit'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.visitDate, true); + return getObsFromEncounter(encounter, obsConcepts.visitDate, true); }, }, { key: 'monthOfVisit', header: t('monthOfVisit', 'Month of Visit'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.monthOfTreatment); + return getObsFromEncounter(encounter, obsConcepts.monthOfTreatment); }, }, { key: 'adherence', header: t('adherence', 'Adherence'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.adherenceAssessment); + return getObsFromEncounter(encounter, obsConcepts.adherenceAssessment); }, }, { key: 'adverseDrugReaction', header: t('adverseDrugReaction', 'Adverse Drug Reaction'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.ADR); + return getObsFromEncounter(encounter, obsConcepts.ADR); }, }, { key: 'nextAppointment', header: t('nextAppointment', 'Next Appointment'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.nextAppointmentDate, true); + return getObsFromEncounter(encounter, obsConcepts.nextAppointmentDate, true); }, }, ], @@ -201,11 +201,11 @@ const TBSummaryOverviewList: React.FC = ({ patientUuid }) => = ({ patientUuid }) => = ({ patientUuid }) => { const { t } = useTranslation(); - const config = useConfig(); const headerTitle = t('MdrTbEnrolment', 'TB/MDR TB Enrolment'); const [isEmptyOutcome, setIsEmptyOutcome] = useState(false); + const { formNames, formUuids, encounterTypes, obsConcepts } = useConfig(); useEffect(() => { - fetchPatientLastEncounter(patientUuid, config.encounterTypes.tbProgramEnrollment).then((encounter) => { - const result = encounter?.obs?.filter((ob) => ob?.concept?.uuid === config.obsConcepts.outcome); + fetchPatientLastEncounter(patientUuid, encounterTypes.tbProgramEnrollment).then((encounter) => { + const result = encounter?.obs?.filter((ob) => ob?.concept?.uuid === obsConcepts.outcome); if (result?.length === 0) { setIsEmptyOutcome(true); } @@ -33,21 +33,21 @@ const MdrTbList: React.FC = ({ patientUuid }) => { key: 'enrollmentDate', header: t('enrollmentDate', 'Enrollment Date'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.enrollmentDate, true); + return getObsFromEncounter(encounter, obsConcepts.enrollmentDate, true); }, }, { key: 'caseID', header: t('caseID', 'Case ID'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.caseID); + return getObsFromEncounter(encounter, obsConcepts.caseID); }, }, { key: 'tbTreatmentId', header: t('tbTreatmentId', 'TB Treatement ID'), getValue: (encounter) => { - const tBEnrollmentType = findObs(encounter, config.obsConcepts.tBEnrollmentType)?.value?.uuid; + const tBEnrollmentType = findObs(encounter, obsConcepts.tBEnrollmentType)?.value?.uuid; return getTbTreatmentId(encounter, tBEnrollmentType); }, }, @@ -55,7 +55,7 @@ const MdrTbList: React.FC = ({ patientUuid }) => { key: 'treatmentStartDate', header: t('treatmentStartDate', 'Treatment Start Date'), getValue: (encounter) => { - const tBEnrollmentType = findObs(encounter, config.obsConcepts.tBEnrollmentType)?.value?.uuid; + const tBEnrollmentType = findObs(encounter, obsConcepts.tBEnrollmentType)?.value?.uuid; return getTbTreatmentStartDate(encounter, tBEnrollmentType); }, }, @@ -63,7 +63,7 @@ const MdrTbList: React.FC = ({ patientUuid }) => { key: 'regimen', header: t('regimen', 'Regimen'), getValue: (encounter) => { - const tBEnrollmentType = findObs(encounter, config.obsConcepts.tBEnrollmentType)?.value?.uuid; + const tBEnrollmentType = findObs(encounter, obsConcepts.tBEnrollmentType)?.value?.uuid; return getTbRegimen(encounter, tBEnrollmentType); }, }, @@ -71,14 +71,14 @@ const MdrTbList: React.FC = ({ patientUuid }) => { key: 'treatmentOutcome', header: t('treatmentOutcome', 'Treatment outcome'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.outcome); + return getObsFromEncounter(encounter, obsConcepts.outcome); }, }, { key: 'dateOfTreatmentOutcome', header: t('dateOfTreatmentOutcome', 'Date of Treatment Outcome'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.DateOfTreatmentOutcome, true); + return getObsFromEncounter(encounter, obsConcepts.DateOfTreatmentOutcome, true); }, }, { @@ -108,8 +108,8 @@ const MdrTbList: React.FC = ({ patientUuid }) => { return ( = ({ patientUuid }) => { const { t } = useTranslation(); - const config = useConfig(); + const { formNames, formUuids, encounterTypes, obsConcepts } = useConfig(); const headerTitle = t('PatientTracing', 'Patient Tracing'); const columns: EncounterListColumn[] = useMemo( () => [ @@ -19,14 +19,14 @@ const TbPatientTracing: React.FC = ({ patientUuid }) => { key: 'contactDate', header: t('contactDate', 'Contact Date'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.dateContacted, true); + return getObsFromEncounter(encounter, obsConcepts.dateContacted, true); }, }, { key: 'contactMethod', header: t('contactMethod', 'Contact Method'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.modeOfContact); + return getObsFromEncounter(encounter, obsConcepts.modeOfContact); }, }, { @@ -56,8 +56,8 @@ const TbPatientTracing: React.FC = ({ patientUuid }) => { return ( = ({ patientUuid }) => { const { t } = useTranslation(); - const config = useConfig(); + const { formNames, formUuids, encounterTypes, obsConcepts } = useConfig(); const headerTitle = t('TbContactListing', 'TB Contact Listing'); const columns: EncounterListColumn[] = useMemo( @@ -20,14 +20,14 @@ const TbContactTracingList: React.FC = ({ patientUuid }) => { key: 'caseID', header: t('caseId', 'TB Case ID'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.caseID); + return getObsFromEncounter(encounter, obsConcepts.caseID); }, }, { key: 'dateContactListed', header: t('dateContactListed', 'Date Contact Listed'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.dateContacted, true); + return getObsFromEncounter(encounter, obsConcepts.dateContacted, true); }, }, { @@ -64,8 +64,8 @@ const TbContactTracingList: React.FC = ({ patientUuid }) => { return ( = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes } = useConfig(); + const { formNames, formUuids, encounterTypes, obsConcepts } = useConfig(); const headerRecentTPT = t('recentTptCases', 'Recent TPT Cases'); const headerPreviousTptCases = t('previousTptCases', 'Previous TPT Cases'); @@ -196,7 +196,7 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { columns={previousTptCasesColumns} description={headerPreviousTptCases} headerTitle={headerPreviousTptCases} - formList={[{ name: 'TPT Case Enrolment form' }]} + formList={[{ name: formNames.TptCaseEnrolmentFormName, uuid: formUuids.tptCaseEnrolmentFormUuid }]} launchOptions={{ hideFormLauncher: true, displayText: '', @@ -209,7 +209,7 @@ const TptPatientSummary: React.FC = ({ patientUuid }) => { columns={TptVisitsColumns} description={headerVisit} headerTitle={headerVisit} - formList={[{ name: 'TPT Case Enrolment form' }]} + formList={[{ name: formNames.TptCaseEnrolmentFormName, uuid: formUuids.tptCaseEnrolmentFormUuid }]} launchOptions={{ hideFormLauncher: true, displayText: '', diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx index 33d2b0a98..74fe248db 100644 --- a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx +++ b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx @@ -10,7 +10,7 @@ interface TptEnrolmentListProps { const TptEnrolmentList: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const headerTitle = t('tptEnrolment', 'TPT Enrolment'); @@ -101,8 +101,8 @@ const TptEnrolmentList: React.FC = ({ patientUuid }) => { patientUuid={patientUuid} encounterType={encounterTypes.tptCaseEnrollment} formList={[ - { name: formNames.TptCaseEnrolmentFormName }, - { name: formNames.TptOutcomeFormName, excludedIntents: ['*'] }, + { name: formNames.TptCaseEnrolmentFormName, uuid: formUuids.tptCaseEnrolmentFormUuid }, + { name: formNames.TptOutcomeFormName, excludedIntents: ['*'], uuid: formUuids.tptOutcomeFormUuid }, ]} columns={columns} description={headerTitle} diff --git a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component.tsx b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component.tsx index 630e4c7a4..2e8888e3b 100644 --- a/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component.tsx +++ b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-treatment.component.tsx @@ -10,7 +10,7 @@ interface TptTreatmentListProps { const TptTreatmentList: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { obsConcepts, encounterTypes, formNames } = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const headerTitle = t('tptTreatment', 'TPT Treatment'); const columns: EncounterListColumn[] = useMemo( () => [ @@ -70,7 +70,7 @@ const TptTreatmentList: React.FC = ({ patientUuid }) => { = ({ patientUuid }) => { const { t } = useTranslation(); - const config = useConfig(); + const { obsConcepts, encounterTypes, formNames, formUuids } = useConfig(); const headerTitle = t('TbTreatmentFollowUp', 'TB Follow-up'); const columns: EncounterListColumn[] = useMemo( @@ -20,35 +20,35 @@ const TbTreatmentFollowUpList: React.FC = ({ patientUuid }) = key: 'visitDate', header: t('visitDate', 'Visit Date'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.visitDate, true); + return getObsFromEncounter(encounter, obsConcepts.visitDate, true); }, }, { key: 'caseId', header: t('caseId', 'Case ID'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.followUpCaseId); + return getObsFromEncounter(encounter, obsConcepts.followUpCaseId); }, }, { key: 'monthOfTreatment', header: t('monthOfTreatment', 'Month of Rx'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.monthOfTreatment); + return getObsFromEncounter(encounter, obsConcepts.monthOfTreatment); }, }, { key: 'adherenceAssessment', header: t('adherenceAssessment', 'Adherence'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.adherenceAssessment); + return getObsFromEncounter(encounter, obsConcepts.adherenceAssessment); }, }, { key: 'nextAppointment', header: t('nextAppointment', 'Next Appointment'), getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.nextAppointmentDate, true); + return getObsFromEncounter(encounter, obsConcepts.nextAppointmentDate, true); }, }, { @@ -78,8 +78,8 @@ const TbTreatmentFollowUpList: React.FC = ({ patientUuid }) = return ( Date: Mon, 18 Mar 2024 09:20:55 +0300 Subject: [PATCH 34/50] (fix) Fixed indefined encounter uuid when adding new encounter (#1823) --- .../components/encounter-list/encounter-list.component.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx index 503939143..728d95a0a 100644 --- a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx +++ b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx @@ -236,7 +236,7 @@ export const EncounterList: React.FC = ({ 'add', onFormSave, null, - null, + '', null, workspaceWindowSize, patientUuid, @@ -256,7 +256,7 @@ export const EncounterList: React.FC = ({ 'add', onFormSave, null, - null, + '', intent, workspaceWindowSize, patientUuid, @@ -303,7 +303,7 @@ export const EncounterList: React.FC = ({ 'add', onFormSave, null, - null, + '', '*', workspaceWindowSize, patientUuid, From a69daad9ac57162dd3133af2685b5e684a42eefd Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Wed, 20 Mar 2024 09:50:16 +0300 Subject: [PATCH 35/50] OHRI-1350 Move custom side nav links to utilize openmrs homepage (#1751) --- .../welcome-section/ohri-welcome-section.scss | 1 + .../tile/ohri-programme-summary-tiles.scss | 1 + packages/esm-commons-lib/src/index.ts | 2 + packages/esm-commons-lib/src/root.scss | 17 ++++ .../src/utils/createNewOHRIDashboardLink.tsx | 44 +++++++++ .../src/utils/createOHRIGroupedLink.tsx | 78 +++++++++++++++ .../src/utils/sidenav-links.scss | 2 +- packages/esm-covid-app/src/dashboard.meta.tsx | 7 +- packages/esm-covid-app/src/home.component.tsx | 16 +++ packages/esm-covid-app/src/index.ts | 10 +- packages/esm-covid-app/src/root.component.tsx | 27 ++++++ packages/esm-covid-app/src/routes.json | 48 +++------ .../covid-summary-tiles.component.tsx | 2 +- packages/esm-hiv-app/src/dashboard.meta.tsx | 10 +- .../src/hiv-treatment-home.component.tsx | 16 +++ .../src/hiv-treatment-root.component.tsx | 27 ++++++ .../esm-hiv-app/src/hts-home.component.tsx | 16 +++ .../esm-hiv-app/src/hts-root.component.tsx | 27 ++++++ packages/esm-hiv-app/src/index.ts | 20 ++-- packages/esm-hiv-app/src/routes.json | 51 ++-------- .../ct-summary-tiles.component.tsx | 2 +- .../hts/home/summary-tiles/summary-tile.scss | 1 + .../esm-ohri-core-app/src/dashboard.meta.tsx | 37 +------ packages/esm-ohri-core-app/src/index.ts | 51 ++-------- .../appointments-dashboard.component.tsx | 8 -- .../dispensing-dashboard.component.tsx | 13 --- .../programs-home.component.tsx | 7 ++ .../service-queues-dashboard.component.tsx | 13 --- packages/esm-ohri-core-app/src/root.tsx | 15 --- packages/esm-ohri-core-app/src/routes.json | 74 +++----------- .../esm-ohri-pmtct-app/src/dashboard.meta.tsx | 9 +- .../esm-ohri-pmtct-app/src/home.component.tsx | 16 +++ packages/esm-ohri-pmtct-app/src/index.ts | 13 ++- .../esm-ohri-pmtct-app/src/root.component.tsx | 27 ++++++ packages/esm-ohri-pmtct-app/src/routes.json | 66 ++++--------- ...maternal-child-summary-tiles.component.tsx | 2 +- .../mother-child-summary-tabs.component.tsx | 6 +- packages/esm-tb-app/src/dashboard.meta.tsx | 16 ++- packages/esm-tb-app/src/home.component.tsx | 16 +++ packages/esm-tb-app/src/index.ts | 26 ++--- packages/esm-tb-app/src/root.component.tsx | 27 ++++++ packages/esm-tb-app/src/routes.json | 97 ++++++------------- .../esm-tb-app/src/tpt-home.component.tsx | 16 +++ .../esm-tb-app/src/tpt-root.component.tsx | 27 ++++++ .../tb-summary-tiles.component.tsx | 2 +- .../tpt-summary-tiles.component.tsx | 2 +- 46 files changed, 576 insertions(+), 435 deletions(-) create mode 100644 packages/esm-commons-lib/src/utils/createNewOHRIDashboardLink.tsx create mode 100644 packages/esm-commons-lib/src/utils/createOHRIGroupedLink.tsx create mode 100644 packages/esm-covid-app/src/home.component.tsx create mode 100644 packages/esm-covid-app/src/root.component.tsx create mode 100644 packages/esm-hiv-app/src/hiv-treatment-home.component.tsx create mode 100644 packages/esm-hiv-app/src/hiv-treatment-root.component.tsx create mode 100644 packages/esm-hiv-app/src/hts-home.component.tsx create mode 100644 packages/esm-hiv-app/src/hts-root.component.tsx delete mode 100644 packages/esm-ohri-core-app/src/ohri-dashboard/appointments/appointments-dashboard.component.tsx delete mode 100644 packages/esm-ohri-core-app/src/ohri-dashboard/dispensing/dispensing-dashboard.component.tsx create mode 100644 packages/esm-ohri-core-app/src/ohri-dashboard/programs-home.component.tsx delete mode 100644 packages/esm-ohri-core-app/src/ohri-dashboard/service-queues/service-queues-dashboard.component.tsx delete mode 100644 packages/esm-ohri-core-app/src/root.tsx create mode 100644 packages/esm-ohri-pmtct-app/src/home.component.tsx create mode 100644 packages/esm-ohri-pmtct-app/src/root.component.tsx create mode 100644 packages/esm-tb-app/src/home.component.tsx create mode 100644 packages/esm-tb-app/src/root.component.tsx create mode 100644 packages/esm-tb-app/src/tpt-home.component.tsx create mode 100644 packages/esm-tb-app/src/tpt-root.component.tsx diff --git a/packages/esm-commons-lib/src/components/ohri-home/welcome-section/ohri-welcome-section.scss b/packages/esm-commons-lib/src/components/ohri-home/welcome-section/ohri-welcome-section.scss index d93a73e6c..ccefc064b 100644 --- a/packages/esm-commons-lib/src/components/ohri-home/welcome-section/ohri-welcome-section.scss +++ b/packages/esm-commons-lib/src/components/ohri-home/welcome-section/ohri-welcome-section.scss @@ -1,6 +1,7 @@ .welcomeContainer { display: flex; flex-direction: column; + margin: 1rem; } .location { diff --git a/packages/esm-commons-lib/src/components/tile/ohri-programme-summary-tiles.scss b/packages/esm-commons-lib/src/components/tile/ohri-programme-summary-tiles.scss index e9845e821..042124f96 100644 --- a/packages/esm-commons-lib/src/components/tile/ohri-programme-summary-tiles.scss +++ b/packages/esm-commons-lib/src/components/tile/ohri-programme-summary-tiles.scss @@ -1,6 +1,7 @@ .desktopView { display: flex; gap: 8px; + margin: 1rem; } .tileView { diff --git a/packages/esm-commons-lib/src/index.ts b/packages/esm-commons-lib/src/index.ts index becd0da5d..7c87c1f6f 100644 --- a/packages/esm-commons-lib/src/index.ts +++ b/packages/esm-commons-lib/src/index.ts @@ -29,6 +29,8 @@ export * from './components/tile/ohri-summary-tile-tablet.component'; export * from './components/tile/ohri-summary-tile.component'; export * from './utils/compare'; export * from './utils/createOHRIDashboardLink'; +export * from './utils/createNewOHRIDashboardLink'; +export * from './utils/createOHRIGroupedLink'; export * from './utils/events'; export * from './utils/get-dosage'; export * from './utils/helpers'; diff --git a/packages/esm-commons-lib/src/root.scss b/packages/esm-commons-lib/src/root.scss index 62b18e4f5..a3f7b89ff 100644 --- a/packages/esm-commons-lib/src/root.scss +++ b/packages/esm-commons-lib/src/root.scss @@ -97,3 +97,20 @@ div[class*='-esm-login__styles__center'] > img { :global(.cds--overflow-menu) > div { width: 15rem !important; } + +:global(.cds--tab-content) { + background-color: #F4F4F4; +} + +:global(.cds--side-nav--expanded .cds--side-nav__items) { + padding: 0.125rem !important; +} + +:global(.cds--side-nav__submenu) { + height: 1.5rem; + + &:focus, + &:hover { + background-color: #e0e0e0; + } +} \ No newline at end of file diff --git a/packages/esm-commons-lib/src/utils/createNewOHRIDashboardLink.tsx b/packages/esm-commons-lib/src/utils/createNewOHRIDashboardLink.tsx new file mode 100644 index 000000000..08316ba86 --- /dev/null +++ b/packages/esm-commons-lib/src/utils/createNewOHRIDashboardLink.tsx @@ -0,0 +1,44 @@ +import React, { useEffect, useMemo, useState } from 'react'; +import classNames from 'classnames'; +import { BrowserRouter, useLocation } from 'react-router-dom'; +import { useTranslation } from 'react-i18next'; +import { ConfigurableLink, navigate } from '@openmrs/esm-framework'; +import { SideNavLink, SideNavMenu, SideNavMenuItem, Button } from '@carbon/react'; +import styles from './sidenav-links.scss'; + +interface DashboardLinkConfig { + name: string; + title: string; + icon: React.ComponentType; +} + +function NewDashboardExtension({ dashboardLinkConfig }: { dashboardLinkConfig: DashboardLinkConfig }) { + const { name, title, icon } = dashboardLinkConfig; + const location = useLocation(); + const spaBasePath = `${window.spaBase}/home`; + + const navLink = useMemo(() => { + const pathArray = location.pathname.split('/home'); + const lastElement = pathArray[pathArray.length - 1]; + return decodeURIComponent(lastElement); + }, [location.pathname]); + + return ( + { + e.preventDefault(); + navigate({ to: `${spaBasePath}/${name}` }); + }} + className={navLink.match(name) ? styles.currentNavItem : ''}> + {title} + + ); +} + +export const createNewOHRIDashboardLink = (dashboardLinkConfig: DashboardLinkConfig) => () => ( + + + +); diff --git a/packages/esm-commons-lib/src/utils/createOHRIGroupedLink.tsx b/packages/esm-commons-lib/src/utils/createOHRIGroupedLink.tsx new file mode 100644 index 000000000..c802ba29c --- /dev/null +++ b/packages/esm-commons-lib/src/utils/createOHRIGroupedLink.tsx @@ -0,0 +1,78 @@ +import React, { useMemo } from 'react'; +import classNames from 'classnames'; +import { BrowserRouter, useLocation } from 'react-router-dom'; +import { useTranslation } from 'react-i18next'; +import { ConfigurableLink } from '@openmrs/esm-framework'; +import { SideNavMenu, SideNavItems } from '@carbon/react'; + +interface DashboardLinkConfig { + name: string; + title: string; + isFolder: boolean; + folderTitle: string; + folderIcon: React.ComponentType; + childLinks?: Array; + isHidden?: boolean; +} + +function DashboardExtension({ dashboardLinkConfig }: { dashboardLinkConfig: DashboardLinkConfig }) { + const { t } = useTranslation(); + const { name, title, isFolder, folderTitle, folderIcon, childLinks, isHidden } = dashboardLinkConfig; + const location = useLocation(); + const spaBasePath = `${window.spaBase}/home`; + + const navLink = useMemo(() => { + const pathArray = location.pathname.split('/home'); + const lastElement = pathArray[pathArray.length - 1]; + return decodeURIComponent(lastElement); + }, [location.pathname]); + + if (isHidden) { + return; + } + + if (isFolder) { + return ( + + + + {t(title)} + + {Array.isArray(childLinks) && + childLinks.map((childLink, childIndex) => ( + + {t(childLink.title)} + + ))} + + + ); + } else { + return ( + + + {t(title)} + + + ); + } +} + +export const createOHRIGroupedLink = (dashboardLinkConfig: DashboardLinkConfig) => () => ( + + + +); diff --git a/packages/esm-commons-lib/src/utils/sidenav-links.scss b/packages/esm-commons-lib/src/utils/sidenav-links.scss index 76c3df410..d1a06f8e3 100644 --- a/packages/esm-commons-lib/src/utils/sidenav-links.scss +++ b/packages/esm-commons-lib/src/utils/sidenav-links.scss @@ -8,4 +8,4 @@ background-color: #e0e0e0 !important; color: #161616 !important; border-left-color: var(--brand-01) !important; -} +} \ No newline at end of file diff --git a/packages/esm-covid-app/src/dashboard.meta.tsx b/packages/esm-covid-app/src/dashboard.meta.tsx index f382a6547..006e5043b 100644 --- a/packages/esm-covid-app/src/dashboard.meta.tsx +++ b/packages/esm-covid-app/src/dashboard.meta.tsx @@ -42,7 +42,8 @@ export const covidClinicalViewDashboardMeta = { export const covid19CasesDashboardMeta = { name: 'covid-cases', slot: 'covid-cases-dashboard-slot', - config: { columns: 1, type: 'grid', programme: 'covid', dashboardTitle: 'COVID-19 Cases', icon: Coronavirus }, title: 'COVID-19 Cases', - dashboardIcon: Coronavirus, -}; + isFolder: true, + folderTitle: 'COVID', + folderIcon: Coronavirus +}; \ No newline at end of file diff --git a/packages/esm-covid-app/src/home.component.tsx b/packages/esm-covid-app/src/home.component.tsx new file mode 100644 index 000000000..24580fe77 --- /dev/null +++ b/packages/esm-covid-app/src/home.component.tsx @@ -0,0 +1,16 @@ +import { OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; +import React from 'react'; +import CovidHomePatientTabs from './views/dashboard/patient-list-tabs/covid-patient-list-tabs.component'; +import CovidSummaryTiles from './views/dashboard/summary-tiles/covid-summary-tiles.component'; + +const Homecomponent = () => { + return ( +
+ + + +
+ ); +}; + +export default Homecomponent; diff --git a/packages/esm-covid-app/src/index.ts b/packages/esm-covid-app/src/index.ts index 13ee9af19..1e3795dba 100644 --- a/packages/esm-covid-app/src/index.ts +++ b/packages/esm-covid-app/src/index.ts @@ -12,9 +12,10 @@ import { covid19CasesDashboardMeta, covidPatientChartMeta, } from './dashboard.meta'; -import { createOHRIDashboardLink, OHRIHome, OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { createOHRIDashboardLink, createOHRIGroupedLink, OHRIHome, OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib'; import { configSchema } from './config-schema'; +import rootComponent from './root.component'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -80,8 +81,5 @@ export const covidClinicalViewDashboardLink = getSyncLifecycle( createOHRIDashboardLink(covidClinicalViewDashboardMeta), options, ); -export const covidCasesDashboardLink = getSyncLifecycle(createOHRIDashboardLink(covid19CasesDashboardMeta), options); -export const covidCasesDashboard = getSyncLifecycle(OHRIHome, { - featureName: 'covid cases dashboard', - moduleName, -}); +export const covidCasesDashboardLink = getSyncLifecycle(createOHRIGroupedLink(covid19CasesDashboardMeta), options); +export const covidCasesDashboard = getSyncLifecycle(rootComponent, options); diff --git a/packages/esm-covid-app/src/root.component.tsx b/packages/esm-covid-app/src/root.component.tsx new file mode 100644 index 000000000..fd0474cc3 --- /dev/null +++ b/packages/esm-covid-app/src/root.component.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { SWRConfig } from 'swr'; +import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import Home from './home.component'; + +const swrConfiguration = { + // Maximum number of retries when the backend returns an error + errorRetryCount: 3, +}; + +const Root: React.FC = () => { + const covidBasename = window.getOpenmrsSpaBase() + 'home/covid-cases'; + + return ( +
+ + + + } /> + + + +
+ ); +}; + +export default Root; \ No newline at end of file diff --git a/packages/esm-covid-app/src/routes.json b/packages/esm-covid-app/src/routes.json index 9e423c8dd..e6dbba5f7 100644 --- a/packages/esm-covid-app/src/routes.json +++ b/packages/esm-covid-app/src/routes.json @@ -16,38 +16,6 @@ "title": "COVID" } }, - { - "name": "covid-cases-dashboard-ext", - "slot": "ohri-covid-dashboard-slot", - "component": "covidCasesDashboardLink", - "meta": { - "name": "covid-cases", - "slot": "covid-cases-dashboard-slot", - "config": { - "columns": 1, - "type": "grid", - "programme": "covid", - "dashboardTitle": "COVID-19 Cases" - }, - "path": "COVID-19", - "title": "COVID-19 Cases" - } - }, - { - "name": "covid-cases-dashboard", - "slot": "covid-cases-dashboard-slot", - "component": "covidCasesDashboard", - "meta": { - "name": "covid-cases", - "slot": "covid-cases-dashboard-slot", - "config": { - "columns": 1, - "programme": "covid", - "dashboardTitle": "COVID-19 Home Page" - }, - "title": "COVID-19 Cases" - } - }, { "name": "covid-home-header-ext", "slot": "covid-home-header-slot", @@ -115,6 +83,22 @@ "name": "covid-vaccinations-ext", "slot": "covid-vaccinations-dashboard-slot", "component": "covidVaccinationsDashboard" + }, + { + "name": "covid-cases-dashboard-ext", + "slot": "homepage-dashboard-slot", + "component": "covidCasesDashboardLink", + "meta": { + "name": "covid-cases", + "slot": "covid-cases-dashboard-slot", + "title": "TB Treatment" + }, + "order": 5 + }, + { + "name": "covid-cases-dashboard", + "slot": "covid-cases-dashboard-slot", + "component": "covidCasesDashboard" } ] } diff --git a/packages/esm-covid-app/src/views/dashboard/summary-tiles/covid-summary-tiles.component.tsx b/packages/esm-covid-app/src/views/dashboard/summary-tiles/covid-summary-tiles.component.tsx index 426c2587a..a2c32733c 100644 --- a/packages/esm-covid-app/src/views/dashboard/summary-tiles/covid-summary-tiles.component.tsx +++ b/packages/esm-covid-app/src/views/dashboard/summary-tiles/covid-summary-tiles.component.tsx @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'; import { Outcomes } from './outcome-list-tile.component'; import { useConfig } from '@openmrs/esm-framework'; -function CovidSummaryTiles({ launchWorkSpace }) { +function CovidSummaryTiles() { const { t } = useTranslation(); const config = useConfig(); const [activeClientsCount, setActiveClientsCount] = useState(100); diff --git a/packages/esm-hiv-app/src/dashboard.meta.tsx b/packages/esm-hiv-app/src/dashboard.meta.tsx index cdbf0abc8..d27ce3a6b 100644 --- a/packages/esm-hiv-app/src/dashboard.meta.tsx +++ b/packages/esm-hiv-app/src/dashboard.meta.tsx @@ -80,16 +80,20 @@ export const appointmentsDashboardMeta = { // Clinical Dashboards export const hivCareAndTreatmentFolderDashboardMeta = { slot: 'ohri-hiv-care-and-treatment-dashboard-slot', - config: { columns: 1, type: 'grid', icon: Home }, isFolder: true, title: 'HIV Care and Treatment', + name: 'care-and-treatment', + folderTitle: 'Care and Treatment', + folderIcon : Home }; export const hivPreventionFolderDashboardMeta = { slot: 'ohri-hiv-prevention-dashboard-slot', - config: { columns: 1, type: 'grid', icon: Pills }, isFolder: true, - title: 'HIV Prevention', + title: 'HIV Testing Services', + name: 'hts', + folderTitle: 'HIV Prevention', + folderIcon : Pills }; export const htsDashboardMeta = { diff --git a/packages/esm-hiv-app/src/hiv-treatment-home.component.tsx b/packages/esm-hiv-app/src/hiv-treatment-home.component.tsx new file mode 100644 index 000000000..0b046590e --- /dev/null +++ b/packages/esm-hiv-app/src/hiv-treatment-home.component.tsx @@ -0,0 +1,16 @@ +import { OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; +import React from 'react'; +import CTSummaryTiles from './views/hts/care-and-treatment/summary-tiles/ct-summary-tiles.component'; +import CTHomePatientTabs from './views/hts/patient-list-tabs/ct-patient-list-tabs.component'; + +const Homecomponent = () => { + return ( +
+ + + +
+ ); +}; + +export default Homecomponent; diff --git a/packages/esm-hiv-app/src/hiv-treatment-root.component.tsx b/packages/esm-hiv-app/src/hiv-treatment-root.component.tsx new file mode 100644 index 000000000..481100308 --- /dev/null +++ b/packages/esm-hiv-app/src/hiv-treatment-root.component.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { SWRConfig } from 'swr'; +import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import Home from './hiv-treatment-home.component'; + +const swrConfiguration = { + // Maximum number of retries when the backend returns an error + errorRetryCount: 3, +}; + +const Root: React.FC = () => { + const hivTreatmentBasename = window.getOpenmrsSpaBase() + 'home/care-and-treatment'; + + return ( +
+ + + + } /> + + + +
+ ); +}; + +export default Root; diff --git a/packages/esm-hiv-app/src/hts-home.component.tsx b/packages/esm-hiv-app/src/hts-home.component.tsx new file mode 100644 index 000000000..9390fc97a --- /dev/null +++ b/packages/esm-hiv-app/src/hts-home.component.tsx @@ -0,0 +1,16 @@ +import { OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; +import React from 'react'; +import OHRIPatientTabs from './views/hts/home/patient-tabs/ohri-patient-tabs.component'; +import HTSSummaryTiles from './views/hts/home/summary-tiles/hts-summary-tiles.component'; + +const Homecomponent = () => { + return ( +
+ + {}} /> + +
+ ); +}; + +export default Homecomponent; diff --git a/packages/esm-hiv-app/src/hts-root.component.tsx b/packages/esm-hiv-app/src/hts-root.component.tsx new file mode 100644 index 000000000..f709f26bb --- /dev/null +++ b/packages/esm-hiv-app/src/hts-root.component.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { SWRConfig } from 'swr'; +import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import Home from './hts-home.component'; + +const swrConfiguration = { + // Maximum number of retries when the backend returns an error + errorRetryCount: 3, +}; + +const Root: React.FC = () => { + const htsBasename = window.getOpenmrsSpaBase() + 'home/hts'; + + return ( +
+ + + + } /> + + + +
+ ); +}; + +export default Root; diff --git a/packages/esm-hiv-app/src/index.ts b/packages/esm-hiv-app/src/index.ts index 884eff4ee..68bc900ea 100644 --- a/packages/esm-hiv-app/src/index.ts +++ b/packages/esm-hiv-app/src/index.ts @@ -16,6 +16,7 @@ import { PatientStatusBannerTag, OHRIHome, OHRIWelcomeSection, + createOHRIGroupedLink, } from '@ohri/openmrs-esm-ohri-commons-lib'; import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib'; @@ -33,6 +34,8 @@ import { partnerNotificationServicesDashboardMeta, hivPreventionFolderDashboardMeta, } from './dashboard.meta'; +import htsRootComponent from './hts-root.component'; +import careAndTreatmentRootComponent from './hiv-treatment-root.component'; import { configSchema } from './config-schema'; @@ -93,23 +96,20 @@ export const hivCareAndTreatmentFolderLink = getSyncLifecycle( options, ); export const hivCareAndTreatmentDashboardLink = getSyncLifecycle( - createOHRIDashboardLink(careAndTreatmentDashboardMeta), + createOHRIGroupedLink(hivCareAndTreatmentFolderDashboardMeta), options, ); -export const hivCareAndTreatmentDashboard = getSyncLifecycle(OHRIHome, { - featureName: 'care and treatment dashboard', - moduleName, -}); +export const hivCareAndTreatmentDashboard = getSyncLifecycle(careAndTreatmentRootComponent, options); export const hivPreventionFolderLink = getSyncLifecycle( createOHRIDashboardLink(hivPreventionFolderDashboardMeta), options, ); -export const hivPreventionDashboardLink = getSyncLifecycle(createOHRIDashboardLink(htsDashboardMeta), options); -export const hivPreventionDashboard = getSyncLifecycle(OHRIHome, { - featureName: 'hts dashboard', - moduleName, -}); +export const hivPreventionDashboardLink = getSyncLifecycle( + createOHRIGroupedLink(hivPreventionFolderDashboardMeta), + options, +); +export const hivPreventionDashboard = getSyncLifecycle(htsRootComponent, options); // Lab Results export const labResultsHomeHeader = getSyncLifecycle(OHRIWelcomeSection, { diff --git a/packages/esm-hiv-app/src/routes.json b/packages/esm-hiv-app/src/routes.json index de547b7ed..98a109545 100644 --- a/packages/esm-hiv-app/src/routes.json +++ b/packages/esm-hiv-app/src/routes.json @@ -23,35 +23,19 @@ }, { "name": "ohri-hiv-prevention-dashboard-ext", - "slot": "ohri-hiv-prevention-dashboard-slot", + "slot": "homepage-dashboard-slot", "component": "hivPreventionDashboardLink", "meta": { "name": "hts", "slot": "hts-dashboard-slot", - "config": { - "columns": 1, - "type": "grid", - "programme": "hts", - "dashboardTitle": "HTS Home Page" - }, "title": "HIV Testing Services" - } + }, + "order": 8 }, { "name": "ohri-hiv-prevention-dashboard", "slot": "hts-dashboard-slot", - "component": "hivPreventionDashboard", - "meta": { - "name": "hts", - "slot": "hts-dashboard-slot", - "config": { - "columns": 1, - "type": "grid", - "programme": "hts", - "dashboardTitle": "HTS Home Page" - }, - "title": "HIV Testing Services" - } + "component": "hivPreventionDashboard" }, { "name": "hts-home-header-ext", @@ -80,36 +64,19 @@ }, { "name": "care-and-treatment-dashboard-ext", - "slot": "ohri-hiv-care-and-treatment-dashboard-slot", + "slot": "homepage-dashboard-slot", "component": "hivCareAndTreatmentDashboardLink", "meta": { "name": "care-and-treatment", "slot": "ct-dashboard-slot", - "config": { - "columns": 1, - "type": "grid", - "programme": "ct", - "dashboardTitle": "C&T Home Page" - }, - "title": "Care and Treatment", - "path": "Care and Treatment" - } + "title": "Care and Treatment" + }, + "order": 9 }, { "name": "ohri-care-and-treatment-dashboard", "slot": "ct-dashboard-slot", - "component": "hivCareAndTreatmentDashboard", - "meta": { - "name": "care-and-treatment", - "slot": "ct-dashboard-slot", - "config": { - "columns": 1, - "type": "grid", - "programme": "ct", - "dashboardTitle": "C&T Home Page" - }, - "title": "Care and Treatment" - } + "component": "hivCareAndTreatmentDashboard" }, { "name": "ct-home-header-ext", diff --git a/packages/esm-hiv-app/src/views/hts/care-and-treatment/summary-tiles/ct-summary-tiles.component.tsx b/packages/esm-hiv-app/src/views/hts/care-and-treatment/summary-tiles/ct-summary-tiles.component.tsx index bb5cfbd83..6d180737e 100644 --- a/packages/esm-hiv-app/src/views/hts/care-and-treatment/summary-tiles/ct-summary-tiles.component.tsx +++ b/packages/esm-hiv-app/src/views/hts/care-and-treatment/summary-tiles/ct-summary-tiles.component.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'; import { OHRIProgrammeSummaryTiles, getReportingCohort } from '@ohri/openmrs-esm-ohri-commons-lib'; import { useConfig } from '@openmrs/esm-framework'; -function CTSummaryTiles({ launchWorkSpace }) { +function CTSummaryTiles() { const { t } = useTranslation(); const [activeClientsCount, setActiveClientsCount] = useState(0); const { cohorts } = useConfig(); diff --git a/packages/esm-hiv-app/src/views/hts/home/summary-tiles/summary-tile.scss b/packages/esm-hiv-app/src/views/hts/home/summary-tiles/summary-tile.scss index 46fc47ab8..b1e41454d 100644 --- a/packages/esm-hiv-app/src/views/hts/home/summary-tiles/summary-tile.scss +++ b/packages/esm-hiv-app/src/views/hts/home/summary-tiles/summary-tile.scss @@ -1,5 +1,6 @@ .desktopView{ display: flex; + margin: 1rem; } .tileView { display: none; diff --git a/packages/esm-ohri-core-app/src/dashboard.meta.tsx b/packages/esm-ohri-core-app/src/dashboard.meta.tsx index f7e2a671b..6e141cdd2 100644 --- a/packages/esm-ohri-core-app/src/dashboard.meta.tsx +++ b/packages/esm-ohri-core-app/src/dashboard.meta.tsx @@ -1,13 +1,4 @@ -import React from 'react'; -import { Home, ListBulleted, Calendar, Medication, Events } from '@carbon/react/icons'; - -export const homeDashboardMeta = { - name: 'home', - slot: 'ohri-home-dashboard-slot', - config: { columns: 1, type: 'grid', icon: Home }, - isLink: true, - title: 'Home', -}; +import { ListBulleted } from '@carbon/react/icons'; export const patientListMeta = { name: 'patient-lists', @@ -15,28 +6,4 @@ export const patientListMeta = { config: { columns: 1, type: 'grid', icon: ListBulleted }, isLink: true, title: 'Patient Lists', -}; - -export const appointmentsDashboardMeta = { - name: 'appointments', - slot: 'ohri-appointments-dashboard-slot', - config: { columns: 1, type: 'grid', icon: Calendar }, - isLink: true, - title: 'Appointments', -}; - -export const dispensingDashboardMeta = { - name: 'dispensing', - slot: 'ohri-dispensing-dashboard-slot', - config: { columns: 1, type: 'grid', icon: Medication }, - isLink: true, - title: 'Dispensing', -}; - -export const serviceQueuesDashboardMeta = { - name: 'service-queues', - slot: 'ohri-service-queues-dashboard-slot', - config: { columns: 1, type: 'grid', icon: Events }, - isLink: true, - title: 'Service Queues', -}; +}; \ No newline at end of file diff --git a/packages/esm-ohri-core-app/src/index.ts b/packages/esm-ohri-core-app/src/index.ts index 3a22766ec..01062df9e 100644 --- a/packages/esm-ohri-core-app/src/index.ts +++ b/packages/esm-ohri-core-app/src/index.ts @@ -2,16 +2,10 @@ import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle, provide } from import { createOHRIPatientChartSideNavLink, patientChartDivider_dashboardMeta, - createOHRIDashboardLink, PatientList, PatientTable, } from '@ohri/openmrs-esm-ohri-commons-lib'; -import { - appointmentsDashboardMeta, - homeDashboardMeta, - dispensingDashboardMeta, - serviceQueuesDashboardMeta, -} from './dashboard.meta'; +import ProgramsHome from './ohri-dashboard/programs-home.component'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -26,42 +20,6 @@ export function startupApp() { defineConfigSchema(moduleName, {}); } -export const dashboard = getAsyncLifecycle(() => import('./root'), options); - -export const homeDashboard = getSyncLifecycle(createOHRIDashboardLink(homeDashboardMeta), options); - -export const patientList = getSyncLifecycle(PatientList, { - featureName: 'home', - moduleName, -}); - -export const appointmentsLink = getSyncLifecycle(createOHRIDashboardLink(appointmentsDashboardMeta), options); -export const appointmentsDashboard = getAsyncLifecycle( - () => import('./ohri-dashboard/appointments/appointments-dashboard.component'), - { - featureName: 'appointments-dashboard', - moduleName, - }, -); - -export const dispensingLink = getSyncLifecycle(createOHRIDashboardLink(dispensingDashboardMeta), options); -export const dispensingDashboard = getAsyncLifecycle( - () => import('./ohri-dashboard/dispensing/dispensing-dashboard.component'), - { - featureName: 'dispensing-dashboard', - moduleName, - }, -); - -export const serviceQueuesLink = getSyncLifecycle(createOHRIDashboardLink(serviceQueuesDashboardMeta), options); -export const serviceQueuesDashboard = getAsyncLifecycle( - () => import('./ohri-dashboard/service-queues/service-queues-dashboard.component'), - { - featureName: 'service-queues-dashboard', - moduleName, - }, -); - export const ohriNavItems = getAsyncLifecycle( () => import('./ohri-dashboard/side-menu/ohri-dashboard-side-nav.component'), { @@ -76,3 +34,10 @@ export const ohriClinicalViewsDivider = getSyncLifecycle( ); export const patientTable = getSyncLifecycle(PatientTable, options); + +export const patientList = getSyncLifecycle(PatientList, { + featureName: 'home', + moduleName, +}); + +export const programsText = getSyncLifecycle(ProgramsHome ,options); diff --git a/packages/esm-ohri-core-app/src/ohri-dashboard/appointments/appointments-dashboard.component.tsx b/packages/esm-ohri-core-app/src/ohri-dashboard/appointments/appointments-dashboard.component.tsx deleted file mode 100644 index 7b4197a9e..000000000 --- a/packages/esm-ohri-core-app/src/ohri-dashboard/appointments/appointments-dashboard.component.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import React, { useEffect } from 'react'; -import { attach, detach, ExtensionSlot } from '@openmrs/esm-framework'; - -const AppointmentsDashboard = () => { - return ; -}; - -export default AppointmentsDashboard; diff --git a/packages/esm-ohri-core-app/src/ohri-dashboard/dispensing/dispensing-dashboard.component.tsx b/packages/esm-ohri-core-app/src/ohri-dashboard/dispensing/dispensing-dashboard.component.tsx deleted file mode 100644 index 32f2bae7e..000000000 --- a/packages/esm-ohri-core-app/src/ohri-dashboard/dispensing/dispensing-dashboard.component.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React, { useEffect } from 'react'; -import { attach, detach, ExtensionSlot } from '@openmrs/esm-framework'; - -const DispensingDashboard = () => { - useEffect(() => { - attach('ohri-dashboard-dispensing-slot', 'dispensing-dashboard'); - return () => detach('ohri-dashboard-dispensing-slot', 'dispensing-dashboard'); - }, []); - - return ; -}; - -export default DispensingDashboard; diff --git a/packages/esm-ohri-core-app/src/ohri-dashboard/programs-home.component.tsx b/packages/esm-ohri-core-app/src/ohri-dashboard/programs-home.component.tsx new file mode 100644 index 000000000..a37833d2d --- /dev/null +++ b/packages/esm-ohri-core-app/src/ohri-dashboard/programs-home.component.tsx @@ -0,0 +1,7 @@ +import React from 'react'; + +const ProgramsHome = () => { + return
Programmes
; +}; + +export default ProgramsHome; diff --git a/packages/esm-ohri-core-app/src/ohri-dashboard/service-queues/service-queues-dashboard.component.tsx b/packages/esm-ohri-core-app/src/ohri-dashboard/service-queues/service-queues-dashboard.component.tsx deleted file mode 100644 index 9ab87c647..000000000 --- a/packages/esm-ohri-core-app/src/ohri-dashboard/service-queues/service-queues-dashboard.component.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React, { useEffect } from 'react'; -import { attach, detach, ExtensionSlot } from '@openmrs/esm-framework'; - -const ServiceQueuesDashboard = () => { - useEffect(() => { - attach('ohri-dashboard-service-queues-slot', 'service-queues-dashboard'); - return () => detach('ohri-dashboard-service-queues-slot', 'service-queues-dashboard'); - }, []); - - return ; -}; - -export default ServiceQueuesDashboard; diff --git a/packages/esm-ohri-core-app/src/root.tsx b/packages/esm-ohri-core-app/src/root.tsx deleted file mode 100644 index 6c7d6ac3b..000000000 --- a/packages/esm-ohri-core-app/src/root.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; -import OHRIDashboard from './ohri-dashboard/ohri-dashboard.component'; - -export default function Root() { - return ( - - - } /> - } /> - } /> - - - ); -} diff --git a/packages/esm-ohri-core-app/src/routes.json b/packages/esm-ohri-core-app/src/routes.json index 30d19b17b..0831c732f 100644 --- a/packages/esm-ohri-core-app/src/routes.json +++ b/packages/esm-ohri-core-app/src/routes.json @@ -3,69 +3,8 @@ "backendDependencies": { "webservices.rest": "^2.24.0" }, - "pages": [ - { - "component": "dashboard", - "route": "dashboard" - }, - { - "component": "dashboard", - "route": "home" - } - ], + "pages": [], "extensions": [ - { - "name": "home-dashboard-ext", - "slot": "dashboard-links-slot", - "component": "homeDashboard", - "meta": { - "title": "Home", - "name": "home", - "slot": "ohri-home-dashboard-slot", - "isLink": true - } - }, - { - "name": "ohri-patient-list", - "slot": "ohri-home-dashboard-slot", - "component": "patientList" - }, - { - "name": "appointments-ohri-dashboard-ext", - "slot": "dashboard-links-slot", - "component": "appointmentsLink" - }, - { - "name": "ohri-appointments-dashboard", - "slot": "ohri-appointments-dashboard-slot", - "component": "appointmentsDashboard" - }, - { - "name": "dispensing-ohri-dashboard-ext", - "slot": "dashboard-links-slot", - "component": "dispensingLink", - "meta": { - "title": "Dispensing", - "name": "dispensing", - "slot": "ohri-dispensing-dashboard-slot", - "isLink": true - } - }, - { - "name": "ohri-dispensing-dashboard", - "slot": "ohri-dispensing-dashboard-slot", - "component": "dispensingDashboard" - }, - { - "name": "service-queues-ohri-dashboard-ext", - "slot": "dashboard-links-slot", - "component": "serviceQueuesLink" - }, - { - "name": "ohri-service-queues-dashboard", - "slot": "ohri-service-queues-dashboard-slot", - "component": "serviceQueuesDashboard" - }, { "name": "ohri-nav-items-ext", "slot": "ohri-nav-items-slot", @@ -80,6 +19,17 @@ { "name": "patient-table", "component": "patientTable" + }, + { + "name": "ohri-patient-list", + "slot": "ohri-home-dashboard-slot", + "component": "patientList" + }, + { + "component": "programsText", + "name": "ohri-home-programs-text", + "slot": "homepage-dashboard-slot" , + "order": 4 } ] } diff --git a/packages/esm-ohri-pmtct-app/src/dashboard.meta.tsx b/packages/esm-ohri-pmtct-app/src/dashboard.meta.tsx index 9b24fad76..26d50d42d 100644 --- a/packages/esm-ohri-pmtct-app/src/dashboard.meta.tsx +++ b/packages/esm-ohri-pmtct-app/src/dashboard.meta.tsx @@ -38,13 +38,6 @@ export const childVisitsDashboardMeta = { export const motherChildDashboardMeta = { name: 'mother-child-health', slot: 'mother-child-health-dashboard-slot', - config: { - columns: 1, - type: 'grid', - programme: 'pmtct', - dashboardTitle: 'Mother Child Health Home Page', - icon: PedestrianChild, - }, - isLink: true, title: 'Maternal & Child Health', + icon: PedestrianChild }; diff --git a/packages/esm-ohri-pmtct-app/src/home.component.tsx b/packages/esm-ohri-pmtct-app/src/home.component.tsx new file mode 100644 index 000000000..7eb3a0666 --- /dev/null +++ b/packages/esm-ohri-pmtct-app/src/home.component.tsx @@ -0,0 +1,16 @@ +import React from 'react'; +import { OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; +import MaternalChildSummaryTiles from './views/summary-tabs/maternal-child-summary-tiles.component'; +import LabResultsSummary from './views/summary-tabs/mother-child-summary-tabs.component'; + +const Home: React.FC = () => { + return ( +
+ + + +
+ ); +}; + +export default Home; diff --git a/packages/esm-ohri-pmtct-app/src/index.ts b/packages/esm-ohri-pmtct-app/src/index.ts index aac321fa9..a31deba7d 100644 --- a/packages/esm-ohri-pmtct-app/src/index.ts +++ b/packages/esm-ohri-pmtct-app/src/index.ts @@ -11,17 +11,18 @@ import { motherChildDashboardMeta, mchFolderMeta, } from './dashboard.meta'; -import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib'; import { registerPostSubmissionAction, registerExpressionHelper } from '@openmrs/openmrs-form-engine-lib'; import { createConditionalDashboardLink, - createOHRIDashboardLink, + createNewOHRIDashboardLink, OHRIHome, OHRIWelcomeSection, createConditionalDashboardGroup, + createDashboardLink, } from '@ohri/openmrs-esm-ohri-commons-lib'; import { generateInfantPTrackerId } from './utils/pmtct-helpers'; import { configSchema } from './config-schema'; +import rootComponent from './root.component'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -55,6 +56,13 @@ export function startupApp() { }); } +export const root = getSyncLifecycle(rootComponent, options); + +export const maternalChildDashboardLink = getSyncLifecycle( + createNewOHRIDashboardLink(motherChildDashboardMeta), + options, +); + export const mchDashboard = getSyncLifecycle(createConditionalDashboardGroup(mchFolderMeta), options); export const mchSummaryDashboardLink = getSyncLifecycle( createDashboardLink({ ...mchSummaryDashboardMeta, moduleName }), @@ -85,7 +93,6 @@ export const childVisitsDashboard = getSyncLifecycle(ChildHealthList, { featureName: 'maternal-visits', moduleName, }); -export const maternalChildDashboardLink = getSyncLifecycle(createOHRIDashboardLink(motherChildDashboardMeta), options); export const maternalChildDashboard = getSyncLifecycle(OHRIHome, { featureName: 'mother child health results dashboard', moduleName, diff --git a/packages/esm-ohri-pmtct-app/src/root.component.tsx b/packages/esm-ohri-pmtct-app/src/root.component.tsx new file mode 100644 index 000000000..5136ae080 --- /dev/null +++ b/packages/esm-ohri-pmtct-app/src/root.component.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { SWRConfig } from 'swr'; +import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import Home from './home.component'; + +const swrConfiguration = { + // Maximum number of retries when the backend returns an error + errorRetryCount: 3, +}; + +const RootComponent: React.FC = () => { + const mchBasename = window.getOpenmrsSpaBase() + 'home/mother-child-health'; + + return ( +
+ + + + } /> + + + +
+ ); +}; + +export default RootComponent; diff --git a/packages/esm-ohri-pmtct-app/src/routes.json b/packages/esm-ohri-pmtct-app/src/routes.json index 6597cc222..a5021cac3 100644 --- a/packages/esm-ohri-pmtct-app/src/routes.json +++ b/packages/esm-ohri-pmtct-app/src/routes.json @@ -3,9 +3,24 @@ "backendDependencies": { "webservices.rest": "^2.24.0" }, - "pages": [ - ], + "pages": [], "extensions": [ + { + "name": "maternal-child-health-results-summary", + "slot": "homepage-dashboard-slot", + "component": "maternalChildDashboardLink", + "meta": { + "title": "Maternal & Child Health", + "name": "mother-child-health", + "slot": "mother-child-health-dashboard-slot" + }, + "order": 6 + }, + { + "name": "mother-child-health-dashboard", + "slot": "mother-child-health-dashboard-slot", + "component": "root" + }, { "name": "mch", "slot": "patient-chart-dashboard-slot", @@ -62,53 +77,6 @@ "name": "child-visits-summary-ext", "slot": "child-visits-summary-slot", "component": "childVisitsDashboard" - }, - { - "name": "maternal-child-health-results-summary", - "slot": "dashboard-slot", - "component": "maternalChildDashboardLink", - "meta": { - "title": "Maternal & Child Health", - "path": "Maternal & Child Health", - "slot": "mother-child-health-dashboard-slot", - "config": { - "columns": 1, - "type": "grid", - "programme": "pmtct", - "dashboardTitle": "Mother and Child Health" - }, - "isLink": true - } - }, - { - "name": "mother-child-health-results-dashboard", - "slot": "mother-child-health-dashboard-slot", - "component": "maternalChildDashboard", - "meta": { - "name": "mother-child-health", - "slot": "mother-child-health-dashboard-slot", - "config": { - "columns": 1, - "programme": "pmtct", - "dashboardTitle": "Mother Child Health Home Page" - }, - "title": "Maternal & Child Health" - } - }, - { - "name": "pmtct-home-header-slot", - "slot": "pmtct-home-header-slot", - "component": "pmtctDashboardHeader" - }, - { - "name": "pmtct-home-tiles-ext", - "slot": "pmtct-home-tiles-slot", - "component": "pmtctDashboardTiles" - }, - { - "name": "pmtct-home-tabs-ext", - "slot": "pmtct-home-tabs-slot", - "component": "pmtctDashboardTabs" } ] } diff --git a/packages/esm-ohri-pmtct-app/src/views/summary-tabs/maternal-child-summary-tiles.component.tsx b/packages/esm-ohri-pmtct-app/src/views/summary-tabs/maternal-child-summary-tiles.component.tsx index f5e0999db..c6531dbcc 100644 --- a/packages/esm-ohri-pmtct-app/src/views/summary-tabs/maternal-child-summary-tiles.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/summary-tabs/maternal-child-summary-tiles.component.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { OHRIProgrammeSummaryTiles, fetchMambaReportData } from '@ohri/openmrs-esm-ohri-commons-lib'; -function MaternalChildSummaryTiles({ launchWorkSpace }) { +function MaternalChildSummaryTiles() { const { t } = useTranslation(); const [activeClientsCount, setActiveClientsCount] = useState(null); const [totalPregnantWomen, setTotalPregnantWomen] = useState(null); diff --git a/packages/esm-ohri-pmtct-app/src/views/summary-tabs/mother-child-summary-tabs.component.tsx b/packages/esm-ohri-pmtct-app/src/views/summary-tabs/mother-child-summary-tabs.component.tsx index f7ff74841..489361ed9 100644 --- a/packages/esm-ohri-pmtct-app/src/views/summary-tabs/mother-child-summary-tabs.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/summary-tabs/mother-child-summary-tabs.component.tsx @@ -4,11 +4,7 @@ import styles from '../summary-tabs/ohri-patient-tabs.scss'; import { useTranslation } from 'react-i18next'; import { PatientList } from '@ohri/openmrs-esm-ohri-commons-lib'; -interface OverviewListProps { - patientUuid: string; -} - -const LabResultsSummary: React.FC = ({ patientUuid }) => { +const LabResultsSummary: React.FC = () => { const { t } = useTranslation(); return ( diff --git a/packages/esm-tb-app/src/dashboard.meta.tsx b/packages/esm-tb-app/src/dashboard.meta.tsx index e9e5fe372..e387cbc50 100644 --- a/packages/esm-tb-app/src/dashboard.meta.tsx +++ b/packages/esm-tb-app/src/dashboard.meta.tsx @@ -44,18 +44,30 @@ export const tbClinicalViewDashboardMeta = { isFolder: true, title: 'Tuberculosis', }; + export const tbPreventionDashboardMeta = { name: 'tb-prevention', slot: 'tb-prevention-dashboard-slot', - config: { columns: 1, type: 'grid', programme: 'tpt', dashboardTitle: 'TB Prevention'}, title: 'TB Prevention', + isFolder: true, + folderTitle: 'Tuberculosis', + folderIcon: PillsAdd, + isHidden: true, }; export const tbCasesDashboardMeta = { name: 'tb-cases', slot: 'tb-cases-dashboard-slot', - config: { columns: 1, type: 'grid', programme: 'tb', dashboardTitle: 'TB Treatment' }, title: 'TB Treatment', + isFolder: true, + childLinks: [ + { + name: 'tb-prevention', + title: 'TB Prevention', + }, + ], + folderTitle: 'Tuberculosis', + folderIcon: PillsAdd, }; export const tptPatientChartMeta = { diff --git a/packages/esm-tb-app/src/home.component.tsx b/packages/esm-tb-app/src/home.component.tsx new file mode 100644 index 000000000..b91b37c7d --- /dev/null +++ b/packages/esm-tb-app/src/home.component.tsx @@ -0,0 +1,16 @@ +import { OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; +import React from 'react'; +import TbHomePatientTabs from './views/dashboard/patient-list-tabs/tb-patient-list-tabs.component'; +import TbSummaryTiles from './views/dashboard/summary-tiles/tb-summary-tiles.component'; + +const Homecomponent = () => { + return ( +
+ + + +
+ ); +}; + +export default Homecomponent; diff --git a/packages/esm-tb-app/src/index.ts b/packages/esm-tb-app/src/index.ts index 0845760dd..b187b5b60 100644 --- a/packages/esm-tb-app/src/index.ts +++ b/packages/esm-tb-app/src/index.ts @@ -1,5 +1,10 @@ -import { defineConfigSchema, getSyncLifecycle } from '@openmrs/esm-framework'; -import { createOHRIDashboardLink, OHRIHome, OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework'; +import { + createOHRIDashboardLink, + OHRIHome, + OHRIWelcomeSection, + createOHRIGroupedLink, +} from '@ohri/openmrs-esm-ohri-commons-lib'; import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib'; import { tbPatientChartMeta, @@ -25,6 +30,8 @@ import tptProgramManagementSummary from './views/tpt/program-management/tpt-prog import tptPatientSummary from './views/tpt/patient-summary/patient-summary.component'; import TptPreventionSummaryTiles from './views/dashboard/summary-tiles/tpt-summary-tiles.component'; import TptPatientListTabs from './views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component'; +import rootComponent from './root.component'; +import TptHomeComponent from './tpt-home.component'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -129,13 +136,8 @@ export const tbClinicalViewDashboardLink = getSyncLifecycle( createOHRIDashboardLink(tbClinicalViewDashboardMeta), options, ); -export const tbCasesDashboardLink = getSyncLifecycle(createOHRIDashboardLink(tbCasesDashboardMeta), options); -export const tbCasesDashboard = getSyncLifecycle(OHRIHome, { - featureName: 'tb cases dashboard', - moduleName, -}); -export const tbPreventionDashboardLink = getSyncLifecycle(createOHRIDashboardLink(tbPreventionDashboardMeta), options); -export const tbPreventionDashboard = getSyncLifecycle(OHRIHome, { - featureName: 'tpt cases dashboard', - moduleName, -}); +export const tbCasesDashboardLink = getSyncLifecycle(createOHRIGroupedLink(tbCasesDashboardMeta), options); +export const tbCasesDashboard = getSyncLifecycle(rootComponent, options); + +export const tbPreventionDashboardLink = getSyncLifecycle(createOHRIGroupedLink(tbPreventionDashboardMeta), options); +export const tbPreventionDashboard = getSyncLifecycle(TptHomeComponent, options); diff --git a/packages/esm-tb-app/src/root.component.tsx b/packages/esm-tb-app/src/root.component.tsx new file mode 100644 index 000000000..58c623831 --- /dev/null +++ b/packages/esm-tb-app/src/root.component.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { SWRConfig } from 'swr'; +import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import Home from './home.component'; + +const swrConfiguration = { + // Maximum number of retries when the backend returns an error + errorRetryCount: 3, +}; + +const Root: React.FC = () => { + const tbBasename = window.getOpenmrsSpaBase() + 'home/tb-cases'; + + return ( +
+ + + + } /> + + + +
+ ); +}; + +export default Root; diff --git a/packages/esm-tb-app/src/routes.json b/packages/esm-tb-app/src/routes.json index 53154a6a4..741077094 100644 --- a/packages/esm-tb-app/src/routes.json +++ b/packages/esm-tb-app/src/routes.json @@ -73,8 +73,6 @@ "slot": "tb-program-management-summary-slot", "component": "tbProgramManagementDashboard" }, - - { "name": "tpt-patient-summary", "slot": "ohri-tpt-slot", @@ -152,68 +150,7 @@ "title": "Tuberculosis" } }, - { - "name": "tb-prevention-dashboard-ext", - "slot": "tb-clinical-dashboard-slot", - "component": "tbPreventionDashboardLink", - "meta": { - "name": "tb-prevention", - "slot": "tb-prevention-dashboard-slot", - "config": { - "columns": 1, - "type": "grid", - "programme": "tpt", - "dashboardTitle": "TB Prevention" - }, - "title": "TB Prevention" - } - }, - { - "name": "tb-prevention-dashboard", - "slot": "tb-prevention-dashboard-slot", - "component": "tbPreventionDashboard", - "meta": { - "name": "tb-prevention", - "slot": "tb-prevention-dashboard-slot", - "config": { - "columns": 1, - "programme": "tpt", - "dashboardTitle": "TB Prevention" - }, - "title": "TB Prevention" - } - }, - { - "name": "tb-cases-dashboard-ext", - "slot": "tb-clinical-dashboard-slot", - "component": "tbCasesDashboardLink", - "meta": { - "name": "tb-cases", - "slot": "tb-cases-dashboard-slot", - "config": { - "columns": 1, - "type": "grid", - "programme": "tb", - "dashboardTitle": "TB Treatment" - }, - "title": "TB Treatment" - } - }, - { - "name": "tb-cases-dashboard", - "slot": "tb-cases-dashboard-slot", - "component": "tbCasesDashboard", - "meta": { - "name": "tb-cases", - "slot": "tb-cases-dashboard-slot", - "config": { - "columns": 1, - "programme": "tb", - "dashboardTitle": "TB Treatment" - }, - "title": "TB Treatment" - } - }, + { "name": "tb-home-header-ext", "slot": "tb-home-header-slot", @@ -243,6 +180,36 @@ "name": "tpt-home-tabs-ext", "slot": "tpt-home-tabs-slot", "component": "tptDashboardTabs" + }, + { + "name": "tb-cases-dashboard-ext", + "slot": "homepage-dashboard-slot", + "component": "tbCasesDashboardLink", + "meta": { + "name": "tb-cases", + "slot": "tb-cases-dashboard-slot", + "title": "TB Treatment" + } + }, + { + "name": "tb-cases-dashboard", + "slot": "tb-cases-dashboard-slot", + "component": "tbCasesDashboard" + }, + { + "name": "tb-prevention-dashboard-ext", + "slot": "homepage-dashboard-slot", + "component": "tbPreventionDashboardLink", + "meta": { + "name": "tb-prevention", + "slot": "tb-prevention-dashboard-slot", + "title": "TB Prevention" + } + }, + { + "name": "tb-prevention-dashboard", + "slot": "tb-prevention-dashboard-slot", + "component": "tbPreventionDashboard" } ] -} +} \ No newline at end of file diff --git a/packages/esm-tb-app/src/tpt-home.component.tsx b/packages/esm-tb-app/src/tpt-home.component.tsx new file mode 100644 index 000000000..83e6a5a4a --- /dev/null +++ b/packages/esm-tb-app/src/tpt-home.component.tsx @@ -0,0 +1,16 @@ +import { OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; +import React from 'react'; +import TbSummaryTiles from './views/dashboard/summary-tiles/tb-summary-tiles.component'; +import TptPatientListTabs from './views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component'; + +const TptHomeComponent = () => { + return ( +
+ + + +
+ ); +}; + +export default TptHomeComponent; diff --git a/packages/esm-tb-app/src/tpt-root.component.tsx b/packages/esm-tb-app/src/tpt-root.component.tsx new file mode 100644 index 000000000..98379012d --- /dev/null +++ b/packages/esm-tb-app/src/tpt-root.component.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { SWRConfig } from 'swr'; +import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import TptHome from './tpt-home.component'; + +const swrConfiguration = { + // Maximum number of retries when the backend returns an error + errorRetryCount: 3, +}; + +const TptRoot: React.FC = () => { + const tbBasename = window.getOpenmrsSpaBase() + 'home/tpt-cases'; + + return ( +
+ + + + } /> + + + +
+ ); +}; + +export default TptRoot; diff --git a/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx index e86b6c99d..b0baaf611 100644 --- a/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx +++ b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx @@ -2,7 +2,7 @@ import { OHRIProgrammeSummaryTiles, fetchMambaReportData } from '@ohri/openmrs-e import React, { useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; -function TbSummaryTiles({ launchWorkSpace }) { +function TbSummaryTiles() { const { t } = useTranslation(); const [activeDSClientsCount, setActiveDSClientsCount] = useState(null); const [activeDRClientsCount, setActiveDRClientsCount] = useState(null); diff --git a/packages/esm-tb-app/src/views/dashboard/summary-tiles/tpt-summary-tiles.component.tsx b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tpt-summary-tiles.component.tsx index 06e839afb..2f2c367bb 100644 --- a/packages/esm-tb-app/src/views/dashboard/summary-tiles/tpt-summary-tiles.component.tsx +++ b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tpt-summary-tiles.component.tsx @@ -2,7 +2,7 @@ import { OHRIProgrammeSummaryTiles } from '@ohri/openmrs-esm-ohri-commons-lib'; import React, { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; -function TptPreventionSummaryTiles({}) { +function TptPreventionSummaryTiles() { const { t } = useTranslation(); const [activeTptClientsCount] = useState(78); const tiles = useMemo( From f9b8651617b8b6d03b2a1abb618fe87517afabbd Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Wed, 27 Mar 2024 12:02:49 +0300 Subject: [PATCH 36/50] (fix) Update new homepage path on playwright (#1825) --- e2e/specs/registration-test.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/specs/registration-test.spec.ts b/e2e/specs/registration-test.spec.ts index 4b3f0c5e8..4834fb5da 100644 --- a/e2e/specs/registration-test.spec.ts +++ b/e2e/specs/registration-test.spec.ts @@ -20,7 +20,7 @@ test('Go to homepage and register patient', async ({ page }) => { }); await test.step('Then should be at the home page', async () => { - await expect(page).toHaveURL(`${process.env.E2E_BASE_URL}/spa/dashboard/home`); + await expect(page).toHaveURL(`${process.env.E2E_BASE_URL}/spa/home`); }); await page.getByLabel('Add Patient').click(); From 28ee70397c10eb761198ec777cf06d706239603d Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Wed, 27 Mar 2024 13:49:02 +0300 Subject: [PATCH 37/50] OHRI-2078 Add unit tests for encounter list in commons lib (#1824) * OHRI-2078 Add unit tests for encounter list in commons lib * fixed linting issues * code review --- __mocks__/encounter-list.mock.tsx | 1252 +++++++++++++++++ .../data-table/o-table.component.tsx | 1 - .../encounter-list.component.tsx | 21 +- .../encounter-list/encounter-list.test.tsx | 107 ++ .../encounter-tile.component.tsx | 2 +- .../src/hooks/useEncounterRows.ts | 5 +- .../esm-commons-lib/src/hooks/useFormsJson.ts | 2 +- .../src/hooks/useLastEncounter.tsx | 2 +- .../src/hooks/usePatientDeathStatus.ts | 18 +- packages/esm-covid-app/src/dashboard.meta.tsx | 4 +- packages/esm-covid-app/src/root.component.tsx | 2 +- .../render/forms-render-test.component.tsx | 2 +- packages/esm-hiv-app/src/dashboard.meta.tsx | 4 +- .../tabs/cd4-results.component.tsx | 5 +- .../tabs/viral-load-results.component.tsx | 15 +- .../esm-ohri-core-app/src/dashboard.meta.tsx | 2 +- .../programs-home.component.tsx | 2 +- .../esm-ohri-pmtct-app/src/dashboard.meta.tsx | 2 +- .../tb-summary-tiles.component.tsx | 2 +- 19 files changed, 1398 insertions(+), 52 deletions(-) create mode 100644 __mocks__/encounter-list.mock.tsx create mode 100644 packages/esm-commons-lib/src/components/encounter-list/encounter-list.test.tsx diff --git a/__mocks__/encounter-list.mock.tsx b/__mocks__/encounter-list.mock.tsx new file mode 100644 index 000000000..b7d9a2215 --- /dev/null +++ b/__mocks__/encounter-list.mock.tsx @@ -0,0 +1,1252 @@ +import { getEncounterValues } from '@ohri/openmrs-esm-ohri-commons-lib'; + +export const mockEncounterType = '15272be5-ae9c-4278-a303-4b8907eae73b'; + +export const mockPatientUuid = '1b2278d5-c9ea-4f00-bfb1-60af48dc838a'; + +export const mockColumns = [ + { + key: 'deathDate', + header: 'Death Date', + getValue: () => '2024-01-01', + link: { + handleNavigate: (encounter) => { + encounter.launchFormActions?.viewEncounter(); + }, + }, + }, + { + key: 'deathCause', + header: 'Cause of Death', + getValue: () => '2024-01-01', + link: { + handleNavigate: (encounter) => { + encounter.launchFormActions?.viewEncounter(); + }, + }, + }, + { + key: 'specificDeathCause', + header: 'Specific cause of Death', + getValue: () => '2024-01-01', + link: { + handleNavigate: (encounter) => { + encounter.launchFormActions?.viewEncounter(); + }, + }, + }, + { + key: 'actions', + header: 'Actions', + getValue: () => '2024-01-01', + link: { + handleNavigate: (encounter) => { + encounter.launchFormActions?.viewEncounter(); + }, + }, + }, +]; + +export const mockForms = [ + { + name: 'Death Form', + uuid: 'some-uuid', + }, +]; + +export const mockEncounter = [ + { + uuid: 'ee106966-4cd9-4465-8ac2-dfac9e3751d3', + encounterDatetime: '2024-01-05T07:01:53.000+0000', + encounterType: { + uuid: '70d2b2f6-860b-438c-994b-c28e863dca34', + display: 'TB Contact Listing', + name: 'TB Contact Listing', + description: 'Use to list contact of a TB patient for testing', + retired: false, + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/encountertype/70d2b2f6-860b-438c-994b-c28e863dca34', + resourceAlias: 'encountertype', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/encountertype/70d2b2f6-860b-438c-994b-c28e863dca34?v=full', + resourceAlias: 'encountertype', + }, + ], + resourceVersion: '1.8', + }, + location: { + uuid: '44c3efb0-2583-4c80-a79e-1f756a03c0a1', + name: 'Outpatient Clinic', + }, + patient: { + uuid: '1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + display: '100002U - Clark Bob Robert', + }, + encounterProviders: [ + { + uuid: 'bc4ef577-ee0a-4288-85a7-77c753b3421e', + provider: { + uuid: 'bc450226-4138-40b7-ad88-9c98df687738', + name: 'Super User', + }, + }, + ], + obs: [ + { + uuid: '711b26c8-a91a-48e3-919c-c4888919d76d', + obsDatetime: '2024-01-05T07:01:53.000+0000', + voided: false, + groupMembers: null, + concept: { + uuid: '160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + name: { + uuid: 'f415bf25-2008-3ac2-8f0e-46e75648e30d', + name: 'Date of event', + }, + }, + value: '2024-01-05T00:00:00.000+0000', + }, + { + uuid: '37094756-1d74-420c-a63c-fe8418ea3b7d', + obsDatetime: '2024-02-13T13:04:39.000+0000', + voided: false, + groupMembers: [ + { + uuid: '71abc700-a69a-40c2-8a0b-90e76abe3da2', + display: 'Address (text): test', + concept: { + uuid: '162725AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Address (text)', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/162725AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + person: { + uuid: '1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + display: '100002U - Clark Bob Robert', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/patient/1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + resourceAlias: 'patient', + }, + ], + }, + obsDatetime: '2024-01-05T07:01:53.000+0000', + accessionNumber: null, + obsGroup: { + uuid: '37094756-1d74-420c-a63c-fe8418ea3b7d', + display: 'Contact details: test, 0789000000, Yes, Family member, Test', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/37094756-1d74-420c-a63c-fe8418ea3b7d', + resourceAlias: 'obs', + }, + ], + }, + valueCodedName: null, + groupMembers: null, + comment: null, + location: { + uuid: '44c3efb0-2583-4c80-a79e-1f756a03c0a1', + display: 'Outpatient Clinic', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/location/44c3efb0-2583-4c80-a79e-1f756a03c0a1', + resourceAlias: 'location', + }, + ], + }, + order: null, + encounter: { + uuid: 'ee106966-4cd9-4465-8ac2-dfac9e3751d3', + display: 'TB Contact Listing 05/01/2024', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/encounter/ee106966-4cd9-4465-8ac2-dfac9e3751d3', + resourceAlias: 'encounter', + }, + ], + }, + voided: false, + value: 'test', + valueModifier: null, + formFieldPath: 'ohri-forms-contactAddress', + formFieldNamespace: 'ohri-forms', + status: 'FINAL', + interpretation: null, + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/71abc700-a69a-40c2-8a0b-90e76abe3da2', + resourceAlias: 'obs', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/71abc700-a69a-40c2-8a0b-90e76abe3da2?v=full', + resourceAlias: 'obs', + }, + ], + resourceVersion: '2.1', + }, + { + uuid: '35293a4d-039e-4d49-b192-c0864beac1df', + display: 'Contact phone number: 0789000000', + concept: { + uuid: '159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Contact phone number', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + person: { + uuid: '1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + display: '100002U - Clark Bob Robert', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/patient/1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + resourceAlias: 'patient', + }, + ], + }, + obsDatetime: '2024-01-05T07:01:53.000+0000', + accessionNumber: null, + obsGroup: { + uuid: '37094756-1d74-420c-a63c-fe8418ea3b7d', + display: 'Contact details: test, 0789000000, Yes, Family member, Test', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/37094756-1d74-420c-a63c-fe8418ea3b7d', + resourceAlias: 'obs', + }, + ], + }, + valueCodedName: null, + groupMembers: null, + comment: null, + location: { + uuid: '44c3efb0-2583-4c80-a79e-1f756a03c0a1', + display: 'Outpatient Clinic', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/location/44c3efb0-2583-4c80-a79e-1f756a03c0a1', + resourceAlias: 'location', + }, + ], + }, + order: null, + encounter: { + uuid: 'ee106966-4cd9-4465-8ac2-dfac9e3751d3', + display: 'TB Contact Listing 05/01/2024', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/encounter/ee106966-4cd9-4465-8ac2-dfac9e3751d3', + resourceAlias: 'encounter', + }, + ], + }, + voided: false, + value: '0789000000', + valueModifier: null, + formFieldPath: 'ohri-forms-contactPhoneNumber', + formFieldNamespace: 'ohri-forms', + status: 'FINAL', + interpretation: null, + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/35293a4d-039e-4d49-b192-c0864beac1df', + resourceAlias: 'obs', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/35293a4d-039e-4d49-b192-c0864beac1df?v=full', + resourceAlias: 'obs', + }, + ], + resourceVersion: '2.1', + }, + { + uuid: 'a5cef1b1-9f44-4fa5-9cc8-07ba2e8a3fc4', + display: 'Contacts invited: Yes', + concept: { + uuid: '164072AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Contacts invited', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/164072AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + person: { + uuid: '1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + display: '100002U - Clark Bob Robert', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/patient/1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + resourceAlias: 'patient', + }, + ], + }, + obsDatetime: '2024-01-05T07:01:53.000+0000', + accessionNumber: null, + obsGroup: { + uuid: '37094756-1d74-420c-a63c-fe8418ea3b7d', + display: 'Contact details: test, 0789000000, Yes, Family member, Test', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/37094756-1d74-420c-a63c-fe8418ea3b7d', + resourceAlias: 'obs', + }, + ], + }, + valueCodedName: null, + groupMembers: null, + comment: null, + location: { + uuid: '44c3efb0-2583-4c80-a79e-1f756a03c0a1', + display: 'Outpatient Clinic', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/location/44c3efb0-2583-4c80-a79e-1f756a03c0a1', + resourceAlias: 'location', + }, + ], + }, + order: null, + encounter: { + uuid: 'ee106966-4cd9-4465-8ac2-dfac9e3751d3', + display: 'TB Contact Listing 05/01/2024', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/encounter/ee106966-4cd9-4465-8ac2-dfac9e3751d3', + resourceAlias: 'encounter', + }, + ], + }, + voided: false, + value: { + uuid: '1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Yes', + name: { + display: 'Yes', + uuid: 'd8c3337b-a1cb-3519-af40-7a016eedb72f', + name: 'Yes', + locale: 'en', + localePreferred: true, + conceptNameType: 'FULLY_SPECIFIED', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/d8c3337b-a1cb-3519-af40-7a016eedb72f', + resourceAlias: 'name', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/d8c3337b-a1cb-3519-af40-7a016eedb72f?v=full', + resourceAlias: 'name', + }, + ], + resourceVersion: '1.9', + }, + datatype: { + uuid: '8d4a4c94-c2cc-11de-8d13-0010c6dffd0f', + display: 'N/A', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/conceptdatatype/8d4a4c94-c2cc-11de-8d13-0010c6dffd0f', + resourceAlias: 'conceptdatatype', + }, + ], + }, + conceptClass: { + uuid: '8d492774-c2cc-11de-8d13-0010c6dffd0f', + display: 'Misc', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/conceptclass/8d492774-c2cc-11de-8d13-0010c6dffd0f', + resourceAlias: 'conceptclass', + }, + ], + }, + set: false, + version: null, + retired: false, + names: [ + { + uuid: 'd8c3337b-a1cb-3519-af40-7a016eedb72f', + display: 'Yes', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/d8c3337b-a1cb-3519-af40-7a016eedb72f', + resourceAlias: 'name', + }, + ], + }, + ], + descriptions: [ + { + uuid: '24f4ab95-c95b-42cc-8839-7014b00987ce', + display: 'Generic answer to a question.', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/24f4ab95-c95b-42cc-8839-7014b00987ce', + resourceAlias: 'description', + }, + ], + }, + ], + mappings: [ + { + uuid: '564715f3-ea35-4e17-b3a7-c6212db334c1', + display: 'PIH: 1065', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/564715f3-ea35-4e17-b3a7-c6212db334c1', + resourceAlias: 'mapping', + }, + ], + }, + { + uuid: 'd7e61750-ff8a-4a57-aa99-a78f0d803ce6', + display: 'CIEL: 1065', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/d7e61750-ff8a-4a57-aa99-a78f0d803ce6', + resourceAlias: 'mapping', + }, + ], + }, + { + uuid: 'a574243a-154e-40d9-825a-7c3e51c0ca6f', + display: 'SNOMED CT: 373066001', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/a574243a-154e-40d9-825a-7c3e51c0ca6f', + resourceAlias: 'mapping', + }, + ], + }, + { + uuid: '6757c68b-2aa9-4080-a4ae-40b946081177', + display: 'AMPATH: 1065', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/6757c68b-2aa9-4080-a4ae-40b946081177', + resourceAlias: 'mapping', + }, + ], + }, + ], + answers: [], + setMembers: [], + attributes: [], + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA?v=full', + resourceAlias: 'concept', + }, + ], + resourceVersion: '2.0', + }, + valueModifier: null, + formFieldPath: 'ohri-forms-contactsInvited', + formFieldNamespace: 'ohri-forms', + status: 'FINAL', + interpretation: null, + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/a5cef1b1-9f44-4fa5-9cc8-07ba2e8a3fc4', + resourceAlias: 'obs', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/a5cef1b1-9f44-4fa5-9cc8-07ba2e8a3fc4?v=full', + resourceAlias: 'obs', + }, + ], + resourceVersion: '2.1', + }, + { + uuid: 'd93d637a-f5ae-40f0-981b-7705e96ec833', + display: 'Relationship to Tuberculosis contact: Family member', + concept: { + uuid: '160239AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Relationship to Tuberculosis contact', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160239AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + person: { + uuid: '1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + display: '100002U - Clark Bob Robert', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/patient/1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + resourceAlias: 'patient', + }, + ], + }, + obsDatetime: '2024-01-05T07:01:53.000+0000', + accessionNumber: null, + obsGroup: { + uuid: '37094756-1d74-420c-a63c-fe8418ea3b7d', + display: 'Contact details: test, 0789000000, Yes, Family member, Test', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/37094756-1d74-420c-a63c-fe8418ea3b7d', + resourceAlias: 'obs', + }, + ], + }, + valueCodedName: null, + groupMembers: null, + comment: null, + location: { + uuid: '44c3efb0-2583-4c80-a79e-1f756a03c0a1', + display: 'Outpatient Clinic', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/location/44c3efb0-2583-4c80-a79e-1f756a03c0a1', + resourceAlias: 'location', + }, + ], + }, + order: null, + encounter: { + uuid: 'ee106966-4cd9-4465-8ac2-dfac9e3751d3', + display: 'TB Contact Listing 05/01/2024', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/encounter/ee106966-4cd9-4465-8ac2-dfac9e3751d3', + resourceAlias: 'encounter', + }, + ], + }, + voided: false, + value: { + uuid: '1560AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Family member', + name: { + display: 'Family member', + uuid: '634a1aa6-73dc-3ab7-a067-293ff62ca1e7', + name: 'Family member', + locale: 'en', + localePreferred: true, + conceptNameType: 'FULLY_SPECIFIED', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1560AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/634a1aa6-73dc-3ab7-a067-293ff62ca1e7', + resourceAlias: 'name', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1560AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/634a1aa6-73dc-3ab7-a067-293ff62ca1e7?v=full', + resourceAlias: 'name', + }, + ], + resourceVersion: '1.9', + }, + datatype: { + uuid: '8d4a48b6-c2cc-11de-8d13-0010c6dffd0f', + display: 'Coded', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/conceptdatatype/8d4a48b6-c2cc-11de-8d13-0010c6dffd0f', + resourceAlias: 'conceptdatatype', + }, + ], + }, + conceptClass: { + uuid: '8d491e50-c2cc-11de-8d13-0010c6dffd0f', + display: 'Question', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/conceptclass/8d491e50-c2cc-11de-8d13-0010c6dffd0f', + resourceAlias: 'conceptclass', + }, + ], + }, + set: false, + version: null, + retired: false, + names: [ + { + uuid: '634a1aa6-73dc-3ab7-a067-293ff62ca1e7', + display: 'Family member', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1560AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/634a1aa6-73dc-3ab7-a067-293ff62ca1e7', + resourceAlias: 'name', + }, + ], + }, + ], + descriptions: [], + mappings: [ + { + uuid: '20f1cf1f-c948-4fd7-8123-bebe110beb9a', + display: 'CIEL: 1560', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1560AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/20f1cf1f-c948-4fd7-8123-bebe110beb9a', + resourceAlias: 'mapping', + }, + ], + }, + { + uuid: '58c0fe00-b0e8-4bea-8ed0-86bab365642f', + display: 'PIH: 6441', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1560AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/58c0fe00-b0e8-4bea-8ed0-86bab365642f', + resourceAlias: 'mapping', + }, + ], + }, + { + uuid: 'fbd918f2-3e31-45ee-8de2-30663bb545b4', + display: 'SNOMED CT: 303071001', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1560AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/fbd918f2-3e31-45ee-8de2-30663bb545b4', + resourceAlias: 'mapping', + }, + ], + }, + ], + answers: [ + { + uuid: '975AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Aunt', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/975AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160729AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Brother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160729AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '1528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Child', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160728AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Daughter', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160728AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '971AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Father', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/971AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160273AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Grandfather', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160273AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '159772AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Grandmother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/159772AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '973AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Grandparent', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/973AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160724AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Maternal grandfather', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160724AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160723AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Maternal grandmother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160723AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '970AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Mother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/970AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '5620AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Other family member', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/5620AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '1527AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Parent', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1527AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '5617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Partner or spouse', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/5617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160725AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Paternal grandfather', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160725AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160726AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Paternal grandmother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160726AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '972AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Sibling', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/972AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Sister', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160727AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Son', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160727AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '974AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Uncle', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/974AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '970AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Mother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/970AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '971AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Father', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/971AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '159772AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Grandmother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/159772AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160273AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Grandfather', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160273AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '972AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Sibling', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/972AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '1528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Child', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '975AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Aunt', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/975AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '974AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Uncle', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/974AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '5620AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Other family member', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/5620AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160726AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Paternal grandmother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160726AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160723AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Maternal grandmother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160723AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160725AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Paternal grandfather', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160725AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160724AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Maternal grandfather', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160724AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160727AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Son', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160727AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160728AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Daughter', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160728AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160729AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Brother', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160729AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '160730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Sister', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/160730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '5617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Partner or spouse', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/5617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '973AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Grandparent', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/973AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + { + uuid: '1527AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Parent', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1527AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + ], + setMembers: [], + attributes: [], + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1560AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/1560AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA?v=full', + resourceAlias: 'concept', + }, + ], + resourceVersion: '2.0', + }, + valueModifier: null, + formFieldPath: 'ohri-forms-tbRelationship', + formFieldNamespace: 'ohri-forms', + status: 'FINAL', + interpretation: null, + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/d93d637a-f5ae-40f0-981b-7705e96ec833', + resourceAlias: 'obs', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/d93d637a-f5ae-40f0-981b-7705e96ec833?v=full', + resourceAlias: 'obs', + }, + ], + resourceVersion: '2.1', + }, + { + uuid: 'a8f75b70-2102-4d91-b946-d075477e153e', + display: 'Name of contact person: Test', + concept: { + uuid: '163258AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + display: 'Name of contact person', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/concept/163258AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + resourceAlias: 'concept', + }, + ], + }, + person: { + uuid: '1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + display: '100002U - Clark Bob Robert', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/patient/1b2278d5-c9ea-4f00-bfb1-60af48dc838a', + resourceAlias: 'patient', + }, + ], + }, + obsDatetime: '2024-01-05T07:01:53.000+0000', + accessionNumber: null, + obsGroup: { + uuid: '37094756-1d74-420c-a63c-fe8418ea3b7d', + display: 'Contact details: test, 0789000000, Yes, Family member, Test', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/37094756-1d74-420c-a63c-fe8418ea3b7d', + resourceAlias: 'obs', + }, + ], + }, + valueCodedName: null, + groupMembers: null, + comment: null, + location: { + uuid: '44c3efb0-2583-4c80-a79e-1f756a03c0a1', + display: 'Outpatient Clinic', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/location/44c3efb0-2583-4c80-a79e-1f756a03c0a1', + resourceAlias: 'location', + }, + ], + }, + order: null, + encounter: { + uuid: 'ee106966-4cd9-4465-8ac2-dfac9e3751d3', + display: 'TB Contact Listing 05/01/2024', + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/encounter/ee106966-4cd9-4465-8ac2-dfac9e3751d3', + resourceAlias: 'encounter', + }, + ], + }, + voided: false, + value: 'Test', + valueModifier: null, + formFieldPath: 'ohri-forms-nameofContactPerson', + formFieldNamespace: 'ohri-forms', + status: 'FINAL', + interpretation: null, + links: [ + { + rel: 'self', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/a8f75b70-2102-4d91-b946-d075477e153e', + resourceAlias: 'obs', + }, + { + rel: 'full', + uri: 'https://ohri-dev.globalhealthapp.net/openmrs/ws/rest/v1/obs/a8f75b70-2102-4d91-b946-d075477e153e?v=full', + resourceAlias: 'obs', + }, + ], + resourceVersion: '2.1', + }, + ], + concept: { + uuid: '164351AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + name: { + uuid: 'd878b58c-51e1-3987-a3d7-96d7af4fba58', + name: 'Contact details', + }, + }, + value: null, + }, + ], + form: { + uuid: 'cb16d920-62f1-3696-b781-e6a4f5e80de1', + name: 'TB Contact Listing', + }, + launchFormActions: {}, + }, +]; diff --git a/packages/esm-commons-lib/src/components/data-table/o-table.component.tsx b/packages/esm-commons-lib/src/components/data-table/o-table.component.tsx index ae4bdaa9d..73ae7cbf6 100644 --- a/packages/esm-commons-lib/src/components/data-table/o-table.component.tsx +++ b/packages/esm-commons-lib/src/components/data-table/o-table.component.tsx @@ -18,7 +18,6 @@ interface TableProps { } export const OTable: React.FC = ({ tableHeaders, tableRows }) => { - return ( diff --git a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx index 728d95a0a..eb91694bc 100644 --- a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx +++ b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx @@ -62,11 +62,7 @@ export const EncounterList: React.FC = ({ const { isDead } = usePatientDeathStatus(patientUuid); const formNames = useMemo(() => formList.map((form) => form.name), []); const { formsJson, isLoading: isLoadingFormsJson } = useFormsJson(formNames); - const { - encounters, - isLoading: isLoadingEncounters, - onFormSave, - } = useEncounterRows(patientUuid, encounterType, filter); + const { encounters, isLoading, onFormSave } = useEncounterRows(patientUuid, encounterType, filter); const { moduleName, workspaceWindowSize, displayText, hideFormLauncher } = launchOptions; const defaultActions = useMemo( @@ -163,7 +159,7 @@ export const EncounterList: React.FC = ({ }; // process columns columns.forEach((column) => { - let val = column.getValue(encounter); + let val = column?.getValue(encounter); if (column.link) { val = ( = ({ {actions.map((actionItem, index) => ( { e.preventDefault(); @@ -246,7 +243,7 @@ export const EncounterList: React.FC = ({ ); } else if (forms.length && !(hideFormLauncher ?? isDead)) { - return ( + return () => ( @@ -266,17 +263,21 @@ export const EncounterList: React.FC = ({ /> ); } + return null; }, [forms, hideFormLauncher, isDead, displayText, moduleName, workspaceWindowSize, onFormSave, patientUuid]); + if (isLoading === true || isLoadingForms === true || isLoadingFormsJson === true) { + return ; + } + return ( <> - {isLoadingEncounters || isLoadingForms ? ( - - ) : encounters.length > 0 ? ( + {paginatedRows?.length > 0 || encounters.length > 0 ? ( <>

{headerTitle}

+ {/* @ts-ignore */} {!(hideFormLauncher ?? isDead) &&
{formLauncher}
}
diff --git a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.test.tsx b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.test.tsx new file mode 100644 index 000000000..c94efe220 --- /dev/null +++ b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.test.tsx @@ -0,0 +1,107 @@ +import '@testing-library/jest-dom'; +import React from 'react'; +import { act, render, screen } from '@testing-library/react'; +import { EncounterList } from './encounter-list.component'; +import { openmrsFetch, usePagination } from '@openmrs/esm-framework'; +import { mockColumns, mockEncounter, mockEncounterType, mockForms } from '../../../../../__mocks__/encounter-list.mock'; +import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib'; +import * as encounterRowsHook from '../../hooks/useEncounterRows'; +import * as formsJsonHook from '../../hooks/useFormsJson'; + +const emptyTestProps = { + formConceptMap: {}, + patientUuid: 'some-uuid', + encounterType: mockEncounterType, + columns: [], + headerTitle: 'Sample header title encounter list', + description: 'Sample description encounter list', + formList: [], + filter: jest.fn(), + launchOptions: { + moduleName: '', + hideFormLauncher: false, + displayText: '', + }, +}; + +const testProps = { + formConceptMap: {}, + patientUuid: 'some-uuid', + encounterType: mockEncounterType, + columns: mockColumns, + headerTitle: 'Sample header title encounter list', + description: 'Sample description encounter list', + formList: mockForms, + filter: jest.fn(), + launchOptions: { + moduleName: '', + hideFormLauncher: false, + displayText: '', + }, +}; + +jest.mock('../../hooks/useEncounterRows'); +jest.mock('../../hooks/useFormsJson'); + +jest.mock('@openmrs/esm-patient-common-lib', () => ({ + launchPatientWorkspace: jest.fn(), +})); + +jest.mock('@openmrs/openmrs-form-engine-lib', () => ({ + OHRIForm: jest + .fn() + .mockImplementation(() => React.createElement('div', { 'data-testid': 'openmrs form' }, 'FORM ENGINE LIB')), +})); + +describe('EncounterList', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + + test('renders an loading state if data is loading', () => { + jest + .spyOn(encounterRowsHook, 'useEncounterRows') + .mockReturnValue({ encounters: [], isLoading: true, error: null, onFormSave: () => {} }); + + jest.spyOn(formsJsonHook, 'useFormsJson').mockReturnValue({ formsJson: [], isLoading: true }); + + act(() => { + render(); + }); + const element = document.querySelector('.cds--skeleton.cds--data-table-container'); + expect(element).not.toBeNull(); + }); + + test('renders an empty state if data is null', () => { + jest + .spyOn(encounterRowsHook, 'useEncounterRows') + .mockReturnValue({ encounters: [], isLoading: false, error: null, onFormSave: () => {} }); + + jest.spyOn(formsJsonHook, 'useFormsJson').mockReturnValue({ formsJson: [], isLoading: false }); + + act(() => { + render(); + }); + expect( + screen.getByText('There are no sample description encounter list to display for this patient'), + ).toBeInTheDocument(); + }); + + test('should render the encounter list component', () => { + jest.spyOn(encounterRowsHook, 'useEncounterRows').mockReturnValue({ + encounters: mockEncounter, + isLoading: false, + error: null, + onFormSave: () => {}, + }); + jest.spyOn(formsJsonHook, 'useFormsJson').mockReturnValue({ formsJson: [], isLoading: false }); + + act(() => { + render(); + }); + expect(screen.getByText('Sample header title encounter list')).toBeInTheDocument(); + expect(screen.getByText('Death Date')).toBeInTheDocument(); + expect(screen.getByText('Click to sort rows by Cause of Death header in ascending order')).toBeInTheDocument(); + expect(screen.getByText('Cause of Death')).toBeInTheDocument(); + }); +}); diff --git a/packages/esm-commons-lib/src/components/encounter-tile/encounter-tile.component.tsx b/packages/esm-commons-lib/src/components/encounter-tile/encounter-tile.component.tsx index d8b3e2b27..ac1f84686 100644 --- a/packages/esm-commons-lib/src/components/encounter-tile/encounter-tile.component.tsx +++ b/packages/esm-commons-lib/src/components/encounter-tile/encounter-tile.component.tsx @@ -56,7 +56,7 @@ export const EncounterValuesTile: React.FC = ({ patien --
- ) + ); } return ( diff --git a/packages/esm-commons-lib/src/hooks/useEncounterRows.ts b/packages/esm-commons-lib/src/hooks/useEncounterRows.ts index dc99bb2c9..508a13e80 100644 --- a/packages/esm-commons-lib/src/hooks/useEncounterRows.ts +++ b/packages/esm-commons-lib/src/hooks/useEncounterRows.ts @@ -6,10 +6,7 @@ import { encounterRepresentation } from '../constants'; export function useEncounterRows(patientUuid: string, encounterType: string, encounterFilter: (encounter) => boolean) { const [encounters, setEncounters] = useState([]); - const url = useMemo( - () => `/ws/rest/v1/encounter?encounterType=${encounterType}&patient=${patientUuid}&v=${encounterRepresentation}`, - [encounterType, patientUuid], - ); + const url = `/ws/rest/v1/encounter?encounterType=${encounterType}&patient=${patientUuid}&v=${encounterRepresentation}`; const { data: response, diff --git a/packages/esm-commons-lib/src/hooks/useFormsJson.ts b/packages/esm-commons-lib/src/hooks/useFormsJson.ts index 09984ea28..c4057b463 100644 --- a/packages/esm-commons-lib/src/hooks/useFormsJson.ts +++ b/packages/esm-commons-lib/src/hooks/useFormsJson.ts @@ -17,7 +17,7 @@ export function useFormsJson(formNames: string[]) { setOpenmrsForms( responses .map((response, index) => { - const match = response.data.results.find((result) => !result.retired && result.name === formNames[index]); + const match = response?.data?.results.find((result) => !result.retired && result.name === formNames[index]); if (!match) { console.error('Form not found: ' + formNames[index]); return null; diff --git a/packages/esm-commons-lib/src/hooks/useLastEncounter.tsx b/packages/esm-commons-lib/src/hooks/useLastEncounter.tsx index 4ffce9a65..ea177c183 100644 --- a/packages/esm-commons-lib/src/hooks/useLastEncounter.tsx +++ b/packages/esm-commons-lib/src/hooks/useLastEncounter.tsx @@ -5,7 +5,7 @@ import useSWR from 'swr'; export function useLastEncounter(patientUuid: string, encounterType: string) { const query = `encounterType=${encounterType}&patient=${patientUuid}&limit=1&order=desc&startIndex=0`; - const endpointUrl = `/ws/rest/v1/encounter?${query}&v=${encounterRepresentation}`; + const endpointUrl = `/ws/rest/v1/encounter?${query}&v=${encounterRepresentation}`; const { data, error, isValidating } = useSWR<{ data: { results: Array } }, Error>( endpointUrl, diff --git a/packages/esm-commons-lib/src/hooks/usePatientDeathStatus.ts b/packages/esm-commons-lib/src/hooks/usePatientDeathStatus.ts index 36a6e3726..f51385c48 100644 --- a/packages/esm-commons-lib/src/hooks/usePatientDeathStatus.ts +++ b/packages/esm-commons-lib/src/hooks/usePatientDeathStatus.ts @@ -1,20 +1,14 @@ import { openmrsFetch } from '@openmrs/esm-framework'; -import { useEffect, useState } from 'react'; import useSWRImmutable from 'swr'; export function usePatientDeathStatus(patientUuid: string) { - const [isDead, setIsDead] = useState(false); - const { data: response } = useSWRImmutable( - `/ws/rest/v1/person/${patientUuid}?v=custom:(dead)`, - openmrsFetch, - ); + const { + data: response, + isLoading, + error, + } = useSWRImmutable(`/ws/rest/v1/person/${patientUuid}?v=custom:(dead)`, openmrsFetch); - useEffect(() => { - if (response) { - setIsDead(response.data.dead); - } - }, [response]); return { - isDead, + isDead: !isLoading && !error && response ? response?.data?.dead : false, }; } diff --git a/packages/esm-covid-app/src/dashboard.meta.tsx b/packages/esm-covid-app/src/dashboard.meta.tsx index 006e5043b..d88764052 100644 --- a/packages/esm-covid-app/src/dashboard.meta.tsx +++ b/packages/esm-covid-app/src/dashboard.meta.tsx @@ -45,5 +45,5 @@ export const covid19CasesDashboardMeta = { title: 'COVID-19 Cases', isFolder: true, folderTitle: 'COVID', - folderIcon: Coronavirus -}; \ No newline at end of file + folderIcon: Coronavirus, +}; diff --git a/packages/esm-covid-app/src/root.component.tsx b/packages/esm-covid-app/src/root.component.tsx index fd0474cc3..74d2066b4 100644 --- a/packages/esm-covid-app/src/root.component.tsx +++ b/packages/esm-covid-app/src/root.component.tsx @@ -24,4 +24,4 @@ const Root: React.FC = () => { ); }; -export default Root; \ No newline at end of file +export default Root; diff --git a/packages/esm-form-render-app/src/render/forms-render-test.component.tsx b/packages/esm-form-render-app/src/render/forms-render-test.component.tsx index efe4ed91e..bd35e63a9 100644 --- a/packages/esm-form-render-app/src/render/forms-render-test.component.tsx +++ b/packages/esm-form-render-app/src/render/forms-render-test.component.tsx @@ -76,7 +76,7 @@ function FormRenderTest() { }; const formValidation = () => { - handleFormValidation(schemaInput, dataTypeToRenderingMap).then((response) => console.log(response)); + handleFormValidation(schemaInput, dataTypeToRenderingMap); }; const handleFormSubmission = (e) => { diff --git a/packages/esm-hiv-app/src/dashboard.meta.tsx b/packages/esm-hiv-app/src/dashboard.meta.tsx index d27ce3a6b..b2817c675 100644 --- a/packages/esm-hiv-app/src/dashboard.meta.tsx +++ b/packages/esm-hiv-app/src/dashboard.meta.tsx @@ -84,7 +84,7 @@ export const hivCareAndTreatmentFolderDashboardMeta = { title: 'HIV Care and Treatment', name: 'care-and-treatment', folderTitle: 'Care and Treatment', - folderIcon : Home + folderIcon: Home, }; export const hivPreventionFolderDashboardMeta = { @@ -93,7 +93,7 @@ export const hivPreventionFolderDashboardMeta = { title: 'HIV Testing Services', name: 'hts', folderTitle: 'HIV Prevention', - folderIcon : Pills + folderIcon: Pills, }; export const htsDashboardMeta = { diff --git a/packages/esm-hiv-app/src/views/hts/lab-results/tabs/cd4-results.component.tsx b/packages/esm-hiv-app/src/views/hts/lab-results/tabs/cd4-results.component.tsx index 0745de60d..8bf769660 100644 --- a/packages/esm-hiv-app/src/views/hts/lab-results/tabs/cd4-results.component.tsx +++ b/packages/esm-hiv-app/src/views/hts/lab-results/tabs/cd4-results.component.tsx @@ -61,9 +61,8 @@ const CD4ResultsList: React.FC = ({ patientUuid }) => { for (let patient of patients) { const lastCd4Result = patientToCd4Map.find((entry) => entry.patientId === patient.resource.id)?.cd4Result; const lastCd4ResultDate = patientToCd4Map.find((entry) => entry.patientId === patient.resource.id)?.cd4ResultDate; - const lastCd4EncounterUuid = patientToCd4Map.find( - (entry) => entry.patientId === patient.resource.id, - )?.cd4EncounterUuid; + const lastCd4EncounterUuid = patientToCd4Map.find((entry) => entry.patientId === patient.resource.id) + ?.cd4EncounterUuid; const patientActions = ( = () => { useEffect(() => { let rows = []; for (let patient of patients) { - const lastviralLoadResult = patientToViralLoadMap.find( - (entry) => entry.patientId === patient.resource.id, - )?.viralLoadResult; - const lastviralLoadResultDate = patientToViralLoadMap.find( - (entry) => entry.patientId === patient.resource.id, - )?.viralLoadResultDate; - const lastViralLoadEncounterUuid = patientToViralLoadMap.find( - (entry) => entry.patientId === patient.resource.id, - )?.viralEncounterUuid; + const lastviralLoadResult = patientToViralLoadMap.find((entry) => entry.patientId === patient.resource.id) + ?.viralLoadResult; + const lastviralLoadResultDate = patientToViralLoadMap.find((entry) => entry.patientId === patient.resource.id) + ?.viralLoadResultDate; + const lastViralLoadEncounterUuid = patientToViralLoadMap.find((entry) => entry.patientId === patient.resource.id) + ?.viralEncounterUuid; const patientActions = ( { - return
Programmes
; + return
Programmes
; }; export default ProgramsHome; diff --git a/packages/esm-ohri-pmtct-app/src/dashboard.meta.tsx b/packages/esm-ohri-pmtct-app/src/dashboard.meta.tsx index 26d50d42d..622ff5445 100644 --- a/packages/esm-ohri-pmtct-app/src/dashboard.meta.tsx +++ b/packages/esm-ohri-pmtct-app/src/dashboard.meta.tsx @@ -39,5 +39,5 @@ export const motherChildDashboardMeta = { name: 'mother-child-health', slot: 'mother-child-health-dashboard-slot', title: 'Maternal & Child Health', - icon: PedestrianChild + icon: PedestrianChild, }; diff --git a/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx index b0baaf611..e309f4970 100644 --- a/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx +++ b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx @@ -39,7 +39,7 @@ function TbSummaryTiles() { linkAddress: '#', subTitle: t('drugResistant', 'Cases with drug resistant TB'), value: activeDRClientsCount, - } + }, ], [activeDSClientsCount, activeDRClientsCount], ); From b6959100e3c5f0d2c79a01227706b9e2416ed0da Mon Sep 17 00:00:00 2001 From: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Date: Mon, 8 Apr 2024 16:05:54 +0300 Subject: [PATCH 38/50] opd package on the ohri clinical views (#1827) * opd package on the ohri clinical views * package.json * update dependencies * yarn lock * remove unused transations --- package.json | 1 + packages/esm-opd-app/package.json | 55 ++++++++++ packages/esm-opd-app/src/config-schema.ts | 1 + packages/esm-opd-app/src/dashboard.meta.tsx | 12 ++ packages/esm-opd-app/src/dashboard.scss | 21 ++++ packages/esm-opd-app/src/declarations.d.tsx | 2 + packages/esm-opd-app/src/index.ts | 30 +++++ packages/esm-opd-app/src/root.scss | 116 ++++++++++++++++++++ packages/esm-opd-app/src/routes.json | 38 +++++++ packages/esm-opd-app/src/setupTests.ts | 15 +++ packages/esm-opd-app/translations/en.json | 1 + packages/esm-opd-app/tsconfig.json | 28 +++++ packages/esm-opd-app/webpack.config.js | 17 +++ yarn.lock | 41 +++++++ 14 files changed, 378 insertions(+) create mode 100644 packages/esm-opd-app/package.json create mode 100644 packages/esm-opd-app/src/config-schema.ts create mode 100644 packages/esm-opd-app/src/dashboard.meta.tsx create mode 100644 packages/esm-opd-app/src/dashboard.scss create mode 100644 packages/esm-opd-app/src/declarations.d.tsx create mode 100644 packages/esm-opd-app/src/index.ts create mode 100644 packages/esm-opd-app/src/root.scss create mode 100644 packages/esm-opd-app/src/routes.json create mode 100644 packages/esm-opd-app/src/setupTests.ts create mode 100644 packages/esm-opd-app/translations/en.json create mode 100644 packages/esm-opd-app/tsconfig.json create mode 100644 packages/esm-opd-app/webpack.config.js diff --git a/package.json b/package.json index e42e8c7fb..f375ef569 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "start:pmtct": "openmrs develop --backend https://ohri-namibia-dev.globalhealthapp.net --sources 'packages/esm-ohri-pmtct-app/'", "start:form-render": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-form-render-app", "start:tb": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-tb-app", + "start:opd": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-opd-app", "prettier": "prettier --fix --config prettier.config.js --write \"packages/**/*.{ts,tsx}\"", "prepare": "husky install", "test": "jest --config jest.config.js --verbose false --passWithNoTests", diff --git a/packages/esm-opd-app/package.json b/packages/esm-opd-app/package.json new file mode 100644 index 000000000..8ce376159 --- /dev/null +++ b/packages/esm-opd-app/package.json @@ -0,0 +1,55 @@ +{ + "name": "@ohri/openmrs-esm-ohri-opd-app", + "version": "2.2.0", + "description": "opd active visits", + "browser": "dist/openmrs-esm-ohri-opd-app.js", + "main": "src/index.ts", + "license": "MIT", + "homepage": "https://github.com/UCSF-IGHS/openmrs-esm-ohri#readme", + "scripts": { + "start": "openmrs develop", + "serve": "webpack serve --mode=development", + "debug": "npm run serve", + "build": "webpack --mode production", + "analyze": "webpack --mode=production --env.analyze=true", + "lint": "eslint src --ext tsx", + "typescript": "tsc", + "prepublishOnly": "npm run build", + "extract-translations": "i18next 'src/**/*.component.tsx'" + }, + "browserslist": [ + "extends browserslist-config-openmrs" + ], + "keywords": [ + "openmrs", + "ohri", + "opd" + ], + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/UCSF-IGHS/openmrs-esm-ohri.git" + }, + "bugs": { + "url": "https://github.com/UCSF-IGHS/openmrs-esm-ohri/issues" + }, + "dependencies": { + "@carbon/react": "^1.13.0", + "@ohri/esm-patient-chart-app": "7.1.0-2" + }, + "peerDependencies": { + "@ohri/esm-patient-chart-app": "7.1.0-2", + "@openmrs/esm-framework": "5.x", + "@openmrs/esm-patient-common-lib": "6.x", + "dayjs": "1.x", + "react": "18.x", + "react-i18next": "11.x", + "swr": "2.x" + }, + "devDependencies": { + "@ohri/esm-patient-chart-app": "7.1.0-2", + "webpack": "^5.88.2" + } +} diff --git a/packages/esm-opd-app/src/config-schema.ts b/packages/esm-opd-app/src/config-schema.ts new file mode 100644 index 000000000..11f523bd0 --- /dev/null +++ b/packages/esm-opd-app/src/config-schema.ts @@ -0,0 +1 @@ +export const configSchema = {}; diff --git a/packages/esm-opd-app/src/dashboard.meta.tsx b/packages/esm-opd-app/src/dashboard.meta.tsx new file mode 100644 index 000000000..29c682181 --- /dev/null +++ b/packages/esm-opd-app/src/dashboard.meta.tsx @@ -0,0 +1,12 @@ +export const opdFolderMeta = { + title: 'OPD', + slotName: 'opd-slot', + isExpanded: false, +}; + +export const activeVisitDashboardMeta = { + slot: 'patient-chart-active-visit-dashboard-slot', + columns: 1, + path: 'Active Visits', + title: 'Active Visits', +}; diff --git a/packages/esm-opd-app/src/dashboard.scss b/packages/esm-opd-app/src/dashboard.scss new file mode 100644 index 000000000..009007b57 --- /dev/null +++ b/packages/esm-opd-app/src/dashboard.scss @@ -0,0 +1,21 @@ +@import "./root.scss"; + +.noMarker { + list-style-type: none; +} + +.noMarker ul li a { + padding-left: 40px !important; + font: lighter; +} + +.currentNavItem > a { + background-color: #cecece !important; + color: #161616 !important; + border-left-color: var(--brand-01) !important; + font: bolder; +} + +.hide { + display: none; +} diff --git a/packages/esm-opd-app/src/declarations.d.tsx b/packages/esm-opd-app/src/declarations.d.tsx new file mode 100644 index 000000000..875203d56 --- /dev/null +++ b/packages/esm-opd-app/src/declarations.d.tsx @@ -0,0 +1,2 @@ +declare module '*.css'; +declare module '*.scss'; diff --git a/packages/esm-opd-app/src/index.ts b/packages/esm-opd-app/src/index.ts new file mode 100644 index 000000000..4549d9e9b --- /dev/null +++ b/packages/esm-opd-app/src/index.ts @@ -0,0 +1,30 @@ +import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle, registerFeatureFlag } from '@openmrs/esm-framework'; +import { opdFolderMeta } from './dashboard.meta'; +import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib'; +import { configSchema } from './config-schema'; +import { activeVisitDashboardMeta } from '@ohri/esm-patient-chart-app/src/dashboard.meta'; + +export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); + +require('./root.scss'); + +export const moduleName = '@ohri/openmrs-esm-ohri-opd-app'; + +const options = { + featureName: 'ohri-opd', + moduleName, +}; + +export function startupApp() { + defineConfigSchema(moduleName, configSchema); +} + +export const opdPatientChartDashboard = getSyncLifecycle(createDashboardGroup(opdFolderMeta), options); + +export const activeVisitDashboardLink = getSyncLifecycle( + createDashboardLink({ + ...activeVisitDashboardMeta, + moduleName, + }), + { featureName: 'active-visit', moduleName }, +); diff --git a/packages/esm-opd-app/src/root.scss b/packages/esm-opd-app/src/root.scss new file mode 100644 index 000000000..c504fa3d9 --- /dev/null +++ b/packages/esm-opd-app/src/root.scss @@ -0,0 +1,116 @@ +@use '@carbon/styles/scss/spacing'; +@use '@carbon/styles/scss/type'; +@import '~@openmrs/esm-styleguide/src/vars'; + +$ui-01: #f4f4f4; +$ui-02: #ffffff; +$ui-03: #e0e0e0; +$ui-05: #161616; +$ui-background: #ffffff; +$color-gray-70: #525252; +$color-blue-60-2: #0f62fe; +$color-yellow-50: #feecae; +$inverse-support-03: #f1c21b; +$warning-background: #fff8e1; +$openmrs-background-grey: #f4f4f4; +$danger: #da1e28; +$interactive-01: #0f62fe; +$brand-teal-01: #3197D9; +$ohri-input-width: 22.313rem; +$ohri-home-background: #ededed; +$button-primary: #0078A6; + +.productiveHeading01 { + @include type.type-style("heading-compact-01"); +} + +.productiveHeading02 { + @include type.type-style("heading-compact-02"); +} + +.productiveHeading03 { + @include type.type-style("heading-03"); +} + +.productiveHeading04 { + @include type.type-style("heading-04"); +} + +.productiveHeading05 { + @include type.type-style("heading-05"); +} + +.productiveHeading06 { + @include type.type-style("heading-06"); +} + +.bodyShort01 { + @include type.type-style("body-compact-01"); +} + +.helperText01 { + @include type.type-style("helper-text-01"); +} + +.bodyShort02 { + @include type.type-style("body-compact-02"); +} + +.bodyLong01 { + @include type.type-style("body-01"); +} + +.bodyLong02 { + @include type.type-style("body-02"); +} + +.label01 { + @include type.type-style("label-01"); +} + +.text02 { + color: $text-02; +} + +aside { + background-color: $ui-02 !important; +} + +// Login Overrides + +div[class*='-esm-login__styles__center'] > img { + width: 140px; // design has 120px +} + +:global(.tab-12rem) > button { + width: 12rem !important; +} + +:global(.tab-14rem) > button { + width: 14rem !important; +} + +:global(.tab-16rem) > button { + width: 16rem !important; +} + +:global(.cds--overflow-menu) > div { + width: 15rem !important; +} + +nav :global(.cds--accordion__title) { + color: #525252; + font-weight: 600 !important; +} + +nav :global(.cds--accordion__content) { + padding-bottom: 0 !important; + padding-top: 0 !important; +} + +nav :global(.cds--accordion__content) > a { + background-color: #cecece !important; + color: #161616 !important; + border-left-color: var(--brand-01) !important; + font: bolder; +} diff --git a/packages/esm-opd-app/src/routes.json b/packages/esm-opd-app/src/routes.json new file mode 100644 index 000000000..a2c331b41 --- /dev/null +++ b/packages/esm-opd-app/src/routes.json @@ -0,0 +1,38 @@ +{ + "$schema": "https://json.openmrs.org/routes.schema.json", + "backendDependencies": { + "webservices.rest": "^2.24.0" + }, + "pages": [ + ], + "extensions": [ + { + "name": "opd", + "slot": "patient-chart-dashboard-slot", + "component": "opdPatientChartDashboard", + "order": 25, + "meta": { + "path": "OPD", + "slot": "opd-slot", + "isExpanded": false + } + }, + { + "name": "active-visit-summary-dashboard", + "component": "activeVisitDashboardLink", + "slot": "opd-slot", + "meta": { + "slot": "patient-chart-active-visit-dashboard-slot", + "columns": 1, + "path": "Active Visits" + } + }, + { + "name": "opd-summary-ext", + "slot": "opd-summary-slot", + "component": "opdSummaryDashboard" + } + + + ] +} diff --git a/packages/esm-opd-app/src/setupTests.ts b/packages/esm-opd-app/src/setupTests.ts new file mode 100644 index 000000000..3abed9870 --- /dev/null +++ b/packages/esm-opd-app/src/setupTests.ts @@ -0,0 +1,15 @@ +import '@testing-library/jest-dom'; + +declare global { + interface Window { + openmrsBase: string; + spaBase: string; + } +} + +const { getComputedStyle } = window; +window.getComputedStyle = (element) => getComputedStyle(element); +window.openmrsBase = '/openmrs'; +window.spaBase = '/spa'; +window.getOpenmrsSpaBase = () => '/openmrs/spa/'; +window.HTMLElement.prototype.scrollIntoView = jest.fn(); diff --git a/packages/esm-opd-app/translations/en.json b/packages/esm-opd-app/translations/en.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/packages/esm-opd-app/translations/en.json @@ -0,0 +1 @@ +{} diff --git a/packages/esm-opd-app/tsconfig.json b/packages/esm-opd-app/tsconfig.json new file mode 100644 index 000000000..db240ff83 --- /dev/null +++ b/packages/esm-opd-app/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "module": "esnext", + "allowSyntheticDefaultImports": true, + "jsx": "react", + "skipLibCheck": true, + "moduleResolution": "node", + "lib": [ + "dom", + "es5", + "scripthost", + "es2015", + "es2015.promise", + "es2016.array.include", + "es2018", + "es2020" + ], + "resolveJsonModule": true, + "noEmit": true, + "target": "esnext", + "paths": { + "@openmrs/*": [ + "./node_modules/@openmrs/*" + ] + } + } +} diff --git a/packages/esm-opd-app/webpack.config.js b/packages/esm-opd-app/webpack.config.js new file mode 100644 index 000000000..b15408968 --- /dev/null +++ b/packages/esm-opd-app/webpack.config.js @@ -0,0 +1,17 @@ +const path = require('path'); +const config = (module.exports = require('openmrs/default-webpack-config')); +config.scriptRuleConfig.exclude = + path.sep == '/' + ? /(node_modules[^\/@openmrs\/esm\-patient\-common\-lib])/ + : /(node_modules[^\\@openmrs\/esm\-patient\-common\-lib])/; + +// Temporary fix to resolve webpack issues with imports from the commons library +config.overrides.resolve = { + extensions: ['.tsx', '.ts', '.jsx', '.js', '.scss'], + alias: { + '@openmrs/esm-framework': '@openmrs/esm-framework/src/internal', + '@ohri/openmrs-esm-ohri-commons-lib': path.resolve(__dirname, '../esm-commons-lib/src/index'), + '@openmrs/openmrs-form-engine-lib': '@openmrs/openmrs-form-engine-lib/src/index', + }, +}; +module.exports = config; diff --git a/yarn.lock b/yarn.lock index a539ba384..abe0ec12f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2721,6 +2721,29 @@ __metadata: languageName: node linkType: hard +"@ohri/esm-patient-chart-app@npm:7.1.0-2": + version: 7.1.0-2 + resolution: "@ohri/esm-patient-chart-app@npm:7.1.0-2" + dependencies: + lodash-es: "npm:^4.17.21" + uuid: "npm:^8.3.2" + peerDependencies: + "@carbon/react": 1.x + "@openmrs/esm-framework": 5.x + "@openmrs/esm-patient-common-lib": "*" + dayjs: 1.x + lodash-es: 4.x + react: 18.x + react-i18next: 11.x + react-router-dom: 6.x + rxjs: 6.x + single-spa: 6.x + single-spa-react: 6.x + swr: 2.x + checksum: 4652f57696856673c720277a93ef65c14afc890a8335729dfa6d4babe3b132db04770f1964a0a88b7331854be65d6266e6c6c8f513a19867903b92dd9c599e60 + languageName: node + linkType: hard + "@ohri/openmrs-esm-ohri-cervical-cancer-app@workspace:packages/esm-cervical-cancer-app": version: 0.0.0-use.local resolution: "@ohri/openmrs-esm-ohri-cervical-cancer-app@workspace:packages/esm-cervical-cancer-app" @@ -2828,6 +2851,24 @@ __metadata: languageName: unknown linkType: soft +"@ohri/openmrs-esm-ohri-opd-app@workspace:packages/esm-opd-app": + version: 0.0.0-use.local + resolution: "@ohri/openmrs-esm-ohri-opd-app@workspace:packages/esm-opd-app" + dependencies: + "@carbon/react": "npm:^1.13.0" + "@ohri/esm-patient-chart-app": "npm:7.1.0-2" + webpack: "npm:^5.88.2" + peerDependencies: + "@ohri/esm-patient-chart-app": 7.1.0-2 + "@openmrs/esm-framework": 5.x + "@openmrs/esm-patient-common-lib": 6.x + dayjs: 1.x + react: 18.x + react-i18next: 11.x + swr: 2.x + languageName: unknown + linkType: soft + "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app": version: 0.0.0-use.local resolution: "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app" From 97f893125a40ee3bc76c083e05d599bfa2e6272a Mon Sep 17 00:00:00 2001 From: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:13:15 +0300 Subject: [PATCH 39/50] opd updates (#1829) --- packages/esm-opd-app/package.json | 6 +++--- packages/esm-opd-app/src/index.ts | 3 +-- yarn.lock | 12 ++++++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/esm-opd-app/package.json b/packages/esm-opd-app/package.json index 8ce376159..b60aee7e9 100644 --- a/packages/esm-opd-app/package.json +++ b/packages/esm-opd-app/package.json @@ -37,10 +37,10 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@ohri/esm-patient-chart-app": "7.1.0-2" + "@ohri/esm-patient-chart-app": "7.1.0-3" }, "peerDependencies": { - "@ohri/esm-patient-chart-app": "7.1.0-2", + "@ohri/esm-patient-chart-app": "7.1.0-3", "@openmrs/esm-framework": "5.x", "@openmrs/esm-patient-common-lib": "6.x", "dayjs": "1.x", @@ -49,7 +49,7 @@ "swr": "2.x" }, "devDependencies": { - "@ohri/esm-patient-chart-app": "7.1.0-2", + "@ohri/esm-patient-chart-app": "7.1.0-3", "webpack": "^5.88.2" } } diff --git a/packages/esm-opd-app/src/index.ts b/packages/esm-opd-app/src/index.ts index 4549d9e9b..14733e5e2 100644 --- a/packages/esm-opd-app/src/index.ts +++ b/packages/esm-opd-app/src/index.ts @@ -1,8 +1,7 @@ import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle, registerFeatureFlag } from '@openmrs/esm-framework'; -import { opdFolderMeta } from './dashboard.meta'; +import { opdFolderMeta, activeVisitDashboardMeta } from './dashboard.meta'; import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib'; import { configSchema } from './config-schema'; -import { activeVisitDashboardMeta } from '@ohri/esm-patient-chart-app/src/dashboard.meta'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); diff --git a/yarn.lock b/yarn.lock index abe0ec12f..1e41993a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2721,9 +2721,9 @@ __metadata: languageName: node linkType: hard -"@ohri/esm-patient-chart-app@npm:7.1.0-2": - version: 7.1.0-2 - resolution: "@ohri/esm-patient-chart-app@npm:7.1.0-2" +"@ohri/esm-patient-chart-app@npm:7.1.0-3": + version: 7.1.0-3 + resolution: "@ohri/esm-patient-chart-app@npm:7.1.0-3" dependencies: lodash-es: "npm:^4.17.21" uuid: "npm:^8.3.2" @@ -2740,7 +2740,7 @@ __metadata: single-spa: 6.x single-spa-react: 6.x swr: 2.x - checksum: 4652f57696856673c720277a93ef65c14afc890a8335729dfa6d4babe3b132db04770f1964a0a88b7331854be65d6266e6c6c8f513a19867903b92dd9c599e60 + checksum: 6a3bda0fcc12e221b774af1c50612192d9b85e2951fca2a1e8f0e3a319bc027d661aec83933c313d119a59c04d25b449641bc8852c97489db01a43cab0bc990a languageName: node linkType: hard @@ -2856,10 +2856,10 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-opd-app@workspace:packages/esm-opd-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@ohri/esm-patient-chart-app": "npm:7.1.0-2" + "@ohri/esm-patient-chart-app": "npm:7.1.0-3" webpack: "npm:^5.88.2" peerDependencies: - "@ohri/esm-patient-chart-app": 7.1.0-2 + "@ohri/esm-patient-chart-app": 7.1.0-3 "@openmrs/esm-framework": 5.x "@openmrs/esm-patient-common-lib": 6.x dayjs: 1.x From 9e92a271ec260fbbbf551ca61e490926af2900c0 Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Mon, 8 Apr 2024 20:33:24 +0300 Subject: [PATCH 40/50] Update spa-build-config.json (#1830) - use @ohri/esm-patient-chart-app - added @ohri/openmrs-esm-ohri-opd-app --- frontend/spa-build-config.json | 57 +++++++++++++++++----------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/frontend/spa-build-config.json b/frontend/spa-build-config.json index 52b5d9405..b0855ea8d 100644 --- a/frontend/spa-build-config.json +++ b/frontend/spa-build-config.json @@ -1,48 +1,47 @@ { "frontendModules": { - "@ohri/openmrs-esm-ohri-core-app": "next", - "@ohri/openmrs-esm-ohri-form-render-app": "next", - "@ohri/openmrs-esm-ohri-hiv-app": "next", - "@ohri/openmrs-esm-ohri-covid-app": "next", - "@ohri/openmrs-esm-ohri-pmtct": "next", - "@ohri/openmrs-esm-ohri-tb-app": "next", - "@ohri/openmrs-esm-ohri-cervical-cancer-app": "next", - "@openmrs/esm-appointments-app": "next", - "@openmrs/esm-dispensing-app": "next", - "@openmrs/esm-form-builder-app": "next", - "@openmrs/esm-home-app": "next", + "@openmrs/esm-devtools-app": "next", "@openmrs/esm-implementer-tools-app": "next", "@openmrs/esm-login-app": "next", - "@openmrs/esm-outpatient-app": "next", + "@openmrs/esm-primary-navigation-app": "next", + "@openmrs/esm-home-app": "next", + "@openmrs/esm-form-engine-app": "next", + "@openmrs/esm-generic-patient-widgets-app": "next", "@openmrs/esm-patient-allergies-app": "next", - "@openmrs/esm-patient-appointments-app": "next", "@openmrs/esm-patient-attachments-app": "next", "@openmrs/esm-patient-banner-app": "next", - "@openmrs/esm-patient-chart-app": "next", + "@ohri/esm-patient-chart-app": "next", "@openmrs/esm-patient-conditions-app": "next", "@openmrs/esm-patient-forms-app": "next", - "@openmrs/esm-patient-immunizations-app": "next", - "@openmrs/esm-patient-list-app": "next", + "@openmrs/esm-patient-flags-app": "next", + "@openmrs/esm-patient-labs-app": "next", + "@openmrs/esm-patient-lists-app": "next", "@openmrs/esm-patient-medications-app": "next", "@openmrs/esm-patient-notes-app": "next", + "@openmrs/esm-patient-orders-app": "next", "@openmrs/esm-patient-programs-app": "next", - "@openmrs/esm-patient-search-app": "next", - "@openmrs/esm-patient-test-results-app": "next", "@openmrs/esm-patient-vitals-app": "next", - "@openmrs/esm-primary-navigation-app": "next", + "@openmrs/esm-active-visits-app": "next", + "@openmrs/esm-appointments-app": "next", + "@openmrs/esm-service-queues-app": "next", + "@openmrs/esm-patient-list-management-app": "next", "@openmrs/esm-patient-registration-app": "next", - "@openmrs/esm-devtools-app": "next", + "@openmrs/esm-patient-search-app": "next", "@openmrs/esm-openconceptlab-app": "next", - "@openmrs/esm-generic-patient-widgets-app": "next", - "@openmrs/esm-patient-lists-app": "next", - "@openmrs/esm-cohort-builder-app": "next", - "@openmrs/esm-patient-list-management-app": "next", - "@openmrs/esm-service-queues-app": "next", - "@openmrs/esm-form-entry-app": "next", - "@openmrs/esm-patient-labs-app": "next", + "@openmrs/esm-system-admin-app": "next", + "@openmrs/esm-dispensing-app": "next", "@openmrs/esm-fast-data-entry-app": "next", - "@openmrs/esm-patient-orders-app": "next", - "@openmrs/esm-system-admin-app": "next" + "@openmrs/esm-cohort-builder-app": "next", + "@ohri/openmrs-esm-ohri-core-app": "next", + "@ohri/openmrs-esm-ohri-hiv-app": "next", + "@ohri/openmrs-esm-ohri-covid-app": "next", + "@ohri/openmrs-esm-ohri-pmtct": "next", + "@ohri/openmrs-esm-ohri-tb-app": "next", + "@ohri/openmrs-esm-ohri-cervical-cancer-app": "next", + "@ohri/openmrs-esm-ohri-form-render-app": "next", + "@openmrs/esm-stock-management-app": "next", + "@openmrs/esm-billing-app": "next", + "@ohri/openmrs-esm-ohri-opd-app": "next" }, "spaPath": "$SPA_PATH", "apiUrl": "$API_URL", From 830f4566111626e5436fab878b3cfa582b873eab Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Tue, 9 Apr 2024 11:12:45 +0300 Subject: [PATCH 41/50] (fix) Fix wrong import in pmtct link (#1831) --- packages/esm-ohri-pmtct-app/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/esm-ohri-pmtct-app/src/index.ts b/packages/esm-ohri-pmtct-app/src/index.ts index a31deba7d..7097e1e25 100644 --- a/packages/esm-ohri-pmtct-app/src/index.ts +++ b/packages/esm-ohri-pmtct-app/src/index.ts @@ -18,11 +18,11 @@ import { OHRIHome, OHRIWelcomeSection, createConditionalDashboardGroup, - createDashboardLink, } from '@ohri/openmrs-esm-ohri-commons-lib'; import { generateInfantPTrackerId } from './utils/pmtct-helpers'; import { configSchema } from './config-schema'; import rootComponent from './root.component'; +import { createDashboardLink } from '@openmrs/esm-patient-common-lib'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); From 1ce904a9e3f4bb16dd2721050c29e0e99d402f49 Mon Sep 17 00:00:00 2001 From: Hero Date: Thu, 11 Apr 2024 15:16:18 +0200 Subject: [PATCH 42/50] removed form engine dependency from the pmtct app (#1832) --- packages/esm-ohri-pmtct-app/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/esm-ohri-pmtct-app/package.json b/packages/esm-ohri-pmtct-app/package.json index edc000bb1..474ee974f 100644 --- a/packages/esm-ohri-pmtct-app/package.json +++ b/packages/esm-ohri-pmtct-app/package.json @@ -36,8 +36,7 @@ "url": "https://github.com/UCSF-IGHS/openmrs-esm-ohri/issues" }, "dependencies": { - "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next" + "@carbon/react": "^1.13.0" }, "peerDependencies": { "@openmrs/esm-framework": "5.x", From de655b9e69d9988b24d8047c5c1eaf6e61fd5fcd Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Thu, 11 Apr 2024 16:25:14 +0300 Subject: [PATCH 43/50] Fix empty button intents on encounter list (#1833) --- .../encounter-list/encounter-list.component.tsx | 8 ++++---- packages/esm-ohri-pmtct-app/src/config-schema.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx index eb91694bc..df878dace 100644 --- a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx +++ b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx @@ -65,7 +65,7 @@ export const EncounterList: React.FC = ({ const { encounters, isLoading, onFormSave } = useEncounterRows(patientUuid, encounterType, filter); const { moduleName, workspaceWindowSize, displayText, hideFormLauncher } = launchOptions; - const defaultActions = useMemo( + const defaultActions = useMemo( () => [ { label: t('viewEncounter', 'View'), @@ -91,7 +91,7 @@ export const EncounterList: React.FC = ({ if (!isLoadingFormsJson) { const formsWithFilteredIntents = formsJson.map((form) => { const descriptor = formList.find((formDescriptor) => formDescriptor.name === form.name); - // handle excluded intents + // handle excluded intents if (descriptor?.excludedIntents?.length) { form['availableIntents'] = form['availableIntents'].filter( (intentEntry) => !descriptor.excludedIntents.includes(intentEntry.intent), @@ -217,7 +217,7 @@ export const EncounterList: React.FC = ({ }, [encounters, pageSize, constructPaginatedTableRows, currentPage]); const formLauncher = useMemo(() => { - if (forms.length == 1 && !forms[0]['availableIntents']?.length) { + if (forms.length == 1 && !forms[0]['availableIntents']?.length) { // we only have one form with no intents // just return the "Add" button return ( @@ -243,7 +243,7 @@ export const EncounterList: React.FC = ({ ); } else if (forms.length && !(hideFormLauncher ?? isDead)) { - return () => ( + return ( diff --git a/packages/esm-ohri-pmtct-app/src/config-schema.ts b/packages/esm-ohri-pmtct-app/src/config-schema.ts index 606180cb6..3c7e055af 100644 --- a/packages/esm-ohri-pmtct-app/src/config-schema.ts +++ b/packages/esm-ohri-pmtct-app/src/config-schema.ts @@ -30,7 +30,7 @@ export const configSchema = { _type: Type.Object, _description: 'List of uuids for PMTCT forms.', _default: { - antenatal: '', + antenatal: '5255a535-2acb-3f44-bd0a-3f80595dece1', labourAndDelivery: '1e5614d6-5306-11e6-beb8-9e71128cae77', motherPostnatal: 'e6b67aa4-6c59-4470-8ad5-b994efeda553', infantPostnatal: '5022c5d7-ea45-47ce-bd65-1ba1d8ad2467', From e9d9063b9e10cb2a59ea05f39812d4e886df6334 Mon Sep 17 00:00:00 2001 From: Lars Albino Lemos Date: Fri, 12 Apr 2024 09:45:05 +0200 Subject: [PATCH 44/50] (chore) Bump `@openmrs/openmrs-form-engine-lib` (#1828) * (chore) bump-form-engine * (chore) Bump `@openmrs/openmrs-form-engine-lib` --------- Co-authored-by: GitHub Actions Co-authored-by: samuelmale <26084581+samuelmale@users.noreply.github.com> Co-authored-by: CynthiaKamau --- packages/esm-commons-lib/package.json | 2 +- packages/esm-form-render-app/package.json | 2 +- yarn.lock | 16 +++++++--------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/esm-commons-lib/package.json b/packages/esm-commons-lib/package.json index 5fba32ac2..2a09b91c8 100644 --- a/packages/esm-commons-lib/package.json +++ b/packages/esm-commons-lib/package.json @@ -32,7 +32,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next", + "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.589", "fuzzy": "^0.1.3", "lodash-es": "^4.17.15", "systemjs-webpack-interop": "^2.3.7", diff --git a/packages/esm-form-render-app/package.json b/packages/esm-form-render-app/package.json index e9db3380f..9e4d9c92d 100644 --- a/packages/esm-form-render-app/package.json +++ b/packages/esm-form-render-app/package.json @@ -39,7 +39,7 @@ }, "dependencies": { "@carbon/react": "^1.13.0", - "@openmrs/openmrs-form-engine-lib": "next", + "@openmrs/openmrs-form-engine-lib": "1.0.0-pre.589", "ace-builds": "^1.4.12", "react-ace": "^9.4.4" }, diff --git a/yarn.lock b/yarn.lock index 1e41993a2..199d3164b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2765,7 +2765,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-commons-lib@workspace:packages/esm-commons-lib" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.589" enzyme: "npm:^3.11.0" enzyme-adapter-react-16: "npm:^1.15.6" fuzzy: "npm:^0.1.3" @@ -2822,7 +2822,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-form-render-app@workspace:packages/esm-form-render-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.589" ace-builds: "npm:^1.4.12" react-ace: "npm:^9.4.4" webpack: "npm:^5.88.2" @@ -2874,7 +2874,7 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:next" + "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.589" webpack: "npm:^5.88.2" peerDependencies: "@openmrs/esm-framework": 5.x @@ -3249,13 +3249,11 @@ __metadata: languageName: node linkType: hard -"@openmrs/openmrs-form-engine-lib@npm:next": - version: 1.0.0-pre.544 - resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.544" +"@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.589": + version: 1.0.0-pre.589 + resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.589" dependencies: ace-builds: "npm:^1.4.12" - enzyme: "npm:^3.11.0" - enzyme-adapter-react-16: "npm:^1.15.6" formik: "npm:^2.2.6" jest-coverage-badges: "npm:^1.0.0" lodash-es: "npm:^4.17.15" @@ -3274,7 +3272,7 @@ __metadata: react: 18.x react-i18next: 11.x rxjs: 6.x - checksum: 47b0c8579c345e5b85ab2e5ca1d6f91cf94f861c023fd1f3fc967dd2865353c0745cb99e1c0256a606a2b83a85ba5905e305ca2772f9c1850513beb0367d6e11 + checksum: 37bef80c99aa250dd78881b18057fa05d08c0c2e657b33787216cf3d00ef95e23355f3a0f20539bf526afdc5a596e5007713f707fde4fd6e1e01cf7ba6f3f51b languageName: node linkType: hard From a78e2d6aae0e433617ade66c1d34411d1713f232 Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Fri, 12 Apr 2024 10:51:22 +0300 Subject: [PATCH 45/50] Bumping form engine version (#1835) Co-authored-by: Amos Laboso --- yarn.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 199d3164b..100a0ac9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2874,7 +2874,6 @@ __metadata: resolution: "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app" dependencies: "@carbon/react": "npm:^1.13.0" - "@openmrs/openmrs-form-engine-lib": "npm:1.0.0-pre.589" webpack: "npm:^5.88.2" peerDependencies: "@openmrs/esm-framework": 5.x From 2bc7fd45717f902ee78bb691495a6c297cd54d24 Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Mon, 15 Apr 2024 14:27:05 +0300 Subject: [PATCH 46/50] (refactor) Add form name instead of form uuild in launch form function (#1837) --- .../encounter-list/encounter-list.component.tsx | 8 ++++---- .../src/components/encounter-list/helpers.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx index df878dace..f5e089bd1 100644 --- a/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx +++ b/packages/esm-commons-lib/src/components/encounter-list/encounter-list.component.tsx @@ -65,7 +65,7 @@ export const EncounterList: React.FC = ({ const { encounters, isLoading, onFormSave } = useEncounterRows(patientUuid, encounterType, filter); const { moduleName, workspaceWindowSize, displayText, hideFormLauncher } = launchOptions; - const defaultActions = useMemo( + const defaultActions = useMemo( () => [ { label: t('viewEncounter', 'View'), @@ -91,7 +91,7 @@ export const EncounterList: React.FC = ({ if (!isLoadingFormsJson) { const formsWithFilteredIntents = formsJson.map((form) => { const descriptor = formList.find((formDescriptor) => formDescriptor.name === form.name); - // handle excluded intents + // handle excluded intents if (descriptor?.excludedIntents?.length) { form['availableIntents'] = form['availableIntents'].filter( (intentEntry) => !descriptor.excludedIntents.includes(intentEntry.intent), @@ -217,10 +217,10 @@ export const EncounterList: React.FC = ({ }, [encounters, pageSize, constructPaginatedTableRows, currentPage]); const formLauncher = useMemo(() => { - if (forms.length == 1 && !forms[0]['availableIntents']?.length) { + if (forms.length == 1 && !forms[0]['availableIntents']?.length) { // we only have one form with no intents // just return the "Add" button - return ( + return (