Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) - O3-4022 - Ward App - handling rendering of mother / child in… #1348

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions __mocks__/encountes.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { type Encounter } from '../packages/esm-ward-app/src/types';
import { mockPatientAlice } from './patient.mock';
import { mockLocationSurgery } from './queue-entry.mock';
import { mockVisitAlice } from './visits.mock';

export const mockEncounterAlice: Encounter = {
uuid: 'asdf',
encounterDatetime: '2024-06-27T19:40:16.000+0000',
patient: mockPatientAlice,
location: mockLocationSurgery,
encounterType: {
uuid: 'asdf',
description: 'admission',
},
obs: [],
visit: mockVisitAlice,
};
12 changes: 12 additions & 0 deletions __mocks__/inpatient-admission.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { type InpatientAdmission } from '@openmrs/esm-ward-app/src/types';
import { mockEncounterAlice } from './encountes.mock';
import { mockPatientAlice } from './patient.mock';
import { mockVisitAlice } from './visits.mock';

export const mockInpatientAdmissionAlice: InpatientAdmission = {
patient: mockPatientAlice,
visit: mockVisitAlice,
currentInpatientRequest: null,
firstAdmissionOrTransferEncounter: mockEncounterAlice,
encounterAssigningToCurrentInpatientLocation: mockEncounterAlice,
};
171 changes: 73 additions & 98 deletions __mocks__/inpatient-request.ts
Original file line number Diff line number Diff line change
@@ -1,108 +1,83 @@
import { type InpatientRequest } from '@openmrs/esm-ward-app/src/types';
import { mockLocationInpatientWard } from './locations.mock';
import { mockPatientAlice } from './patient.mock';
import { mockVisitAlice } from './visits.mock';

