Skip to content

Commit

Permalink
(chore) v5 migration fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pirupius committed Jul 19, 2023
1 parent 4b2911c commit 7d89395
Show file tree
Hide file tree
Showing 6 changed files with 1,131 additions and 829 deletions.
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@icap-ethiopia/esm-ethiohri-app",
"version": "1.0.1",
"version": "1.2.0",
"license": "MPL-2.0",
"author": "ICAP Ethiopia",
"description": "A microfrontend ethiohri OpenMRS",
Expand Down Expand Up @@ -56,17 +56,16 @@
"swr": "^2.0.1"
},
"peerDependencies": {
"@openmrs/esm-framework": "4.x",
"@openmrs/esm-framework": "5.x",
"react": "18.x",
"react-i18next": "11.x",
"rxjs": "6.x"
},
"devDependencies": {
"@ohri/openmrs-esm-ohri-commons-lib": "1.0.7-pre.2497",
"@ohri/openmrs-esm-ohri-commons-lib": "next",
"@openmrs/esm-framework": "next",
"@openmrs/esm-patient-common-lib": "next",
"@openmrs/esm-styleguide": "4.x",
"@openmrs/openmrs-form-engine-lib": "1.0.0-pre.244",
"@openmrs/openmrs-form-engine-lib": "next",
"@playwright/test": "^1.30.0",
"@swc/cli": "^0.1.57",
"@swc/core": "^1.3.6",
Expand Down
7 changes: 7 additions & 0 deletions src/ethiohri-dashboard.meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,41 @@ export const PMTCT_META = {
export const MATERNAL_HEALTH_SUMMARY = {
title: "Maternal Health",
slot: "maternal-health-slot",
path: "Maternal Health",
};

export const CHILD_HEALTH_SUMMARY = {
title: "Child Health",
slot: "child-health-slot",
path: "Child Health",
};

export const PREP_META = {
title: "PrEP Prophylaxis",
slot: "prep-slot",
path: "PrEP Prophylaxis",
};

export const POST_META = {
title: "PEP Prophylaxis",
slot: "post-exposure-slot",
path: "PEP Prophylaxis",
};

export const HIV_TESTING_SERVICE_META = {
title: "HIV Testing Service",
slot: "hiv-testing-service-slot",
path: "HIV Testing Service",
};

export const PROGRAM_MANAGEMENT_META = {
title: "Program Management",
slot: "program-management-slot",
path: "Program Management",
};

export const CLINICAL_VISITS = {
title: "Clinical Visits",
slot: "clinical-visits-slot",
path: "Clinical Visits",
};
50 changes: 36 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ export const importTranslation = require.context(

export function startupApp() {
defineConfigSchema(moduleName, configSchema);
// provide(ethiohriConfigOverrides);
// provide(ethiohriConfig);
provide(ethiohriConfigOverrides);
provide(ethiohriConfig);

// addToBaseFormsRegistry(formsRegistry);

// registerControl({
// id: "eth-date",
// loadControl: () => import("./controls/date/ethiohri-date.component"),
// type: "eth-date",
// });
registerControl({
id: "eth-date",
loadControl: () => import("./controls/date/ethiohri-date.component"),
type: "eth-date",
});
}

export const patientDetailsButton = getAsyncLifecycle(
Expand Down Expand Up @@ -86,16 +86,23 @@ export const hivCareAndTreatmentMenu = getSyncLifecycle(
options
);
export const programManagementMenu = getSyncLifecycle(
createDashboardLink(PROGRAM_MANAGEMENT_META),
createDashboardLink({
...PROGRAM_MANAGEMENT_META,
moduleName,
}),
options
);

export const programManagementChart = getAsyncLifecycle(
() =>
import("./pages/program-management/program-managment-summary.component"),
options
);
export const clinicalVisitsMenu = getSyncLifecycle(
createDashboardLink(CLINICAL_VISITS),
createDashboardLink({
...CLINICAL_VISITS,
moduleName,
}),
options
);
export const clinicalVisitsChart = getAsyncLifecycle(
Expand All @@ -107,39 +114,54 @@ export const pmtctMenu = getSyncLifecycle(
options
);
export const maternalHealthMenu = getSyncLifecycle(
createDashboardLink(MATERNAL_HEALTH_SUMMARY),
createDashboardLink({
...MATERNAL_HEALTH_SUMMARY,
moduleName,
}),
options
);
export const maternalHealthChart = getAsyncLifecycle(
() => import("./pages/pmtct/maternal-health.component"),
options
);
export const childHealthMenu = getSyncLifecycle(
createDashboardLink(CHILD_HEALTH_SUMMARY),
createDashboardLink({
...CHILD_HEALTH_SUMMARY,
moduleName,
}),
options
);
export const childHealthChart = getAsyncLifecycle(
() => import("./pages/child-care/child-care.component"),
options
);
export const prepMenu = getSyncLifecycle(
createDashboardLink(PREP_META),
createDashboardLink({
...PREP_META,
moduleName,
}),
options
);
export const prepChart = getAsyncLifecycle(
() => import("./pages/pre-exposure/pre-exposure-summary.component"),
options
);
export const pepMenu = getSyncLifecycle(
createDashboardLink(POST_META),
createDashboardLink({
...POST_META,
moduleName,
}),
options
);
export const pepChart = getAsyncLifecycle(
() => import("./pages/post-exposure/post-exposure.component"),
options
);
export const hivTestingServiceMenu = getSyncLifecycle(
createDashboardLink(HIV_TESTING_SERVICE_META),
createDashboardLink({
...HIV_TESTING_SERVICE_META,
moduleName,
}),
options
);
export const hivTestingServiceChart = getAsyncLifecycle(
Expand Down
190 changes: 95 additions & 95 deletions src/pages/child-care/tabs/hei-followup.component.tsx
Original file line number Diff line number Diff line change
@@ -1,109 +1,109 @@
/* eslint-disable prettier/prettier */
import React, { useMemo } from "react";
import {
EncounterList,
EncounterListColumn,
EncounterList,
EncounterListColumn,
} from "@ohri/openmrs-esm-ohri-commons-lib";
import { PMTCT_ENCOUNTER_TYPE } from "../../../constants";
import { getData } from "../../encounterUtils";
import { moduleName } from "../../../index";

const HEIFollowup: React.FC<{ patientUuid: string }> = ({ patientUuid }) => {
const columns: EncounterListColumn[] = useMemo(
() => [
{
key: "enrollmentDate",
header: "Enrollment Date",
getValue: (encounter) => {
return getData(
encounter,
"160555AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
true
);
},
},
{
key: "ageAtEnrollment",
header: "Age at enrollment",
getValue: (encounter) => {
return getData(
encounter,
"160617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
false
);
},
},
{
key: "placeOfBirth",
header: "Place of birth",
getValue: (encounter) => {
return getData(
encounter,
"163531AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
false
);
},
},
{
key: "birthWeight",
header: "Birth weight",
getValue: (encounter) => {
return getData(
encounter,
"8ddaed89-5474-424a-a9e1-a8ad28b091fb",
false
);
},
},
{
key: "infantReferred",
header: "Infant referred",
getValue: (encounter) => {
return getData(
encounter,
"164849AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
false
);
},
},
{
key: "actions",
header: "Actions",
getValue: (encounter) => [
{
form: { name: "pmtct", package: "eth_hiv" },
encounterUuid: encounter.uuid,
intent: "*",
label: "View HEI Followup",
mode: "view",
},
{
form: { name: "pmtct", package: "eth_hiv" },
encounterUuid: encounter.uuid,
intent: "*",
label: "Edit HEI Followup",
mode: "edit",
},
],
},
const columns: EncounterListColumn[] = useMemo(
() => [
{
key: "enrollmentDate",
header: "Enrollment Date",
getValue: (encounter) => {
return getData(
encounter,
"160555AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
true
);
},
},
{
key: "ageAtEnrollment",
header: "Age at enrollment",
getValue: (encounter) => {
return getData(
encounter,
"160617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
false
);
},
},
{
key: "placeOfBirth",
header: "Place of birth",
getValue: (encounter) => {
return getData(
encounter,
"163531AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
false
);
},
},
{
key: "birthWeight",
header: "Birth weight",
getValue: (encounter) => {
return getData(
encounter,
"8ddaed89-5474-424a-a9e1-a8ad28b091fb",
false
);
},
},
{
key: "infantReferred",
header: "Infant referred",
getValue: (encounter) => {
return getData(
encounter,
"164849AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
false
);
},
},
{
key: "actions",
header: "Actions",
getValue: (encounter) => [
{
form: { name: "pmtct", package: "eth_hiv" },
encounterUuid: encounter.uuid,
intent: "*",
label: "View HEI Followup",
mode: "view",
},
{
form: { name: "pmtct", package: "eth_hiv" },
encounterUuid: encounter.uuid,
intent: "*",
label: "Edit HEI Followup",
mode: "edit",
},
],
[]
);
},
],
[]
);

return (
<EncounterList
patientUuid={patientUuid}
encounterUuid={PMTCT_ENCOUNTER_TYPE}
form={{ package: "eth_hiv", name: "pmtct" }}
columns={columns}
description="HEI Followup Encounter List"
headerTitle="HEI Followup"
launchOptions={{
displayText: "Add",
moduleName: moduleName,
}}
/>
);
return (
<EncounterList
patientUuid={patientUuid}
encounterType={PMTCT_ENCOUNTER_TYPE}
formList={[{ name: "eth_hiv" }]}
columns={columns}
description="HEI Followup Encounter List"
headerTitle="HEI Followup"
launchOptions={{
displayText: "Add",
moduleName: moduleName,
}}
/>
);
};

export default HEIFollowup;
Loading

0 comments on commit 7d89395

Please sign in to comment.