Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
kajambiya authored and CynthiaKamau committed Oct 4, 2024
1 parent a274d65 commit 259faab
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 429 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import { useConfig } from '@openmrs/esm-framework';
import { getEncounterTileColumns } from '../../encounter-tile/utils/encounter-tile-config-builder';
import { EncounterTile, type EncounterTileColumn } from '../../encounter-tile/components/encounter-tile.component';

interface OverviewListProps {
patientUuid: string;
}

interface TileDefinition {
title: string;
columns: Array<EncounterTileColumn>;
}

const PatientSummaryOverviewList: React.FC<OverviewListProps> = ({ patientUuid }) => {
const config = useConfig();

const tilesDefinitions = config.tilesDefinitions;

const tilesData: Array<TileDefinition> = tilesDefinitions.map((tile: any) => ({
title: tile.tileHeader,
columns: getEncounterTileColumns(tile),
}));

return (
<>
{tilesData.map((tile, index) => (
<EncounterTile key={index} patientUuid={patientUuid} columns={tile.columns} headerTitle={tile.title} />
))}
</>
);
};

export default PatientSummaryOverviewList;
13 changes: 0 additions & 13 deletions packages/esm-patient-chart-app/src/dashboard.meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,3 @@ export const encountersDashboardMeta = {
path: 'Visits',
title: 'Visits',
};

//clinical views
export const hivPatientSummaryDashboardMeta = {
slot: 'hiv-care-and-treatment-group-slot',
path: 'hiv-patient-summary',
title: 'HIV Patient Summary',
};

export const programManagementDashboardMeta = {
slot: 'hiv-care-and-treatment-group-slot',
path: 'hiv-program-management',
title: 'HIV Program Management',
};
11 changes: 0 additions & 11 deletions packages/esm-patient-chart-app/src/encounter-list/api.resource.ts

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CodeSnippetSkeleton, Tile, Column } from '@carbon/react';
import React from 'react';
import styles from './tile.scss';
import { LazyCell } from '../lazy-cell/lazy-cell.component';
import { LazyCell } from '../../lazy-cell/lazy-cell.component';
import { useLastEncounter } from '../hooks/useLastEncounter';

