From 54f0eecd3684c2a6c2658b969150b69d960d1aab Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Fri, 21 Jun 2024 11:28:38 +0300 Subject: [PATCH] OHRI-2253 Implement pmtct homepage dashboard workflows --- .../src/{ => api}/api.resource.ts | 2 +- .../esm-ohri-pmtct-app/src/home.component.tsx | 4 +- packages/esm-ohri-pmtct-app/src/index.ts | 6 +- .../esm-ohri-pmtct-app/src/pmtct/common.scss | 10 --- ...maternal-child-summary-tiles.component.tsx | 0 .../mother-child-summary-tabs.component.tsx | 3 +- .../home-dashboard/ohri-patient-tabs.scss | 56 ++++++++++++ .../child-health/child-health-config.json | 0 .../child-health/child-health.component.tsx | 0 .../src/pmtct/patient-chart/common.scss | 39 +++++++++ .../maternal-health-config.json | 0 .../maternal-health.component.tsx | 0 .../mch-summary/mch-summary.component.tsx | 0 .../mch-summary/tabs/appointments-config.json | 0 .../mch-summary/tabs/arv-therapy-config.json | 0 .../tabs/current-pregnancy.component.tsx | 2 +- .../hiv-exposed-family-summary-config.json | 0 .../hiv-exposed-infant-summary-config.json | 0 .../tabs/hiv-exposed-infant.component.tsx | 2 +- .../tabs/infant-summary-config.json | 0 .../tabs/mother-previous-visit.json | 2 +- .../tabs/recent-pregnancy-config.json | 0 .../medications/medications.components.tsx | 0 .../pmtct/summary-tabs/ohri-patient-tabs.scss | 13 --- .../art-linkage-action.ts | 4 +- .../current-ptracker-action.ts | 4 +- .../mother-child-linkage-action.ts | 6 +- packages/esm-ohri-pmtct-app/src/types.ts | 86 +++++++++++++++++++ 28 files changed, 198 insertions(+), 41 deletions(-) rename packages/esm-ohri-pmtct-app/src/{ => api}/api.resource.ts (99%) delete mode 100644 packages/esm-ohri-pmtct-app/src/pmtct/common.scss rename packages/esm-ohri-pmtct-app/src/pmtct/{summary-tabs => home-dashboard}/maternal-child-summary-tiles.component.tsx (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{summary-tabs => home-dashboard}/mother-child-summary-tabs.component.tsx (90%) create mode 100644 packages/esm-ohri-pmtct-app/src/pmtct/home-dashboard/ohri-patient-tabs.scss rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/child-health/child-health-config.json (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/child-health/child-health.component.tsx (100%) create mode 100644 packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/common.scss rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/maternal-health/maternal-health-config.json (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/maternal-health/maternal-health.component.tsx (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/mch-summary.component.tsx (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/tabs/appointments-config.json (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/tabs/arv-therapy-config.json (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/tabs/current-pregnancy.component.tsx (99%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/tabs/hiv-exposed-family-summary-config.json (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/tabs/hiv-exposed-infant-summary-config.json (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/tabs/hiv-exposed-infant.component.tsx (98%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/tabs/infant-summary-config.json (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/tabs/mother-previous-visit.json (97%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/mch-summary/tabs/recent-pregnancy-config.json (100%) rename packages/esm-ohri-pmtct-app/src/pmtct/{ => patient-chart}/medications/medications.components.tsx (100%) delete mode 100644 packages/esm-ohri-pmtct-app/src/pmtct/summary-tabs/ohri-patient-tabs.scss create mode 100644 packages/esm-ohri-pmtct-app/src/types.ts diff --git a/packages/esm-ohri-pmtct-app/src/api.resource.ts b/packages/esm-ohri-pmtct-app/src/api/api.resource.ts similarity index 99% rename from packages/esm-ohri-pmtct-app/src/api.resource.ts rename to packages/esm-ohri-pmtct-app/src/api/api.resource.ts index f7cff4191..8532888e7 100644 --- a/packages/esm-ohri-pmtct-app/src/api.resource.ts +++ b/packages/esm-ohri-pmtct-app/src/api/api.resource.ts @@ -1,5 +1,5 @@ import { openmrsFetch, getConfig } from '@openmrs/esm-framework'; -import { type Patient, type PatientIdentifier, type Relationship } from './types'; +import { type Patient, type PatientIdentifier, type Relationship } from '../types'; import { fetchPatientRelationships } from '@ohri/openmrs-esm-ohri-commons-lib'; const BASE_WS_API_URL = '/ws/rest/v1/'; diff --git a/packages/esm-ohri-pmtct-app/src/home.component.tsx b/packages/esm-ohri-pmtct-app/src/home.component.tsx index 00094614b..1ccf3d4d9 100644 --- a/packages/esm-ohri-pmtct-app/src/home.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/home.component.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; -import MaternalChildSummaryTiles from './pmtct/summary-tabs/maternal-child-summary-tiles.component'; -import MotherChildSummary from './pmtct/summary-tabs/mother-child-summary-tabs.component'; +import MaternalChildSummaryTiles from './pmtct/home-dashboard/maternal-child-summary-tiles.component'; +import MotherChildSummary from './pmtct/home-dashboard/mother-child-summary-tabs.component'; const Home: React.FC = () => { return ( diff --git a/packages/esm-ohri-pmtct-app/src/index.ts b/packages/esm-ohri-pmtct-app/src/index.ts index 2dce511f5..16710798b 100644 --- a/packages/esm-ohri-pmtct-app/src/index.ts +++ b/packages/esm-ohri-pmtct-app/src/index.ts @@ -1,6 +1,6 @@ import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework'; -import MaternalHealthList from './pmtct/maternal-health/maternal-health.component'; -import ChildHealthList from './pmtct/child-health/child-health.component'; +import MaternalHealthList from './pmtct/patient-chart/maternal-health/maternal-health.component'; +import ChildHealthList from './pmtct/patient-chart/child-health/child-health.component'; import { mchSummaryDashboardMeta, maternalVisitsDashboardMeta, @@ -64,7 +64,7 @@ export const mchSummaryDashboardLink = getSyncLifecycle( options, ); -export const mchSummaryDashboard = getAsyncLifecycle(() => import('./pmtct/mch-summary/mch-summary.component'), { +export const mchSummaryDashboard = getAsyncLifecycle(() => import('./pmtct/patient-chart/mch-summary/mch-summary.component'), { featureName: 'mch-summary', moduleName, }); diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/common.scss b/packages/esm-ohri-pmtct-app/src/pmtct/common.scss deleted file mode 100644 index 733dbee41..000000000 --- a/packages/esm-ohri-pmtct-app/src/pmtct/common.scss +++ /dev/null @@ -1,10 +0,0 @@ -@use '@carbon/styles/scss/spacing'; -@import '../root.scss'; - -.tabContainer div[role='tabpanel'] { - padding: 0 !important; -} - -.tabContainer li button { - width: 100% !important; -} diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/summary-tabs/maternal-child-summary-tiles.component.tsx b/packages/esm-ohri-pmtct-app/src/pmtct/home-dashboard/maternal-child-summary-tiles.component.tsx similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/summary-tabs/maternal-child-summary-tiles.component.tsx rename to packages/esm-ohri-pmtct-app/src/pmtct/home-dashboard/maternal-child-summary-tiles.component.tsx diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/summary-tabs/mother-child-summary-tabs.component.tsx b/packages/esm-ohri-pmtct-app/src/pmtct/home-dashboard/mother-child-summary-tabs.component.tsx similarity index 90% rename from packages/esm-ohri-pmtct-app/src/pmtct/summary-tabs/mother-child-summary-tabs.component.tsx rename to packages/esm-ohri-pmtct-app/src/pmtct/home-dashboard/mother-child-summary-tabs.component.tsx index d0bcd40ea..15a616195 100644 --- a/packages/esm-ohri-pmtct-app/src/pmtct/summary-tabs/mother-child-summary-tabs.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/pmtct/home-dashboard/mother-child-summary-tabs.component.tsx @@ -1,10 +1,9 @@ import React from 'react'; import { Tabs, Tab, TabPanels, TabPanel, TabList } from '@carbon/react'; +import styles from './ohri-patient-tabs.scss'; import { useTranslation } from 'react-i18next'; import { PatientList } from '@ohri/openmrs-esm-ohri-commons-lib'; -import styles from '../summary-tabs/ohri-patient-tabs.scss'; - const MotherChildSummary: React.FC = () => { const { t } = useTranslation(); return ( diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/home-dashboard/ohri-patient-tabs.scss b/packages/esm-ohri-pmtct-app/src/pmtct/home-dashboard/ohri-patient-tabs.scss new file mode 100644 index 000000000..b1abc6e71 --- /dev/null +++ b/packages/esm-ohri-pmtct-app/src/pmtct/home-dashboard/ohri-patient-tabs.scss @@ -0,0 +1,56 @@ +@use '@carbon/styles/scss/spacing'; +@import '../../root.scss'; + +.widgetContainer { + background-color: $ui-background; +} + +.widgetHeaderContainer { + display: flex; + justify-content: space-between; + align-items: center; + padding: spacing.$spacing-04 0 spacing.$spacing-04 spacing.$spacing-05; +} + +.widgetHeaderContainer > h4:after { + content: ''; + display: block; + width: 2rem; + padding-top: 0.188rem; + border-bottom: 0.375rem solid var(--brand-01); +} + +.toggleButtons { + width: fit-content; + margin: 0 spacing.$spacing-03; +} + +.searchField { + width: 100%; + max-width: 250px; + border: 0px !important; +} + +.searchBox { + width: 100%; + display: flex; + justify-content: right; +} + +.container { + margin-top: 16px; + margin-left: inherit; + width: 100%; + overflow-y: hidden; +} + +.tabContainer{ + margin-top: 16px; + padding-left: 1rem; + background-color: #ffffff; + +} + +.tabContainer li button{ + width: 100% !important; +} diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/child-health/child-health-config.json b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/child-health/child-health-config.json similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/child-health/child-health-config.json rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/child-health/child-health-config.json diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/child-health/child-health.component.tsx b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/child-health/child-health.component.tsx similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/child-health/child-health.component.tsx rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/child-health/child-health.component.tsx diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/common.scss b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/common.scss new file mode 100644 index 000000000..c18064deb --- /dev/null +++ b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/common.scss @@ -0,0 +1,39 @@ +@use '@carbon/styles/scss/spacing'; +@import '../../root.scss'; + +.widgetContainer { + background-color: $ui-background; +} + +.widgetHeaderContainer { + display: flex; + justify-content: space-between; + align-items: center; + padding: spacing.$spacing-04 0 spacing.$spacing-04 spacing.$spacing-05; +} + +.widgetHeaderContainer > h4:after { + content: ''; + display: block; + width: 2rem; + padding-top: 0.188rem; + border-bottom: 0.375rem solid var(--brand-01); +} + +.toggleButtons { + width: fit-content; + margin: 0 spacing.$spacing-03; +} + +.tabContainer div[role='tabpanel'] { + padding: 0 !important; +} + +.tabContainer li button { + width: 100% !important; + } + + + .hivStatusTag { + min-width: 80px; + } diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/maternal-health/maternal-health-config.json b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/maternal-health/maternal-health-config.json similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/maternal-health/maternal-health-config.json rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/maternal-health/maternal-health-config.json diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/maternal-health/maternal-health.component.tsx b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/maternal-health/maternal-health.component.tsx similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/maternal-health/maternal-health.component.tsx rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/maternal-health/maternal-health.component.tsx diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/mch-summary.component.tsx b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/mch-summary.component.tsx similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/mch-summary.component.tsx rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/mch-summary.component.tsx diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/appointments-config.json b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/appointments-config.json similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/appointments-config.json rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/appointments-config.json diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/arv-therapy-config.json b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/arv-therapy-config.json similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/arv-therapy-config.json rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/arv-therapy-config.json diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/current-pregnancy.component.tsx b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/current-pregnancy.component.tsx similarity index 99% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/current-pregnancy.component.tsx rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/current-pregnancy.component.tsx index 4b6724ad1..b877980b5 100644 --- a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/current-pregnancy.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/current-pregnancy.component.tsx @@ -14,11 +14,11 @@ import { import dayjs from 'dayjs'; import { Link } from '@carbon/react'; import { navigate, useConfig } from '@openmrs/esm-framework'; -import { fetchPatientIdentifiers, fetchChildLatestFinalOutcome } from '../../../api.resource'; import recentPregnancyConfigSchema from './recent-pregnancy-config.json'; import appointmentSummaryConfigSchema from './appointments-config.json'; import arvTherapyColumnsConfigSchema from './arv-therapy-config.json'; import motherPreviousVisitConfigSchema from './mother-previous-visit.json'; +import { fetchChildLatestFinalOutcome, fetchPatientIdentifiers } from '../../../../api/api.resource'; interface pregnancyOutcomeProps { id: string; diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/hiv-exposed-family-summary-config.json b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/hiv-exposed-family-summary-config.json similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/hiv-exposed-family-summary-config.json rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/hiv-exposed-family-summary-config.json diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/hiv-exposed-infant-summary-config.json b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/hiv-exposed-infant-summary-config.json similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/hiv-exposed-infant-summary-config.json rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/hiv-exposed-infant-summary-config.json diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/hiv-exposed-infant.component.tsx b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/hiv-exposed-infant.component.tsx similarity index 98% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/hiv-exposed-infant.component.tsx rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/hiv-exposed-infant.component.tsx index 741a31153..e4cd81fd8 100644 --- a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/hiv-exposed-infant.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/hiv-exposed-infant.component.tsx @@ -16,7 +16,7 @@ import { type familyItemProps } from './current-pregnancy.component'; import hivExposedInfantSummary from './hiv-exposed-infant-summary-config.json'; import hivExposedFamilySummary from './hiv-exposed-family-summary-config.json'; import hivExposedInfantConfigSchema from './infant-summary-config.json'; -import { fetchPatientIdentifiers } from '../../../api.resource'; +import { fetchPatientIdentifiers } from '../../../../api/api.resource'; const HivExposedInfant: React.FC<{ patientUuid: string; diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/infant-summary-config.json b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/infant-summary-config.json similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/infant-summary-config.json rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/infant-summary-config.json diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/mother-previous-visit.json b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/mother-previous-visit.json similarity index 97% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/mother-previous-visit.json rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/mother-previous-visit.json index baa1a444d..be37e4d71 100644 --- a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/mother-previous-visit.json +++ b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/mother-previous-visit.json @@ -5,7 +5,7 @@ "tabName": "Visits", "headerTitle": "Visits", "displayText": "Visits", - "encounterType": "mchEncounterTypeEncounterType", + "encounterType": "mchEncounterType", "columns": [ { "id": "visitType", diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/recent-pregnancy-config.json b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/recent-pregnancy-config.json similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/mch-summary/tabs/recent-pregnancy-config.json rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/mch-summary/tabs/recent-pregnancy-config.json diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/medications/medications.components.tsx b/packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/medications/medications.components.tsx similarity index 100% rename from packages/esm-ohri-pmtct-app/src/pmtct/medications/medications.components.tsx rename to packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/medications/medications.components.tsx diff --git a/packages/esm-ohri-pmtct-app/src/pmtct/summary-tabs/ohri-patient-tabs.scss b/packages/esm-ohri-pmtct-app/src/pmtct/summary-tabs/ohri-patient-tabs.scss deleted file mode 100644 index c150958b8..000000000 --- a/packages/esm-ohri-pmtct-app/src/pmtct/summary-tabs/ohri-patient-tabs.scss +++ /dev/null @@ -1,13 +0,0 @@ -@use '@carbon/styles/scss/spacing'; -@import '../../root.scss'; - -.tabContainer{ - margin-top: 16px; - padding-left: 1rem; - background-color: #ffffff; - -} - -.tabContainer li button{ - width: 100% !important; -} 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 9410eece6..681dc4296 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 @@ -1,7 +1,7 @@ import { type PostSubmissionAction } from '@openmrs/openmrs-form-engine-lib'; import { getConfig } from '@openmrs/esm-framework'; -import { fetchPatientIdentifiers, saveIdentifier } from '../api.resource'; -import { type PatientIdentifier } from '../types'; +import { PatientIdentifier } from '../types'; +import { fetchPatientIdentifiers, saveIdentifier } from '../api/api.resource'; const ArtSubmissionAction: PostSubmissionAction = { applyAction: async function ({ patient, encounters, sessionMode }) { 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 74294c284..be3729892 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 @@ -1,6 +1,6 @@ import { type PostSubmissionAction } from '@openmrs/openmrs-form-engine-lib'; -import { fetchPatientIdentifiers, saveIdentifier } from '../api.resource'; -import { type PatientIdentifier } from '../types'; +import { fetchPatientIdentifiers, saveIdentifier } from '../api/api.resource'; +import { Patient, PatientIdentifier } from '../types'; import { getConfig } from '@openmrs/esm-framework'; export const PTrackerSubmissionAction: PostSubmissionAction = { 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 e2ba6adc8..fbb6086be 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 @@ -1,6 +1,6 @@ -import { type PostSubmissionAction } from '@openmrs/openmrs-form-engine-lib'; -import { generateIdentifier, savePatients, saveRelationship } from '../api.resource'; -import { type Patient, type PatientIdentifier } from '../types'; +import { PostSubmissionAction } from '@openmrs/openmrs-form-engine-lib'; +import { generateIdentifier, savePatients, saveRelationship } from '../api/api.resource'; +import { Patient, PatientIdentifier } from '../types'; import { findObsByConcept, findChildObsInTree, getObsValueCoded } from '../utils/obs-encounter-utils'; import { updatePatientPtracker } from './current-ptracker-action'; import { getConfig } from '@openmrs/esm-framework'; diff --git a/packages/esm-ohri-pmtct-app/src/types.ts b/packages/esm-ohri-pmtct-app/src/types.ts new file mode 100644 index 000000000..e8ba0aada --- /dev/null +++ b/packages/esm-ohri-pmtct-app/src/types.ts @@ -0,0 +1,86 @@ +export interface Location { + uuid: string; + display: string; + name: string; + description?: string; + address1?: string; + address2?: string; + cityVillage?: string; + stateProvince?: string; + country?: string; + postalCode?: string; + latitude?: string; + longitude?: string; + countryDistrict?: string; + address3?: string; + address4?: string; + address5?: string; + address6?: string; +} + +export interface Concept { + uuid: string; + display: string; + answers?: Concept[]; +} + +export type Relationship = { + relationshipType: string; + personA: string; + personB: string; +}; + +export interface PatientIdentifier { + uuid?: string; + identifier: string; + identifierType?: string; + location?: string; + preferred?: boolean; +} + +interface NameValue { + uuid?: string; + preferred: boolean; + givenName: string; + middleName: string; + familyName: string; +} +export interface AttributeValue { + attributeType: string; + value: string; +} + +export type Patient = { + uuid?: string; + identifiers: Array; + person: { + uuid?: string; + names: Array; + gender: string; + birthdate: string; + birthdateEstimated: boolean; + dead: boolean; + deathDate?: string; + causeOfDeath?: string; + }; +}; + +export interface RelationshipValue { + relatedPersonName?: string; + relatedPersonUuid: string; + relation?: string; + relationshipType: string; + action?: 'ADD' | 'UPDATE' | 'DELETE'; + initialrelationshipTypeValue?: string; + uuid?: string; +} + +export interface AncVisitsReport { + uuid: string; + rows: Array<{ total: number }>; + definition: { + uuid?: string; + name?: string; + description?: string; + }; +}