Skip to content

Commit

Permalink
OHRI-2253 Implement pmtct homepage dashboard workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
CynthiaKamau committed Jun 21, 2024
1 parent ad6e23f commit 54f0eec
Show file tree
Hide file tree
Showing 28 changed files with 198 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -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/';
Expand Down
4 changes: 2 additions & 2 deletions packages/esm-ohri-pmtct-app/src/home.component.tsx
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
6 changes: 3 additions & 3 deletions packages/esm-ohri-pmtct-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
});
Expand Down
10 changes: 0 additions & 10 deletions packages/esm-ohri-pmtct-app/src/pmtct/common.scss

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
39 changes: 39 additions & 0 deletions packages/esm-ohri-pmtct-app/src/pmtct/patient-chart/common.scss
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"tabName": "Visits",
"headerTitle": "Visits",
"displayText": "Visits",
"encounterType": "mchEncounterTypeEncounterType",
"encounterType": "mchEncounterType",
"columns": [
{
"id": "visitType",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
86 changes: 86 additions & 0 deletions packages/esm-ohri-pmtct-app/src/types.ts
Original file line number Diff line number Diff line change
@@ -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<PatientIdentifier>;
person: {
uuid?: string;
names: Array<NameValue>;
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;
};
}

0 comments on commit 54f0eec

Please sign in to comment.