Skip to content

Commit

Permalink
Merge branch '1323-bulk-upload' into import-close-flag-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Jul 5, 2024
2 parents 1aada6d + bd2b221 commit 16c3a92
Show file tree
Hide file tree
Showing 32 changed files with 2,823 additions and 15 deletions.
29 changes: 21 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
FROM alpine/git AS sources

RUN git clone --depth=1 --branch=v2.0.1 https://github.com/onaio/express-server.git /usr/src/express-server
# TODO - update the tag here
RUN git clone --branch=bulk-upload-bull https://github.com/onaio/express-server.git /usr/src/express-server

WORKDIR /usr/src/express-server

RUN git checkout 378f2884

FROM node:16.18-alpine as build

Expand All @@ -21,7 +26,6 @@ RUN chown -R node .
USER node
RUN yarn lerna run build


FROM node:16.18-alpine as nodejsbuild

COPY --from=sources /usr/src/express-server /usr/src/express-server
Expand All @@ -32,7 +36,9 @@ RUN yarn && yarn tsc && npm prune -production --legacy-peer-deps
# Remove unused dependencies
RUN rm -rf ./node_modules/typescript

FROM node:16.18-alpine as final
# TODO - change image to use one with python or install python here
FROM nikolaik/python-nodejs:python3.12-nodejs22-alpine as final


# Use tini for NodeJS application https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#handling-kernel-signals
RUN apk add --no-cache tini curl
Expand All @@ -52,21 +58,28 @@ WORKDIR /usr/src/web
COPY --from=build /project/node_modules /usr/src/web/node_modules
COPY --from=build /project/app/build /usr/src/web

RUN chown -R node /usr/src/web

# RUN chown -R pn /usr/src/web

WORKDIR /usr/src/app

COPY --from=nodejsbuild /usr/src/express-server/dist /usr/src/app
COPY --from=nodejsbuild /usr/src/express-server/build /usr/src/app
COPY --from=nodejsbuild /usr/src/express-server/node_modules /usr/src/app/node_modules

RUN chown -R node /usr/src/app

USER node
RUN pip install -r /usr/src/app/fhir-tooling/requirements.txt

# RUN chown -R pn /usr/src/app

# USER pn

ENV EXPRESS_REACT_BUILD_PATH /usr/src/web/

EXPOSE 3000

CMD [ "/bin/sh", "-c", "/usr/local/bin/app.sh && node ." ]
CMD [ "/bin/sh", "-c", "/usr/local/bin/app.sh && node /usr/src/app/dist" ]

# ENTRYPOINT [ "/bin/sh" ]
# ENTRYPOINT [ "/bin/sh", "-c", "/usr/local/bin/app.sh && node ." ]

ENTRYPOINT ["/sbin/tini", "--"]
35 changes: 35 additions & 0 deletions app/src/App/fhir-apps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ import { CloseFlag, URL_CLOSE_FLAGS } from '@opensrp/fhir-flag';
import { useTranslation } from '../mls';
import '@opensrp/user-management/dist/index.css';
import { APP_LOGIN_URL } from '../configs/dispatchConfig';
import { DATA_IMPORT_CREATE_URL, ImportDetailViewDetails, DATA_IMPORT_DETAIL_URL, DATA_IMPORT_LIST_URL, DataImportList, StartDataImport } from '@opensrp/fhir-import';

/** Util function that renders Oauth2 callback components
*
Expand Down Expand Up @@ -203,6 +204,40 @@ const FHIRApps = () => {
permissions={['iam_group.read']}
component={UserGroupsList}
/>
<PrivateComponent
redirectPath={APP_CALLBACK_URL}
disableLoginProtection={DISABLE_LOGIN_PROTECTION}
exact
path={DATA_IMPORT_LIST_URL}
permissions={['WebDataImport.read']}
component={DataImportList}
/>
<PrivateComponent
redirectPath={APP_CALLBACK_URL}
disableLoginProtection={DISABLE_LOGIN_PROTECTION}
exact
path={`${DATA_IMPORT_CREATE_URL}`}
permissions={['WebDataImport.create']}
component={StartDataImport}
/>
<PrivateComponent
redirectPath={APP_CALLBACK_URL}
disableLoginProtection={DISABLE_LOGIN_PROTECTION}
exact
path={`${DATA_IMPORT_DETAIL_URL}/:${'workflowId'}`}
{...patientProps}
permissions={['WebDataImport.read']}
component={ImportDetailViewDetails}
/>
<PrivateComponent
redirectPath={APP_CALLBACK_URL}
disableLoginProtection={DISABLE_LOGIN_PROTECTION}
exact
path={`${DATA_IMPORT_LIST_URL}/:${'workflowId'}`}
{...patientProps}
permissions={['WebDataImport.read']}
component={DataImportList}
/>
<PrivateComponent
redirectPath={APP_CALLBACK_URL}
disableLoginProtection={DISABLE_LOGIN_PROTECTION}
Expand Down
11 changes: 11 additions & 0 deletions app/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DashboardOutlined, IdcardOutlined } from '@ant-design/icons';
import UploadIcon from '@2fd/ant-design-icons/lib/Upload';
import {
ENABLE_HEALTHCARE_SERVICES,
ENABLE_FHIR_GROUP,
Expand Down Expand Up @@ -31,6 +32,7 @@ import {
import React from 'react';
import { UserRole } from '@opensrp/rbac/dist/types/roleDefinition';
import { getConfig, eusmProjectCode } from '@opensrp/pkg-config';
import { DATA_IMPORT_LIST_URL } from '@opensrp/fhir-import';

/** Interface for menu items */
export interface Route {
Expand Down Expand Up @@ -192,6 +194,15 @@ export function getRoutes(roles: string[], t: TFunction, userRole: UserRole): Ro
url: LIST_PATIENTS_URL,
isHomePageLink: true,
},
{
otherProps: { icon: <UploadIcon /> },
title: t('Data Imports'),
key: 'data-import',
enabled: true,
permissions: ['WebDataImport.read'],
url: DATA_IMPORT_LIST_URL,
isHomePageLink: true,
},
];

