Skip to content

Commit

Permalink
Merge pull request #767 from UCSF-IGHS/dev
Browse files Browse the repository at this point in the history
DEMO-6 Release v6.23 Dev Sync to Demo
  • Loading branch information
samuelmale authored Feb 25, 2022
2 parents 9cb970e + a34b08e commit a976d0a
Show file tree
Hide file tree
Showing 20 changed files with 24,911 additions and 272 deletions.
24,804 changes: 24,646 additions & 158 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export function fetchPatientsFinalHIVStatus(patientUUID: string) {
if (data.entry?.length) {
return data.entry[0].resource.valueCodeableConcept.coding[0].display;
}
return 'Negative';
return '';
});
}

Expand All @@ -178,7 +178,7 @@ export function fetchPatientComputedConcept_HIV_Status(patientUUID: string) {
if (data.entry?.length) {
return data.entry[0].resource.valueCodeableConcept.coding[0].display;
}
return 'Negative';
return '';
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/encounter-list/encounter-list.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const EncounterList: React.FC<EncounterListProps> = ({
const capitalize = word => word[0].toUpperCase() + word.substr(1);

const launchEncounterForm = (form?: any, intent: string = '*', action: string = 'add', encounterUuid?: any) => {
const launcherTitle = `${capitalize(action)} ` + (form?.name || encounterForm?.name) + ` (${intent})`;
const launcherTitle = `${capitalize(action)} ` + (form?.name || encounterForm?.name);

if (action === 'view') {
launchFormWithCustomTitle(form, launcherTitle, 'view', encounterUuid, forceComponentUpdate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
import ReactDOM from 'react-dom';
import { addPatientToCohort, evictCohortMembership, getCohorts, getPatientListsForPatient } from '../../../api/api';

const AddPatientToListOverflowMenuItem: React.FC<{ patientUuid: string; displayText?: string }> = ({
patientUuid,
displayText,
}) => {
const AddPatientToListOverflowMenuItem: React.FC<{
patientUuid: string;
displayText?: string;
excludeCohorts?: Array<string>;
}> = ({ patientUuid, displayText, excludeCohorts }) => {
const { patient } = usePatient(patientUuid);
const [isOpen, setIsOpen] = useState(false);
const patientDisplay = useMemo(() => {
Expand All @@ -22,6 +23,7 @@ const AddPatientToListOverflowMenuItem: React.FC<{ patientUuid: string; displayT
close={() => setIsOpen(false)}
patientUuid={patientUuid}
title={`Add ${patientDisplay} to list`}
excludeCohorts={excludeCohorts}
/>
)}
<li className="bx--overflow-menu-options__option">
Expand All @@ -47,7 +49,8 @@ export const AddPatientToListModal: React.FC<{
patientUuid: string;
title?: string;
cohortType?: string;
}> = ({ isOpen, close, patientUuid, cohortType, title }) => {
excludeCohorts?: Array<string>;
}> = ({ isOpen, close, patientUuid, cohortType, title, excludeCohorts }) => {
const [cohorts, setCohorts] = useState<Array<{ uuid: string; name: string }>>([]);
const [alreadySubscribedCohorts, setAlreadySubscribedCohorts] = useState([]);
const [currentMemberships, setCurrentMemberships] = useState([]);
Expand All @@ -59,9 +62,12 @@ export const AddPatientToListModal: React.FC<{
Promise.all([getCohorts(cohortType), getPatientListsForPatient(patientUuid)]).then(
([allCohortsRes, currentCohortMemberships]) => {
// filter out cohorts in which this patient is already a member
const filteredCohorts = allCohortsRes.filter(
let filteredCohorts = allCohortsRes.filter(
cohort => !currentCohortMemberships.some(membership => cohort.uuid == membership.cohort.uuid),
);
if (excludeCohorts && excludeCohorts.length) {
filteredCohorts = filteredCohorts.filter(cohort => !excludeCohorts.includes(cohort.name));
}
setCohorts(filteredCohorts);
setCurrentMemberships(currentCohortMemberships);
setAlreadySubscribedCohorts(currentCohortMemberships.map(membership => membership.cohort));
Expand Down
14 changes: 10 additions & 4 deletions src/components/patient-lists/patient-list-cohort.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const LaunchableFormMenuItem = ({ patientUuid, launchableForm, form, encounterTy
const [actionText, setActionText] = useState(launchableForm.actionText);
const [encounterUuid, setEncounterUuid] = useState(null);
const [isLoading, setIsLoading] = useState(false);
const continueEncounterActionText = launchableForm.editActionText || 'Continue encounter';
const continueEncounterActionText = launchableForm.actionText || 'Continue encounter ';

useEffect(() => {
if (launchableForm.editLatestEncounter && encounterType && !encounterUuid) {
Expand All @@ -126,9 +126,9 @@ const LaunchableFormMenuItem = ({ patientUuid, launchableForm, form, encounterTy
itemText={actionText}
onClick={() => {
if (encounterUuid) {
launchFormInEditMode(form, encounterUuid);
launchFormInEditMode(form, encounterUuid, null, null, 'ohri-forms');
} else {
launchForm(form);
launchForm(form, null, null, 'ohri-forms');
}
navigate({ to: patientUrl });
}}
Expand All @@ -146,6 +146,7 @@ interface CohortPatientListProps {
excludeColumns?: Array<string>;
queryParams?: Array<string>;
associatedEncounterType?: string;
addPatientToListOptions?: { excludeCohorts?: Array<string> };
launchableForm?: {
package: string;
name: string;
Expand All @@ -170,6 +171,7 @@ const CohortPatientList: React.FC<CohortPatientListProps> = ({
queryParams,
associatedEncounterType,
launchableForm,
addPatientToListOptions,
}) => {
const [patients, setPatients] = useState([]);
const [isLoading, setIsLoading] = useState(true);
Expand Down Expand Up @@ -232,7 +234,11 @@ const CohortPatientList: React.FC<CohortPatientListProps> = ({
) : (
<></>
)}
<AddPatientToListOverflowMenuItem patientUuid={patientUuid} displayText="Move to list" />
<AddPatientToListOverflowMenuItem
patientUuid={patientUuid}
displayText="Move to list"
excludeCohorts={addPatientToListOptions?.excludeCohorts || []}
/>
</OverflowMenu>
),
};
Expand Down
8 changes: 8 additions & 0 deletions src/components/patient-lists/patient-list-cohort.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@
width: 150px;
float: right;
}

:global(.bx--overflow-menu-options__btn) {
max-width: 15rem !important;
}

:global(.bx--overflow-menu--flip.bx--overflow-menu-options) {
min-width: 13rem !important;
}
82 changes: 38 additions & 44 deletions src/covid/pages/lab-results.encounter-list.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,35 @@
import React, { useEffect, useState } from 'react';
import React from 'react';
import { useTranslation } from 'react-i18next';
import styles from '../covid.scss';
import { Tabs, Tab, Tag } from 'carbon-components-react';
import EmptyState from '../../components/empty-state/empty-state.component';

import {
covidClientsWithPendingLabResults,
covidLabOrderDate_UUID,
covidLabOrderEncounterType_UUID,
covidReasonsForTestingConcep_UUID,
covidTestResultConcept_UUID,
covidTestResultDate_UUID,
covidTestResultUUID,
covidTestStatusConcept_UUID,
covidTestTypeUUID,
covidTypeofTestConcept_UUID,
covid_Assessment_EncounterUUID,
} from '../../constants';

interface OverviewListProps {
patientUuid: string;
}

interface CovidOverviewListProps {
patientUuid: string;
}
import EncounterList, {
EncounterListColumn,
getObsFromEncounter,
} from '../../components/encounter-list/encounter-list.component';

export const covidFormSlot = 'hts-encounter-form-slot';
export const covidEncounterRepresentation =
'custom:(uuid,encounterDatetime,location:(uuid,name),' +
'encounterProviders:(uuid,provider:(uuid,name)),' +
'obs:(uuid,obsDatetime,concept:(uuid,name:(uuid,name)),value:(uuid,name:(uuid,name))))';

const pcrTestResult = '3f4ee14b-b4ab-4597-9fe9-406883b63d76';
const rapidTestResult = 'cbcbb029-f11f-4437-9d53-1d0f0a170433';
interface CovidLabWidgetProps {
patientUuid: string;
}

//Generic Component Import
import EncounterList, {
EncounterListColumn,
getObsFromEncounter,
getEncounterValues,
} from '../../components/encounter-list/encounter-list.component';

const columnsLab: EncounterListColumn[] = [
{
key: 'orderDate',
Expand Down Expand Up @@ -87,7 +74,8 @@ const columnsLab: EncounterListColumn[] = [
key: 'lastTestResult',
header: 'Test Result',
getValue: encounter => {
return getObsFromEncounter(encounter, covidTestResultConcept_UUID);
const pcrResult = getObsFromEncounter(encounter, pcrTestResult);
return pcrResult && pcrResult != '--' ? pcrResult : getObsFromEncounter(encounter, rapidTestResult);
},
},
{
Expand All @@ -100,29 +88,35 @@ const columnsLab: EncounterListColumn[] = [
{
key: 'actions',
header: 'Actions',
getValue: encounter => [
{
form: { name: 'covid_lab_test', package: 'covid' },
encounterUuid: encounter.uuid,
intent: '*',
label: 'View Details',
mode: 'view',
},
{
form: { name: 'covid_lab_result', package: 'covid' },
encounterUuid: encounter.uuid,
intent: '*',
label: 'Add/Edit Lab Result',
mode: 'edit',
},
{
form: { name: 'covid_lab_order_cancellation', package: 'covid' },
encounterUuid: encounter.uuid,
intent: '*',
label: 'Cancel Lab Order',
mode: 'edit',
},
],
getValue: encounter => {
const baseActions = [
{
form: { name: 'covid_lab_test', package: 'covid' },
encounterUuid: encounter.uuid,
intent: '*',
label: 'View Details',
mode: 'view',
},
{
form: { name: 'covid_lab_result', package: 'covid' },
encounterUuid: encounter.uuid,
intent: '*',
label: 'Add/Edit Lab Result',
mode: 'edit',
},
];
const status = getObsFromEncounter(encounter, covidTestStatusConcept_UUID);
if (status.includes('Pending')) {
baseActions.push({
form: { name: 'covid_lab_order_cancellation', package: 'covid' },
encounterUuid: encounter.uuid,
intent: '*',
label: 'Cancel Lab Order',
mode: 'edit',
});
}
return baseActions;
},
},
];

Expand Down
4 changes: 2 additions & 2 deletions src/forms/ohri-form.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const OHRIForm: React.FC<OHRIFormProps> = ({
},
};
registerExtension(extDetails.id, extDetails);
attach('patient-chart-workspace-header-slot', extDetails.id);
// attach('patient-chart-workspace-header-slot', extDetails.id);

return () => {
detach('patient-chart-workspace-header-slot', extDetails.id);
Expand Down Expand Up @@ -186,7 +186,7 @@ const OHRIForm: React.FC<OHRIFormProps> = ({
)}

<div className={styles.formContent}>
<PatientBanner patient={patient} />
{workspaceLayout != 'minimized' && <PatientBanner patient={patient} />}
{form.markdown && (
<div className={styles.markdownContainer}>
<ReactMarkdown children={form.markdown.join('\n')} />
Expand Down
41 changes: 16 additions & 25 deletions src/forms/ohri-form.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
:global(.contextWorkspaceContainer) {
//overflow-y: auto;
}

.ohriForm {
height: 100%;
overflow: hidden;
flex-grow: 1;
}

.ohriFormContainer {
display: -webkit-flex;
height: 100vh;
height: 100%;
overflow-y: hidden;
}

Expand All @@ -30,17 +27,12 @@

.formContentBody {
overflow-y: auto;
// padding-bottom: 100px;
margin-bottom: 100px;
width: inherit;
position: sticky;
}

.minifiedFormContentBody {
// padding-bottom: 34px !important;
// height: 77.5vh;
margin-bottom: 0px !important;
height: 72.5vh;
}

@media (max-width: 768px) {
Expand All @@ -49,23 +41,9 @@
}
}

@media(max-width: 1000px) {

}

:global(.patientChartWrapper) aside,
:global(.omrs-breakpoint-gt-tablet) {
border-left: 1px solid #8d8d8d !important;
}

:global(.patientChartWrapper) {
:global(.omrs-breakpoint-gt-tablet) {
border-left: 1px solid #8d8d8d !important;
}
}

.minifiedButtons {
width: 100%;
height: 63.5px;
}

.minifiedButtons :global(.bx--btn) {
Expand All @@ -80,3 +58,16 @@
.markdownContainer {
padding: 1rem;
}

aside[class*='-esm-patient-chart__workspace-window__container__'] {
border-left: 1px solid #8d8d8d !important;
}

aside[class*='-esm-patient-chart__workspace-window__container__'] > div {
display: flex;
bottom: 0;
}

aside[class*='-esm-patient-chart__workspace-window__container__'] > div > div {
flex-grow: 1;
}
2 changes: 1 addition & 1 deletion src/hts/home/patient-tabs/ohri-patient-tabs.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function HTSHomePatientTabs() {

const tabsConfigs = [
{
label: t('waitingForPreTestCounseling', 'Waiting for pre-test counselling'),
label: t('waitingForPreTestCounseling', 'Waiting for pre-test counselling-'),
cohortId: preTestCounsellingCohort,
cohortSlotName: 'pre-test-counseling-slot',
associatedEncounterType: htsRetrospectiveEncounterType,
Expand Down
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function setupOpenMRS() {
},
{
id: 'care-and-treatment-dashboard-ext',
slot: 'hiv-dashboard-slot',
slot: 'ohri-hiv-dashboard-slot',
load: getSyncLifecycle(createOHRIDashboardLink(careAndTreatmentDashboardMeta), options),
meta: careAndTreatmentDashboardMeta,
online: true,
Expand All @@ -332,7 +332,7 @@ function setupOpenMRS() {
},
{
id: 'hts-dashboard-ext',
slot: 'hiv-dashboard-slot',
slot: 'ohri-hiv-dashboard-slot',
load: getSyncLifecycle(createOHRIDashboardLink(htsDashboardMeta), options),
meta: htsDashboardMeta,
online: true,
Expand Down Expand Up @@ -462,6 +462,13 @@ function setupOpenMRS() {
columnSpan: 4,
},
},
{
name: 'form-render-link',
slot: 'app-menu-slot',
load: getAsyncLifecycle(() => import('./links/form-render-app-menu-link.component'), options),
online: true,
offline: true,
},
],
};
}
Expand Down
Loading

0 comments on commit a976d0a

Please sign in to comment.