From cd0f24ba5f8893839f3736d82c616f6b6393e45d Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Fri, 19 Jan 2024 15:52:14 +0300 Subject: [PATCH 1/2] Added auth for publish to npm (#1775) (#1776) --- .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 16faa63a6320dc652cbfb5c36787afe443335f65 Mon Sep 17 00:00:00 2001 From: Amos Laboso Date: Wed, 31 Jan 2024 10:10:18 +0300 Subject: [PATCH 2/2] Dev merging into working (#1793) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added auth for publish to npm (#1775) * 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 * OHRI-2117 Add TPT program menu (#1781) * (chore) remove condition for release on master push (#1778) * OHRI-2109 Add TB Prevention link under Tuberculosis program in the clinical per… (#1782) * Add TB Prevention link under Tuberculosis program in the clinical perspectives * renaming * renaming * 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 * 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 * 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 * Add the Previous TPT Cases Table on the patient summary board (#1790) * OHRI-2123 TPT Enrolment List (#1786) * OHRI-2123 TPT Enrolment List * Exclude Intents in the formList prop * Update config-schema.ts * OHRI-1916 : Maternal visits list should indicate HIV Test status not … (#1791) * OHRI-1916 : Maternal visits list should indicate HIV Test status not HIV test result * add hivTestStatus to transilation * Fix hyperlink on empty table list (#1792) --------- Co-authored-by: AJAL ODORA JONATHAN <43242517+ODORA0@users.noreply.github.com> Co-authored-by: Pius Rubangakene Co-authored-by: lucyjemutai <130601439+lucyjemutai@users.noreply.github.com> Co-authored-by: Hero --- .github/workflows/node.master.js.yml | 2 +- .../cohort-patient-list.component.tsx | 3 + .../cohort-patient-list/helpers.tsx | 49 ++++++ .../ohri-patient-list-tabs.component.tsx | 1 + .../tabs/antenatal-care.component.tsx | 6 +- .../esm-ohri-pmtct-app/translations/en.json | 1 + packages/esm-tb-app/src/config-schema.ts | 22 +++ packages/esm-tb-app/src/dashboard.meta.tsx | 33 +++- packages/esm-tb-app/src/index.ts | 45 +++++ packages/esm-tb-app/src/routes.json | 102 +++++++++++- packages/esm-tb-app/src/tb-helper.ts | 42 ++--- .../tpt-patient-list-tabs.component.tsx | 58 +++++++ .../tpt-summary-tiles.component.tsx | 22 +++ .../patient-summary.component.tsx | 157 ++++++++++++++++++ .../tabs/tpt-enrolment.component.tsx | 118 +++++++++++++ .../tabs/tpt-treatment.component copy.tsx | 21 +++ .../tpt-program-management.tsx | 31 ++++ packages/esm-tb-app/translations/en.json | 15 +- 18 files changed, 697 insertions(+), 31 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 create mode 100644 packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx 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/.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 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-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", diff --git a/packages/esm-tb-app/src/config-schema.ts b/packages/esm-tb-app/src/config-schema.ts index f3a3121c0..c4771d9d3 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,16 @@ export const configSchema = { tBEnrollmentType: '163775AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', dsTBEnrollment: '160541AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', dRTBEnrollment: '160052AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptTreatmentId: '162727AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptEnrollmentDate: '164852AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptIndication: '162276AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptRegimen: '1264AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptAppointmentDate: '5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptAdherence: '164075AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptTreatmentStartDate: '162320AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptOutcome: '1266AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptOutcomeDate: '163284AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptDateOutcome: '163284AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', }, }, cohorts: { @@ -54,6 +66,15 @@ export const configSchema = { _description: 'TB Cohort uuid.', _default: { clientsEnrolledForTb: '98fd11ba-cb4d-46f7-9b82-40d49949c7ef', + clientsEnrolledForTpt: '5f28254f-0a80-4d15-ad91-68c6cf5ea715', + }, + }, + formNames: { + _type: Type.Object, + _description: 'TPT Form Names.', + _default: { + TptOutcomeFormName: 'TPT outcome form', + TptCaseEnrolmentFormName: 'TPT Case Enrolment form', }, }, }; @@ -62,4 +83,5 @@ export interface ConfigObject { identifiers: Object; encounterTypes: Object; obsConcepts: Object; + formNames: Object; } diff --git a/packages/esm-tb-app/src/dashboard.meta.tsx b/packages/esm-tb-app/src/dashboard.meta.tsx index 0be3c3498..e9e5fe372 100644 --- a/packages/esm-tb-app/src/dashboard.meta.tsx +++ b/packages/esm-tb-app/src/dashboard.meta.tsx @@ -44,11 +44,38 @@ 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', 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, -}; \ No newline at end of file +}; + +export const tptPatientChartMeta = { + title: 'TPT Program', + slotName: 'ohri-tpt-slot', + 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, + 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..0845760dd 100644 --- a/packages/esm-tb-app/src/index.ts +++ b/packages/esm-tb-app/src/index.ts @@ -9,6 +9,10 @@ import { tbTreatmentFollowUpDashboardMeta, tbClinicalViewDashboardMeta, tbCasesDashboardMeta, + tptProgramManagementDashboardMeta, + tptPatientChartMeta, + tptPatientSummaryMeta, + tbPreventionDashboardMeta, } from './dashboard.meta'; import { configSchema } from './config-schema'; import TBSummaryOverviewList from './views/patient-summary/tb-patient-summary.component'; @@ -17,6 +21,10 @@ 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'; +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'); @@ -35,6 +43,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, @@ -83,6 +93,36 @@ 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 }), + options, +); +export const tptPatientSummaryDashboard = getSyncLifecycle(tptPatientSummary, { + featureName: 'tpt-patient-summary', + 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( @@ -94,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 2fd34a6b9..53154a6a4 100644 --- a/packages/esm-tb-app/src/routes.json +++ b/packages/esm-tb-app/src/routes.json @@ -22,7 +22,24 @@ "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", "slot": "ohri-tb-slot", @@ -57,6 +74,41 @@ "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", + "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", @@ -100,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", @@ -145,6 +228,21 @@ "name": "tb-home-tabs-ext", "slot": "tb-home-tabs-slot", "component": "tbDashboardTabs" - } + }, + { + "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/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/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..15f20b8bb --- /dev/null +++ b/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tpt-patient-list-tabs.component.tsx @@ -0,0 +1,58 @@ +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'; + +function TptPatientListTabs() { + const { t } = useTranslation(); + 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/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/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..f6d9e076b --- /dev/null +++ b/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx @@ -0,0 +1,157 @@ +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 { moduleName } from '../../..'; + +const TptPatientSummary: React.FC = ({ patientUuid }) => { + const { t } = useTranslation(); + const { obsConcepts, encounterTypes } = useConfig(); + + const headerRecentTPT = t('recentTptCases', 'Recent TPT Cases'); + const headerPreviousTptCases = t('previousTptCases', 'Previous TPT Cases'); + const headerVisit = t('visits', 'Visits'); + + 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); + }, + }, + ], + [], + ); + + 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 ( + <> + + + + + ); +}; + +export default TptPatientSummary; 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..33d2b0a98 --- /dev/null +++ b/packages/esm-tb-app/src/views/tpt/program-management/tabs/tpt-enrolment.component.tsx @@ -0,0 +1,118 @@ +import React, { useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; +import { EncounterList, EncounterListColumn, getObsFromEncounter } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { moduleName } from '../../../..'; +import { useConfig } from '@openmrs/esm-framework'; + +interface TptEnrolmentListProps { + patientUuid: string; +} + +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 ( + + ); +}; + +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..c14edd9e7 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -28,5 +28,18 @@ "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", + "patientSummary": "Patient Summary", + "allTptClients": "All TPT Clients", + "currentTptClients": "Clients Currently on TPT", + "tptTreatmentId": "TPT Treatment ID", + "indication": "Indication", + "tptAdherence": "Adherence", + "nextAppointmentDate": "Next Appointment Date", + "previousTptCases": "Previous TPT Cases", + "recentTptCases": "Recent TPT Cases", + "editTptFollowUpForm": "Edit TPT Follow-up form", + "dateOutcome": "Date of Outcome" }