export interface EncounterTileColumn {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@use '@openmrs/esm-styleguide/src/vars' as *;

.title {
@include type.productiveHeading03;
@include type.type-style('productive-heading-03');
}

.title:after {
Expand All @@ -21,7 +21,7 @@
}

.tile {
height: 100%;
height: 35%;
padding: layout.$spacing-01 0 layout.$spacing-05 layout.$spacing-05;
margin: layout.$spacing-03;
border: solid 1px #e0e0e0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { openmrsFetch } from '@openmrs/esm-framework';
import { type OpenmrsEncounter } from '../../../esm-patient-common-lib/src/types';
import { type OpenmrsEncounter } from '@openmrs/esm-patient-common-lib';

import useSWR from 'swr';

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getConceptFromMappings, getObsFromEncounter } from './encounter-list-utils';
import { extractSchemaValues, replaceWithConfigDefaults } from './shema-manipulation';
import { getConceptFromMappings, getObsFromEncounter } from './helpers';

interface MenuCardProps {
title: string;
Expand All @@ -21,6 +20,9 @@ interface ColumnDefinition {
hasSummary?: boolean;
conceptMappings?: Array<string>;
summaryConcept?: SummaryConcept;
isTrueFalseConcept?: boolean;
type: string;
fallbackConcepts?: Array<string>;
}

interface FormattedCardColumn {
Expand All @@ -39,11 +41,8 @@ const calculateDateDifferenceInDate = (givenDate: string): string => {
return `${totalDays} days`;
};

export const getEncounterTileColumns = (schemaConfig: MenuCardProps, config = null) => {
const configDefaults = extractSchemaValues(config);
const transformedSchemaConfig = replaceWithConfigDefaults(schemaConfig, configDefaults);

const columns: Array<FormattedCardColumn> = transformedSchemaConfig.columns?.map((column) => ({
export const getEncounterTileColumns = (tileDefinition: MenuCardProps) => {
const columns: Array<FormattedCardColumn> = tileDefinition.columns?.map((column) => ({
key: column.id,
header: column.title,
concept: column.concept,
Expand Down Expand Up @@ -78,7 +77,7 @@ export const getEncounterTileColumns = (schemaConfig: MenuCardProps, config = nu
const primaryDate = getObsFromEncounter(
encounter,
column.summaryConcept.primaryConcept,
column.summaryConcept.hasDate,
column.summaryConcept.isDate,
);

if (primaryDate !== '--') {
Expand All @@ -88,7 +87,7 @@ export const getEncounterTileColumns = (schemaConfig: MenuCardProps, config = nu
}
}

return getObsFromEncounter(encounter, column.summaryConcept.primaryConcept, column.summaryConcept.hasDate);
return getObsFromEncounter(encounter, column.summaryConcept.primaryConcept, column.summaryConcept.isDate);
}
: null,
}));
Expand Down
39 changes: 4 additions & 35 deletions packages/esm-patient-chart-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ import { genericDashboardConfigSchema } from './side-nav/generic-dashboard.compo
import { genericNavGroupConfigSchema } from './side-nav/generic-nav-group.component';
import { moduleName } from './constants';
import { setupOfflineVisitsSync, setupCacheableRoutes } from './offline';
import {
summaryDashboardMeta,
encountersDashboardMeta,
hivPatientSummaryDashboardMeta,
programManagementDashboardMeta,
} from './dashboard.meta';
import { summaryDashboardMeta, encountersDashboardMeta } from './dashboard.meta';
import addPastVisitActionButtonComponent from './actions-buttons/add-past-visit.component';
import cancelVisitActionButtonComponent from './actions-buttons/cancel-visit.component';
import currentVisitSummaryComponent from './visit/visits-widget/current-visit-summary.component';
Expand All @@ -35,9 +30,7 @@ import startVisitActionButtonOnPatientSearch from './visit/start-visit-button.co
import startVisitFormComponent from './visit/visit-form/visit-form.component';
import stopVisitActionButtonComponent from './actions-buttons/stop-visit.component';
import visitAttributeTagsComponent from './patient-banner-tags/visit-attribute-tags.component';
import { PatientSummaryCardContainer } from './patient-summary/patient-summary.component';
import { ProgramManagement } from './patient-summary/program-management.component';
import HIVSummaryOverviewList from './patient-summary/patient-hiv-encounter-summary.component';
import PatientSummaryOverviewList from './clinical-views/components/patient-program-summary.component';

// This allows @openmrs/esm-patient-common-lib to be accessed by modules that are not
// using webpack. This is used for ngx-formentry.
Expand Down Expand Up @@ -119,17 +112,9 @@ export const stopVisitPatientSearchActionButton = getSyncLifecycle(stopVisitActi
featureName: 'patient-actions-slot',
moduleName,
});
// export const patientSummaryCardContainer = getSyncLifecycle(PatientSummaryCardContainer, {
// featureName: 'encounter-tiles-group',
// moduleName,
// });
export const patientSummaryCardContainer = getSyncLifecycle(HIVSummaryOverviewList, {
featureName: 'encounter-tiles-group',
moduleName,
});

export const programManagementComponent = getSyncLifecycle(ProgramManagement, {
featureName: 'encounter-list-table-tabs',
export const patientProgramSummary = getSyncLifecycle(PatientSummaryOverviewList, {
featureName: 'program-summary',
moduleName,
});

Expand All @@ -153,22 +138,6 @@ export const encountersSummaryDashboardLink =
{ featureName: 'encounter', moduleName },
);

export const hivPatientSummaryDashboardLink = getSyncLifecycle(
createDashboardLink({
...hivPatientSummaryDashboardMeta,
moduleName,
}),
{ featureName: 'hiv-patient-summary', moduleName },
);

export const hivPatientManagementDashboardLink = getSyncLifecycle(
createDashboardLink({
...programManagementDashboardMeta,
moduleName,
}),
{ featureName: 'hiv-patient-summary', moduleName },
);

export const currentVisitSummary = getSyncLifecycle(currentVisitSummaryComponent, {
featureName: 'current-visit-summary',
moduleName,
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 259faab

Please sign in to comment.