Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Projects

Page tree
Skip to end of metadata
Go to start of metadata

This page represents work by ?Kevin Peters for ?Summer Of Code 2008 and may have been replaced by work elsewhere.

Overview

The Logic Web Service is a module for OpenMRS that allows web access to Logic Service functions.

info|The Logic Web Service uses HTTP BASIC authentication, and is thus only recommended for use on servers that use SSL. Use of non-SSL servers would broadcast HTTP authentication insecurely.

Installation

Access the Logic Web Service Module in the Module Repository and download the latest file (a .omod file). Install this module in OpenMRS (Administration -> Manage Modules -> Add Module).

Limiting Access by IP Address

Access can be limited by IP address via a global property. By default, only the computer on which the Logic Web Service module is installed can access it.

How to Modify

Create the property logicws.allowed_ip_list in your OpenMRS runtime properties file, and fill it in with a whitespace-separated list of remote IP addresses allowed to access the Logic Web Service API. Each entry should be four numbers (0-255) separated with periods, using "*" for wildcards.

Example

logicws.allowed_ip_list=192.168.1.* 192.168.2.50

Allows all clients with IP addresses beginning with 192.168.1 plus the IP address 192.168.2.50.

API Functions

getFilters

http://demo.openmrs.org/openmrs/moduleServlet/logicws/api/getFilters

: <?xml version="1.0" encoding="utf-8"?>
: <filterList>
:     <filter name="FILTER_1" id="1" />
:     <filter name="FILTER_2" id="2" />
:     <filter name="FILTER_N" id="42" />
: </filterList>

getTokenTags

http://demo.openmrs.org/openmrs/moduleServlet/logicws/api/getTokenTags

: <?xml version="1.0" encoding="utf-8"?>
: <tokenTagList>
:     <tag>TAG_1</tag>
:     <tag>TAG_2</tag>
:     <tag>TAG_N</tag>
: </tokenTagList>

getTokens

http://demo.openmrs.org/openmrs/moduleServlet/logicws/api/getTokens?tag=TAG

: <?xml version="1.0" encoding="utf-8"?>
: <tokenList>
:     <token name="TOKEN_1" type="TEXT" />
:     <token name="TOKEN_2" type="BOOLEAN" />
:     <token name="TOKEN_3" type="DATETIME" />
:     <token name="TOKEN_N" type="NUMERIC" scale="3" precision="5" />
: </tokenList>
:
: <!--
:
: Scale is an optional attribute that describes the maximum number
:     of digits to the right of the decimal point.
:
: Precision is an optional attribute that describes the maximum
:     number of decimal digits.
:
: -->

getData

http://demo.openmrs.org/openmrs/moduleServlet/logicws/api/getData?query=SELECT AGGREGATE X {TOKEN_1} OPERATOR OPERAND:SPLIT_1:SPLIT_2|AGGREGATE X {TOKEN_2} OPERATOR OPERAND:SPLIT_1:SPLIT_2 FROM COHORT&datastyle=DATASTYLE

The "splits" are those attributes that allow the user to get back more data regarding the token besides the token value (observation date, observation location, etc.). The data style is one of three data style choices: mostrecent, stacked, and flat.

: <?xml version="1.0" encoding="utf-8"?>
: <dataset>
:     <columns>
:         <column token="PATIENT_ID"/>
:         <column token="WEIGHT"/>
:         <column token="CD4 COUNT"/>
:     </columns>
:     <rows>
:         <row>
:             <value>1</value>
:             <value>180</value>
:             <value>209</value>
:         </row>
:         <row>
:             <value>2</value>
:             <value>200</value>
:             <value>198</value>
:         </row>
:     </rows>
: </dataset>
: 

Troubleshooting

  • It doesn't work right!
    If you find anything wrong with this, please notify the developers of this, by posting in the forums, sending an email to the Implementer's list, or sending a direct e-mail to Rudd Zwolinski or Kevin Peters. Make sure to note what went wrong, what you were doing when it happened, and any error messages if there are any.

Developers

To get involved in working on the Logic Web Service, see the Reporting Framework Integration Project.