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

CT Adult and Child Pages #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@
"url": "https://github.com/UCSF-IGHS/openmrs-esm-rwanda/issues"
},
"dependencies": {
"@carbon/react": "^1.33.1",
"@carbon/react": "1.37.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change can be reverted. Not a blocker though cause it's being overriden by the resolution

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roger that

"dayjs": "^1.11.9",
"lodash-es": "^4.17.21",
"react-image-annotate": "^1.8.0"
},
"resolutions": {
"@carbon/react": "1.17.0"
},
"peerDependencies": {
"@openmrs/esm-framework": "5.x",
"react": "18.x",
Expand Down
36 changes: 29 additions & 7 deletions src/care-and-treatment/care-and-treatment.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import React from "react";
import { Tabs, Tab, TabList, TabPanels, TabPanel } from "@carbon/react";
import styles from "../common.scss";
import { useTranslation } from "react-i18next";
import TabOne from "./tabs/tab-one.component";
import TabThree from "./tabs/tab-three.component";
import TabTwo from "./tabs/tab-two.component";
import CtAdultVisitForm from "./tabs/ct-adult-visit-form.component";
import CtAdultProblemsForm from "./tabs/ct-adult-problems-form";
import CtAdultOiForm from "./tabs/ct-adult-oi-form";
import CtAdultLabForm from "./tabs/ct-adult-lab-form";
import CtAdultImagingForm from "./tabs/ct-adult-imaging-form";
import CtAdultHospitalizationForm from "./tabs/ct-adult-hospitalization-form";
import CtAdultAllergyForm from "./tabs/ct-adult-allergy-form";

interface OverviewListProps {
patientUuid: string;
Expand All @@ -16,19 +22,35 @@ const CareAndTreatment: React.FC<OverviewListProps> = ({ patientUuid }) => {
<div className={styles.tabContainer}>
<Tabs>
<TabList contained>
<Tab className="tab-12rem">{t("tabOne", "Tab One")}</Tab>
<Tab>{t("tabTwo", "Tab Two")}</Tab>
<Tab>{t("tabThree", "Tab Three")}</Tab>
<Tab className="tab-12rem">{t("tabOne", "Visits")}</Tab>
<Tab>{t("tabTwo", "Problems (Wahala)")}</Tab>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this intentional 😅

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL... of course. AI doesn't speak pigin yet

<Tab>{t("tabThree", "OI Form")}</Tab>
<Tab className="tab-12rem">{t("tabOne", "Lab")}</Tab>
<Tab>{t("tabTwo", "Imaging")}</Tab>
<Tab>{t("tabThree", "Hospitalizations")}</Tab>
<Tab>{t("tabThree", "Allergies")}</Tab>
</TabList>
<TabPanels>
<TabPanel>
<TabOne patientUuid={patientUuid} />
<CtAdultVisitForm patientUuid={patientUuid} />
</TabPanel>
<TabPanel>
<TabTwo patientUuid={patientUuid} />
<CtAdultProblemsForm patientUuid={patientUuid} />
</TabPanel>
<TabPanel>
<TabThree patientUuid={patientUuid} />
<CtAdultOiForm patientUuid={patientUuid} />
</TabPanel>
<TabPanel>
<CtAdultLabForm patientUuid={patientUuid} />
</TabPanel>
<TabPanel>
<CtAdultImagingForm patientUuid={patientUuid} />
</TabPanel>
<TabPanel>
<CtAdultHospitalizationForm patientUuid={patientUuid} />
</TabPanel>
<TabPanel>
<CtAdultAllergyForm patientUuid={patientUuid} />
</TabPanel>
</TabPanels>
</Tabs>
Expand Down
107 changes: 107 additions & 0 deletions src/care-and-treatment/tabs/ct-adult-allergy-form.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import {
EmptyStateComingSoon,
EncounterList,
EncounterListColumn,
getObsFromEncounter,
} from "@ohri/openmrs-esm-ohri-commons-lib";
import { moduleName } from "../../index";

const CtAdultAllergyForm: React.FC<{ patientUuid: string }> = ({
patientUuid,
}) => {
const { t } = useTranslation();
const formName = "A - HIV Visit - Allergy Form";
const title = t("adultCtProblemsTab", "Allergies");
const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0";

const columns: EncounterListColumn[] = useMemo(
() => [
{
key: "adverseEventMedication",
header: t("adverseEventMedication", "Suspect drug"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"3cd95ed6-26fe-102b-80cb-0017a47871b2"
);
},
},
{
key: "adverseEventMedicationNonCoded",
header: t("adverseEventMedicationNonCoded", "Suspect drug (Other)"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"2c62cce0-8b88-4b9e-8b22-c99c7ccc3e27"
);
},
},
{
key: "adverseEventEffect",
header: t("adverseEventEffect", "Effect"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"3cd96052-26fe-102b-80cb-0017a47871b2"
);
},
},
{
key: "adverseEventActionTaken",
header: t("adverseEventActionTaken", "Action taken"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"3cdc7e2c-26fe-102b-80cb-0017a47871b2"
);
},
},
{
key: "actions",
header: t("actions", "Actions"),
getValue: (encounter) => [
{
form: { name: formName, package: "maternal_health" },
encounterUuid: encounter.uuid,
intent: "*",
label: t("viewDetails", "View Details"),
mode: "view",
},
{
form: { name: formName, package: "maternal_health" },
encounterUuid: encounter.uuid,
intent: "*",
label: t("editForm", "Edit Form"),
mode: "edit",
},
],
},
],
[]
);

