Skip to content

Commit

Permalink
BREAKING: O3-2563 Rename esm-patient-labs-app to esm-patient-tests-app (
Browse files Browse the repository at this point in the history
  • Loading branch information
brandones authored Oct 9, 2024
1 parent 266bdd0 commit d1833f1
Show file tree
Hide file tree
Showing 103 changed files with 129 additions and 112 deletions.
18 changes: 9 additions & 9 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,6 @@ replace_edited_strings = false
keep_translations = false
resource_name = esm-patient-immunizations-app

[o:openmrs:p:openmrs3:r:esm-patient-labs-app]
file_filter = packages/esm-patient-labs-app/translations/<lang>.json
source_file = packages/esm-patient-labs-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
replace_edited_strings = false
keep_translations = false
resource_name = esm-patient-labs-app

[o:openmrs:p:openmrs3:r:esm-patient-lists-app]
file_filter = packages/esm-patient-lists-app/translations/<lang>.json
source_file = packages/esm-patient-lists-app/translations/en.json
Expand Down Expand Up @@ -154,6 +145,15 @@ replace_edited_strings = false
keep_translations = false
resource_name = esm-patient-programs-app

[o:openmrs:p:openmrs3:r:esm-patient-tests-app]
file_filter = packages/esm-patient-tests-app/translations/<lang>.json
source_file = packages/esm-patient-tests-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
replace_edited_strings = false
keep_translations = false
resource_name = esm-patient-tests-app

[o:openmrs:p:openmrs3:r:esm-patient-vitals-app]
file_filter = packages/esm-patient-vitals-app/translations/<lang>.json
source_file = packages/esm-patient-vitals-app/translations/en.json
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ The `openmrs-esm-patient-chart` is a frontend module for the OpenMRS SPA. It con
- [Conditions](packages/esm-patient-conditions-app/README.md)
- [Forms](packages/esm-patient-forms-app/README.md)
- [Immunizations](packages/esm-patient-immunizations-app/README.md)
- [Labs](packages/esm-patient-labs-app/README.md)
- [Medications](packages/esm-patient-medications-app/README.md)
- [Notes](packages/esm-patient-notes-app/README.md)
- [Patient banner](packages/esm-patient-banner-app/README.md)
- [Patient chart](packages/esm-patient-chart-app/README.md)
- [Programs](packages/esm-patient-programs-app/README.md)
- [Tests](packages/esm-patient-tests-app/README.md)
- [Vitals](packages/esm-patient-vitals-app/README.md)

In addition to these widgets, two other microfrontends exist that encapsulate cross-cutting concerns. These are:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,65 +1,71 @@
# esm-patient-labs-app
# esm-patient-tests-app

Functionality for viewing test results and ordering labs.
Functionality for viewing test results and ordering tests, whether lab tests, radiology, or otherwise.

## Test Results

It provides tabular and chart-based overviews of the test results available for a patient.

IMPORTANT NOTE: To have data show up in this view, your concepts just need to have "Type: Test" or "Type: LabSet".
If you are seeing strange things showing up, like Temperature, in the Test Results viewer, then you probably just need to change the Type for your Temperature concept to something other than "Test", like finding.
It provides tabular and chart-based overviews of the test results available for a patient.

IMPORTANT NOTE: To have data show up in this view, your concepts just need to have "Type: Test" or "Type: LabSet".
If you are seeing strange things showing up, like Temperature, in the Test Results viewer, then you probably just need to change the Type for your Temperature concept to something other than "Test", such as "Finding."

## How to Configure the Lab Filter View
The Lab Filter feature enables you to set up custom filter views - eg based on standard medical hierarchies, or even based on your own custom ideas (e.g. "Our Favorite HIV-Related Tests"), like this:

The Lab Filter feature enables you to set up custom filter views - eg based on standard medical hierarchies, or even based on your own custom concepts (e.g. "Our Favorite HIV-Related Tests"), like this:

<img width="300" alt="image" src="https://user-images.githubusercontent.com/67400059/161005725-18b38112-d2bd-4ae1-8a01-f797cb69aa57.png">

To configure your own Lab Filters, you need to use Labs, LabSets, and ConvSets (Convenience Sets) in your Concept Dictionary.
To configure your own Lab Filters, you need to use Labs, LabSets, and ConvSets (Convenience Sets) in your Concept Dictionary.
Below, we will walk through the steps taken to set up [**this OpenMRS Example Lab Filter**](https://app.openconceptlab.org/#/orgs/openmrs/collections/ExampleLabFilter/).

### 1. Decide what you want.
In this example, we wanted a layout like:
* Bloodwork
* Hematology
* CBC
* Lymphocytes (%)
* Neutrophils (%)
* Hemoglobin
* Mean corpuscular volume (MCV)
* Hematocrit
* Red blood cells
* Platelets
* White blood cells
* Chemistry
* Serum Electrolytes
* Serum calcium
* Serum carbon dioxide
* Serum chloride
* Serum potassium
* Serum sodium
### 1. Decide what you want

In this example, we wanted a layout like:

* Bloodwork
* Hematology
* CBC
* Lymphocytes (%)
* Neutrophils (%)
* Hemoglobin
* Mean corpuscular volume (MCV)
* Hematocrit
* Red blood cells
* Platelets
* White blood cells
* Chemistry
* Serum Electrolytes
* Serum calcium
* Serum carbon dioxide
* Serum chloride
* Serum potassium
* Serum sodium

### 2. Create the "parents" as concepts with type = ConvSet
* Bloodwork --> Create as a custom concept, type = ConvSet
* Hematology --> Create as a custom concept, type = ConvSet
* Chemistry --> Create as a custom concept, type = ConvSet

* Bloodwork --> Create as a custom concept, type = ConvSet
* Hematology --> Create as a custom concept, type = ConvSet
* Chemistry --> Create as a custom concept, type = ConvSet

### 3. Add the "children" Set Members to each parent
* Bloodwork
* Hematology --> Add concept as a Set Member to "Bloodwork"
* CBC --> Add concept as a Set Member to "Hematology"
* Chemistry --> Add concept as a Set Member to "Bloodwork"
* Serum Electrolytes --> Add concept as a Set Member to "Chemistry"

* Bloodwork
* Hematology --> Add concept as a Set Member to "Bloodwork"
* CBC --> Add concept as a Set Member to "Hematology"
* Chemistry --> Add concept as a Set Member to "Bloodwork"
* Serum Electrolytes --> Add concept as a Set Member to "Chemistry"

_Note1: As of March 2022, Set Members cannot be added to concepts through the Term Browser, but you can either use your EMR directly or the OpenMRS Dictionary Manager._

_Note2: if you don't already have all the "children" concepts, e.g. CBC, Serum Electrolytes, you may have to add these specifically into your dictionary first._

### 4. Check your work

Review your concepts to see that the hierarchy all looks right in the Dictionary/Collection. In the above example (which was created using the OpenMRS Dictionary Manager), you can see that _Bloodwork_ now correctly contains _Hematology_ and _Chemistry_.

<img width="1173" alt="image" src="https://user-images.githubusercontent.com/67400059/161008455-edbd31d1-00ca-4236-9309-bc41763a6f0a.png">

### 5. Update the config-schema file with your ConvSet codes
Go here to add the UUIDs for each of your ConvSet concepts which you want to show up in the Lab Results filters:
https://github.com/openmrs/openmrs-esm-patient-chart/blob/master/packages/esm-patient-labs-app/src/config-schema.ts#L3

Go here to add the UUIDs for each of your ConvSet concepts which you want to show up in the Lab Results filters:
<https://github.com/openmrs/openmrs-esm-patient-chart/blob/master/packages/esm-patient-tests-app/src/config-schema.ts#L3>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@openmrs/esm-patient-labs-app",
"name": "@openmrs/esm-patient-tests-app",
"version": "8.2.0",
"license": "MPL-2.0",
"description": "Patient lab order and test results microfrontend for the OpenMRS SPA",
"browser": "dist/openmrs-esm-patient-labs-app.js",
"description": "Patient test order and results microfrontend for the OpenMRS SPA",
"browser": "dist/openmrs-esm-patient-tests-app.js",
"main": "src/index.ts",
"source": true,
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,18 @@ export interface ObsTreeEntry {
conceptUuid: string;
defaultOpen: boolean;
}

export interface LabTestReason {
uuid: string;
label?: string;
}

export interface OrderReason {
labTestUuid: string;
required: boolean;
orderReasons: Array<string>;
}

export interface ConfigObject {
resultsViewerConcepts: Array<ObsTreeEntry>;
orders: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@ import {
getAsyncLifecycle,
getSyncLifecycle,
messageOmrsServiceWorker,
translateFrom,
} from '@openmrs/esm-framework';
import { createDashboardLink } from '@openmrs/esm-patient-common-lib';
import { configSchema } from './config-schema';
import { dashboardMeta } from './test-results/dashboard.meta';
import externalOverviewComponent from './test-results/overview/external-overview.extension';
import resultsViewerComponent from './test-results/results-viewer';

const moduleName = '@openmrs/esm-patient-labs-app';
const moduleName = '@openmrs/esm-patient-tests-app';

const options = {
featureName: 'patient-labs',
featureName: 'patient-tests',
moduleName,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { type ComponentProps, useCallback, useState } from 'react';
import classNames from 'classnames';
import capitalize from 'lodash-es/capitalize';
import { capitalize } from 'lodash-es';
import { useTranslation } from 'react-i18next';
import { Button } from '@carbon/react';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import useSWR, { mutate } from 'swr';
import { useCallback, useMemo } from 'react';
import useSWRImmutable from 'swr/immutable';
import { chunk } from 'lodash-es';
import { type FetchResponse, openmrsFetch, restBaseUrl, showSnackbar, useConfig } from '@openmrs/esm-framework';
import useSWR, { mutate } from 'swr';
import useSWRImmutable from 'swr/immutable';
import type { LabOrderBasketItem, OrderPost, PatientOrderFetchResponse } from '@openmrs/esm-patient-common-lib';
import { type FetchResponse, openmrsFetch, restBaseUrl, showSnackbar, useConfig } from '@openmrs/esm-framework';
import { type ConfigObject } from '../config-schema';

export const careSettingUuid = '6f0c9a92-6f24-11e3-af88-005056821db0';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import LabOrderBasketPanel from './lab-order-basket-panel.extension';
import { screen, render } from '@testing-library/react';
import { type LabOrderBasketItem, type OrderBasketItem } from '@openmrs/esm-patient-common-lib';
import LabOrderBasketPanel from './lab-order-basket-panel.extension';

const mockUseOrderBasket = jest.fn();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
"slots": ["patient-chart-results-viewer-slot", "patient-chart-test-results-dashboard-slot"],
"component": "resultsViewer"
},
{
"name": "print-modal",
"component": "printModal"
},
{
"name": "lab-order-panel",
"component": "labOrderPanel",
Expand All @@ -41,9 +37,12 @@
{
"name": "timeline-results-modal",
"component": "timelineResultsModal"
},
{
"name": "print-modal",
"component": "printModal"
}
],
"pages": [],
"workspaces": [
{
"name": "add-lab-order",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { createContext, useReducer, useEffect, useMemo } from 'react';
import isObject from 'lodash/isObject';
import { isObject } from 'lodash-es';
import { parseTime } from '../panel-timeline/helpers';
import {
type TreeNode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
ReducerActionType,
type LowestNode,
type ReducerAction,
type ReducerState,
ReducerActionType,
type TreeParents,
type TreeNode,
type LowestNode,
type TreeParents,
} from './filter-types';

export const getName = (prefix, name) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { usePatient, openmrsFetch, restBaseUrl, type FetchResponse } from '@openmrs/esm-framework';
import { useMemo } from 'react';
import useSWR from 'swr';
import useSWRInfinite from 'swr/infinite';
import { usePatient, openmrsFetch, restBaseUrl, type FetchResponse } from '@openmrs/esm-framework';
import { assessValue, exist } from '../loadPatientTestData/helpers';

export const getName = (prefix: string | undefined, name: string) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import { uniq } from 'lodash-es';
import {
type PatientData,
type ObsRecord,
type ConceptUuid,
type ObsUuid,
type ObsMetaInfo,
} from '@openmrs/esm-patient-common-lib';
import {
getEntryConceptClassUuid,
getUserDataFromCache,
Expand All @@ -6,14 +14,6 @@ import {
extractMetaInformation,
addUserDataToCache,
} from './helpers';
import {
type PatientData,
type ObsRecord,
type ConceptUuid,
type ObsUuid,
type ObsMetaInfo,
} from '@openmrs/esm-patient-common-lib';
import uniq from 'lodash-es/uniq';

function parseSingleObsData(
testConceptNameMap: Record<ConceptUuid, string>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import useOverviewData from './useOverviewData';
import CommonOverview from './common-overview.component';
import { DataTableSkeleton } from '@carbon/react';
import { navigate } from '@openmrs/esm-framework';
import CommonOverview from './common-overview.component';
import useOverviewData from './useOverviewData';

const defaultOpenTimeline = (patientUuid, panelUuid) => {
const url = `/patient/${patientUuid}/testresults/timeline/${panelUuid}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { useTranslation } from 'react-i18next';
import { Button, DataTableSkeleton } from '@carbon/react';
import { EmptyState } from '@openmrs/esm-patient-common-lib';
import { ArrowRightIcon, useLayoutType } from '@openmrs/esm-framework';
import styles from './recent-overview.scss';
import useOverviewData from './useOverviewData';
import CommonOverview from './common-overview.component';
import { navigateToResults, navigateToTimeline, navigateToTrendline } from '../helpers';
import styles from './recent-overview.scss';

const RECENT_COUNT = 5;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const PanelTimelineComponent: React.FC<PanelTimelineComponentProps> = ({ activeP
allTimes.map((time) => observations.find((obs) => obs.effectiveDateTime === time)),
]),
);

if (!activePanel) {
return <p>{t('panelTimelineInstructions', 'Select a panel to view the timeline')}</p>;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import classNames from 'classnames';
import { useTranslation } from 'react-i18next';
import { EmptyState } from '@openmrs/esm-patient-common-lib';
import { PaddingContainer, TimeSlots, Grid, RowStartCell, GridItems, ShadowBox } from './helpers';
import { type ParsedTimeType } from '../filter/filter-types';
import type { ObsRecord } from '../../types';
import { type ObsRecord } from '../../types';
import useScrollIndicator from './useScroll';
import styles from './timeline.scss';

Expand Down Expand Up @@ -107,6 +108,7 @@ const DataRows: React.FC<DataRowsProps> = ({ timeColumns, rowData, sortedTimes,
);

export const Timeline: React.FC<TimelineParams> = ({ parsedTime, rowData, panelName, sortedTimes, testUuid }) => {
const { t } = useTranslation();
const [xIsScrolled, yIsScrolled, containerRef] = useScrollIndicator(0, 32);
const { yearColumns, dayColumns, timeColumns } = parsedTime;

Expand Down Expand Up @@ -137,7 +139,12 @@ export const Timeline: React.FC<TimelineParams> = ({ parsedTime, rowData, panelN
</PaddingContainer>
</RecentResultsGrid>
);
return <EmptyState displayText={'timeline data'} headerTitle="Data Timeline" />;
return (
<EmptyState
displayText={t('timelineData_lower', 'timeline data')}
headerTitle={t('dataTimeline', 'Data Timeline')}
/>
);
};

export default Timeline;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styles from './result-panel.scss';
import { type Concept, type ConceptMeta, type FHIRObservationResource, observationInterpretation } from '../../types';
import { type OBSERVATION_INTERPRETATION } from '@openmrs/esm-patient-common-lib';
import { type Concept, type ConceptMeta, type FHIRObservationResource, observationInterpretation } from '../../types';
import styles from './result-panel.scss';

export const getConceptUuid = (obs: FHIRObservationResource) => obs?.code.coding[0].code;

Expand Down
Loading

0 comments on commit d1833f1

Please sign in to comment.