Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OHRI-2254 Implement tb homepage dashboard workflows #1885

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,93 +1,16 @@
import React, { useMemo } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { getObsFromEncounter, OHRIPatientListTabs } from '@ohri/openmrs-esm-ohri-commons-lib';
import { getPatientListTabsData, OHRIPatientListTabs } from '@ohri/openmrs-esm-ohri-commons-lib';
import { moduleName } from '../../../index';
import { useConfig } from '@openmrs/esm-framework';
import tbPatientListTabsConfig from './tb-patient-list.config.json';

function TbHomePatientTabs() {
const { t } = useTranslation();
const config = useConfig();
const patientListTabs = getPatientListTabsData(tbPatientListTabsConfig, config);

const tabsConfigs = useMemo(
() => [
{
label: t('allTbClients', 'All TB Clients'),
cohortId: config.cohorts.clientsEnrolledForTb,
isReportingCohort: true,
cohortSlotName: 'clients-assessed-for-covid-tb',
launchableForm: {
editActionText: t('editFollowUpForm', 'Edit TB Follow-up Form'),
editLatestEncounter: true,
targetDashboard: 'tb-assessments',
name: 'TB Follow-up Form',
},
associatedEncounterType: config.encounterTypes.tbProgramEnrollment,
excludeColumns: ['timeAddedToList', 'waitingTime', 'location', 'phoneNumber', 'hivResult'],
extraAssociatedEncounterTypes: [config.encounterTypes.tbTreatmentAndFollowUp],
otherColumns: [
{
key: 'caseID',
header: t('caseID', 'Case ID'),
getValue: ({ latestEncounter }) => {
return getObsFromEncounter(latestEncounter, config.obsConcepts.caseID);
},
index: 1,
},
{
key: 'drugSensitivity',
header: t('drugSensitivity', 'Drug Sensitivity'),
getValue: ({ latestEncounter }) => {
return getObsFromEncounter(latestEncounter, config.obsConcepts.drugSensitivity);
},
},
{
key: 'site',
header: t('siteOfTb,', 'Site of TB'),
getValue: ({ latestEncounter }) => {
return getObsFromEncounter(latestEncounter, config.obsConcepts.site);
},
},
{
key: 'nextAppointmentDate',
header: t('appointmentDate', 'Appointment Date'),
getValue: (patient) => {
const patientLatestExtraEncounters = patient.latestExtraEncounters;
if (patientLatestExtraEncounters && patientLatestExtraEncounters.length) {
const latestFollowUpEncounter = patientLatestExtraEncounters.find(
(encounter) => encounter.encounterType.uuid === config.encounterTypes.tbTreatmentAndFollowUp,
);
return latestFollowUpEncounter
? getObsFromEncounter(latestFollowUpEncounter, config.obsConcepts.nextAppointmentDate, true)
: '--';
} else {
return '--';
}
},
},
{
key: 'outcome',
header: t('outcome', 'Outcome'),
getValue: ({ latestEncounter }) => {
return getObsFromEncounter(latestEncounter, config.obsConcepts.outcome);
},
},
],
viewPatientProgramSummary: true,
},
],
[
config.cohorts.clientsEnrolledForTb,
config.encounterTypes.tbProgramEnrollment,
config.encounterTypes.tbTreatmentAndFollowUp,
config.obsConcepts.caseID,
config.obsConcepts.drugSensitivity,
config.obsConcepts.nextAppointmentDate,
config.obsConcepts.outcome,
config.obsConcepts.site,
t,
],
);
return <OHRIPatientListTabs patientListConfigs={tabsConfigs} moduleName={moduleName} />;
return <OHRIPatientListTabs patientListConfigs={patientListTabs} moduleName={moduleName} />;
}

export default TbHomePatientTabs;
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"menuId": "tbClients",
"tabDefinitions": [
{
"tabName": "All Tb Clients",
"cohortId": "clientsEnrolledForTb",
"isReportingCohort": true,
"cohortSlotName": "clients-assessed-for-covid-tb",
"launchableForm": {
"package": "tb",
"name": "TB Follow-up Form",
"actionText": "Edit TB follow-up form",
"targetDashboard": "tb-assessments"
},
"associatedEncounterType": "tbProgramEnrollment",
"extraAssociatedEncounterTypes": ["tbTreatmentAndFollowUp"],
"excludeColumns": ["timeAddedToList", "waitingTime", "location", "phoneNumber", "hivResult"],
"otherColumns": [
{
"id": "caseID",
"title": "Case ID",
"concept": "caseID",
"index": 1
},
{
"id": "drugSensitivity",
"title": "Drug sensitivity",
"concept": "drugSensitivity"
},
{
"id": "site",
"title": "Site of TB",
"concept": "site"
},
{
"id": "nextAppointmentDate",
"isDate": true,
"title": "Site of TB",
"concept": "nextAppointmentDate"
},
{
"id": "outcome",
"title": "Outcome",
"concept": "outcome"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,65 +1,16 @@
import React, { useMemo } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { getObsFromEncounter, OHRIPatientListTabs } from '@ohri/openmrs-esm-ohri-commons-lib';
import { getPatientListTabsData, OHRIPatientListTabs } from '@ohri/openmrs-esm-ohri-commons-lib';
import { moduleName } from '../../../index';
import { useConfig } from '@openmrs/esm-framework';
import tptPatientListTabsConfig from './tpt-patient-list.config.json';

function TptPatientListTabs() {
const { t } = useTranslation();
const { obsConcepts, encounterTypes, cohorts } = useConfig();
const config = useConfig();
const patientListTabs = getPatientListTabsData(tptPatientListTabsConfig, config);

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,
},
],
[
cohorts.clientsEnrolledForTpt,
encounterTypes.tptCaseEnrollment,
obsConcepts.tptEnrollmentDate,
obsConcepts.tptIndication,
obsConcepts.tptTreatmentId,
t,
],
);
return <OHRIPatientListTabs patientListConfigs={tabsConfigs} moduleName={moduleName} />;
return <OHRIPatientListTabs patientListConfigs={patientListTabs} moduleName={moduleName} />;
}

export default TptPatientListTabs;
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"menuId": "tptClients",
"tabDefinitions": [
{
"tabName": "All Tpt Clients",
"cohortId": "clientsEnrolledForTpt",
"isReportingCohort": true,
"cohortSlotName": "clients-assessed-for-covid-tpt",
"launchableForm": {
"package": "tpt",
"name": "TPT Followup & Treatment form",
"actionText": "Edit TPT Follow-up form",
"targetDashboard": "tb-assessments"
},
"associatedEncounterType": "tptCaseEnrollment",
"excludeColumns": ["timeAddedToList", "waitingTime", "location", "phoneNumber", "hivResult"],
"otherColumns": [
{
"id": "tptTreatmentId",
"title": "TPT Treatment ID",
"concept": "tptTreatmentId",
"index": 1
},
{
"id": "EnrolmentDate",
"isDate": true,
"title": "Enrolment date",
"concept": "tptEnrollmentDate"
},
{
"id": "indication",
"title": "Indication",
"concept": "tptIndication"
}
]
}
]
}
Loading