return filterFalsyRoutes(routes, userRole);
Expand Down
46 changes: 46 additions & 0 deletions packages/fhir-import/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Package

<!-- package description -->

## Installation

```sh
yarn add @opensrp/template
```

<!--
Include further installation instructions, for instance if the package requires for the user
to manually add css.
-->

## Usage

<!--
### Props/ Configuration
#### linkerField
_Optional_(`string` | `undefined` = `undefined`)
When the table is rendered, you can click anywhere on a row to drill down to the next level of the hierarchy. However, you may want to display some kind of indication that it is possible to drill down on a row of data. The `linkerField` prop allows you to define which field should have this indicator. By default this is set to the `id` field.
-->

### Code examples

<!--
A single simple, minimal, working snippet for each use-case that the package supports
```tsx
import { DrillDownTable, columnsFromObjects } from '@onaio/drill-down-table/';
const props = {
columns: columnsFromObjects(data),
data
};
<DrillDownTable {...props} />;
```
-->
144 changes: 144 additions & 0 deletions packages/fhir-import/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
declare module '@2fd/ant-design-icons' {
import { ReactNode, SVGProps } from 'react';

export interface IconProps extends SVGProps<SVGSVGElement> {
title?: string;
size?: number | string;
color?: string;
}

export interface IconComponent {
(props: IconProps): ReactNode;
}

export const AccountBookOutlined: IconComponent;
export const AlertOutlined: IconComponent;
export const AliyunOutlined: IconComponent;
export const AmazonOutlined: IconComponent;
export const AndroidOutlined: IconComponent;
export const AppleOutlined: IconComponent;
export const AppstoreOutlined: IconComponent;
export const ArrowDownOutlined: IconComponent;
export const ArrowLeftOutlined: IconComponent;
export const ArrowRightOutlined: IconComponent;
export const ArrowUpOutlined: IconComponent;
export const AudioOutlined: IconComponent;
export const BackwardOutlined: IconComponent;
export const BankOutlined: IconComponent;
export const BarcodeOutlined: IconComponent;
export const BarsOutlined: IconComponent;
export const BellOutlined: IconComponent;
export const BookOutlined: IconComponent;
export const BoxPlotOutlined: IconComponent;
export const BugOutlined: IconComponent;
export const BuildOutlined: IconComponent;
export const BulbOutlined: IconComponent;
export const CalculatorOutlined: IconComponent;
export const CalendarOutlined: IconComponent;
export const CameraOutlined: IconComponent;
export const CarOutlined: IconComponent;
export const CarryOutOutlined: IconComponent;
export const CheckCircleOutlined: IconComponent;
export const CheckSquareOutlined: IconComponent;
export const ClockCircleOutlined: IconComponent;
export const CloudOutlined: IconComponent;
export const CodeOutlined: IconComponent;
export const CoffeeOutlined: IconComponent;
export const CompassOutlined: IconComponent;
export const ContactsOutlined: IconComponent;
export const ContainerOutlined: IconComponent;
export const ControlOutlined: IconComponent;
export const CreditCardOutlined: IconComponent;
export const CrownOutlined: IconComponent;
export const CustomerServiceOutlined: IconComponent;
export const DashboardOutlined: IconComponent;
export const DatabaseOutlined: IconComponent;
export const DeleteOutlined: IconComponent;
export const DesktopOutlined: IconComponent;
export const DislikeOutlined: IconComponent;
export const DollarOutlined: IconComponent;
export const DownloadOutlined: IconComponent;
export const EditOutlined: IconComponent;
export const EnvironmentOutlined: IconComponent;
export const ExclamationCircleOutlined: IconComponent;
export const ExperimentOutlined: IconComponent;
export const ExportOutlined: IconComponent;
export const EyeOutlined: IconComponent;
export const FileOutlined: IconComponent;
export const FilterOutlined: IconComponent;
export const FireOutlined: IconComponent;
export const FlagOutlined: IconComponent;
export const FolderOutlined: IconComponent;
export const FolderOpenOutlined: IconComponent;
export const FundProjectionScreenOutlined: IconComponent;
export const FunnelPlotOutlined: IconComponent;
export const GiftOutlined: IconComponent;
export const GlobalOutlined: IconComponent;
export const GoldOutlined: IconComponent;
export const HddOutlined: IconComponent;
export const HeartOutlined: IconComponent;
export const HomeOutlined: IconComponent;
export const HourglassOutlined: IconComponent;
export const IdcardOutlined: IconComponent;
export const InboxOutlined: IconComponent;
export const KeyOutlined: IconComponent;
export const LaptopOutlined: IconComponent;
export const LayoutOutlined: IconComponent;
export const LikeOutlined: IconComponent;
export const LineChartOutlined: IconComponent;
export const LockOutlined: IconComponent;
export const MailOutlined: IconComponent;
export const MedicineBoxOutlined: IconComponent;
export const MehOutlined: IconComponent;
export const MessageOutlined: IconComponent;
export const MobileOutlined: IconComponent;
export const MoneyCollectOutlined: IconComponent;
export const NotificationOutlined: IconComponent;
export const OrderedListOutlined: IconComponent;
export const PaperClipOutlined: IconComponent;
export const PartitionOutlined: IconComponent;
export const PauseOutlined: IconComponent;
export const PhoneOutlined: IconComponent;
export const PictureOutlined: IconComponent;
export const PlayCircleOutlined: IconComponent;
export const PlusOutlined: IconComponent;
export const PrinterOutlined: IconComponent;
export const ProfileOutlined: IconComponent;
export const ProjectOutlined: IconComponent;
export const PushpinOutlined: IconComponent;
export const QrcodeOutlined: IconComponent;
export const ReadOutlined: IconComponent;
export const ReconciliationOutlined: IconComponent;
export const RedEnvelopeOutlined: IconComponent;
export const ReloadOutlined: IconComponent;
export const RestOutlined: IconComponent;
export const RocketOutlined: IconComponent;
export const SafetyCertificateOutlined: IconComponent;
export const SaveOutlined: IconComponent;
export const ScheduleOutlined: IconComponent;
export const SecurityScanOutlined: IconComponent;
export const SettingOutlined: IconComponent;
export const ShopOutlined: IconComponent;
export const ShoppingCartOutlined: IconComponent;
export const SkinOutlined: IconComponent;
export const SmileOutlined: IconComponent;
export const SolutionOutlined: IconComponent;
export const StarOutlined: IconComponent;
export const StopOutlined: IconComponent;
export const SwitcherOutlined: IconComponent;
export const TabletOutlined: IconComponent;
export const TagOutlined: IconComponent;
export const TagsOutlined: IconComponent;
export const ToolOutlined: IconComponent;
export const UnlockOutlined: IconComponent;
export const UsergroupAddOutlined: IconComponent;
export const UsergroupDeleteOutlined: IconComponent;
export const UserOutlined: IconComponent;
export const VideoCameraOutlined: IconComponent;
export const WalletOutlined: IconComponent;
export const WarningOutlined: IconComponent;
export const WifiOutlined: IconComponent;
export const ZoomInOutlined: IconComponent;
export const ZoomOutOutlined: IconComponent;
}

