diff --git a/frontend/ohri-config.json b/frontend/ohri-config.json index fb40f87a5..0132c7f77 100644 --- a/frontend/ohri-config.json +++ b/frontend/ohri-config.json @@ -64,7 +64,7 @@ "src": "ohri_logo_light.svg" } }, - "@ohri/openmrs-esm-ohri-pmtct": { + "@ohri/openmrs-esm-ohri-pmtct-app": { "identifiers": { "preferredIdentifierSource": "8549f706-7e85-4c1d-9424-217d50a2988b" }, diff --git a/frontend/spa-build-config.json b/frontend/spa-build-config.json index c2e499174..4312e6843 100644 --- a/frontend/spa-build-config.json +++ b/frontend/spa-build-config.json @@ -36,7 +36,7 @@ "@ohri/openmrs-esm-ohri-hiv-care-treatment-app": "next", "@ohri/openmrs-esm-ohri-hiv-prevention-app": "next", "@ohri/openmrs-esm-ohri-covid-app": "next", - "@ohri/openmrs-esm-ohri-pmtct": "next", + "@ohri/openmrs-esm-ohri-pmtct-app": "next", "@ohri/openmrs-esm-ohri-tb-app": "next", "@ohri/openmrs-esm-ohri-cervical-cancer-app": "next", "@ohri/openmrs-esm-ohri-form-render-app": "next", diff --git a/packages/esm-commons-lib/src/utils/encounter-list-utils.ts b/packages/esm-commons-lib/src/utils/encounter-list-utils.ts index eb6e2d7ca..448591810 100644 --- a/packages/esm-commons-lib/src/utils/encounter-list-utils.ts +++ b/packages/esm-commons-lib/src/utils/encounter-list-utils.ts @@ -1,5 +1,6 @@ import dayjs from 'dayjs'; import { formatDate, parseDate } from '@openmrs/esm-framework'; +import { fetchPatientRelationships } from '../api/api'; export function getEncounterValues(encounter, param: string, isDate?: Boolean) { if (isDate) return dayjs(encounter[param]).format('DD-MMM-YYYY'); @@ -55,6 +56,15 @@ export function getMultipleObsFromEncounter(encounter, obsConcepts: Array p.provider.name).join(' | '); } + if (type === 'mothersName') { + return fetchMotherName(encounter.patient.uuid); + } + if (secondaryConcept && typeof obs.value === 'object' && obs.value.names) { const primaryValue = obs.value.names.find((conceptName) => conceptName.conceptNameType === 'SHORT')?.name || obs.value.name.name; @@ -91,7 +105,7 @@ export function getObsFromEncounter( } } - if (!obs && fallbackConcepts?.length >= 1) { + if (!obs && fallbackConcepts?.length) { const concept = fallbackConcepts.find((c) => findObs(encounter, c) != null); obs = findObs(encounter, concept); } diff --git a/packages/esm-ohri-pmtct-app/CHANGELOG.md b/packages/esm-ohri-pmtct-app/CHANGELOG.md index b26b6eb8e..563ed6ebd 100644 --- a/packages/esm-ohri-pmtct-app/CHANGELOG.md +++ b/packages/esm-ohri-pmtct-app/CHANGELOG.md @@ -5,4 +5,4 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline ## [1.0.9-alpha.1](https://github.com/UCSF-IGHS/openmrs-esm-ohri/compare/v1.0.9-alpha.0...v1.0.9-alpha.1) (2023-06-18) -**Note:** Version bump only for package @ohri/openmrs-esm-ohri-pmtct +**Note:** Version bump only for package @ohri/openmrs-esm-ohri-pmtct-app diff --git a/packages/esm-ohri-pmtct-app/package.json b/packages/esm-ohri-pmtct-app/package.json index 8d110f652..68510dd19 100644 --- a/packages/esm-ohri-pmtct-app/package.json +++ b/packages/esm-ohri-pmtct-app/package.json @@ -1,5 +1,5 @@ { - "name": "@ohri/openmrs-esm-ohri-pmtct", + "name": "@ohri/openmrs-esm-ohri-pmtct-app", "version": "2.3.1", "description": "PMTCT microfrontend for OpenMRS HIV Reference Implementation (OHRI)", "browser": "dist/ohri-pmtct-app.js", diff --git a/packages/esm-ohri-pmtct-app/src/api/api.ts b/packages/esm-ohri-pmtct-app/src/api/api.ts index 13c87b7ba..d38f26583 100644 --- a/packages/esm-ohri-pmtct-app/src/api/api.ts +++ b/packages/esm-ohri-pmtct-app/src/api/api.ts @@ -4,7 +4,7 @@ import useSWR from 'swr'; import { fetchPatientRelationships } from '@ohri/openmrs-esm-ohri-commons-lib'; const BASE_WS_API_URL = '/ws/rest/v1/'; -const config = await getConfig('@ohri/openmrs-esm-ohri-pmtct'); +const config = await getConfig('@ohri/openmrs-esm-ohri-pmtct-app'); export function generateIdentifier(source: string) { return openmrsFetch(`/ws/rest/v1/idgen/identifiersource/${source}/identifier`, { diff --git a/packages/esm-ohri-pmtct-app/src/index.ts b/packages/esm-ohri-pmtct-app/src/index.ts index 0eaf0eea4..b361357df 100644 --- a/packages/esm-ohri-pmtct-app/src/index.ts +++ b/packages/esm-ohri-pmtct-app/src/index.ts @@ -21,7 +21,7 @@ import { createDashboardLink } from '@openmrs/esm-patient-common-lib'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); -export const moduleName = '@ohri/openmrs-esm-ohri-pmtct'; +export const moduleName = '@ohri/openmrs-esm-ohri-pmtct-app'; require('./root.scss'); 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 fa2062bfb..a01386e31 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 @@ -5,7 +5,7 @@ import { PatientIdentifier } from '../api/types'; const ArtSubmissionAction: PostSubmissionAction = { applyAction: async function ({ patient, encounters, sessionMode }) { - const config = await getConfig('@ohri/openmrs-esm-ohri-pmtct'); + const config = await getConfig('@ohri/openmrs-esm-ohri-pmtct-app'); const encounter = encounters[0]; const encounterLocation = encounter.location['uuid']; 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 214d4ecde..2e8918819 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 @@ -17,7 +17,7 @@ export const PTrackerSubmissionAction: PostSubmissionAction = { }; export async function updatePatientPtracker(encounter, encounterLocation, patientUuid) { - const config = await getConfig('@ohri/openmrs-esm-ohri-pmtct'); + const config = await getConfig('@ohri/openmrs-esm-ohri-pmtct-app'); const inComingPTrackerID = encounter.obs.find( (observation) => observation.concept.uuid === config.obsConcepts.pTrackerIdConcept, )?.value; diff --git a/packages/esm-ohri-pmtct-app/src/post-submission-actions/mother-child-linkage-action.ts b/packages/esm-ohri-pmtct-app/src/post-submission-actions/mother-child-linkage-action.ts index 6bb7e7ae5..645cbf4da 100644 --- a/packages/esm-ohri-pmtct-app/src/post-submission-actions/mother-child-linkage-action.ts +++ b/packages/esm-ohri-pmtct-app/src/post-submission-actions/mother-child-linkage-action.ts @@ -47,7 +47,7 @@ export const MotherToChildLinkageSubmissionAction: PostSubmissionAction = { }; async function getPreferredIdentifierSource() { - const config = await getConfig('@ohri/openmrs-esm-ohri-pmtct'); + const config = await getConfig('@ohri/openmrs-esm-ohri-pmtct-app'); return config.identifiers.preferredIdentifierSource; } diff --git a/packages/esm-ohri-pmtct-app/src/views/child-health/child-health-config.json b/packages/esm-ohri-pmtct-app/src/views/child-health/child-health-config.json new file mode 100644 index 000000000..77f59e2aa --- /dev/null +++ b/packages/esm-ohri-pmtct-app/src/views/child-health/child-health-config.json @@ -0,0 +1,77 @@ +{ + "menuId": "childHealth", + "tabDefinitions": [ + { + "tabName": "Infant Postnatal Visit", + "headerTitle": "Infant Postnatal Visit", + "displayText": "Infant Postnatal Visit", + "encounterType": "af1f1b24-d2e8-4282-b308-0bf79b365584", + "columns": [ + { + "id": "pTrackerId", + "title": "PTracker Id", + "concept": "6c45421e-2566-47cb-bbb3-07586fffbfe2" + }, + { + "id": "mothersName", + "title": "Mothers Name", + "type": "mothersName" + }, + { + "id": "artProphylaxisStatus", + "title": "ART Prophylaxis Status", + "concept": "1148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "linkedToArt", + "title": "Linked to ART", + "concept": "a40d8bc4-56b8-4f28-a1dd-412da5cf20ed" + }, + { + "id": "breastfeedingStatus", + "title": "Breastfeeding status", + "concept": "1151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "outcomeStatus", + "title": "Outcome Status", + "concept": "160433AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "nextVisitDate", + "isDate": true, + "title": "Next visit date", + "concept": "5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "actions", + "title": "Actions", + "actionOptions": [ + { + "formName": "Antenatal Form", + "package": "pmtct", + "label": "View Details", + "mode": "view" + }, + { + "formName": "Antenatal Form", + "package": "pmtct", + "label": "Edit Form", + "mode": "edit" + } + ] + } + ], + "launchOptions": { + "displayText": "Add", + "moduleName": "@ohri/openmrs-esm-ohri-pmtct-app" + }, + "formList": [ + { + "name": "Infant - Postanal Form", + "uuid": "5022c5d7-ea45-47ce-bd65-1ba1d8ad2467" + } + ] + } + ] + } \ No newline at end of file diff --git a/packages/esm-ohri-pmtct-app/src/views/child-health/child-health.component.tsx b/packages/esm-ohri-pmtct-app/src/views/child-health/child-health.component.tsx index 8eed1ef48..1d1b3e21d 100644 --- a/packages/esm-ohri-pmtct-app/src/views/child-health/child-health.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/child-health/child-health.component.tsx @@ -1,29 +1,41 @@ import React from 'react'; import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; import styles from '../common.scss'; -import { useTranslation } from 'react-i18next'; -import InfantPostnatalList from './tabs/infant-postnatal-care.component'; +import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; +import childHealthTabConfigSchema from './child-health-config.json'; interface OverviewListProps { patientUuid: string; } -const ChildHealthList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); +const ChildHealthSummary: React.FC = ({ patientUuid }) => { + const tabs = getMenuItemTabConfiguration(childHealthTabConfigSchema); return (
- {t('infantPostnatalVisit', 'Infant Postnatal Visit')} + {tabs.map((tab) => ( + {tab.name} + ))} - - - + {tabs.map((tab) => ( + + + + ))}
); }; -export default ChildHealthList; +export default ChildHealthSummary; 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 deleted file mode 100644 index 922cc67fd..000000000 --- a/packages/esm-ohri-pmtct-app/src/views/child-health/tabs/infant-postnatal-care.component.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import React, { useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { - EncounterList, - EncounterListColumn, - fetchPatientRelationships, - getObsFromEncounter, -} from '@ohri/openmrs-esm-ohri-commons-lib'; -import { moduleName } from '../../..'; -import { useConfig } from '@openmrs/esm-framework'; - -interface InfantPostnatalListProps { - patientUuid: string; -} - -const InfantPostnatalList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const config = useConfig(); - const headerTitle = t('hivExposedInfant', 'HIV Exposed Infant'); - const { encounterTypes, formNames, formUuids } = useConfig(); - - async function fetchMotherName() { - let motherName = '--'; - const response = await fetchPatientRelationships(patientUuid); - if (response.length) { - motherName = response[0].personA.display; - } - return motherName; - } - - const columns: EncounterListColumn[] = useMemo(() => { - return [ - { - key: 'pTrackerId', - header: t('pTrackerId', 'Child PTracker ID'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.pTrackerIdConcept); - }, - }, - { - key: 'mothersName', - header: t('mothersName', 'Mothers Name'), - getValue: async (encounter) => { - return await fetchMotherName(); - }, - }, - { - key: 'artProphylaxisStatus', - header: t('artProphylaxisStatus', 'ART Prophylaxis Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.artProphylaxisStatus); - }, - }, - { - key: 'linkedToArt', - header: t('linkedToArt', 'Linked to ART'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.linkedToArt); - }, - }, - { - key: 'breastfeedingStatus', - header: t('breastfeedingStatus', 'Breastfeeding status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.breastfeedingStatus); - }, - }, - { - key: 'outcomeStatus', - header: t('outcomeStatus', 'Outcome Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.outcomeStatus); - }, - }, - { - key: 'nextVisitDate', - header: t('nextVisitDate', 'Next visit date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.nextVisitDate, true); - }, - }, - { - key: 'actions', - header: t('actions', 'Actions'), - getValue: (encounter) => [ - { - form: { name: 'Infant - Postanal Form', package: 'child_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('viewDetails', 'View Details'), - mode: 'view', - }, - { - form: { name: 'Infant - Postanal Form', package: 'child_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('editForm', 'Edit Form'), - mode: 'edit', - }, - ], - }, - ]; - }, []); - - return ( - - ); -}; - -export default InfantPostnatalList; diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health-config.json b/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health-config.json new file mode 100644 index 000000000..9183d275d --- /dev/null +++ b/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health-config.json @@ -0,0 +1,221 @@ +{ + "menuId": "maternalHealth", + "tabDefinitions": [ + { + "tabName": "Antenatal Care", + "headerTitle": "Antenatal Care", + "displayText": "Antenatal Care", + "encounterType": "677d1a80-dbbe-4399-be34-aa7f54f11405", + "columns": [ + { + "id": "pTrackerId", + "title": "PTracker Id", + "concept": "6c45421e-2566-47cb-bbb3-07586fffbfe2" + }, + { + "id": "visitDate", + "isDate": true, + "title": "Visit Date", + "concept": "163260AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "hivTestStatus", + "title": "HIV Test Status", + "concept": "164401AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "artLinkage", + "title": "ART linkage (if positive)", + "concept": "6e62bf7e-2107-4d09-b485-6e60cbbb2d08" + }, + { + "id": "edd", + "isDate": true, + "title": "EDD", + "concept": "5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "facility", + "title": "Facility", + "type": "location" + }, + { + "id": "followUpDate", + "isDate": true, + "title": "Next follow-up date", + "concept": "5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "vlResults", + "title": "VL Results", + "concept": "1305AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "actions", + "title": "Actions", + "actionOptions": [ + { + "formName": "Antenatal Form", + "package": "pmtct", + "label": "View Details", + "mode": "view" + }, + { + "formName": "Antenatal Form", + "package": "pmtct", + "label": "Edit Form", + "mode": "edit" + } + ] + } + ], + "launchOptions": { + "displayText": "Add", + "moduleName": "@ohri/openmrs-esm-ohri-pmtct-app" + }, + "formList": [ + { + "name": "Antenatal Form", + "uuid": "5255a535-2acb-3f44-bd0a-3f80595dece1" + } + ] + }, + { + "tabName": "Labour and Delivery", + "headerTitle": "Labour and Delivery", + "displayText": "Labour and Delivery", + "encounterType": "6dc5308d-27c9-4d49-b16f-2c5e3c759757", + "columns": [ + { + "id": "pTrackerId", + "title": "PTracker Id", + "concept": "6c45421e-2566-47cb-bbb3-07586fffbfe2" + }, + { + "id": "deliveryDate", + "isDate": true, + "title": "Delivery Date", + "concept": "5599AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "bookedForANC", + "title": "Booked for ANC", + "concept": "1719AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "hivTestStatus", + "title": "HIV Test Status", + "concept": "164401AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "artInitiation", + "isDate": true, + "title": "ART Initiation", + "concept": "159599AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "birthCount", + "title": "Birth Count", + "concept": "1568AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "actions", + "title": "Actions", + "actionOptions": [ + { + "formName": "Labour & Delivery Form", + "package": "pmtct", + "label": "View Details", + "mode": "view" + }, + { + "formName": "Labour & Delivery Form", + "package": "pmtct", + "label": "Edit Form", + "mode": "edit" + } + ] + } + ], + "launchOptions": { + "displayText": "Add", + "moduleName": "@ohri/openmrs-esm-ohri-pmtct-app" + }, + "formList": [ + { + "name": "Labour & Delivery Form", + "uuid": "1e5614d6-5306-11e6-beb8-9e71128cae77" + } + ] + }, + { + "tabName": "Postnatal Care", + "headerTitle": "Postnatal Care", + "displayText": "Postnatal Care", + "encounterType": "269bcc7f-04f8-4ddc-883d-7a3a0d569aad", + "columns": [ + { + "id": "pTrackerId", + "title": "PTracker Id", + "concept": "6c45421e-2566-47cb-bbb3-07586fffbfe2" + }, + { + "id": "visitDate", + "isDate": true, + "title": "Visit Date", + "concept": "163260AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "currentHivStatus", + "title": "Current HIV Status", + "concept": "164401AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "recentViralLoadTestDate", + "isDate": true, + "title": "Recent Viral load test date", + "concept": "163281AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "recentViralLoadResults", + "title": "Recent Viral load results", + "concept": "1305AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "nextVisitDate", + "isDate": true, + "title": "Next visit date", + "concept": "163260AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "actions", + "title": "Actions", + "actionOptions": [ + { + "formName": "Postnatal Care", + "package": "pmtct", + "label": "View Details", + "mode": "view" + }, + { + "formName": "Postnatal Care", + "package": "pmtct", + "label": "Edit Form", + "mode": "edit" + } + ] + } + ], + "launchOptions": { + "displayText": "Add", + "moduleName": "@ohri/openmrs-esm-ohri-pmtct-app" + }, + "formList": [ + { + "name": "Mother - Postnatal Form", + "uuid": "e6b67aa4-6c59-4470-8ad5-b994efeda553" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health.component.tsx b/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health.component.tsx index 95cedbed7..42b420522 100644 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health.component.tsx @@ -1,39 +1,41 @@ import React from 'react'; import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; import styles from '../common.scss'; -import { useTranslation } from 'react-i18next'; -import AntenatalCareList from './tabs/antenatal-care.component'; -import LabourDeliveryList from './tabs/labour-delivery.component'; -import PostnatalCareList from './tabs/postnatal-care.component'; +import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; +import maternalHealthTabConfigSchema from './maternal-health-config.json'; interface OverviewListProps { patientUuid: string; } -const MaternalHealthList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); +const MaternalHealthSummary: React.FC = ({ patientUuid }) => { + const tabs = getMenuItemTabConfiguration(maternalHealthTabConfigSchema); return (
- {t('antenatalCare', 'Antenatal Care')} - {t('labourAndDelivery', 'Labour and Delivery')} - {t('postnatalCare', 'Postnatal Care')} + {tabs.map((tab) => ( + {tab.name} + ))} - - - - - - - - - + {tabs.map((tab) => ( + + + + ))}
); }; -export default MaternalHealthList; +export default MaternalHealthSummary; 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 deleted file mode 100644 index 80644d420..000000000 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/antenatal-care.component.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import React, { useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { EncounterList, EncounterListColumn, getObsFromEncounter } from '@ohri/openmrs-esm-ohri-commons-lib'; -import { moduleName } from '../../../index'; -import { useConfig } from '@openmrs/esm-framework'; - -interface AntenatalCareListProps { - patientUuid: string; -} - -const AntenatalCareList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const config = useConfig(); - const headerTitle = t('antenatalCare', 'Antenatal Care'); - const { encounterTypes, formNames, formUuids } = useConfig(); - - const columns: EncounterListColumn[] = useMemo( - () => [ - { - key: 'pTrackerId', - header: t('pTrackerId', 'PTracker Id'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.pTrackerIdConcept); - }, - }, - { - key: 'visitDate', - header: t('visitDate', 'Visit Date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.visitDateConcept, true); - }, - }, - { - key: 'hivTestStatus', - header: t('hivTestStatus', 'HIV Test Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.hivTestStatus); - }, - }, - { - key: 'artLinkage', - header: t('artLinkage', 'ART linkage (if positive)'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.artInitiationConcept); - }, - }, - { - key: 'edd', - header: t('edd', 'EDD'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.eDDConcept, true); - }, - }, - { - key: 'facility', - header: t('facility', 'Facility'), - getValue: (encounter) => { - return encounter.location.name; - }, - }, - { - key: 'followUpDate', - header: t('followUpDate', 'Next follow-up date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.followUpDateConcept, true); - }, - }, - { - key: 'vlResults', - header: t('vlResults', 'VL Results'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.vLResultsConcept); - }, - }, - { - key: 'actions', - header: t('actions', 'Actions'), - getValue: (encounter) => [ - { - form: { name: 'Antenatal Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('viewDetails', 'View Details'), - mode: 'view', - }, - { - form: { name: 'Antenatal Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('editForm', 'Edit Form'), - mode: 'edit', - }, - ], - }, - ], - [], - ); - - return ( - - ); -}; - -export default AntenatalCareList; 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 deleted file mode 100644 index 9515b21f3..000000000 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/labour-delivery.component.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import React, { useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { EncounterList, EncounterListColumn, getObsFromEncounter } from '@ohri/openmrs-esm-ohri-commons-lib'; -import { moduleName } from '../../../index'; -import { useConfig } from '@openmrs/esm-framework'; - -interface LabourDeliveryListProps { - patientUuid: string; -} - -const LabourDeliveryList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const config = useConfig(); - const headerTitle = t('labourAndDelivery', 'Labour and Delivery'); - const { encounterTypes, formNames, formUuids } = useConfig(); - - const columns: EncounterListColumn[] = useMemo( - () => [ - { - key: 'pTrackerId', - header: t('pTrackerId', 'PTracker Id'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.pTrackerIdConcept); - }, - }, - { - key: 'deliveryDate', - header: t('deliveryDate', 'Delivery Date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.visitDateConcept, true); - }, - }, - { - key: 'bookedForANC', - header: t('bookedForANC', 'Booked for ANC'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.bookedForAncConcept); - }, - }, - { - key: 'hivTestStatus', - header: t('hivTestStatus', 'HIV Test Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.hivTestStatus); - }, - }, - { - key: 'artInitiation', - header: t('artInitiation', 'ART Initiation'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.artInitiationConcept); - }, - }, - { - key: 'birthCount', - header: t('birthCount', 'Birth Count'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.birthCountConcept); - }, - }, - { - key: 'actions', - header: t('actions', 'Actions'), - getValue: (encounter) => [ - { - form: { name: 'Labour & Delivery Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('viewDetails', 'View Details'), - mode: 'view', - }, - { - form: { name: 'Labour & Delivery Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('editForm', 'Edit Form'), - mode: 'edit', - }, - ], - }, - ], - [], - ); - - return ( - - ); -}; - -export default LabourDeliveryList; 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 deleted file mode 100644 index d581da9dd..000000000 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/postnatal-care.component.tsx +++ /dev/null @@ -1,101 +0,0 @@ -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 PostnatalCareListProps { - patientUuid: string; -} - -const PostnatalCareList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const config = useConfig(); - const headerTitle = t('postnatalCare', 'Postnatal Care'); - const { encounterTypes, formNames, formUuids } = useConfig(); - - const columns: EncounterListColumn[] = useMemo( - () => [ - { - key: 'pTrackerId', - header: t('pTrackerId', 'PTracker ID'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.pTrackerIdConcept); - }, - }, - { - key: 'visitDate', - header: t('visitDate', 'Visit Date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.visitDate, true); - }, - }, - { - key: 'currentHivStatus', - header: t('currentHivStatus', 'Current HIV Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.hivTestStatus); - }, - }, - { - key: 'recentViralLoadTestDate', - header: t('recentViralLoadTestDate', 'Recent Viral load test date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.MotherViralLoadDate, true); - }, - }, - { - key: 'recentViralLoadResults', - header: t('recentViralLoadResults', 'Recent Viral load results'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.MotherViralLoadResult); - }, - }, - { - key: 'nextVisitDate', - header: t('nextVisitDate', 'Next visit date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.MotherNextVisitDate, true); - }, - }, - { - key: 'actions', - header: t('actions', 'Actions'), - getValue: (encounter) => [ - { - form: { name: 'Mother - Postnatal Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('viewDetails', 'View Details'), - mode: 'view', - }, - { - form: { name: 'Mother - Postnatal Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('editForm', 'Edit Form'), - mode: 'edit', - }, - ], - }, - ], - [], - ); - - return ( - - ); -}; - -export default PostnatalCareList; diff --git a/yarn.lock b/yarn.lock index 5eb84e3b3..98f8a726e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3015,9 +3015,9 @@ __metadata: languageName: unknown linkType: soft -"@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app": +"@ohri/openmrs-esm-ohri-pmtct-app@workspace:packages/esm-ohri-pmtct-app": version: 0.0.0-use.local - resolution: "@ohri/openmrs-esm-ohri-pmtct@workspace:packages/esm-ohri-pmtct-app" + resolution: "@ohri/openmrs-esm-ohri-pmtct-app@workspace:packages/esm-ohri-pmtct-app" dependencies: "@carbon/react": "npm:^1.13.0" webpack: "npm:^5.88.2"