/openmrs-owa-labworkflow

Primary LanguageJavaScriptOtherNOASSERTION

OpenMRS

openmrs-owa-labworkflow

This repository contains the openmrs-owa-labworkflow OpenMRS Open Web App.

Add a description of what your app does here.

For further documentation about OpenMRS Open Web Apps see the wiki page.

Development

Production Build

You will need NodeJS 6+ installed to do this. See the install instructions here.

Once you have NodeJS installed, install the dependencies (first time only):

npm install

Build the distributable using Webpack as follows:

npm run build:prod

This will create a file called openmrs-owa-labworkflow.zip file in the dist directory, which can be uploaded to the OpenMRS Open Web Apps module.

Local Deploy

To deploy directly to your local Open Web Apps directory, run:

npm run build:deploy

This will build and deploy the app to the /Users/andeladeveloper/Downloads/referenceapplication-standalone-2.8.0/appdata\\owa directory. To change the deploy directory, edit the LOCAL_OWA_FOLDER entry in config.json. If this file does not exists, create one in the root directory that looks like:

{
  "LOCAL_OWA_FOLDER": "/Users/andeladeveloper/Downloads/referenceapplication-standalone-2.8.0/appdata\\owa"
}

Running Cypress tests

When you clone this repo for the first time or pull the latest updates, you wiil need to run npm install which will also install cypress and start-server-and-test as dev dependencies, and then as usual run npm link @openmrs/react-components to link to the correct version of React Components.

Using the sample "cypress.env.json.sample" file, create a file "cypress.env.json" at the root level of this repo which sets two environmental variables for the username and password you will be using to connect to the server (NOTE: this has to be valid username and password).

{
  "username": "your-username",
  "password": "Your-Password"
}

To run all tests: npm run test-cypress (this should fire up your server for you as well)

NOTE: To run tests make sure your OpenMRS instance is running and this OWA is started and linked up to the instance.

To fire up Cypress in interactive mode:

  1. Make sure the app is running on localhost:3000
  2. npm run cypress:open

See docs for cypress here: https://www.cypress.io/

Live Reload

To use Browersync to watch your files and reload the page, inject CSS or synchronize user actions across browser instances, you will need the APP_ENTRY_POINT entry in your config.json file:

{
  "LOCAL_OWA_FOLDER": "/Users/andeladeveloper/Downloads/referenceapplication-standalone-2.8.0/appdata\\owa",
  "APP_ENTRY_POINT": "http://localhost:8081/openmrs-standalone/owa/openmrs-owa-labworkflow/index.html"
}

Run Browsersync as follows:

npm run watch

Extending

Install npm packages dependencies as follows:

npm install --save <package>

To use the installed package, import it as follows:

//import and assign to variable
import variableName from 'package';

To contain package in vendor bundle, remember to add it to vendor entry point array, eg.:

entry: {
  app : `${__dirname}/app/js/owa.js`,
  css: `${__dirname}/app/css/owa.css`,
  vendor : [
    'package',
    ...//other packages in vendor bundle
  ]
},

Any files that you add manually must be added in the app directory.

Troubleshooting

You may experience problems due to the Access-Control-Allow-Origin header not being set by OpenMRS. To fix this you'll need to enable Cross-Origin Resource Sharing in Tomcat.

Usage

Before using the Lab Workflow Application, the administrator should make the following one time configurations using the admin portal.

  1. Create a setting labworkflowowa.labResultsEncounterType.
  2. Create a date format, setting labworkflowowa.dateAndTimeFormat as the name, with a value of the date format, e.g. DD-MMM-YYYY HH:mm, in the global properties

See instructions here for Tomcat 7 and here for Tomcat 6.

License

MPL 2.0 w/ HD