<commit_before><img src="https://cloud.githubusercontent.com/assets/668093/12567089/0ac42774-c372-11e5-97eb-00baf0fccc37.jpg" alt="OpenMRS"/>

# Concept Dictionary
[![Build Status](https://travis-ci.org/rkorytkowski/openmrs-owa-conceptdictionary.svg?branch=master)](https://travis-ci.org/rkorytkowski/openmrs-owa-conceptdictionary) [![Codacy Badge](https://api.codacy.com/project/badge/grade/a7b282f69c44458297ec61d65d4b3baf)](https://www.codacy.com/app/pascal_2/openmrs-owa-conceptdictionary) [![Codacy Badge](https://api.codacy.com/project/badge/coverage/a7b282f69c44458297ec61d65d4b3baf)](https://www.codacy.com/app/pascal_2/openmrs-owa-conceptdictionary)

This repository contains the Concept Dictionary OpenMRS Open Web App.

> Concept dictionary functionality implemented as an OWA

For further documentation about OpenMRS Open Web Apps see [the wiki page](https://wiki.openmrs.org/display/docs/Open+Web+Apps+Module).

Please follow [the style guide](https://github.com/rkorytkowski/angular-styleguide/blob/master/a1/README.md) for AngularJS development.

## 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:

````sh
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
````sh
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:
````sh
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](https://nodejs.org/en/download/package-manager/).

Once you have NodeJS installed, you need to install Gulp and Bower (first time only) as follows:
````sh
npm install -g gulp bower
````

Install the dependencies (first time only):

```sh
npm install && bower install
```

Build the distributable using [Gulp](http://gulpjs.com/) as follows:

````sh
gulp
````

This will create a file called `conceptdictionary.zip` file in the `dist` directory, which can be uploaded to the OpenMRS Open Web Apps module.

### Development Build

Bulild project with scrpits minification using

````sh
gulp build-prod
````

This will create a file called `conceptdictionary.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:

````sh
gulp deploy-local
````

This will build and deploy the app to the `C:\Users\Rafal\openmrs\conceptdictionary` directory. To change the deploy directory, edit the `LOCAL_OWA_FOLDER` value in `config.json`. You can find your deploy directory running:

````sh
 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:

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

Next run:
````sh
gulp watch
````

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

### Installing Concepts OWA on OpenMRS Reference Application

First, You need to download *.zip package with Concept 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 `conceptdictionary.zip` file and then upload it via button.
When application is installed, it can be accessed under `owa/conceptdictionary/index.html`.

<p><b>Adding Application link to "Configure Metadata" menu:</b> </p>
When on Reference Application Menu, enter `System Administration` -> `Manage Apps` -> `Add App Definition` and input following text inside:

````sh
{
    "id": "owa.conceptdictionary",
    "description": "Concept OWA Dictionary",
    "order": 0,
    "extensions": [
        {
            "id": "use 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`

### Extending

Install [Bower](http://bower.io/) packages dependencies as follows:

````sh
bower install --save <package>
````

Be sure to include the following in your `html` files at the position you want the Bower dependencies injected:
<commit_msg>Fixed Readme typo<commit_after><img src="https://cloud.githubusercontent.com/assets/668093/12567089/0ac42774-c372-11e5-97eb-00baf0fccc37.jpg" alt="OpenMRS"/>

# Concept Dictionary
[![Build Status](https://travis-ci.org/rkorytkowski/openmrs-owa-conceptdictionary.svg?branch=master)](https://travis-ci.org/rkorytkowski/openmrs-owa-conceptdictionary) [![Codacy Badge](https://api.codacy.com/project/badge/grade/a7b282f69c44458297ec61d65d4b3baf)](https://www.codacy.com/app/pascal_2/openmrs-owa-conceptdictionary) [![Codacy Badge](https://api.codacy.com/project/badge/coverage/a7b282f69c44458297ec61d65d4b3baf)](https://www.codacy.com/app/pascal_2/openmrs-owa-conceptdictionary)

This repository contains the Concept Dictionary OpenMRS Open Web App.

> Concept dictionary functionality implemented as an OWA

For further documentation about OpenMRS Open Web Apps see [the wiki page](https://wiki.openmrs.org/display/docs/Open+Web+Apps+Module).

Please follow [the style guide](https://github.com/rkorytkowski/angular-styleguide/blob/master/a1/README.md) for AngularJS development.

## 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:

````sh
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
````sh
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:
````sh
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](https://nodejs.org/en/download/package-manager/).

Once you have NodeJS installed, you need to install Gulp and Bower (first time only) as follows:
````sh
npm install -g gulp bower
````

Install the dependencies (first time only):

```sh
npm install && bower install
```

Build the distributable using [Gulp](http://gulpjs.com/) as follows:

````sh
gulp
````

This will create a file called `conceptdictionary.zip` file in the `dist` directory, which can be uploaded to the OpenMRS Open Web Apps module.

### Development Build

Bulild project with scrpits minification using

````sh
gulp build-prod
````

This will create a file called `conceptdictionary.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:

````sh
gulp deploy-local
````

This will build and deploy the app to the `C:\Users\Rafal\openmrs\conceptdictionary` directory. To change the deploy directory, edit the `LOCAL_OWA_FOLDER` value in `config.json`. You can find your deploy directory running:

````sh
 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:

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

Next run:
````sh
gulp watch
````

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

### Installing Concepts OWA on OpenMRS Reference Application

First, You need to download *.zip package with Concept 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 `conceptdictionary.zip` file and then upload it via button.
When application is installed, it can be accessed under `owa/conceptdictionary/index.html`.

<p><b>Adding Application link to "Configure Metadata" menu:</b> </p>
When on Reference Application Menu, enter `System Administration` -> `Manage Apps` -> `Add App Definition` and input following text inside:

````sh
{
    "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`

### Extending

Install [Bower](http://bower.io/) packages dependencies as follows:

````sh
bower install --save <package>
````

Be sure to include the following in your `html` files at the position you want the Bower dependencies injected:

{'fraction_non_alphanumeric': 0.1191607933125717, 'fraction_numerical': 0.016390755613833796, 'mean_word_length': 4.301042571676803, 'pattern_counts': {'":': 36, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 22, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1577558', 'n_tokens_mistral': 4015, 'n_tokens_neox': 3664, 'n_words': 1177}