return (
<EncounterList
patientUuid={patientUuid}
encounterType={encounterTypeUUID}
formList={[
{
name: formName,
fixedIntent: "*",
excludedIntents: [],
},
]}
columns={columns}
description={title}
headerTitle={title}
launchOptions={{
displayText: "Add",
moduleName: moduleName,
}}
/>
);
};

export default CtAdultAllergyForm;
107 changes: 107 additions & 0 deletions src/care-and-treatment/tabs/ct-adult-hospitalization-form.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import {
EmptyStateComingSoon,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is no longer necessary

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes. Will clean it up

EncounterList,
EncounterListColumn,
getObsFromEncounter,
} from "@ohri/openmrs-esm-ohri-commons-lib";
import { moduleName } from "../../index";

const CtAdultHospitalizationForm: React.FC<{ patientUuid: string }> = ({
patientUuid,
}) => {
const { t } = useTranslation();
const formName = "A - HIV Visit - Problem Form";
const title = t("adultCtProblemsTab", "Problems");
const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0";

const columns: EncounterListColumn[] = useMemo(
() => [
{
key: "chronicCareDiagnosis",
header: t("chronicCareDiagnosis", "Chronic care diagnosis"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"bb7e04d8-3355-4fe8-9c87-98642eafab93"
);
},
},
{
key: "chronicCareDiagnosisNonCoded",
header: t("chronicCareDiagnosisNonCoded", "Care diagnosis non coded"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"0814d34f-a6ab-408c-848b-c69c96b42f70"
);
},
},
{
key: "ctAdultComment",
header: t("ctAdultComment", "Comments"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"3ce888c0-26fe-102b-80cb-0017a47871b2"
);
},
},
{
key: "emrMatchesPaper",
header: t("emrMatchesPaper", "EMR matches paper"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"c8f6b4ae-600e-496c-b6b9-d6b395e13a1f"
);
},
},
{
key: "actions",
header: t("actions", "Actions"),
getValue: (encounter) => [
{
form: { name: formName, package: "maternal_health" },
encounterUuid: encounter.uuid,
intent: "*",
label: t("viewDetails", "View Details"),
mode: "view",
},
{
form: { name: formName, package: "maternal_health" },
encounterUuid: encounter.uuid,
intent: "*",
label: t("editForm", "Edit Form"),
mode: "edit",
},
],
},
],
[]
);

return (
<EncounterList
patientUuid={patientUuid}
encounterType={encounterTypeUUID}
formList={[
{
name: formName,
fixedIntent: "*",
excludedIntents: [],
},
]}
columns={columns}
description={title}
headerTitle={title}
launchOptions={{
displayText: "Add",
moduleName: moduleName,
}}
/>
);
};

export default CtAdultHospitalizationForm;
107 changes: 107 additions & 0 deletions src/care-and-treatment/tabs/ct-adult-imaging-form.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import {
EmptyStateComingSoon,
EncounterList,
EncounterListColumn,
getObsFromEncounter,
} from "@ohri/openmrs-esm-ohri-commons-lib";
import { moduleName } from "../../index";

const CtAdultImagingForm: React.FC<{ patientUuid: string }> = ({
patientUuid,
}) => {
const { t } = useTranslation();
const formName = "A - HIV Visit - Problem Form";
const title = t("adultCtProblemsTab", "Problems");
const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0";

const columns: EncounterListColumn[] = useMemo(
() => [
{
key: "chronicCareDiagnosis",
header: t("chronicCareDiagnosis", "Chronic care diagnosis"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"bb7e04d8-3355-4fe8-9c87-98642eafab93"
);
},
},
{
key: "chronicCareDiagnosisNonCoded",
header: t("chronicCareDiagnosisNonCoded", "Care diagnosis non coded"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"0814d34f-a6ab-408c-848b-c69c96b42f70"
);
},
},
{
key: "ctAdultComment",
header: t("ctAdultComment", "Comments"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"3ce888c0-26fe-102b-80cb-0017a47871b2"
);
},
},
{
key: "emrMatchesPaper",
header: t("emrMatchesPaper", "EMR matches paper"),
getValue: (encounter) => {
return getObsFromEncounter(
encounter,
"c8f6b4ae-600e-496c-b6b9-d6b395e13a1f"
);
},
},
{
key: "actions",
header: t("actions", "Actions"),
getValue: (encounter) => [
{
form: { name: formName, package: "maternal_health" },
encounterUuid: encounter.uuid,
intent: "*",
label: t("viewDetails", "View Details"),
mode: "view",
},
{
form: { name: formName, package: "maternal_health" },
encounterUuid: encounter.uuid,
intent: "*",
label: t("editForm", "Edit Form"),
mode: "edit",
},
],
},
],
[]
);

return (
<EncounterList
patientUuid={patientUuid}
encounterType={encounterTypeUUID}
formList={[
{
name: formName,
fixedIntent: "*",
excludedIntents: [],
},
]}
columns={columns}
description={title}
headerTitle={title}
launchOptions={{
displayText: "Add",
moduleName: moduleName,
}}
/>
);
};

export default CtAdultImagingForm;
Loading