47 changes: 47 additions & 0 deletions packages/fhir-import/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@opensrp/fhir-import",
"version": "0.0.6",
"description": "",
"main": "dist/index.js",
"types": "dist/types",
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": "https://github.com/opensrp/web",
"scripts": {
"test": "run -T test $INIT_CWD --verbose",
"tsc": "run -T tsc",
"lint": "run -T eslint ./**/*.{js,jsx,ts,tsx}",
"copy": "run -T copyfiles -u 1 \"./src/**/*.{css,html}\" \"./dist/\"",
"build": "run tsc && run transpile && run copy",
"transpile": "run -T babel src -d dist --root-mode upward --extensions .ts,.tsx --ignore '**/*.test.ts,**/*.test.tsx,**/tests,**/__tests__'"
},
"jest": {
"automock": false,
"setupFiles": [
"../../setupTests"
]
},
"bugs": {
"url": "https://github.com/opensrp/web/issues"
},
"peerDependencies": {
"@opensrp/i18n": "^0.0.1",
"react": "^17.0.0",
"react-dom": "17.0.0",
"react-query": "^3.15.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0"
},
"dependencies": {
"@2fd/ant-design-icons": "^2.6.0",
"@opensrp/notifications": "^0.0.5",
"@opensrp/rbac": "workspace:^",
"@opensrp/react-utils": "^0.0.12"
},
"author": "OpenSRP Engineering",
"license": "Apache-2.0"
}
Loading

0 comments on commit 16c3a92

Please sign in to comment.