Skip to content

Commit

Permalink
OHRI-1994 Add TB Program menu and tabs shell on the patient chart (#1695
Browse files Browse the repository at this point in the history
)

* OHRI-1994 Add TB Program menu and tabs shell on the patient chart

* PR comments

* Use PatientChartProps from commons lib
  • Loading branch information
ODORA0 authored Nov 22, 2023
1 parent 673b6be commit 676752d
Show file tree
Hide file tree
Showing 11 changed files with 302 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"start:cervical-cancer": "openmrs develop --backend https://ohri-dev.globalhealthapp.net --sources packages/esm-cervical-cancer-app",
"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",
"prettier": "prettier --fix --config prettier.config.js --write \"packages/**/*.{ts,tsx}\"",
"prepare": "husky install",
"test": "jest --config jest.config.js --verbose false --passWithNoTests",
Expand Down
39 changes: 36 additions & 3 deletions packages/esm-tb-app/src/dashboard.meta.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
export const tuberclosisMeta = {
title: 'Tuberclosis',
slotName: 'tuberclosis-slot',
export const tbPatientChartMeta = {
title: 'TB Program',
slotName: 'ohri-tb-slot',
isExpanded: false,
};

export const tbPatientSummaryDashboardMeta = {
slot: 'tb-patient-summary-dashboard-slot',
columns: 1,
title: 'Patient Summary',
path: 'tb-patient-summary',
layoutMode: 'anchored',
};

export const tbProgramManagementDashboardMeta = {
slot: 'tb-program-management-summary-slot',
columns: 1,
title: 'Program Management',
path: 'tb-program-management',
layoutMode: 'anchored',
};

export const tbTreatmentFollowUpDashboardMeta = {
slot: 'tb-treatment-follow-up-summary-slot',
columns: 1,
title: 'Treatment and follow-up',
path: 'tb-treatment-follow-up',
layoutMode: 'anchored',
};

export const tbContactListingDashboardMeta = {
slot: 'tb-contact-listing-summary-slot',
columns: 1,
title: 'Tb Contact Listing',
path: 'tb-contact-listing',
layoutMode: 'anchored',
};
57 changes: 57 additions & 0 deletions packages/esm-tb-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework';
import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib';
import {
tbPatientChartMeta,
tbContactListingDashboardMeta,
tbPatientSummaryDashboardMeta,
tbProgramManagementDashboardMeta,
tbTreatmentFollowUpDashboardMeta,
} from './dashboard.meta';

export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');

Expand All @@ -15,3 +22,53 @@ const options = {
export function startupApp() {
defineConfigSchema(moduleName, {});
}

export const patientChartTbDashboard = getSyncLifecycle(createDashboardGroup(tbPatientChartMeta), options);

export const tbPatientSummaryDashboardLink = getSyncLifecycle(
createDashboardLink({ ...tbPatientSummaryDashboardMeta, moduleName }),
options,
);
export const tbPatientSummaryList = getAsyncLifecycle(
() => import('./views/patient-summary/tb-patient-summary.component'),
{
featureName: 'hts-service-summary-list',
moduleName,
},
);

export const tbProgramManagementDashboardLink = getSyncLifecycle(
createDashboardLink({ ...tbProgramManagementDashboardMeta, moduleName }),
options,
);
export const tbProgramManagementDashboard = getAsyncLifecycle(
() => import('./views/program-management/maternal-health.component'),
{
featureName: 'tb-program-management-summary',
moduleName,
},
);

export const tbTreatmentFollowUpDashboardLink = getSyncLifecycle(
createDashboardLink({ ...tbTreatmentFollowUpDashboardMeta, moduleName }),
options,
);
export const tbTreatmentFollowUpDashboard = getAsyncLifecycle(
() => import('./views/treatment-and-follow-up/tb-treatment-follow-up.component'),
{
featureName: 'tb-treatment-follow-up-summary',
moduleName,
},
);

export const tbContactListingDashboardLink = getSyncLifecycle(
createDashboardLink({ ...tbContactListingDashboardMeta, moduleName }),
options,
);
export const tbContactListingDashboard = getAsyncLifecycle(
() => import('./views/tb-contact-listing/tb-contact-list.component'),
{
featureName: 'tb-contact-listing-summary',
moduleName,
},
);
84 changes: 84 additions & 0 deletions packages/esm-tb-app/src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,89 @@
"pages": [
],
"extensions": [
{
"name": "tb-dashboard-link",
"slot": "dashboard-slot",
"component": "tbFolderLink",
"meta": {
"slot": "ohri-tb-dashboard-slot",
"isFolder": true,
"title": "TB Program"
}
},
{
"name": "ohri-tb",
"slot": "patient-chart-dashboard-slot",
"component": "patientChartTbDashboard",
"order": 24
},

{
"name": "tb-summary-dashboard",
"slot": "ohri-tb-slot",
"component": "tbPatientSummaryDashboardLink",
"meta": {
"slot": "tb-patient-summary-dashboard-slot",
"columns": 1,
"path": "tb-patient-summary",
"layoutMode": "anchored"
}
},
{
"name": "tb-patient-summary-ext",
"slot": "tb-patient-summary-dashboard-slot",
"component": "tbPatientSummaryList"
},

{
"name": "tb-program-management-summary",
"slot": "ohri-tb-slot",
"component": "tbProgramManagementDashboardLink",
"meta": {
"slot": "tb-program-management-summary-slot",
"columns": 1,
"path": "tb-program-management",
"layoutMode": "anchored"
}
},
{
"name": "tb-program-management-summary-ext",
"slot": "tb-program-management-summary-slot",
"component": "tbProgramManagementDashboard"
},

{
"name": "tb-treatment-follow-up-summary",
"slot": "ohri-tb-slot",
"component": "tbTreatmentFollowUpDashboardLink",
"meta": {
"slot": "tb-treatment-follow-up-summary-slot",
"columns": 1,
"path": "tb-treatment-follow-up",
"layoutMode": "anchored"
}
},
{
"name": "tb-treatment-follow-up-summary-ext",
"slot": "tb-treatment-follow-up-summary-slot",
"component": "tbTreatmentFollowUpDashboard"
},

{
"name": "tb-contact-listing-summary",
"slot": "ohri-tb-slot",
"component": "tbContactListingDashboardLink",
"meta": {
"slot": "tb-contact-listing-summary-slot",
"columns": 1,
"path": "tb-contact-listing",
"layoutMode": "anchored"
}
},
{
"name": "tb-contact-listing-summary-ext",
"slot": "tb-contact-listing-summary-slot",
"component": "tbContactListingDashboard"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { EmptyStateComingSoon, PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib';
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';

const TBSummaryOverviewList: React.FC<PatientChartProps> = ({ patientUuid }) => {
const { t } = useTranslation();

const headerRecentTB = t('recentTuberculosis', 'Recent Tuberculosis');
const headerPreviousCases = t('previousCases', 'Previous Cases');
const headerVisit = t('visits', 'Visits');

return (
<>
<EmptyStateComingSoon displayText={headerRecentTB} headerTitle={headerRecentTB} />
<EmptyStateComingSoon displayText={headerPreviousCases} headerTitle={headerPreviousCases} />
<EmptyStateComingSoon displayText={headerVisit} headerTitle={headerVisit} />
</>
);
};

export default TBSummaryOverviewList;
Original file line number Diff line number Diff line change
@@ -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 MdrTbList from './tabs/mdr-tb.component';
import TbPatientTracing from './tabs/tb-patient-tracing.component';
import { PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib';

const ProgramManagementSummary: React.FC<PatientChartProps> = ({ patientUuid }) => {
const { t } = useTranslation();
return (
<div className={styles.tabContainer}>
<Tabs>
<TabList contained>
<Tab>{t('MdrTbEnrolment', 'TB/MDR TB Enrolment')}</Tab>
<Tab>{t('PatientTracing', 'Patient Tracing')}</Tab>
</TabList>
<TabPanels>
<TabPanel>
<MdrTbList patientUuid={patientUuid} />
</TabPanel>
<TabPanel>
<TbPatientTracing patientUuid={patientUuid} />
</TabPanel>
</TabPanels>
</Tabs>
</div>
);
};

export default ProgramManagementSummary;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EmptyStateComingSoon, PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib';

const MdrTbList: React.FC<PatientChartProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const headerTitle = t('MdrTbEnrolment', 'TB/MDR TB Enrolment');

return (
<>
<EmptyStateComingSoon displayText={headerTitle} headerTitle={headerTitle} />
</>
);
};

export default MdrTbList;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EmptyStateComingSoon, PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib';

const TbPatientTracing: React.FC<PatientChartProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const headerTitle = t('PatientTracing', 'Patient Tracing');

return (
<>
<EmptyStateComingSoon displayText={headerTitle} headerTitle={headerTitle} />
</>
);
};

export default TbPatientTracing;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EmptyStateComingSoon, PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib';

const TbContactTracingList: React.FC<PatientChartProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const headerTitle = t('TbContactListing', 'TB Contact Listing');

return (
<>
<EmptyStateComingSoon displayText={headerTitle} headerTitle={headerTitle} />
</>
);
};

export default TbContactTracingList;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { EmptyStateComingSoon, PatientChartProps } from '@ohri/openmrs-esm-ohri-commons-lib';

const TbTreatmentFollowUpList: React.FC<PatientChartProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const headerTitle = t('TbTreatmentFollowUp');

return (
<>
<EmptyStateComingSoon displayText={headerTitle} headerTitle={headerTitle} />
</>
);
};

export default TbTreatmentFollowUpList;
9 changes: 8 additions & 1 deletion packages/esm-tb-app/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"tuberclosis": "Tuberclosis"
"tuberclosis": "Tuberclosis",
"MdrTbEnrolment": "TB/MDR TB Enrolment",
"PatientTracing": "Patient Tracing",
"TbTreatmentFollowUp": "TB Follow Up",
"TbContactListing": "TB Contact Listing",
"recentTuberculosis": "Recent Tuberclosis",
"previousCases": "Previous Case",
"visits": "Visits"
}

0 comments on commit 676752d

Please sign in to comment.