Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

API Implementation Notes

Jonathan Payne edited this page Feb 25, 2015 · 4 revisions

OCL works by crowdsourcing information from various data sources specifically OpenMRS dictionaries , Apelon data sources (like SNOMED). Our indexing and primary data source is in SOLR, which has two cores : concepts and types. SOLR can be accessed from this point : SOLR ADMIN at which you can manage the OCL cores.

OCL concepts holds all the concepts metadata, indexing the following fields. Note more fields can be included in this schema, just remember to add the field you index to the solr schema

        "full_id": "AMPATH_a877c68e-1350-11df-a1f1-0026b9348838",
        "DescUuid": "a8ebe4b0-1350-11df-a1f1-0026b9348838",
        "retired": "false",
        "displayLocale": "en",
        "namelocale": "en",
        "changedby": "2",
        "mappingUuid": "c3074671-15ca-4643-81b5-70fd16aa0faa",
        "mappingDisplay": "local:2",
        "creator": "59",
        "dateChanged": "2005-03-03 17:51:12",
        "conceptMapType": "",
        "description": "Anemia, due to the destruction or dissolution of red blood cells, with subsequent release of hemoglo",
        "conceptId": "ampath_2",
        "name": "ANEMIA, HEMOLYSIS",
        "isSet": "false",
        "setParent": "6567 : NON-CANCER DIAGNOSIS",
        "__type__": "OclConcept",
        "nameuuid": "a92e726c-1350-11df-a1f1-0026b9348838",
        "classtype": "Diagnosis",
        "localeDesc": "en",
        "display": "ANEMIA, HEMOLYSIS",
        "url": "/concept/a877c68e-1350-11df-a1f1-0026b9348838",
        "source": "Ampath",
        "resourceVersion": "0.9",
        "starCount": "0",
        "dateCreated": "2004-01-01 00:00:00",
        "datatype": "N/A",
        "uuid": "a877c68e-1350-11df-a1f1-0026b9348838",
        "precise": "false",
        "preferredDesc": "true",
        "_version_": 1438834568957264000

The types indexes the following objects:

  • Class
  • Collection
  • Datatype
  • Mapping
  • Maptype
  • Source
  • Star
  • User

To differentiate the above objects you add a field called "type":"name of resource", which is the basis on which queries are made.

USER

{
        "full_id": "USER_a13b4b8a-2d69-11e2-b21b-aa00487d8eba",
        "location": "",
        "roleuuid": "",
        "retired": "false",
        "displayLocale": "en",
        "roledescription": "",
        "type": "user",
        "creator": "1",
        "username": "",
        "organization": "",
        "rolename": "",
        "roledisplay": "",
        "firstName": "",
        "dateChange": "2012-11-13 03:11:57",
        "roleretired": "",
        "lastName": "",
        "__type__": "OclUser",
        "display": "",
        "roleprivileges": "",
        "url": "/concept/a13b4b8a-2d69-11e2-b21b-aa00487d8eba",
        "changedbywhom": "1",
        "email": "",
        "resourceVersion": "0.9",
        "dateCreated": "2005-01-01 00:00:00",
        "uuid": "a13b4b8a-2d69-11e2-b21b-aa00487d8eba",
        "_version_": 1438820048970973200
      }

CLASS

{
        "dict": "CIEL",
        "full_id": "CIEL_CLASS_8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
        "__type__": "OclClass",
        "displayLocale": "en",
        "retired": "",
        "descriptionLocale": "en",
        "locale": "en",
        "display": "Test",
        "changedby": "null",
        "type": "class",
        "preferred": "true",
        "url": "/class/8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
        "creator": "1",
        "dateChanged": "null",
        "hl7Code": "",
        "description": "Acq. during patient encounter (vitals, labs, etc.)",
        "resourceVersion": "0.9",
        "openmrsResourceVersion": "1.8",
        "name": "Test",
        "dateCreated": "2004-02-02 00:00:00",
        "uuid": "8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
        "descriptionPreferred": "true",
        "_version_": 1438820094848270300
      }

DATATYPE

 {
        "dict": "CIEL",
        "full_id": "CIEL_DATATYPE_8d4a4488-c2cc-11de-8d13-0010c6dffd0f",
        "__type__": "OclDataType",
        "displayLocale": "en",
        "retired": "false",
        "descriptionLocale": "en",
        "locale": "en",
        "display": "Numeric",
        "changedby": "null",
        "type": "datatype",
        "preferred": "true",
        "url": "/datatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f",
        "creator": "1",
        "dateChanged": "null",
        "description": "Numeric value, including integer or float (e.g., creatinine, weight)",
        "resourceVersion": "0.9",
        "openmrsResourceVersion": "1.8",
        "name": "Numeric",
        "hl7Abbreviation": "NM",
        "dateCreated": "2004-02-02 00:00:00",
        "uuid": "8d4a4488-c2cc-11de-8d13-0010c6dffd0f",
        "descriptionPreferred": "true",
        "_version_": 1438820094883922000
      }

SOURCE

