The basic idea of this project - building a fast, responsive search layer for medical data. Currently, the search layer in OpenMRS performs many unecessary checks before accessing the data. Our task is to bring that data into a lightweight node.js search layer. Before each database lookup, we must perform a quick check using the OpenMRS API to see if the user is allowed to view that particular resource.
Every indexed object consist of such fields:
Indexed objects, which added to index:
elastic-search uses river inteface for adding/updating indexes. A river is a pluggable service running within elasticsearch cluster pulling data (or being pushed with data) that is then indexed into the cluster.
For fetching data from MySQL database we use MySQL river. River can be setuped using request to Elasticsearch with next params (for example)
curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
}'
sql - sql statements for fetching data froom MySQL database;
index - index name;
poll - time interval for updating;
type - index type;
strategy - the strategy of updating indexes, there are 3 strategies:
table - does not use an sql
command. Instead, a whole table is prepared at the database side from which the rows are selected for indexing. The name of the table must be equal to the river name.
In our case we use simple strategy, which provides updating indexes.
For each table/sub-table we create a river, which will update data for this table.
For searching data yo must execute GET request to server
Currently such search types supported:
Supported options:
Example requests:
All requests require authorization, currently BASIC authorization provided, with login and password.
First request may take long time, because all privileges and access rights will be checked and saved to local storage. With next requests to server only quick user checking will be perfomed, and all privileges will be taken from local storage. In 10 minutes after last request user data and privileges will be removed from local storage, and next request will also take a long time.
All user data indexed to Elasticsearch index, which allows make quick requests to ES for checking user privileges.
Options, which will be checked:
By default, response presented in JSON format.
Response structure for different resources:
middleName
familyName
givenName
address1
address2
cityVillage
stateProvince
postalCode
country
value
name
description
format
searchable
voided
display
uuid
person (see person)
identifiers (array)
voided
description
name
format
identifier
person (see person)
name
identifier
diplay
retired
uuid
name
valueReference
name
description
datatype
conceptClass
description
name
sortWeight
uuid
description
locale
uuid
patient (see patient)
form
location (see location)
voided
display
visit
provider (see provider)
uuid
encounterType
description
name
encounterDatetime
order (see order)
uuid
name
retired
dosageForm
doseStrength
display
maximumDailyDose
minimumDailyDose
units
concept
combination
route
startDate
orderer
concept (see concept)
instructions
orderType
description
name
discontinuedReason
autoExpireDate
display
encounter (see encounter)
person (see person)
concept (see concept)
obsDatetime
location (see location)
display
encounter (see encounter)
order
voided
value
accessionNumber
obsGroup
uuid
valueModifier
comments
valueCodedName
countryDistrict
retired
address1
address2
parentLocation
postalCode
description
name
cityVillage
stateProvince
longitude
latitude
uuid
childLocations
attributes (array)
valueReferencename
name
description
datatype
tags (array)
name
description