Skip to content

rkorytkowski/openmrs-owa-conceptdictionary

Repository files navigation

OpenMRS

Concept Dictionary

Build Status Codacy Badge Codacy Badge Download Demo

This repository contains the Concept Dictionary OpenMRS Open Web App.

Installing Concepts OWA

Before installing the app, please make sure you have the following modules installed:

  1. Open Web Apps 1.4 or later
  2. Webservices.rest 1.15-SNAPSHOT built from source

First, you need to Download the zip package with Concept Dictionary OWA. To add this package to Reference App, enter advanced administration panel (default at: openmrs/admin/index.htm), then go to Manage Apps in Open Web Apps Module menu, click "Browse", find the zip file and then upload it via button. When application is installed, it can be accessed under owa/conceptdictionary/index.html.

Adding Application link to "Configure Metadata" menu:

When on Reference Application Menu, enter `System Administration` -> `Manage Apps` -> `Add App Definition` and input following text inside:
{
    "id": "owa.conceptdictionary",
    "description": "Concept OWA Dictionary",
    "order": 0,
    "extensions": [
        {
            "id": "owa.conceptdictionary.adminGroup",
            "extensionPointId": "org.openmrs.module.adminui.adminGroups",
            "type": "group",
            "label": "Concepts",
            "icon": "icon-book"
        },
        {
            "id": "owa.conceptdictionary.adminLink",
            "extensionPointId": "org.openmrs.module.adminui.adminLinks",
            "type": "link",
            "label": "Manage Concept Dictionary",
            "url": "owa/conceptdictionary/index.html",
            "extensionParams": {
                "group": "owa.conceptdictionary.adminGroup"
            }
        }
    ]
}

Save changes, now Concept OWA is visible at adminui/metadata/configureMetadata.page

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

Development

Please follow the style guide for AngularJS development.

Setup OpenMRS server

You will need JDK 1.7, maven and OpenMRS SDK. Please refer to [the wiki page] (https://wiki.openmrs.org/display/docs/OpenMRS+SDK#OpenMRSSDK-Installation) for installation instructions.

You need to setup a server (first time only) as follows:

mvn openmrs-sdk:setup-platform -DserverId=conceptdictionary
mvn openmrs-sdk:install -DartifactId=owa -Dversion=1.4-SNAPSHOT -DserverId=conceptdictionary
mvn openmrs-sdk:install -DartifactId=uiframework -Dversion=3.6 -DserverId=conceptdictionary
mvn openmrs-sdk:install -DartifactId=uicommons -Dversion=1.7 -DserverId=conceptdictionary

You need to install latest version of REST webservices module

mvn openmrs-sdk:install -DartifactId=webservices.rest -Dversion=2.14-SNAPSHOT -DserverId=conceptdictionary
# You can also add "-U" atribute to maven command to ensure that module is downloaded from Maven repository

Now you can run the server:

mvn openmrs-sdk:run -DserverId=conceptdictionary

Once it says "Started Jetty Server", visit http://localhost:8080/openmrs in your browser.

Production Build

You will need NodeJS 4+ 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

This will create a dist directory, which content can be uploaded to the OpenMRS Open Web Apps module.

Releasing

To release the app set the version property in bintray.json and package.json to the version you want to release.

Next create a new tag named after the version or create a release from GitHub Releases.

The tag will be built by Travis-ci and the release pushed to Bintray automatically.

Finally set the property version in bintray.json and package.json to the next development version.

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 directory specified in LOCAL_OWA_FOLDER value in ./config.json, created by dev. If config.json is absent, app will be deployed to /dist directory. You can find your deploy directory running:

 mvn openmrs-sdk:run -DserverId=conceptdictionary

Look at the tmp directory location. The tmp directory is created in your deploy directory so just skip \tmp.

[INFO] --- openmrs-sdk-maven-plugin:2.1.2:run (default-cli) @ standalone-pom ---
[INFO] Configuring Jetty for project: Maven Stub Project (No POM)
[INFO] Context path = /openmrs
[INFO] Tmp directory = C:\Users\Rafal\openmrs\conceptdictionary\tmp

It is also possible to configure the project so that whenever a file is changed it is deployed to a server and a browser is refreshed. First please make sure the APP_ENTRY_POINT is set in config.json as follows:

{
  "LOCAL_OWA_FOLDER": "C:\\\\Users\\\\rafal\\\\openmrs\\\\conceptdictionary\\\\owa\\\\",
  "APP_ENTRY_POINT":"http://localhost:8080/openmrs/owa/conceptdictionary/index.html"
}

Next run:

npm run watch

While it runs, it watches all files for changes and automatically updates your browser.

###UI elements

Styles css, fonts and some UI components like openmrs-header and openmrs-breadcrums come from the openmrs-contrib-uicommons dependency. Please refer to the other project, if you want to contribute to them.

###Deplyoing to GitHub Pages

The master branch of this repo is being deployed to http://rkorytkowski.github.io/openmrs-owa-conceptdictionary with every commit. If you want to have the same behavior in your fork you need to make sure deploy.sh has the execution bit set using:

git update-index --chmod=+x deploy.sh

You will also need to change the url to point to your fork in deploy.sh line 27 and set the GITHUB_PAGES_TOKEN variable in travis-ci to your token generated from https://github.com/settings/tokens

Extending

Install npm packages dependencies as follows:

npm install --save <package>

Be sure to include the loading statement in your .js files at the modules you want your dependencies injected:

//import module
require('package')
//import and assign to variable
import variableName from 'package';

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

Community

OpenMRS Talk OpenMRS IRC OpenMRS Telegram OpenMRS Wiki

Support

Ask questions on OpenMRS Talk.

License

MPL 2.0 w/ HD © OpenMRS Inc.