{
        "dict": "AMPATH",
        "full_id": "AMPATH_SOURCE_aabeea58-1350-11df-a1f1-0026b9348838",
        "locale": "en",
        "retired": "false",
        "displayLocale": "en",
        "changedby": "",
        "type": "source",
        "versionStatus": "production",
        "dateChanged": "",
        "creator": "1",
        "nameType": "Short-Name",
        "username": "",
        "description": "Local definitions",
        "name": "local",
        "descriptionPreferred": "true",
        "sourceType": "dictionary",
        "dateReleased": "",
        "publicAccess": "View",
        "__type__": "OclSource",
        "display": "local",
        "access": "access",
        "preferred": "true",
        "url": "/source/aabeea58-1350-11df-a1f1-0026b9348838",
        "shortCode": "local",
        "resourceVersion": "0.9",
        "owner": "paynejd",
        "starCount": "0",
        "dateCreated": "2005-09-23 00:00:00",
        "uuid": "aabeea58-1350-11df-a1f1-0026b9348838",
        "descriptionLocale": "en",
        "_version_": 1438820049623187500
      }

MAPPING

{
        "dict": "PIH",
        "conceptA_id": "6894",
        "full_id": "PIH_MAPPING_996d0f53-5dc1-462a-903f-2470d8cad9f6",
        "__type__": "OclMapping",
        "displayLocale": "en",
        "retired": "false",
        "display": "PIH:6894",
        "properties": "null",
        "type": "mapping",
        "url": "/mapping/996d0f53-5dc1-462a-903f-2470d8cad9f6",
        "creator": "7",
        "conceptB_source": "ICD-10-WHO",
        "conceptB_id": "R06.8",
        "resourceVersion": "0.9",
        "map_type": "NARROWER-THAN",
        "conceptA_source": "PIH",
        "dateCreated": "2010-11-15 12:46:22",
        "uuid": "996d0f53-5dc1-462a-903f-2470d8cad9f6",
        "_version_": 1438820049786765300
      }

MAPTYPE

 {
        "dict": "CIEL",
        "full_id": "CIEL_MAPTYPE_35543629-7d8c-11e1-909d-c80aa9edcf4e",
        "__type__": "OclMapType",
        "displayLocale": "en",
        "retired": "false",
        "locale": "en",
        "display": "SAME-AS",
        "changedby": "1",
        "type": "maptype",
        "preferred": "true",
        "url": "/maptype/35543629-7d8c-11e1-909d-c80aa9edcf4e",
        "creator": "1",
        "openmrsResourceVersion": "1.9",
        "resourceVersion": "1.9",
        "name": "SAME-AS",
        "dateCreated": "2013-05-13 00:00:00",
        "uuid": "35543629-7d8c-11e1-909d-c80aa9edcf4e",
        "descriptionLocale": "en",
        "descriptionPreferred": "true",
        "_version_": 1438820049015013400
      }

COLLECTION

{
        "collectionType": "Collection",
        "full_id": "COLLECTION_470aa06e-dc57-11e2-8e4c-2a028bb5e96f",
        "locale": "en",
        "retired": "false",
        "displayLocale": "en",
        "changedby": "",
        "type": "collection",
        "dateChanged": "",
        "creator": "",
        "username": "",
        "name": "CARE India Community ANC",
        "descriptionPreferred": "true",
        "publicAccess": "View",
        "__type__": "OclCollection",
        "display": "CARE India Community ANC",
        "access": "",
        "preferred": "true",
        "url": "/collection/470aa082-dc57-11e2-8e4c-2a028bb5e96f",
        "concept_url": "/source/ciel/concept/145AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|/source/ciel/concept/1512AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|/source/ciel/concept/113006AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|/source/ciel/concept/129227AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|/source/ciel/concept/159382AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|/source/ciel/concept/1171AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|/source/ciel/concept/5086AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|/source/ciel/concept/119481AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|/source/ciel/concept/145519AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|/source/ciel/concept/100AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
        "hl7Code": "",
        "concept_id": "145|1512|113006|129227|159382|1171|5086|119481|145519|100|1449|111633|129211|154042|299|1573|113280|",
        "openmrsResourceVersion": "",
        "resourceVersion": "0.9",
        "owner": "jpayne",
        "starCount": "0",
        "dateCreated": "",
        "concept_uuid": "145AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|1512AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|113006AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|129227AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|159382AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|1171AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|5086AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|119481AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|145519AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|100AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|1449AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|111633AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|129211AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|154042AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|299AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|1573AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|113280AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|134610AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|159758AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|1272AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|5105AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|122496AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|147232AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|664AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|1638AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|113861AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|138580AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|1380AAAAAAAAAAAAAAAAAAAAA",
        "uuid": "470aa078-dc57-11e2-8e4c-2a028bb5e96f",
        "descriptionLocale": "en",
        "_version_": 1438820049505747000
      }

We use the Flask python library here to map the URLS and manage the REST resources,and use Sunburnt library here to query and update the SOLR index.

Clone this wiki locally