Skip to content

Commit

Permalink
(feat) : Add lab manifest to KenyaEMR 3.x (#280)
Browse files Browse the repository at this point in the history
* Lan manifest esm added, with summary cards and metrics

* WIP

* Added lab manifest table listing lab manifests

* Added filtering of lab manifest based in status

* Added manifest form

* Added manifest detail screen but ui elements unimplemented

* Lab detail Header implementation done

* Implemted active request and samples

* REdesigned summary cards fr lab manifest, added counties resource hjson for manifets form, used tabs for acttive request and manifest samples

* Added lab manifest to nav utiles

* Manifest editing working with array data source

* Hooks mocking network calls

* Lab manifest and detail consuming actual endpoint

* Cleaned metrics, removed fhir2 deps

* Listing actual manifest samples and removed unecessary hook for samples

* Filtering sample at endpoint level, added extra sample information

* Cleaned up styling, seperated metric value into component
  • Loading branch information
Omoshlawi authored Jul 29, 2024
1 parent 74048d3 commit 30c6f94
Show file tree
Hide file tree
Showing 43 changed files with 3,553 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/esm-lab-manifest-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
![Node.js CI](https://github.com/palladiumkenya/kenyaemr-esm-3.x/workflows/Node.js%20CI/badge.svg)

# ESM Lab manifest

This is a frontend module that provides lab manifest functionality.
8 changes: 8 additions & 0 deletions packages/esm-lab-manifest-app/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const rootConfig = require('../../jest.config.js');

const packageConfig = {
...rootConfig,
collectCoverage: false,
};

module.exports = packageConfig;
54 changes: 54 additions & 0 deletions packages/esm-lab-manifest-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "@kenyaemr/esm-lab-manifest-app",
"version": "5.2.0",
"description": "lab-manifest app for KenyaEMR",
"browser": "dist/kenyaemr-esm-lab-manifest-app.js",
"main": "src/index.ts",
"source": true,
"license": "MPL-2.0",
"homepage": "https://github.com/palladiumkenya/kenyaemr-esm-core#readme",
"scripts": {
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
"debug": "npm run serve",
"build": "webpack --mode production",
"analyze": "webpack --mode=production --env.analyze=true",
"lint": "eslint src --ext ts,tsx",
"typescript": "tsc",
"extract-translations": "i18next 'src/**/*.component.tsx' 'src/index.ts' --config ../../tools/i18next-parser.config.js",
"test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests",
"test:watch": "cross-env TZ=UTC jest --watch --config jest.config.js",
"coverage": "yarn test --coverage"
},
"browserslist": [
"extends browserslist-config-openmrs"
],
"keywords": [
"openmrs"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/palladiumkenya/kenyaemr-esm-core#readme"
},
"bugs": {
"url": "https://github.com/palladiumkenya/kenyaemr-esm-core/issues"
},
"dependencies": {
"@carbon/react": "^1.42.1",
"lodash-es": "^4.17.15",
"react-to-print": "^2.14.13"
},
"peerDependencies": {
"@openmrs/esm-framework": "5.x",
"react": "^18.1.0",
"react-i18next": "11.x",
"react-router-dom": "6.x",
"swr": "2.x"
},
"devDependencies": {
"webpack": "^5.74.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import LabManifestDetailHeader from '../header/lab-manifest-detail-header.component';
import { LabManifestHeader } from '../header/lab-manifest-header.component';
import { LabManifestTabs } from '../tabs/lab-manifest-tabs-component';

const LabManifestDetail = () => {
const { manifestUuid } = useParams();
const { t } = useTranslation();

return (
<div>
<LabManifestHeader title={t('labManifest', 'Lab Manifest')} />
<LabManifestDetailHeader manifestUuid={manifestUuid} />
<LabManifestTabs manifestUuid={manifestUuid} />
</div>
);
};

export default LabManifestDetail;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { LabManifestHeader } from '../header/lab-manifest-header.component';
import LabManifestMetrics from '../metrics/lab-manifest-metrics.component';
import LabManifestsTable from '../tables/lab-manifest-table.component';

const LabManifestComponent: React.FC = () => {
const { t } = useTranslation();
return (
<div className={`omrs-main-content`}>
<LabManifestHeader title={t('labManifest', 'Lab Manifest')} />
<LabManifestMetrics />
<LabManifestsTable />
</div>
);
};

export default LabManifestComponent;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React, { useMemo } from 'react';
import last from 'lodash-es/last';
import { BrowserRouter, useLocation } from 'react-router-dom';
import { ConfigurableLink } from '@openmrs/esm-framework';

export interface LinkConfig {
name: string;
title: string;
}

export function LinkExtension({ config }: { config: LinkConfig }) {
const { name, title } = config;
const location = useLocation();
const spaBasePath = window.getOpenmrsSpaBase() + 'home';

let urlSegment = useMemo(() => decodeURIComponent(last(location.pathname.split('/'))!), [location.pathname]);

const isUUID = (value) => {
const regex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/;
return regex.test(value);
};

if (isUUID(urlSegment)) {
urlSegment = 'lab-manifest';
}

return (
<ConfigurableLink
to={spaBasePath + '/' + name}
className={`cds--side-nav__link ${name === urlSegment && 'active-left-nav-link'}`}>
{title}
</ConfigurableLink>
);
}

export const createLeftPanelLink = (config: LinkConfig) => () =>
(
<BrowserRouter>
<LinkExtension config={config} />
</BrowserRouter>
);
5 changes: 5 additions & 0 deletions packages/esm-lab-manifest-app/src/config-schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Type, validator } from '@openmrs/esm-framework';

export const configSchema = {};

export type Config = {};
Loading

0 comments on commit 30c6f94

Please sign in to comment.