This module tries as much as possible to minimise the amount of configuration required. For local installations where there is no requirement to synchronise data with remote installations, no configuration is necessary. In cases where remote synchronisation is required, there are two ways to go about it:
- Configure the application to use LIMS' API and optionally use LIMS' results update channel for realtime results updates
- Configure the application to attach to LIMS' message queue (ie CouchDB)
This makes use of EMR-API's config/application.yml
and it's the recommended setup.
The Lab module extends the configuration file with a few parameters of its own.
Below is a list of the parameters added and what they do:
Field | Description |
---|---|
lims_protocol | The layer 7 protocol the LIMS API is using. Valid values are http and https |
lims_host | IP address or domain of the machine hosting the LIMS API server |
lims_port | Port on the host machine the LIMS API server is exposed on |
lims_username | Username used by this application to authenticate with LIMS |
lims_password | Password used by this application to authenticate with LIMS |
lims_prefix | LIMS API version, setting it to api/v1 should be fine |
lims_realtime_updates_url | An optional field that when specified enables receipt of results from LIMS in realtime. The value of this is a URL to a web socket exposed by LIMS for updates. |
The following is an example configuration:
# LIMS Configuration
lims_protocol: http
lims_host: lims.hismalawi.org
lims_port: 80
lims_prefix: api/v1
lims_username: emr_api
lims_password: caput-draconis
lims_realtime_updates: lims.hismalawi.org:8000
This was the original implementation, it's no longer recommended. In setups where the EMR API application is installed on the same machine as the local LIMS proxy, no configuration is required. LIMS' configurations will be read and used. The following is the search path for a configuration file:
1. ~/apps/nlims_controller/config/couchdb.yml
2. /var/www/nlims_controller/config/couchdb.yml
3. ../nlims_controller/config/couchdb.yml
4. config/lims-couch.yml
First the module looks for a LIMS' CouchDB configuration in the apps
directory that's located in the current user's home directory (ie
user the app runs as). If not found then it goes to /var/www
and
looks for a LIMS installation, and so on. The last place it looks for
a configuration is the HIS-EMR-API config's directory. It looks for
a file named lims-couch.yml which is just a copy of the LIM's couchdb.yml.
The CouchDB configuration file for LIMS comes as a YAML file of the following structure (NOTE: the indentation matters):
development: &development
protocol: 'http'
host: localhost
port: 5984
prefix: nlims
suffix: repo
username: admin
password: caput-draconis
test:
<<: *development
suffix: test
production:
<<: *development
protocol: 'http'
The file has three sections, development, test, and production. These correspond to various deployment environments. The parameters that fall under production apply to the production environment, similarly test and development's parameters apply to the test and development environments. Sections can inherit parameters from other sections by using the special <<: parameter, for example, in the configuration above: test and production inherit from the development environment.
The configuration parameters are the same across alls sections, thus the following will describe the parameters that are appearing in the development section of the example configuration above.
Field | Description |
---|---|
protocol | This is the protocol the CouchDB server is running on: Valid values are http and https |
host | This is the ip address of the machine the target CouchDB instance is running on |
port | Normally CouchDB runs on port 5984, but if that port was changed to something else then this must be updated to that |
prefix | LIMS's database names are structured as prefix_order_suffix. This parameter just specifies the prefix of the database name |
suffix | See prefix above, this is the suffix of the target database name |
username | This is the CouchDB user username |
password | Accompanies the username above |