export const mockInpatientRequest: InpatientRequest[] = [{
patient: mockPatientAlice,
visit: {
uuid: 'e5727d7e-8e1e-4615-bc3a-abd69e63234a',
display: 'Clinic or Hospital Visit @ KGH - 06/27/2024 07:40 PM',
patient: {
uuid: mockPatientAlice.uuid,
display: mockPatientAlice.display,
},
visitType: {
uuid: 'f01c54cb-2225-471a-9cd5-d348552c337c',
display: 'Clinic or Hospital Visit',
},
indication: null,
location: mockLocationInpatientWard,
startDatetime: '2024-06-27T19:40:16.000+0000',
stopDatetime: null,
encounters: [
{
uuid: '78f4dff6-197a-4314-b702-e1f796bf7531',
display: 'Consultation 07/23/2024',
},
{
uuid: '9e4cf2b3-8587-4999-93d6-3a3cbd50f9d8',
display: 'Sierra Leone MCH Triage 07/16/2024',
},
],
attributes: [],
voided: false,
resourceVersion: '1.9',
},
dispositionLocation: mockLocationInpatientWard,
dispositionType: 'ADMIT',
disposition: {
uuid: '6c047a20-c2bf-43ef-9e88-6da7b17e8c1a',
display: 'Admit to hospital',
name: {
export const mockInpatientRequest: InpatientRequest[] = [
{
patient: mockPatientAlice,
visit: mockVisitAlice,
dispositionLocation: mockLocationInpatientWard,
dispositionType: 'ADMIT',
disposition: {
uuid: '6c047a20-c2bf-43ef-9e88-6da7b17e8c1a',
display: 'Admit to hospital',
uuid: 'b1e494ef-4779-4262-bc42-56a79c39303c',
name: 'Admit to hospital',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
},
datatype: {
uuid: '8d4a4c94-c2cc-11de-8d13-0010c6dffd0f',
display: 'N/A',
},
conceptClass: {
uuid: '8d492774-c2cc-11de-8d13-0010c6dffd0f',
display: 'Misc',
},
set: false,
version: null,
retired: false,
names: [
{
uuid: '122a523c-cbec-4283-991f-858f44ffccca',
display: 'Hospital admission',
},
{
uuid: 'b1e494ef-4779-4262-bc42-56a79c39303c',
name: {
display: 'Admit to hospital',
uuid: 'b1e494ef-4779-4262-bc42-56a79c39303c',
name: 'Admit to hospital',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
},
{
uuid: 'f72fadb0-d5db-102d-ad2a-000c29c2a5d7',
display: "ADMIS Á L'HÔPITAL",
},
{
uuid: 'acdcc1d2-7414-4337-890e-c8ccbccda41a',
display: 'Admèt nan lopital',
},
{
uuid: '4f12edd7-e516-493b-bc21-da1a9d29873f',
display: "Admettre à l'hôpital",
},
],
descriptions: [
{
uuid: '7d29309b-faaa-4767-83e6-6c75117fc569',
display: 'patient will be admitted from the clinic to the hospital for managment of an acute problem.',
},
],
mappings: [
{
uuid: '75a1a11e-4943-102e-96e9-000c29c2a5d7',
display: 'PIH: ADMIT TO HOSPITAL',
datatype: {
uuid: '8d4a4c94-c2cc-11de-8d13-0010c6dffd0f',
display: 'N/A',
},
{
uuid: 'b260d122-4864-102e-96e9-000c29c2a5d7',
display: 'PIH: 3799',
conceptClass: {
uuid: '8d492774-c2cc-11de-8d13-0010c6dffd0f',
display: 'Misc',
},
],
answers: [],
setMembers: [],
attributes: [],
resourceVersion: '2.0',
},
dispositionEncounter: {
uuid: '6c047a20-c2bf-43ef-9e88-6da7b17e8c1a',
display: 'Admit to hospital',
encounterDatetime: '2021-09-28T11:00:00.000Z',
set: false,
version: null,
retired: false,
names: [
{
uuid: '122a523c-cbec-4283-991f-858f44ffccca',
display: 'Hospital admission',
},
{
uuid: 'b1e494ef-4779-4262-bc42-56a79c39303c',
display: 'Admit to hospital',
},
{
uuid: 'f72fadb0-d5db-102d-ad2a-000c29c2a5d7',
display: "ADMIS Á L'HÔPITAL",
},
{
uuid: 'acdcc1d2-7414-4337-890e-c8ccbccda41a',
display: 'Admèt nan lopital',
},
{
uuid: '4f12edd7-e516-493b-bc21-da1a9d29873f',
display: "Admettre à l'hôpital",
},
],
descriptions: [
{
uuid: '7d29309b-faaa-4767-83e6-6c75117fc569',
display: 'patient will be admitted from the clinic to the hospital for managment of an acute problem.',
},
],
mappings: [
{
uuid: '75a1a11e-4943-102e-96e9-000c29c2a5d7',
display: 'PIH: ADMIT TO HOSPITAL',
},
{
uuid: 'b260d122-4864-102e-96e9-000c29c2a5d7',
display: 'PIH: 3799',
},
],
answers: [],
setMembers: [],
attributes: [],
resourceVersion: '2.0',
},
dispositionEncounter: {
uuid: '6c047a20-c2bf-43ef-9e88-6da7b17e8c1a',
display: 'Admit to hospital',
encounterDatetime: '2021-09-28T11:00:00.000Z',
},
},
}];
];
34 changes: 34 additions & 0 deletions __mocks__/visits.mock.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { type Visit } from '@openmrs/esm-framework';
import { mockPatientAlice } from './patient.mock';
import { mockLocationInpatientWard } from './locations.mock';

export const mockPastVisit = {
data: {
results: [
Expand Down Expand Up @@ -55,3 +59,33 @@ export const mockVisitTypes = [
display: 'TB Clinic Visit',
},
];

export const mockVisitAlice: Visit = {
uuid: 'e5727d7e-8e1e-4615-bc3a-abd69e63234a',
display: 'Clinic or Hospital Visit @ KGH - 06/27/2024 07:40 PM',
patient: {
uuid: mockPatientAlice.uuid,
display: mockPatientAlice.display,
},
visitType: {
uuid: 'f01c54cb-2225-471a-9cd5-d348552c337c',
display: 'Clinic or Hospital Visit',
},
indication: null,
location: mockLocationInpatientWard,
startDatetime: '2024-06-27T19:40:16.000+0000',
stopDatetime: null,
encounters: [
{
uuid: '78f4dff6-197a-4314-b702-e1f796bf7531',
display: 'Consultation 07/23/2024',
},
{
uuid: '9e4cf2b3-8587-4999-93d6-3a3cbd50f9d8',
display: 'Sierra Leone MCH Triage 07/16/2024',
},
],
attributes: [],
voided: false,
resourceVersion: '1.9',
};
12 changes: 11 additions & 1 deletion packages/esm-ward-app/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,18 @@ export interface WardViewContext {
WardPatientHeader: React.FC<WardPatient>;
}

export interface PatientAndAdmission {
patient: Patient;
currentAdmission: InpatientAdmission;
}

export interface MotherChildRelationships {
motherByChildUuid: Map<string, PatientAndAdmission>;
childrenByMotherUuid: Map<string, PatientAndAdmission[]>;
}

export interface MaternalWardViewContext {
motherChildrenRelationshipsByPatient: Map<string, MotherAndChild[]>;
motherChildRelationships: MotherChildRelationships;
}

export type PatientWorkspaceAdditionalProps = Omit<WardPatientWorkspaceProps, keyof DefaultWorkspaceProps>;
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const CodedObsTagsRow: React.FC<WardPatientCodedObsTagsRowProps> = ({ id, patien
obsCustomRepresentation,
);
const { t } = useTranslation();
const conceptToTagColorMap = useConceptToTagColorMap(config.tags);
const conceptToTagColorMap = useConceptToTagColorMap(config?.tags ?? []);

if (isLoading) {
return (
Expand Down
Loading
Loading