Skip to content

Commit

Permalink
OHRI-2119: Populate the Recent TPT tiles on the TPT patient summary b…
Browse files Browse the repository at this point in the history
…oard (#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
  • Loading branch information
lucyjemutai authored Jan 24, 2024
1 parent 9786b9b commit 8397b2c
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 10 deletions.
8 changes: 8 additions & 0 deletions packages/esm-tb-app/src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<TptPatientSummaryProps> = ({ patientUuid }) => {
const TptPatientSummary: React.FC<PatientChartProps> = ({ 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 (
<>
<EmptyStateComingSoon displayText={headerTitle} headerTitle={headerTitle} />
<SummaryCard
patientUuid={patientUuid}
headerTitle={headerRecentTPT}
columns={recentTbPreventionColumns}
maxRowItems={4}
/>
<EmptyStateComingSoon displayText={headerPreviousCases} headerTitle={headerPreviousCases}/>
</>
);
};
Expand Down
9 changes: 8 additions & 1 deletion packages/esm-tb-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"

}

0 comments on commit 8397b2c

Please sign in to comment.