Skip to content

Commit

Permalink
Add lab referal workflow (#1)
Browse files Browse the repository at this point in the history
Add lab referal workflow (#1)
  • Loading branch information
jabahum authored Apr 15, 2024
1 parent f8b8fbd commit 22e6605
Show file tree
Hide file tree
Showing 21 changed files with 438 additions and 156 deletions.
54 changes: 26 additions & 28 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node CI
name: UgandaEMR CI

on:
push:
Expand All @@ -9,8 +9,8 @@ on:
types:
- created
env:
ESM_NAME: "@openmrs/esm-laboratory-app"
JS_NAME: "openmrs-esm-laboratory-app.js"
ESM_NAME: "@ugandaemr/esm-laboratory-app"
JS_NAME: "ugandaemr-esm-laboratory-app.js"

jobs:
build:
Expand All @@ -21,24 +21,24 @@ jobs:
TURBO_TEAM: ${{ github.repository_owner }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: "18"
node-version: "18.x"
registry-url: "https://registry.npmjs.org"

- name: Cache dependencies
id: cache
uses: actions/cache@v4
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v2
with:
Expand All @@ -49,12 +49,11 @@ jobs:
- run: yarn turbo build --color --concurrency=5

- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist
overwrite: true
pre_release:
runs-on: ubuntu-latest
Expand All @@ -64,25 +63,25 @@ jobs:
if: ${{ github.event_name == 'push' }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: "18"
node-version: "18.x"
registry-url: "https://registry.npmjs.org"

- name: Cache dependencies
id: cache
uses: actions/cache@v4
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v2
with:
Expand All @@ -95,7 +94,7 @@ jobs:
- name: Build
run: yarn turbo build --color --concurrency=5

- run: git config user.email "<>" && git config user.name "OpenMRS CI"
- run: git config user.email "<>" && git config user.name "UgandaEMR CI"
- run: git add . && git commit -m "Prerelease version" --no-verify

- name: Pre-release
Expand All @@ -104,12 +103,11 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist
overwrite: true
release:
runs-on: ubuntu-latest
Expand All @@ -119,33 +117,33 @@ jobs:
if: ${{ github.event_name == 'release' }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: "18"
node-version: "18.x"
registry-url: "https://registry.npmjs.org"

- name: Cache dependencies
id: cache
uses: actions/cache@v4
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v3
uses: felixmosh/turborepo-gh-artifacts@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ secrets.TURBO_SERVER_TOKEN }}

- run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@openmrs/esm-laboratory-app",
"name": "@ugandaemr/esm-laboratory-app",
"version": "1.0.0",
"license": "MPL-2.0",
"description": "Laboratory microfrontend for OpenMRS 3.x",
"browser": "dist/openmrs-esm-laboratory-app.js",
"browser": "dist/ugandaemr-esm-laboratory-app.js",
"main": "src/index.ts",
"source": true,
"scripts": {
Expand Down
3 changes: 0 additions & 3 deletions src/completed-list/completed-list.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ import {
TableToolbarContent,
Layer,
TableToolbarSearch,
DatePicker,
DatePickerInput,
DataTableSkeleton,
Tag,
} from "@carbon/react";
import styles from "./completed-list.scss";
import { getStatusColor } from "../utils/functions";
Expand Down
5 changes: 5 additions & 0 deletions src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export const configSchema = {
_default: "214e27a1-606a-4b1e-a96e-d736c87069d5",
_description: "Concept uuid for the laboratory tool encounter type.",
},
artCardEncounterTypeUuid: {
_type: Type.String,
_default: "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f",
_description: "Concept uuid for the laboratory tool encounter type.",
},
laboratoryOrderTypeUuid: {
_type: Type.String,
_default: "52a447d3-a64a-11e3-9aeb-50e549534c5e",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import {
} from "@openmrs/esm-patient-common-lib";
import rejectedTabComponent from "./lab-tabs/rejected-tab.component";

const moduleName = "@openmrs/esm-laboratory-app";
const moduleName = "@ugandaemr/esm-laboratory-app";

const options = {
featureName: "openmrs-esm-laboratory",
featureName: "ugandaemr-esm-laboratory",
moduleName,
};

Expand Down
6 changes: 2 additions & 4 deletions src/lab-tabs/referred-tab.component.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from "react";
import { EmptyState } from "@openmrs/esm-patient-common-lib";
import ReferredOrdersList from "../referred-orders/referred-orders.component";

const ReferredComponent = () => {
return (
<div>
<EmptyState
displayText={"referred tests"}
headerTitle={"Referred tests"}
/>
<ReferredOrdersList />
</div>
);
};
Expand Down
13 changes: 12 additions & 1 deletion src/lab-tiles/referred-tile.component.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import React from "react";
import { useTranslation } from "react-i18next";
import SummaryTile from "../summary-tiles/summary-tile.component";
import { useLabTestsStats } from "../summary-tiles/laboratory-summary.resource";

const ReferredTileComponent = () => {
const { t } = useTranslation();

const { data } = useLabTestsStats("");

const filteredData = data?.filter(
(item) =>
item?.fulfillerStatus === "IN_PROGRESS" &&
item?.accessionNumber !== null &&
item?.dateStopped === null &&
item?.instructions === "REFER TO CPHL"
);

return (
<SummaryTile
label={t("transferred", "Transferred")}
value={0}
value={filteredData.length}
headerLabel={t("referredTests", "Ex-Referred tests")}
/>
);
Expand Down
3 changes: 2 additions & 1 deletion src/lab-tiles/worklist-tile.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const WorklistTileComponent = () => {
(item) =>
item?.fulfillerStatus === "IN_PROGRESS" &&
item?.accessionNumber !== null &&
item?.dateStopped === null
item?.dateStopped === null &&
item?.instructions !== "REFER TO CPHL"
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ const LaboratoryActiveTestOrderResults: React.FC<
> = ({ patientUuid }) => {
const { t } = useTranslation();

const { enableSendingLabTestsByEmail, laboratoryEncounterTypeUuid } =
useConfig();
const {
enableSendingLabTestsByEmail,
laboratoryEncounterTypeUuid,
artCardEncounterTypeUuid,
} = useConfig();

const displayText = t(
"activelLaboratoryTestsDisplayTextTitle",
Expand All @@ -94,20 +97,25 @@ const LaboratoryActiveTestOrderResults: React.FC<
patientUuid: patientUuid,
laboratoryEncounterTypeUuid: laboratoryEncounterTypeUuid,
});

console.info(items);

const pageSizes = [10, 20, 30, 40, 50];
const [currentPageSize, setPageSize] = useState(10);

const sortedLabRequests = useMemo(() => {
return [...items]
?.filter(
(item) => item?.encounterType?.uuid === laboratoryEncounterTypeUuid
(item) =>
item?.encounterType?.uuid === laboratoryEncounterTypeUuid ||
item?.encounterType?.uuid === artCardEncounterTypeUuid
)
?.sort((a, b) => {
const dateA = new Date(a.encounterDatetime);
const dateB = new Date(b.encounterDatetime);
return dateB.getTime() - dateA.getTime();
});
}, [items, laboratoryEncounterTypeUuid]);
}, [artCardEncounterTypeUuid, items, laboratoryEncounterTypeUuid]);

const [searchTerm, setSearchTerm] = useState("");
const [laboratoryOrders, setLaboratoryOrders] = useState(sortedLabRequests);
Expand Down Expand Up @@ -167,13 +175,6 @@ const LaboratoryActiveTestOrderResults: React.FC<
});
};

const LaunchLabRequestForm: React.FC = () => {
return (
<IconButton label="Add">
<Add onClick={launchLabRequestForm} />
</IconButton>
);
};
const PrintButtonAction: React.FC<PrintProps> = ({ encounter }) => {
const { patient } = useGetPatientByUuid(encounter.patient.uuid);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ const LaboratoryOrderReferalResults: React.FC<
> = ({ patientUuid }) => {
const { t } = useTranslation();

const { enableSendingLabTestsByEmail, laboratoryEncounterTypeUuid } =
useConfig();
const {
enableSendingLabTestsByEmail,
laboratoryEncounterTypeUuid,
artCardEncounterTypeUuid,
} = useConfig();

const displayText = t(
"referralLaboratoryTestsDisplayTextTitle",
Expand Down Expand Up @@ -112,14 +115,17 @@ const LaboratoryOrderReferalResults: React.FC<
const sortedLabRequests = useMemo(() => {
return [...items]
?.filter(
(item) => item?.encounterType?.uuid === laboratoryEncounterTypeUuid
(item) =>
(item?.encounterType?.uuid === laboratoryEncounterTypeUuid ||
item?.encounterType?.uuid === artCardEncounterTypeUuid) &&
item?.orders?.filter((item) => item?.instructions === "REFER TO CPHL")
)
?.sort((a, b) => {
const dateA = new Date(a.encounterDatetime);
const dateB = new Date(b.encounterDatetime);
return dateB.getTime() - dateA.getTime();
});
}, [items, laboratoryEncounterTypeUuid]);
}, [artCardEncounterTypeUuid, items, laboratoryEncounterTypeUuid]);

const [searchTerm, setSearchTerm] = useState("");
const [laboratoryOrders, setLaboratoryOrders] = useState(sortedLabRequests);
Expand Down Expand Up @@ -193,13 +199,6 @@ const LaboratoryOrderReferalResults: React.FC<
);
};

const LaunchLabRequestForm: React.FC = () => {
return (
<IconButton label="Add">
<Add />
</IconButton>
);
};
const PrintButtonAction: React.FC<PrintProps> = ({ encounter }) => {
const { patient } = useGetPatientByUuid(encounter.patient.uuid);

Expand Down Expand Up @@ -256,8 +255,7 @@ const LaboratoryOrderReferalResults: React.FC<
{ id: 1, header: t("tests", "Tests"), key: "orders" },
{ id: 2, header: t("location", "Location"), key: "location" },
{ id: 3, header: t("status", "Status"), key: "status" },
{ id: 4, header: t("referral", "Referral"), key: "referral" },
{ id: 5, header: t("actions", "Action"), key: "actions" },
{ id: 4, header: t("actions", "Action"), key: "actions" },
],
[t]
);
Expand Down Expand Up @@ -294,7 +292,6 @@ const LaboratoryOrderReferalResults: React.FC<
),
location: entry?.location?.display,
status: "--",
referral: "--",
actions: (
<div style={{ display: "flex" }}>
<EditReferralAction
Expand Down
Loading

0 comments on commit 22e6605

Please sign in to comment.