Terminology Adapter

Terminology Adapter

/terminology

Retrieval and validation of terminologies

GET /terminology/codesystem/{codeSystem}/entities

List of entities in an explicit version of a single code system

Parameters
  • codeSystem (path/string): Identifying code of the codesystem

  • codesystemversion (query/string): Version of the codesystem. Defaults to the newest version

  • matchvalue (query/string): Filter to results that contain this value, either in code or description

  • codelist (query/array): Filter to results whose code exactly matches one of the codes in this list

  • page (query/integer): Page of results to return. Starts with 1

  • pagesize (query/integer): Size of a single page

GET /terminology/codesystem/{codeSystem}/entity/{entity}

Returns details about a single entity

Parameters
  • codeSystem (path/string): Identifying code of the codesystem

  • entity (path/string): code of the parent entity

  • codesystemversion (query/string): Version of the codesystem. Defaults to the newest version

GET /terminology/codesystem/{codeSystem}/entity/{entity}/children

List of all children of a single entity

Parameters
  • codeSystem (path/string): Identifying code of the codesystem

  • entity (path/string): code of the parent entity

  • codesystemversion (query/string): Version of the codesystem. Defaults to the newest version

  • matchvalue (query/string): Filter to results that contain this value, either in code or description

  • codelist (query/array): Filter to results whose code exactly matches one of the codes in this list

  • page (query/integer): Page of results to return. Starts with 1

  • pagesize (query/integer): Size of a single page

POST /terminology/codesystem/{codeSystem}/resolve

Resolves a list of entity codes with associated types into a list of actual entity codes

Parameters
  • codeSystem (path/string):

  • codesystemversion (query/string):

  • body (body/array): list of entities to be resolved

Notes

Resolves a list of entity codes with associated types into a list of actual entity codes

Each entity code in the input has an associated type. Depending on the type, the code will resolve to the following:

  • fixed - itself

  • tree - itself and all its children

GET /terminology/codesystem/{codeSystem}/validate

Validates a list of entity codes in a given code system

Parameters
  • codeSystem (path/string): Identifying code of the codesystem

  • codesystemversion (query/string): Version of the codesystem. Defaults to the newest version

  • entities (query/array): Codes of the entities to validate

GET /terminology/codesystems

Lists code systems matching a criteria

Parameters
  • matchvalue (query/string): Filter to results that contain this value, either in code or description

  • codelist (query/array): Filter to results whose code exactly matches one of the codes in this list

  • page (query/integer): Page of results to return. Starts with 1

  • pagesize (query/integer): Size of a single page

Notes

Only the newest version of each code system will be returned

Electronic Health Record APIs

A simple yet powerful services to store, retrieve and query health data

/composition

OpenEhr compositions.

GET /composition/{uid}

Loads an OpenEhr composition.

Parameters
  • uid (path/string): The unique ID of the composition, with or without the domain and version part.

  • format (query/string): The format of JSON representation of the composition to return. Default: FLAT.

Notes

Returns an OpenEhr composition denoted by the specified id in one of the supported JSON formats, along with some metadata.

The ID can be specified as a complete unique ID with the domain and version part (8849182c-82ad-4088-a07f-48ead4180515::example.domain.com::1), or just the identifier part (8849182c-82ad-4088-a07f-48ead4180515), in which case the last version of the composition in the current domain will be returned.

Example of return data on successful call, using FLAT JSON composition type:

{
    "meta": {
        "href": "http://example.domain.com:8082/rest/v1/composition/8849182c-82ad-4088-a07f-48ead4180515::example.domain.com::1"
    },
    "format": "FLAT",
    "templateId": "ISPEK - ZN - Vital Functions Encounter",
    "composition": {
        "vital_functions/context/context_detail:0/departmental_period_of_care_identifier": "244135",
        "vital_functions/context/context_detail:0/period_of_care_identifier": "30650812",
        "vital_functions/vital_signs/body_temperature:0/any_event:0/time": "2014-01-22T14:18:07.339Z",
        "vital_functions/context/setting|code": "238",
        "vital_functions/vital_signs/body_temperature:0/any_event:0/body_temperature|unit": "°C",
        "vital_functions/context/start_time": "2014-01-22T14:18:07.339Z",
        "vital_functions/context/setting|238": true,
        "vital_functions/context/context_detail:0/portlet_id": "NURSING",
        "vital_functions/context/setting|terminology": "openehr",
        "vital_functions/vital_signs/body_temperature:0/any_event:0/body_temperature|magnitude": 38.2,
        "vital_functions/context/setting|value": "other care"
    },
    "deleted": false,
    "lastVersion": true
}
Response codes
  • 200: Success - returns JSON composition values and meta-data in response body.

  • 204: No content - requested composition has been deleted. In this case, the HTTP response will contain a Link header giving the URL to the last active (non-deleted) version of the composition.

  • 400: Could not parse the format parameter (COMP-1011).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Composition with the given id does not exist (COMP-1021).

DELETE /composition/{uid}

Deletes an existing OpenEhr composition.

Parameters
  • uid (path/string): Composition UID to be deleted.

  • committerName (query/string): The name of the committer user. If omitted, the current session’s logged in user’s name will be used.

  • committerId (query/string): The external id of the committer user. If omitted, the current session’s logged in user’s external id will be used, if the user has one.

Notes

Deletes an existing OpenEhr composition.

Response codes
  • 200: Successfully deleted.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Composition with the given id does not exist (COMP-1021).

POST /composition

Creates a new OpenEhr composition.

Parameters
  • templateId (query/string): Specifies the OpenEhr template id that the composition belongs to. Required, unless the sent composition is in the RAW JSON format, which has this information embedded.

  • ehrId (query/string): The EHR id to save the composition into. Required if not already set on the current session by a preceding call.

  • format (query/string): The format of JSON representation of the composition to return. Default: FLAT.

  • committerName (query/string): The name of the committer user. If omitted, the current session’s logged in user’s name will be used.

  • committerId (query/string): The external id of the committer user. If omitted, the current session’s logged in user’s external id will be used, if the user has one.

  • body (body/string): The composition to create, in one of the supported JSON formats.

Notes

Saves a new OpenEhr composition to the specified, or the currently active EHR.

The composition can be specified in one of the supported JSON formats (FLAT, STRUCTURED, RAW). Unless the format is RAW, then the templateId parameter is required. The composition JSON is sent in the request body. An example for the structured format:

{
    "ctx": {
      "language": "en",
      "territory": "SI",
      "composer_name": "matijak_test"
    },
    "vitals": {
      "vitals": [
        {
          "body_temperature": [
            {
              "any_event": [
                {
                  "description_of_thermal_stress": [
                    "Test description of symptoms"
                  ],
                  "temperature": [
                    {
                      "|magnitude": 37.2,
                      "|unit": "°C"
                    }
                  ],
                  "symptoms": [
                    {
                      "|code": "at0.64",
                      "|value": "Chills / rigor / shivering",
                      "|terminology": "local"
                    }
                  ],
                  "time": [
                    "2014-01-22T15:18:07.339+01:00"
                  ]
                }
              ]
            }
          ]
        }
      ],
      "context": [
        {
          "setting": [
            {
              "|code": "238",
              "|value": "other care",
              "|terminology": "openehr"
            }
          ],
          "start_time": [
            "2014-01-22T15:18:07.339+01:00"
          ]
        }
      ]
    }
  }

EHR id: The EHR to save the composition to needs to be specified via the ehrId parameter, if it has not already been set on your session by a previous call.

A note on the ctx/ properties inside the composition JSON: In the FLAT and STRUCTURED format, the language (ctx/language) and the territory properties (ctx/territory) are required, as they specify the composition locale and language, which is then checked against the template’s languages to see if it is supported. Other context-related properties, such as composer_name or start_time may also be specified in this fashion.

An example of a successful response body:

{
  "meta": {
    "href": "http://example.domain.com:8082/rest/v1/composition/bddcedc8-46cc-4df6-8b1a-b05534235f17::example.domain.com::1"
  },
  "action": "CREATE"
}
Response codes
  • 201: Successfully created - response body will contain a link to the newly created composition

  • 400: Bad request - could not parse the format parameter (COMP-1011), templateId not specified (TMPL-3031), no EHR to save to can be determined (EHR-2031), composition language and territory problems (COMP-1051, COMP-1061, COMP-1071), invalid composition data (COMP-1081).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Ehr with the given id does not exist (EHR-2021), template with the given id does not exist (TMPL-3021).

/ehr

EHR metadata.

GET /ehr/{ehrId}

Returns information about the specified EHR.

Parameters
  • ehrId (path/string): The ID of the EHR to return.

Notes

Returns a JSON representation of the state of the specified EHR.

An example of a successful response body:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/ehr/f77f9b4a-cfda-414d-aa6c-4f78bcac7601"
  },
  "action": "RETRIEVE",
  "ehrStatus": {
    "subjectId": "90470912",
    "subjectNamespace": "ExternalDB",
    "queryable": true,
    "modifiable": true
  },
  "ehrId": "f77f9b4a-cfda-414d-aa6c-4f78bcac7601"
}
Response codes
  • 200: Success - response body will contain information about the EHR.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Not found - EHR does not exist (EHR-2021).

GET /ehr

Returns the EHR for the specified subject ID and namespace.

Parameters
  • subjectId (query/string): The subject ID whose EHR needs to be located

  • subjectNamespace (query/string): The namespace that the subject belongs to.

Notes

Returns a JSON representation of the state of the EHR, or 204 No Content if no such EHR exists.

An example of a successful response body:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/ehr/f77f9b4a-cfda-414d-aa6c-4f78bcac7601"
  },
  "action": "RETRIEVE",
  "ehrStatus": {
    "subjectId": "90470912",
    "subjectNamespace": "ExternalDB",
    "queryable": true,
    "modifiable": true
  },
  "ehrId": "f77f9b4a-cfda-414d-aa6c-4f78bcac7601"
}
Response codes
  • 200: Success - response body will contain information about the EHR.

  • 204: No content - no EHR for the specified subject ID and namespace exists.

  • 400: Bad request - no subject ID specified (EHR-2081), no subject namespace specified (EHR-2091).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

POST /ehr

Creates a new EHR.

Parameters
  • subjectId (query/string): The external ID of the user who will own this EHR.

  • subjectNamespace (query/string): The namespace the subjectId belongs to.

  • committerName (query/string): The name of the committer user. If omitted, the current session’s logged in user’s name will be used.

Notes

Creates a new EHR and returns its ID.

The caller can specify an external subject ID and namespace to whom the new EHR will belong.

An example of a successful response body:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/ehr/f77f9b4a-cfda-414d-aa6c-4f78bcac7601"
  },
  "action": "CREATE",
  "ehrId": "f77f9b4a-cfda-414d-aa6c-4f78bcac7601"
}
Response codes
  • 201: Successfully created - response body will contain the newly created EHR’s ID.

  • 400: Bad request - no subject ID specified (EHR-2081), no subject namespace specified (EHR-2091), EHR for the specified subject ID and namespace already exists (EHR-2124).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

PUT /ehr/status/{ehrId}

Update EHR_STATUS of an EHR.

Parameters
  • ehrId (path/string): EHR ID.

  • body (body/EhrStatusDto): EHR status.

Notes

Updates EHR_STATUS of an EHR.

An example of a request body:

{
    "subjectId": "90470912",
    "subjectNamespace": "ExternalDB",
    "queryable": true,
    "modifiable": true
}

An example of a successful response body:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/ehr/649eb8dd-787d-4669-bcc9-185903c6ddcb"
  },
  "action": "UPDATE"
}
Response codes
  • 200: Success - EHR_STATUS updated.

  • 404: Not found - specified EHR was not found (DEMO-6021).

/form

Form definitions.

GET /form

Lists Think!Ehr forms.

Notes

Returns a list of Think!Ehr form definitions.

This call only returns form meta-data and no form resources.

Example of a successful call:

{
  "forms": [
    {
      "templateId": "Vital Signs",
      "name": "Basic",
      "version": "1.0.0",
      "createdTimestamp": "2014-03-03T09:46:54.272+01:00",
      "status": "active",
      "category": "Default",
      "creator": "ehrscape",
      "type": "JSON"
    },
    {
      "templateId": "Vital Signs",
      "name": "Extended",
      "version": "1.0.1",
      "createdTimestamp": "2014-03-03T10:02:13.135+01:00",
      "status": "active",
      "category": "Default",
      "creator": "ehrscape",
      "type": "JSON"
    }
  ]
}
Response codes
  • 200: Success - returns form definitions.

  • 204: No content - there are no form definitions.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /form/{name}/{version}

Loads a Think!Ehr form.

Parameters
  • name (path/string): The name of the form.

  • version (path/string): The version of the form, such as 1.0.0.

  • resources (query/string): Which, if any, resources to expand. Possible values are NONE, ALL, SOURCE, BINARY or a comma-separated list of names of resources to load. Default: NONE.

Notes

Returns a Think!Ehr form denoted by its name and version.

This call can return only the form and form resource meta-data (the default), or it can already expand the specified (or all) form resources. See the description of the resources parameter for details.

In case of resource expansion, for resources that are of the source type (text, JSON etc.), this method will do its best to transform the resource content into the correct JSON type (for example, a JSON object, or a JSON text node). For binary resources, the content resource property will contain raw bytes.

Example of a successful call, with the form-layout property expanded (?resources=form-layout):

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/form/TM_Simple_Vital_Functions/1.5.1"
  },
  "form": {
    "templateId": "TM - Simple Vital Functions",
    "name": "TM_Simple_Vital_Functions",
    "version": "1.5.1",
    "createdTimestamp": "2013-12-10T16:27:41.277+01:00",
    "status": "active",
    "category": "Default",
    "creator": "admin",
    "type": "JSON",
    "resources": [
      {
        "name": "form-description",
        "mimetype": "application/json",
        "type": "source",
        "href": "http://localhost:8082/rest/v1/form/TM_Simple_Vital_Functions/1.5.1/resource/form-description"
      },
      {
        "name": "form-language",
        "mimetype": "text/plain",
        "type": "source",
        "href": "http://localhost:8082/rest/v1/form/TM_Simple_Vital_Functions/1.5.1/resource/form-language"
      },
      {
        "name": "form-layout",
        "mimetype": "application/json",
        "type": "source",
        "href": "http://localhost:8082/rest/v1/form/TM_Simple_Vital_Functions/1.5.1/resource/form-layout",
        "content": [
          {
            "id": "row0",
            "idx": 0,
            "cols": [
              {
                "id": "row0-col0",
                "children": [],
                "rows": [
                  {
                    "id": "row0-col0-row0",
                    "idx": 0,
                    "cols": [
                      {
                        "id": "row0-col0-row0-col0",
                        "children": [
                          {
                            "id": "simple_vital_functions/body_weight/any_event/weight",
                            "idx": 0
                          }
                        ]
                      },
                      {
                        "id": "row0-col0-row0-col1",
                        "children": [
                          {
                            "id": "simple_vital_functions/height_length/any_event/height_length",
                            "idx": 0
                          }
                        ]
                      },
                      {
                        "id": "row0-col0-row0-col2",
                        "children": [
                          {
                            "id": "simple_vital_functions/body_mass_index/any_event/body_mass_index",
                            "idx": 0
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "id": "row0-col0-row1",
                    "idx": 1,
                    "cols": [
                      {
                        "id": "row0-col0-row1-col0",
                        "children": [
                          {
                            "id": "simple_vital_functions/body_temperature/any_event/temperature",
                            "idx": 0
                          }
                        ]
                      },
                      {
                        "id": "row0-col0-row1-col1",
                        "children": [
                          {
                            "id": "simple_vital_functions/pulse/any_event/rate",
                            "idx": 0
                          },
                          {
                            "id": "simple_vital_functions/respirations/any_event/rate",
                            "idx": 1
                          }
                        ]
                      },
                      {
                        "id": "row0-col0-row1-col2",
                        "children": [
                          {
                            "id": "simple_vital_functions/blood_pressure/any_event/systolic",
                            "idx": 0
                          },
                          {
                            "id": "simple_vital_functions/blood_pressure/any_event/diastolic",
                            "idx": 1
                          }
                        ]
                      },
                      {
                        "id": "row0-col0-row1-col3",
                        "children": [
                          {
                            "id": "simple_vital_functions/indirect_oximetry/spo2",
                            "idx": 0
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "id": "row0-col0-row2",
                    "idx": 2,
                    "cols": [
                      {
                        "id": "row0-col0-row2-col0",
                        "children": [
                          {
                            "id": "simple_vital_functions/story_or_history/pain/nil_significant",
                            "idx": 0
                          }
                        ]
                      },
                      {
                        "id": "row0-col0-row2-col1",
                        "children": [
                          {
                            "id": "simple_vital_functions/story_or_history/pain/observed_current_intensity/degree",
                            "idx": 0
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "name": "form-title",
        "mimetype": "text/plain",
        "type": "source",
        "href": "http://localhost:8082/rest/v1/form/TM_Simple_Vital_Functions/1.5.1/resource/form-title"
      }
    ]
  }
}
Response codes
  • 200: Success - returns the form JSON.

  • 400: Bad request - cannot parse form version (FORM-5135).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: This form version does not exist (FORM-5021), the specified form resource does not exist (FORM-5721).

GET /form/{name}/{version}/resource/{resource}

Loads a Think!Ehr form resource content.

Parameters
  • name (path/string): The name of the form.

  • version (path/string): The version of the form, such as 1.0.0.

  • resource (path/string): The name of the form resource.

  • envelope (query/boolean): Whether or not to wrap a response in a JSON object that includes meta-data, or just return the resource content (default).

Notes

Returns a Think!Ehr form resource content, optionally enveloped with meta-data.

Unless the envelope parameter is true, this method will return the actual contents of the resource as a response, with the Content-Type HTTP header set to the correct media type for the resource (such as application/json, text/plain or image/jpeg). For example, if the resource is actually a JPEG image, the actual image will be returned in the HTTP response, with the Content-Type header set to image/jpeg.

If, however, the envelope parameter is set to true, then the usual envelope response will be returned, with all the meta-data about the resource, as explained in the model. Example:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/form/UnitTestDemoForm/1.0.0/resource/form-language"
  },
  "formName": "UnitTestDemoForm",
  "formVersion": "1.0.0",
  "resource": {
    "name": "form-language",
    "mimetype": "text/plain",
    "type": "source",
    "href": "http://localhost:8082/rest/v1/form/UnitTestDemoForm/1.0.0/resource/form-language",
    "content": "en"
  }
}

As usual, non-binary resources will be converted from bytes to their appropriate representation (text or JSON) within the envelope. Binary resources' content property will contain a raw byte representation of the resource.

Response codes
  • 200: Success - returns the form JSON.

  • 400: Bad request - cannot parse form version (FORM-5135).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: The specified form resource does not exist (FORM-5721).

/query

AQL queries.

GET /query

Returns the results of the specified AQL query.

Parameters
  • aql (query/string): The AQL query to execute

Notes

Returns the data produced by the specified query, along with some meta-data.

The AQL to execute is specified as a query parameter to this call. Example:

http://localhost:8082/rest/v1/query/?aql=select%20c%20from%20Composition%20c%20where%20c/uid/value='uid=0da4b8bc-1fb8-4e2e-be27-f63934a60fc2::default::1'

This method does not support named parameters and their expansion inside the AQL query string. For parameter expansion support, see the POST query method.

Note that even though parameter expansion is not supported, the $ehrUid placeholder will be replaced with the session’s currently active EHR id, if there is one.

The returned result-set is an array of rows as returned by the query. Each row is a JSON object whose properties correspond to columns returned by the AQL query. These column properties have the same name as aliases in the SELECT clause of the query. In absence of these aliases, numeric marking of columns in the format #0, #1 … is used.

An example of a successful response body, querying for the three highest temperatures greater than 38.5 °C inside an EHR, with the unit and temperature SELECT aliases:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/query/?aql=select%20o/data%5Bat0002%5D/events%5Bat0003%20and%20name/value%3D'Any%20event'%5D/data%5Bat0001%5D/items%5Bat0004%5D/value/magnitude%20as%20temperature,%20o/data%5Bat0002%5D/events%5Bat0003%20and%20name/value%3D'Any%20event'%5D/data%5Bat0001%5D/items%5Bat0004%5D/value/units%20as%20unit%20from%20EHR%5Behr_id/value%3D'554f896d-faca-4513-bddf-664541146308d'%5D%20CONTAINS%20Observation%20o%5BopenEHR-EHR-OBSERVATION.body_temperature-zn.v1%5D%20WHERE%20o/data%5Bat0002%5D/events%5Bat0003%20and%20name/value%3D'Any%20event'%5D/data%5Bat0001%5D/items%5Bat0004%5D/value/magnitude%20%3E%2038.5%20order%20by%20temperature%20desc%20fetch%203"
  },
  "resultSet": [
    {
      "unit": "°C",
      "temperature": 40.2
    },
    {
      "unit": "°C",
      "temperature": 39.8
    },
    {
      "unit": "°C",
      "temperature": 38.6
    }
  ],
  "aql": "select o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude as temperature, o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/units as unit from EHR[ehr_id/value=$ehrUid] CONTAINS Observation o[openEHR-EHR-OBSERVATION.body_temperature-zn.v1] WHERE o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude > 38.5 order by temperature desc fetch 3",
  "executedAql": "select o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude as temperature, o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/units as unit from EHR[ehr_id/value='554f896d-faca-4513-bddf-664541146308d'] CONTAINS Observation o[openEHR-EHR-OBSERVATION.body_temperature-zn.v1] WHERE o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude > 38.5 order by temperature desc fetch 3"
}
Response codes
  • 200: Success - query result-set JSON will be returned with at least a single result.

  • 204: No content - the query produced no results.

  • 400: Bad request - cannot parse AQL (QRY-4135), EHR placeholder could not be expanded due to EHR not set (EHR-2031).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

POST /query

Querying with named parameter support.

Parameters
  • body (body/QueryRequestData): A JSON object representing the AQL query and its parameters (see model).

Notes

Returns the data produced by the specified query, supporting named parameter expansion.

The query to execute is specified as a JSON object, with one property describing the AQL and another describing a map of named parameters whose values are expanded before querying. See the model description below.

Here is how the AQL query and its parameters are specified in the JSON body:

{
"aql": "select o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude as temperature, o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/units as unit from EHR[ehr_id/value='554f896d-faca-4513-bddf-664541146308d'] CONTAINS Observation o[openEHR-EHR-OBSERVATION.body_temperature-zn.v1] WHERE o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude > :temperature and o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0.63 and name/value='Symptoms']/value/defining_code/code_string=:chills order by temperature desc fetch 3",

"aqlParameters":
{
   "temperature": 38.5,
   "chills": "at0.64"
 }
}

The :parameterName syntax (in the above example, :temperature and :chills) is used in the AQL string to mark the places where parameters will be expanded.

Note that the parameter types of the JSON request body are important. They need to roughly correspond to parameter types in the OpenEHR reference model. This means that if, for example, the property you’re using in your query condition is a decimal value (like in the example above), then the JSON property should be an unquoted decimal value as well.

The $ehrUid placeholder will be replaced with the session’s currently active EHR id, if there is one.

The returned result-set is an array of rows as returned by the query. Each row is a JSON object whose properties correspond to columns returned by the AQL query. These column properties have the same name as aliases in the SELECT clause of the query. In absence of these aliases, numeric marking of columns in the format #0, #1 … is used.

This POST method does not in any way alter the server state, its purpose is to facilitate submission of queries in the HTTP body as JSON, supporting named parameter expansion. This enables us to determine the type of parameters more easily.

An example of a successful response body, querying for the three highest temperatures greater than 38.5 °C whose symptoms also include chills, inside an EHR, with the unit and temperature SELECT aliases:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/query/?aql=select%20o/data%5Bat0002%5D/events%5Bat0003%20and%20name/value%3D'Any%20event'%5D/data%5Bat0001%5D/items%5Bat0004%5D/value/magnitude%20as%20temperature,%20o/data%5Bat0002%5D/events%5Bat0003%20and%20name/value%3D'Any%20event'%5D/data%5Bat0001%5D/items%5Bat0004%5D/value/units%20as%20unit%20from%20EHR%5Behr_id/value%3D'554f896d-faca-4513-bddf-664541146308d'%5D%20CONTAINS%20Observation%20o%5BopenEHR-EHR-OBSERVATION.body_temperature-zn.v1%5D%20WHERE%20o/data%5Bat0002%5D/events%5Bat0003%20and%20name/value%3D'Any%20event'%5D/data%5Bat0001%5D/items%5Bat0004%5D/value/magnitude%20%3E%2038.5%20and%20o/data%5Bat0002%5D/events%5Bat0003%20and%20name/value%3D'Any%20event'%5D/data%5Bat0001%5D/items%5Bat0.63%20and%20name/value%3D'Symptoms'%5D/value/defining_code/code_string%3D'at0.64'%20order%20by%20temperature%20desc%20fetch%203"
  },
  "resultSet": [
    {
      "unit": "°C",
      "temperature": 38.8
    },
    {
      "unit": "°C",
      "temperature": 38.8
    },
    {
      "unit": "°C",
      "temperature": 38.8
    }
  ],
  "aql": "select o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude as temperature, o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/units as unit from EHR[ehr_id/value='554f896d-faca-4513-bddf-664541146308d'] CONTAINS Observation o[openEHR-EHR-OBSERVATION.body_temperature-zn.v1] WHERE o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude > :temperature and o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0.63 and name/value='Symptoms']/value/defining_code/code_string=:chills order by temperature desc fetch 3",
  "executedAql": "select o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude as temperature, o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/units as unit from EHR[ehr_id/value='554f896d-faca-4513-bddf-664541146308d'] CONTAINS Observation o[openEHR-EHR-OBSERVATION.body_temperature-zn.v1] WHERE o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0004]/value/magnitude > 38.5 and o/data[at0002]/events[at0003 and name/value='Any event']/data[at0001]/items[at0.63 and name/value='Symptoms']/value/defining_code/code_string='at0.64' order by temperature desc fetch 3",
  "aqlParameters": {
    "temperature": 38.5,
    "chills": "at0.64"
  }
}
Response codes
  • 200: Success - query result-set JSON will be returned with at least a single result.

  • 204: No content - the query produced no results.

  • 400: Bad request - cannot parse AQL/expand parameters (QRY-4135), EHR placeholder could not be expanded due to EHR not set (EHR-2031), could not parse request entity.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 415: Unsupported media type - if the request entity is not a JSON object (SYS-9414).

/session

Session management.

POST /session

Creates a new OpenEhr session.

Parameters
  • username (query/string): Username.

  • password (query/string): Password.

Notes

Logs in the specified user, creating a new session in the process.

A successful call will create a new OpenEhr session for the specified user. The session ID will be returned both as a JSON response to this call, as well as in the Ehr-Session HTTP response header.

In order to ensure that this newly created session is used on subsequent REST requests, the client needs to make the calls with the HTTP request Ehr-Session header’s value set to the session ID.

Example of a successful call response:

{
  "action": "CREATE",
  "sessionId": "096c9d95-c434-4c97-a7ee-59e2c521ec33"
}

The response header, with the Ehr-Session set, will look like this:

{
  "Server": "Jetty(9.1.1.v20140108)",
  "Transfer-Encoding": "chunked",
  "Content-Language": "en-US",
  "Content-Type": "application/json;charset=UTF-8",
  "Access-Control-Allow-Origin": "http://localhost:8082",
  "Access-Control-Expose-Headers": "",
  "Access-Control-Allow-Credentials": "true",
  "Ehr-Session": "096c9d95-c434-4c97-a7ee-59e2c521ec33"
}
Response codes
  • 201: Created - session created, user successfully logged in.

  • 400: Bad request - missing or empty username or password parameters (SESS-5081).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

DELETE /session

Closes an OpenEhr session.

Parameters
  • sessionId (query/string): The ID of the session to close. Required if this is not specified via the Ehr-Session HTTP header.

  • Ehr-Session (header/string): The ID of the session to close. Required if this is not specified via the sessionId query parameter.

Notes

Closes the OpenEhr session specified by its ID.

The ID of the session to close can be specified either as the query parameter to this call, or else via the Ehr-Session request header. If no session ID is specified via either method, an error is thrown. An error is also thrown if both are specified, but they do not match.

If a non-existing or already closed session is provided, the response will be the same as if the session was successfully closed, except that the action property of the response will be set to NOOP instead of DELETE.

Example of a successful call response:

{
  "action": "DELETE",
  "sessionId": "2dcd6528-0471-4950-82fa-a018272f1339"
}
Response codes
  • 200: Success - session closed.

  • 400: Bad request - missing or empty session ID (SESS-5091), session ID mismatch (SESS-5308).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

PUT /session

Pings an OpenEhr session.

Parameters
  • sessionId (query/string): The ID of the session to ping. Required if this is not specified via the Ehr-Session HTTP header.

  • Ehr-Session (header/string): The ID of the session to ping. Required if this is not specified via the sessionId query parameter.

Notes

Pings the OpenEhr session specified by its ID, keeping it alive.

The purpose of this method is to enable clients to provide heartbeat functionality with regards to an OpenEhr session. Each session has a limited amount of time before it expires (configured on OpenEhr server) - this method touches the session and extends its lifespan for another such cycle.

This method can also be used to determine whether or not a session is still alive - a 204 response indicates that it is and a 404 that it is not.

Response codes
  • 204: Success (no content) - session pinged and it is still alive.

  • 400: Bad request - missing or empty session ID (SESS-5091), session ID mismatch (SESS-5308).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 404: Not found - session doesn’t exist or has expired (SESS-5021).

PUT /session/ehr/{ehrId}

Sets the EHR on the session.

Parameters
  • ehrId (path/string): The ID of the EHR to set on the session.

  • sessionId (query/string): The ID of the session to set the EHR on. Required if this is not specified via the Ehr-Session HTTP header.

  • Ehr-Session (header/string): The ID of the session to set the EHR on. Required if this is not specified via the sessionId query parameter.

Notes

Sets the specified EHR on the session.

This method will set the specified EHR ID to the specified, currently open EHR session. This EHR ID can then be used for query placeholder expansion (where it will replace the $ehrUid placeholder) and other calls where an EHR is expected to be set.

Example of a successful call response:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/session/?sessionId=336c21cc-b37a-45ca-924e-f53530d1bb1e"
  },
  "action": "EXECUTE",
  "sessionId": "336c21cc-b37a-45ca-924e-f53530d1bb1e",
  "ehrId": "8846225a-daad-46ac-8ea3-ef866b019123"
}
Response codes
  • 200: Success - EHR was successfully set on the session.

  • 400: Bad request - missing or empty session ID (SESS-5091), session ID mismatch (SESS-5308).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Not found - session doesn’t exist or has expired (SESS-5021), EHR does not exist (EHR-2021).

PUT /session/ehr/{subjectNamespace}/{subjectId}

Sets the EHR on the session (via subject namespace and ID).

Parameters
  • subjectNamespace (path/string): The namespace where the subject ID lives.

  • subjectId (path/string): The subject ID.

  • sessionId (query/string): The ID of the session to set the EHR on. Required if this is not specified via the Ehr-Session HTTP header.

  • Ehr-Session (header/string): The ID of the session to set the EHR on. Required if this is not specified via the sessionId query parameter.

Notes

Sets the EHR on the session, first finding it via the specified subject namespace and ID.

This method will set the EHR ID found via the subject namespace and ID to the specified, currently open EHR session. This EHR ID can then be used for query placeholder expansion (where it will replace the $ehrUid placeholder) and other calls where an EHR is expected to be set.

Example of a successful call response:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/session/?sessionId=336c21cc-b37a-45ca-924e-f53530d1bb1e"
  },
  "action": "EXECUTE",
  "sessionId": "336c21cc-b37a-45ca-924e-f53530d1bb1e",
  "ehrId": "8846225a-daad-46ac-8ea3-ef866b019123"
}
Response codes
  • 200: Success - EHR was successfully set on the session.

  • 400: Bad request - missing or empty session ID (SESS-5091), session ID mismatch (SESS-5308).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Not found - session doesn’t exist or has expired (SESS-5021), EHR does not exist (EHR-2021).

/template

Web templates.

POST /template

Uploads an operational template.

Parameters
  • body (body/java.io.InputStream):

Notes

This call allows uploading openEHR operational templates prepared by the openEHR modelling tools.

Response codes
  • 201: Success.

  • 400: Invalid content (unable to read opt) (TMPL-3602).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /template

Gets all template ids.

Notes

Returns a list of template ids (as a JSON object).

Example of a successful call response:

{
  "templates": [
    {
      "templateId": "Allergies",
      "createdOn": "2014-03-28T11:12:51.242Z"
    },
    {
      "templateId": "Vital Signs",
      "createdOn": "2014-03-28T11:12:51.277Z"
    }
  ]
}
Response codes
  • 200: Success - returns the JSON containing the web template.

  • 204: No content - there are no templates.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /template/{templateId}

Loads an OpenEhr web template.

Parameters
  • templateId (path/string): The ID of the template to load.

  • defaultLanguage (query/string): The default language to generate the returned web template with.

  • languages (query/string): Other languages to include in the returned web template, separated by a comma.

Notes

Returns an OpenEhr template in its web-appropriate representation (as a JSON object).

A note on languages: the web template will be generated with localized names for all the languages that the underlying template supports, unless it is specified differently via the defaultLanguage and languages query parameters, both of which are optional. The defaultLanguage parameter determines the default name for each web template node (the localizedName property), whereas the languages parameter will generate additional localized names inside the localizedNames map for all the languages listed in this parameter (different languages should be separated by a comma: en,sl,no). See the example below.

Note that the underlying OpenEhr template needs to support these languages, or else a 400 error (bad request) will be returned (TMPL-3061).

Example of a successful call response:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/template/Demo%20Vitals"
  },
  "webTemplate": {
    "templateId": "Demo Vitals",
    "version": "1.1",
    "defaultLanguage": "en",
    "languages": [
      "en",
      "sl"
    ],
    "tree": {
      "id": "vitals",
      "name": "Vitals",
      "localizedName": "Vitals",
      "rmType": "COMPOSITION",
      "nodeId": "openEHR-EHR-COMPOSITION.encounter.v1",
      "min": 1,
      "max": 1,
      "localizedNames": {
        "sl": "Encounter",
        "en": "Encounter"
      },
      "aqlPath": "",
      "children": [
        {
          "id": "vitals",
          "name": "Vitals",
          "localizedName": "Vitals",
          "rmType": "SECTION",
          "nodeId": "openEHR-EHR-SECTION.ispek_dialog.v1",
          "min": 0,
          "max": 1,
          "localizedNames": {
            "sl": "Dialog",
            "en": "Dialog"
          },
          "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']",
          "children": [
            {
              "id": "haemoglobin_a1c",
              "name": "Haemoglobin A1c",
              "localizedName": "Haemoglobin A1c",
              "rmType": "OBSERVATION",
              "nodeId": "openEHR-EHR-OBSERVATION.lab_test-hba1c.v1",
              "min": 0,
              "max": -1,
              "localizedNames": {
                "sl": "Hemoglobin A1c",
                "en": "Haemoglobin A1c"
              },
              "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]",
              "children": [
                {
                  "id": "requestor_order_identifier",
                  "name": "Requestor order identifier",
                  "localizedName": "Requestor order identifier",
                  "rmType": "DV_TEXT",
                  "nodeId": "at0062",
                  "min": 0,
                  "max": 1,
                  "dependsOn": [
                    "any_event"
                  ],
                  "localizedNames": {
                    "sl": "ID naročnika",
                    "en": "Requestor order identifier"
                  },
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/protocol[at0004]/items[at0062]/value",
                  "input": {
                    "type": "TEXT"
                  }
                },
                {
                  "id": "receiver_order_identifier",
                  "name": "Receiver order Identifier",
                  "localizedName": "Receiver order Identifier",
                  "rmType": "DV_TEXT",
                  "nodeId": "at0063",
                  "min": 0,
                  "max": 1,
                  "dependsOn": [
                    "any_event"
                  ],
                  "localizedNames": {
                    "sl": "ID prejemnika",
                    "en": "Receiver order Identifier"
                  },
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/protocol[at0004]/items[at0063]/value",
                  "input": {
                    "type": "TEXT"
                  }
                },
                {
                  "id": "laboratory_test_result_identifier",
                  "name": "Laboratory test result identifier",
                  "localizedName": "Laboratory test result identifier",
                  "rmType": "DV_TEXT",
                  "nodeId": "at0068",
                  "min": 0,
                  "max": 1,
                  "dependsOn": [
                    "any_event"
                  ],
                  "localizedNames": {
                    "sl": "ID laboratorijskega testa",
                    "en": "Laboratory test result identifier"
                  },
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/protocol[at0004]/items[at0068]/value",
                  "input": {
                    "type": "TEXT"
                  }
                },
                {
                  "id": "datetime_result_issued",
                  "name": "Datetime result issued",
                  "localizedName": "Datetime result issued",
                  "rmType": "DV_DATE_TIME",
                  "nodeId": "at0075",
                  "min": 0,
                  "max": 1,
                  "dependsOn": [
                    "any_event"
                  ],
                  "localizedNames": {
                    "sl": "Datum in čas dobljenih rezultatov",
                    "en": "Datetime result issued"
                  },
                  "annotations": {
                    "comment": "The date and time related to the results status is\n                                useful for version control and cumulative results for the report.\n                            "
                  },
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/protocol[at0004]/items[at0075]/value",
                  "input": {
                    "type": "DATETIME"
                  }
                },
                {
                  "id": "any_event",
                  "name": "Any event",
                  "localizedName": "Any event",
                  "rmType": "EVENT",
                  "nodeId": "at0002",
                  "min": 0,
                  "max": -1,
                  "localizedNames": {
                    "sl": "*Any event(en)",
                    "en": "Any event"
                  },
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/data[at0001]/events[at0002]",
                  "children": [
                    {
                      "id": "test_name",
                      "name": "Test name",
                      "localizedName": "Test name",
                      "rmType": "DV_TEXT",
                      "nodeId": "at0005",
                      "min": 0,
                      "max": 1,
                      "localizedNames": {
                        "sl": "Naziv testa",
                        "en": "Test name"
                      },
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/data[at0001]/events[at0002]/data[at0003]/items[at0005]/value",
                      "input": {
                        "type": "TEXT"
                      }
                    },
                    {
                      "id": "diagnostic_service",
                      "name": "Diagnostic service",
                      "localizedName": "Diagnostic service",
                      "rmType": "DV_TEXT",
                      "nodeId": "at0077",
                      "min": 0,
                      "max": 1,
                      "localizedNames": {
                        "sl": "Naziv diagnostičnega laboratorija",
                        "en": "Diagnostic service"
                      },
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/data[at0001]/events[at0002]/data[at0003]/items[at0077]/value",
                      "input": {
                        "type": "TEXT"
                      }
                    },
                    {
                      "id": "test_status",
                      "name": "Test status",
                      "localizedName": "Test status",
                      "rmType": "DV_CODED_TEXT",
                      "nodeId": "at0073",
                      "min": 0,
                      "max": 1,
                      "localizedNames": {
                        "sl": "Status testa",
                        "en": "Test status"
                      },
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/data[at0001]/events[at0002]/data[at0003]/items[at0073]/value/defining_code",
                      "input": {
                        "type": "CODED_TEXT",
                        "list": [
                          {
                            "value": "at0037",
                            "label": "Interim",
                            "localizedLabels": {
                              "sl": "Začasen",
                              "en": "Interim"
                            }
                          },
                          {
                            "value": "at0038",
                            "label": "Final",
                            "localizedLabels": {
                              "sl": "Končni",
                              "en": "Final"
                            }
                          },
                          {
                            "value": "at0039",
                            "label": "Supplementary",
                            "localizedLabels": {
                              "sl": "Dodaten",
                              "en": "Supplementary"
                            }
                          },
                          {
                            "value": "at0040",
                            "label": "Corrected (amended)",
                            "localizedLabels": {
                              "sl": "Popravek",
                              "en": "Corrected (amended)"
                            }
                          },
                          {
                            "value": "at0074",
                            "label": "Aborted",
                            "localizedLabels": {
                              "sl": "Ni razvit",
                              "en": "Aborted"
                            }
                          },
                          {
                            "value": "at0079",
                            "label": "Never performed",
                            "localizedLabels": {
                              "sl": "Nikoli izveden",
                              "en": "Never performed"
                            }
                          }
                        ]
                      }
                    },
                    {
                      "id": "hba1c",
                      "name": "HbA1c",
                      "localizedName": "HbA1c",
                      "rmType": "DV_PROPORTION",
                      "nodeId": "at0078.1",
                      "min": 0,
                      "max": 1,
                      "localizedNames": {
                        "sl": "HbA1c",
                        "en": "HbA1c"
                      },
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/data[at0001]/events[at0002]/data[at0003]/items[at0078.1]/value",
                      "input": {
                        "type": "PROPORTION",
                        "list": [
                          {
                            "value": "%",
                            "label": "%",
                            "validation": {
                              "range": {
                                "minOp": ">=",
                                "min": 0,
                                "maxOp": "<=",
                                "max": 100
                              }
                            }
                          }
                        ]
                      }
                    },
                    {
                      "id": "overall_interpretation",
                      "name": "Overall interpretation",
                      "localizedName": "Overall interpretation",
                      "rmType": "DV_TEXT",
                      "nodeId": "at0057",
                      "min": 0,
                      "max": 1,
                      "localizedNames": {
                        "sl": "Dodatne opombe",
                        "en": "Overall interpretation"
                      },
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/data[at0001]/events[at0002]/data[at0003]/items[at0057]/value",
                      "input": {
                        "type": "TEXT"
                      }
                    },
                    {
                      "id": "time",
                      "name": "Time",
                      "rmType": "DV_DATE_TIME",
                      "min": 1,
                      "max": 1,
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/data[at0001]/events[at0002]/time",
                      "input": {
                        "type": "DATETIME"
                      },
                      "inContext": true
                    }
                  ]
                },
                {
                  "id": "subject",
                  "name": "Subject",
                  "rmType": "PARTY_PROXY",
                  "min": 1,
                  "max": 1,
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/subject",
                  "inContext": true
                },
                {
                  "id": "encoding",
                  "name": "Encoding",
                  "rmType": "CODE_PHRASE",
                  "min": 1,
                  "max": 1,
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/encoding",
                  "input": {
                    "type": "CODED_TEXT"
                  },
                  "inContext": true
                },
                {
                  "id": "language",
                  "name": "Language",
                  "rmType": "CODE_PHRASE",
                  "min": 1,
                  "max": 1,
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.lab_test-hba1c.v1]/language",
                  "input": {
                    "type": "CODED_TEXT"
                  },
                  "inContext": true
                }
              ]
            },
            {
              "id": "body_temperature",
              "name": "Body temperature",
              "localizedName": "Body temperature",
              "rmType": "OBSERVATION",
              "nodeId": "openEHR-EHR-OBSERVATION.body_temperature-zn.v1",
              "min": 0,
              "max": -1,
              "localizedNames": {
                "sl": "Telesna temperatura",
                "en": "Body temperature"
              },
              "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]",
              "children": [
                {
                  "id": "site_of_measurement",
                  "name": "Site of measurement",
                  "localizedName": "Site of measurement",
                  "rmType": "DV_CODED_TEXT",
                  "nodeId": "at0021.1",
                  "min": 0,
                  "max": 1,
                  "dependsOn": [
                    "any_event"
                  ],
                  "localizedNames": {
                    "sl": "Lokacija",
                    "en": "Site of measurement"
                  },
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/protocol[at0020]/items[at0021.1]/value/defining_code",
                  "input": {
                    "type": "CODED_TEXT",
                    "list": [
                      {
                        "value": "at0.60",
                        "label": "Buccal",
                        "localizedLabels": {
                          "sl": "Notranja stran ličnice",
                          "en": "Buccal"
                        }
                      },
                      {
                        "value": "at0.61",
                        "label": "Sublingual",
                        "localizedLabels": {
                          "sl": "Pod jezikom",
                          "en": "Sublingual"
                        }
                      },
                      {
                        "value": "at0022",
                        "label": "Mouth",
                        "localizedLabels": {
                          "sl": "Usta",
                          "en": "Mouth"
                        }
                      },
                      {
                        "value": "at0023",
                        "label": "Ear canal",
                        "localizedLabels": {
                          "sl": "V ušesu",
                          "en": "Ear canal"
                        }
                      },
                      {
                        "value": "at0024",
                        "label": "Axilla",
                        "localizedLabels": {
                          "sl": "Pod pazduho",
                          "en": "Axilla"
                        }
                      },
                      {
                        "value": "at0025",
                        "label": "Rectum",
                        "localizedLabels": {
                          "sl": "Rektalno",
                          "en": "Rectum"
                        }
                      },
                      {
                        "value": "at0026",
                        "label": "Nasopharynx",
                        "localizedLabels": {
                          "sl": "Nazofarinks",
                          "en": "Nasopharynx"
                        }
                      },
                      {
                        "value": "at0027",
                        "label": "Urinary bladder",
                        "localizedLabels": {
                          "sl": "Sečni mehur",
                          "en": "Urinary bladder"
                        }
                      },
                      {
                        "value": "at0028",
                        "label": "Intravascular",
                        "localizedLabels": {
                          "sl": "Intravaskularno",
                          "en": "Intravascular"
                        }
                      },
                      {
                        "value": "at0043",
                        "label": "Skin",
                        "localizedLabels": {
                          "sl": "Na koži",
                          "en": "Skin"
                        }
                      },
                      {
                        "value": "at0051",
                        "label": "Vagina",
                        "localizedLabels": {
                          "sl": "Vaginalno",
                          "en": "Vagina"
                        }
                      },
                      {
                        "value": "at0054",
                        "label": "Oesophagus",
                        "localizedLabels": {
                          "sl": "V požiralniku",
                          "en": "Oesophagus"
                        }
                      },
                      {
                        "value": "at0055",
                        "label": "Inguinal skin crease",
                        "localizedLabels": {
                          "sl": "V ustih",
                          "en": "Inguinal skin crease"
                        }
                      }
                    ]
                  }
                },
                {
                  "id": "other_site_of_measurement",
                  "name": "Other site of measurement",
                  "localizedName": "Other site of measurement",
                  "rmType": "DV_TEXT",
                  "nodeId": "at0.62",
                  "min": 0,
                  "max": 1,
                  "dependsOn": [
                    "any_event"
                  ],
                  "localizedNames": {
                    "sl": "Drugo",
                    "en": "Other site of measurement"
                  },
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/protocol[at0020]/items[at0.62]/value",
                  "input": {
                    "type": "TEXT"
                  }
                },
                {
                  "id": "any_event",
                  "name": "Any event",
                  "localizedName": "Any event",
                  "rmType": "EVENT",
                  "nodeId": "at0003",
                  "min": 0,
                  "max": -1,
                  "localizedNames": {
                    "sl": "*Any event(en)",
                    "en": "Any event"
                  },
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/data[at0002]/events[at0003]",
                  "children": [
                    {
                      "id": "body_exposure",
                      "name": "Body exposure",
                      "localizedName": "Body exposure",
                      "rmType": "DV_CODED_TEXT",
                      "nodeId": "at0030",
                      "min": 0,
                      "max": 1,
                      "dependsOn": [
                        "symptoms",
                        "temperature"
                      ],
                      "localizedNames": {
                        "sl": "Obleka",
                        "en": "Body exposure"
                      },
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/data[at0002]/events[at0003]/state[at0029]/items[at0030]/value/defining_code",
                      "input": {
                        "type": "CODED_TEXT",
                        "list": [
                          {
                            "value": "at0031",
                            "label": "Naked",
                            "localizedLabels": {
                              "sl": "Nag",
                              "en": "Naked"
                            }
                          },
                          {
                            "value": "at0032",
                            "label": "Reduced clothing/bedding",
                            "localizedLabels": {
                              "sl": "Premalo oblečen (zavit)",
                              "en": "Reduced clothing/bedding"
                            }
                          },
                          {
                            "value": "at0033",
                            "label": "Appropriate clothing/bedding",
                            "localizedLabels": {
                              "sl": "Primerno oblečen (zavit)",
                              "en": "Appropriate clothing/bedding"
                            }
                          },
                          {
                            "value": "at0034",
                            "label": "Increased clothing/bedding",
                            "localizedLabels": {
                              "sl": "Preveč oblečen (zavit)",
                              "en": "Increased clothing/bedding"
                            }
                          }
                        ],
                        "defaultValue": {
                          "value": "at0033",
                          "label": "Appropriate clothing/bedding",
                          "localizedLabels": {
                            "sl": "Primerno oblečen (zavit)",
                            "en": "Appropriate clothing/bedding"
                          }
                        }
                      }
                    },
                    {
                      "id": "description_of_thermal_stress",
                      "name": "Description of thermal stress",
                      "localizedName": "Description of thermal stress",
                      "rmType": "DV_TEXT",
                      "nodeId": "at0041",
                      "min": 0,
                      "max": 1,
                      "dependsOn": [
                        "symptoms",
                        "temperature"
                      ],
                      "localizedNames": {
                        "sl": "Opis",
                        "en": "Description of thermal stress"
                      },
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/data[at0002]/events[at0003]/state[at0029]/items[at0041]/value",
                      "input": {
                        "type": "TEXT"
                      }
                    },
                    {
                      "id": "temperature",
                      "name": "Temperature",
                      "localizedName": "Temperature",
                      "rmType": "DV_QUANTITY",
                      "nodeId": "at0004",
                      "min": 0,
                      "max": 1,
                      "localizedNames": {
                        "sl": "Telesna temperatura",
                        "en": "Temperature"
                      },
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/data[at0002]/events[at0003]/data[at0001]/items[at0004]/value",
                      "input": {
                        "type": "QUANTITY",
                        "list": [
                          {
                            "value": "°C",
                            "label": "°C",
                            "validation": {
                              "precision": {
                                "min": 1,
                                "max": 1
                              }
                            }
                          },
                          {
                            "value": "°F",
                            "label": "°F",
                            "validation": {
                              "precision": {
                                "min": 1,
                                "max": 1
                              }
                            }
                          }
                        ]
                      }
                    },
                    {
                      "id": "symptoms",
                      "name": "Symptoms",
                      "localizedName": "Symptoms",
                      "rmType": "DV_CODED_TEXT",
                      "nodeId": "at0.63",
                      "min": 0,
                      "max": 2,
                      "localizedNames": {
                        "sl": "Ugotovitve",
                        "en": "Symptoms"
                      },
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/data[at0002]/events[at0003]/data[at0001]/items[at0.63]/value/defining_code",
                      "input": {
                        "type": "CODED_TEXT",
                        "list": [
                          {
                            "value": "at0.64",
                            "label": "Chills / rigor / shivering",
                            "localizedLabels": {
                              "sl": "Mrazenje/mrzlica",
                              "en": "Chills / rigor / shivering"
                            }
                          },
                          {
                            "value": "at0.65",
                            "label": "Goose- bumps",
                            "localizedLabels": {
                              "sl": "Kurja polt",
                              "en": "Goose- bumps"
                            }
                          }
                        ]
                      }
                    },
                    {
                      "id": "time",
                      "name": "Time",
                      "rmType": "DV_DATE_TIME",
                      "min": 1,
                      "max": 1,
                      "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/data[at0002]/events[at0003]/time",
                      "input": {
                        "type": "DATETIME"
                      },
                      "inContext": true
                    }
                  ]
                },
                {
                  "id": "subject",
                  "name": "Subject",
                  "rmType": "PARTY_PROXY",
                  "min": 1,
                  "max": 1,
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/subject",
                  "inContext": true
                },
                {
                  "id": "encoding",
                  "name": "Encoding",
                  "rmType": "CODE_PHRASE",
                  "min": 1,
                  "max": 1,
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/encoding",
                  "input": {
                    "type": "CODED_TEXT"
                  },
                  "inContext": true
                },
                {
                  "id": "language",
                  "name": "Language",
                  "rmType": "CODE_PHRASE",
                  "min": 1,
                  "max": 1,
                  "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/language",
                  "input": {
                    "type": "CODED_TEXT"
                  },
                  "inContext": true
                }
              ]
            }
          ]
        },
        {
          "id": "context",
          "rmType": "EVENT_CONTEXT",
          "nodeId": "",
          "min": 1,
          "max": 1,
          "aqlPath": "/context",
          "children": [
            {
              "id": "setting",
              "name": "Setting",
              "rmType": "DV_CODED_TEXT",
              "min": 1,
              "max": 1,
              "aqlPath": "/context/setting",
              "input": {
                "type": "CODED_TEXT"
              },
              "inContext": true
            },
            {
              "id": "start_time",
              "name": "Start_time",
              "rmType": "DV_DATE_TIME",
              "min": 1,
              "max": 1,
              "aqlPath": "/context/start_time",
              "input": {
                "type": "DATETIME"
              },
              "inContext": true
            }
          ]
        },
        {
          "id": "composer",
          "name": "Composer",
          "rmType": "PARTY_PROXY",
          "min": 1,
          "max": 1,
          "aqlPath": "/composer",
          "inContext": true
        }
      ]
    }
  }
}
Response codes
  • 200: Success - returns the JSON containing the web template.

  • 400: Bad request - unsupported language (TMPL-3061).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Template does not exist (TMPL-3021).

GET /template/{templateId}/example

Returns an example of data values for a web template.

Parameters
  • templateId (path/string): The ID of the template to load.

  • defaultLanguage (query/string): The default language to generate the web template with.

  • languages (query/string): Other languages to include in the web template, separated by a comma.

  • format (query/com.marand.thinkehr.server.rest.CompositionFormat): The format of JSON representation of the example composition to return. Default: FLAT.

  • exampleFilter (query/com.marand.thinkehr.server.rest.TemplateExampleFilter): The type of example to produce - intended for input (sent to the server), output (received back from the server) etc.

Notes

Returns an example of data values for a ThinkEhr web template.

This method will show all the web template paths that can be filled out in order to successfully save a composition in the web template format. It will do its best to generate legal exampledata values for those paths, taking into account the data type and validation constraints.

Two parameters control the output of this call. The format parameter controls whether the produced output will be the web template composition values in either the FLAT or the STRUCTURED (hierarchical) JSON format. The exampleFilter parameter controls whether the example will show the values as they would be submitted to the server (INPUT) or received from the server (OUTPUT), since the latter one is more detailed.

Example of a successful call response (FLAT INPUT):

{
  "ctx/language": "en",
  "ctx/territory": "US",
  "ctx/composer_name": "Silvia Blake",
  "ctx/time": "2014-05-26T10:06:08.356+02:00",
  "ctx/id_namespace": "HOSPITAL-NS",
  "ctx/id_scheme": "HOSPITAL-NS",
  "ctx/participation_name": "Dr. Marcus Johnson",
  "ctx/participation_function": "requester",
  "ctx/participation_mode": "face-to-face communication",
  "ctx/participation_id": "199",
  "ctx/participation_name:1": "Lara Markham",
  "ctx/participation_function:1": "performer",
  "ctx/participation_id:1": "198",
  "ctx/health_care_facility|name": "Hospital",
  "ctx/health_care_facility|id": "9091",
  "vitals/vitals/haemoglobin_a1c:0/any_event:0/test_name": "Test name 90",
  "vitals/vitals/haemoglobin_a1c:0/any_event:0/diagnostic_service": "Diagnostic service 31",
  "vitals/vitals/haemoglobin_a1c:0/any_event:0/test_status|at0037": true,
  "vitals/vitals/haemoglobin_a1c:0/any_event:0/test_status|code": "at0037",
  "vitals/vitals/haemoglobin_a1c:0/any_event:0/hba1c|numerator": 79.56,
  "vitals/vitals/haemoglobin_a1c:0/any_event:0/hba1c|denominator": 100,
  "vitals/vitals/haemoglobin_a1c:0/any_event:0/overall_interpretation": "Overall interpretation 53",
  "vitals/vitals/haemoglobin_a1c:0/requestor_order_identifier": "Ident. 86",
  "vitals/vitals/haemoglobin_a1c:0/receiver_order_identifier": "Ident. 80",
  "vitals/vitals/haemoglobin_a1c:0/laboratory_test_result_identifier": "Ident. 40",
  "vitals/vitals/haemoglobin_a1c:0/datetime_result_issued": "2014-05-26T08:06:08.360Z",
  "vitals/vitals/body_temperature:0/any_event:0/temperature|magnitude": 31.8,
  "vitals/vitals/body_temperature:0/any_event:0/temperature|unit": "°C",
  "vitals/vitals/body_temperature:0/any_event:0/symptoms|at0.64": true,
  "vitals/vitals/body_temperature:0/any_event:0/symptoms:0|code": "at0.64",
  "vitals/vitals/body_temperature:0/any_event:0/body_exposure|at0033": true,
  "vitals/vitals/body_temperature:0/any_event:0/body_exposure|code": "at0033",
  "vitals/vitals/body_temperature:0/any_event:0/description_of_thermal_stress": "Description of thermal stress 91",
  "vitals/vitals/body_temperature:0/site_of_measurement|at0054": true,
  "vitals/vitals/body_temperature:0/site_of_measurement|code": "at0054",
  "vitals/vitals/body_temperature:0/other_site_of_measurement": "Other site of measurement 30"
}
Response codes
  • 200: Success - returns the JSON containing the web template values example.

  • 400: Bad request - unsupported language (TMPL-3061).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Template does not exist (TMPL-3021).

/demographics

Demographics.

GET /demographics/party/{partyId}

Retrieves the demographics info for the specified party.

Parameters
  • partyId (path/string): The external ID of the party to retrieve.

  • when (query/string): The instant of time for which to return the information about the party in the ISO-8601 format (2014-03-03T15:05:43.992Z).

Notes

This method contacts the remote demographics service and returns a JSON description of the party (specified by the partyId path parameter) in whichever format the service provides, along with some meta-data.

A note about domains: all demographics operations take place within the requesting user’s default domain. This means that the user can only query for and add parties that are in his default domain. If the user has no default domain set, a 400 Bad Request (DEMO-6088) error will be thrown.

Example of a successful response:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/demographics/party/1"
  },
  "action": "RETRIEVE",
  "party": {
    "id": "1",
    "version": 0,
    "firstNames": "Bruce",
    "lastNames": "Wayne",
    "gender": "MALE",
    "dateOfBirth": "2014-03-03T15:04:24.456Z",
    "address": {
      "id": "1",
      "version": 0,
      "address": "Fake Street 15, Gotham City"
    },
    "partyAdditionalInfo": [
      {
        "id": "5",
        "version": 0,
        "key": "contact_info_hidden",
        "value": "yes"
      },
      {
        "id": "6",
        "version": 0,
        "key": "title",
        "value": "Mr"
      },
      {
        "id": "7",
        "version": 0,
        "key": "insurance_level",
        "value": "9"
      }
    ]
  }
}
Response codes
  • 200: Success - returns the JSON containing party description.

  • 400: Bad Request - no domain could be determined for the user (DEMO-6088).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Not found - party does not exist (DEMO-6021).

  • 503: Service unavailable - could not connect to the remote demographics service.

DELETE /demographics/party/{partyId}

Deletes a party record from the remote demographics store.

Parameters
  • partyId (path/string): The id of the party to delete.

Notes

This method deletes a party denoted by its id from the remote demographics store, along with all its sub-entities (such as additional info).

Successful response:

{
  "action": "DELETE"
}

A note about domains: all demographics operations take place within the requesting user’s default domain. This means that the user can only query for and add parties that are in his default domain. If the user has no default domain set, a 400 Bad Request (DEMO-6088) error will be thrown.

Response codes
  • 200: Success - party successfully deleted.

  • 400: Bad request - no domain could be determined for the user (DEMO-6088).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Not found - the specified party was not found (DEMO-6021).

  • 503: Service unavailable - could not connect to the remote demographics service.

GET /demographics/ehr/{ehrId}/party

Retrieves the demographics info for the specified party.

Parameters
  • ehrId (path/string): EHR ID of the party to retrieve.

  • when (query/string): The instant of time for which to return the information about the party in the ISO-8601 format (2014-03-03T15:05:43.992Z).

Notes

This method contacts the remote demographics service and returns a JSON description of the party (specified by the partyId path parameter) in whichever format the service provides, along with some meta-data.

A note about domains: all demographics operations take place within the requesting user’s default domain. This means that the user can only query for and add parties that are in his default domain. If the user has no default domain set, a 400 Bad Request (DEMO-6088) error will be thrown.

Example of a successful response:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/demographics/ehr/89e610ee-aed2-41fb-9a70-8d30631bdaec/party"
  },
  "action": "RETRIEVE",
  "party": {
    "id": "1",
    "version": 0,
    "firstNames": "Bruce",
    "lastNames": "Wayne",
    "gender": "MALE",
    "dateOfBirth": "2014-03-03T15:04:24.456Z",
    "address": {
      "id": "1",
      "version": 0,
      "address": "Fake Street 15, Gotham City"
    },
    "partyAdditionalInfo": [
      {
        "id": "5",
        "version": 0,
        "key": "contact_info_hidden",
        "value": "yes"
      },
      {
        "id": "6",
        "version": 0,
        "key": "title",
        "value": "Mr"
      },
      {
        "id": "7",
        "version": 0,
        "key": "insurance_level",
        "value": "9"
      }
    ]
  }
}
Response codes
  • 200: Success - returns the JSON containing party description.

  • 400: Bad Request - no domain could be determined for the user (DEMO-6088).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Not found - party does not exist (DEMO-6021).

  • 503: Service unavailable - could not connect to the remote demographics service.

POST /demographics/party

Creates a new party record in the remote demographics store.

Parameters
  • body (body/string): The party to create in whatever format the demographics service supports.

Notes

This method saves a new party, specified in the JSON request body, to the remote demographics service.

The JSON request body has to be in the format that the remote demographics service understands.

Quick specification of what the default party object looks like:

{
    "firstNames": "string",
    "lastNames": "string",
    "gender": "MALE|FEMALE|UNKNOWN|OTHER",
    "dateOfBirth": "ISO-8601 timestamp (including time portion)",
    "timeOfDeath": "ISO-8601 timestamp (including time portion)",
    "address": {
      "address": "string"
    },
    "partyAdditionalInfo (arbitrary collection of key-value pairs)": [
            {
        "key": "key1",
        "value": "value1"
      },
      {
        "key": "key1",
        "value": "value1"
      }
    ]
  }

None of the properties are required, but if you do specify any partyAdditionalInfo elements, the key has to be set. The return JSON format looks the same, but it will have the identity properties set for elements (id and version). If you send these in this method call, they are ignored.

A request body should look something like this:

{
    "firstNames": "Jordan",
    "lastNames": "Nolan",
    "gender": "MALE",
    "dateOfBirth": "1990-03-09T00:00:00.000Z",
    "address": {
      "address": "Toronto, Canada"
    },
    "partyAdditionalInfo": [
      {
        "key": "pet",
        "value": "dog"
      },
      {
        "key": "title",
        "value": "Mr"
      }
    ]
  }

Successful response:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/demographics/party/16"
  },
  "action": "CREATE"
}

A note about domains: all demographics operations take place within the requesting user’s default domain. This means that the user can only query for and add parties that are in his default domain. If the user has no default domain set, a 400 Bad Request (DEMO-6088) error will be thrown.

Response codes
  • 201: Success - party record created.

  • 400: Bad request - the service could not parse the party JSON (DEMO-6041), missing party additional info keys (DEMO-6042), no domain could be determined for the user (DEMO-6088).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 503: Service unavailable - could not connect to the remote demographics service.

PUT /demographics/party

Updates a party record in the remote demographics store.

Parameters
  • body (body/string): The party to update.

Notes

This method updates a party, specified in the JSON request body.

The JSON request body has to be in the format that the remote demographics service understands. See the documentation for party POST to see a description of the format.

Successful response:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/demographics/party/16"
  },
  "action": "UPDATE"
}

A note about domains: all demographics operations take place within the requesting user’s default domain. This means that the user can only query for and add parties that are in his default domain. If the user has no default domain set, a 400 Bad Request (DEMO-6088) error will be thrown.

Response codes
  • 200: Success - party updated or else it was determined that no update was necessary.

  • 400: Bad request - the service could not parse the party JSON (DEMO-6041), missing party additional info keys (DEMO-6042), no domain could be determined for the user (DEMO-6088).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 404: Not found - the specified party or one of its sub-entities (such as additional info) was not found (DEMO-6021).

  • 409: Conflict - the record has already been updated by another transaction - optimistic locking exception (SYS-9409).

  • 503: Service unavailable - could not connect to the remote demographics service.

GET /demographics/party/query

Queries the demographics store for matching parties, with the query parameters specified in the URL.

Parameters
  • maxHits (query/integer): Limit the query results to this many hits.

  • parameters (query/string): Query parameters in the key1=value1&key2=value2 format

Notes

This method queries the demographics store for matching parties, with key1=value1&key2=value2 URL parameters serving as the query parameters.

The special query parameter search will perform an OR-search on both the firstNames and the lastNames property of the party.

A case-insensitive search will be performed for matching keys and values.

Please note that all properties whose key names start with date or time are considered to be ISO-8601 timestamps (1980-04-12T00:00:00.000Z) and will be attempted to be parsed as such. Failure to parse such criteria will result in a 400 Bad Request error.

An example of complex search criteria:

.../demographics/party/query/?firstNames=*Bruce*&dateOfBirth=1980-04-12T00:00:00.000Z&gender=MALE&insuranceLevel=5

This will find all parties whose first names include Bruce that have been born on the 12th of April, 1980, are male and have the additional property insuranceLevel set to 9.

For string based values, the * character can be used to indicate wildcard-matching behavior.

An example of a successful response body:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/demographics/party/query/?lastNames=*Way*"
  },
  "action": "RETRIEVE",
  "parties": [
    {
      "id": "1",
      "version": 0,
      "firstNames": "Bruce",
      "lastNames": "Wayne",
      "gender": "MALE",
      "dateOfBirth": "2014-03-03T15:04:24.456Z",
      "address": {
        "id": "1",
        "version": 0,
        "address": "Fake Street 15, Gotham City"
      },
      "partyAdditionalInfo": [
        {
          "id": "7",
          "version": 0,
          "key": "insurance_level",
          "value": "9"
        },
        {
          "id": "6",
          "version": 0,
          "key": "title",
          "value": "Mr"
        },
        {
          "id": "5",
          "version": 0,
          "key": "contact_info_hidden",
          "value": "yes"
        }
      ]
    },
    {
      "id": "9",
      "version": 0,
      "firstNames": "Selina",
      "lastNames": "Wayne",
      "gender": "FEMALE",
      "dateOfBirth": "1980-03-03T15:04:24.456Z",
      "address": {
        "id": "9",
        "version": 0,
        "address": "Fake Street 19, Gotham City"
      },
      "partyAdditionalInfo": [
        {
          "id": "15",
          "version": 0,
          "key": "title",
          "value": "Mrs"
        },
        {
          "id": "16",
          "version": 0,
          "key": "insurance_level",
          "value": "10"
        },
        {
          "id": "10",
          "version": 0,
          "key": "contact_info_hidden",
          "value": "no"
        }
      ]
    }
  ]
}

A note about domains: all demographics operations take place within the requesting user’s default domain. This means that the user can only query for and add parties that are in his default domain. If the user has no default domain set, a 400 Bad Request (DEMO-6088) error will be thrown.

Response codes
  • 200: Success - query successfully executed and result returned.

  • 204: No content - query produced no results.

  • 400: Bad request - no query criteria specified (DEMO-6150), could not parse parameters (DEMO-6151), no domain could be determined for the user (DEMO-6088), could not parse request JSON.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 503: Service unavailable - could not connect to the remote demographics service.

POST /demographics/party/query

Queries the demographics store for matching parties.

Parameters
  • maxHits (query/integer): Limit the query results to this many hits.

  • body (body/array): An array of key-value query criteria.

Notes

This method queries the demographics store for matching parties, using a JSON array of key-value arguments as the search criteria.

The JSON request body is an array of key-value search criteria that are then used as the WHERE clause of the SQL query (a conjunction (AND) of the individual key-value pairs will be used to produce the WHERE clause).

The format of the restriction clause:

{
    "key": "string",
    "value": "string"
}

The special key search will perform an OR-search on both the firstNames and the lastNames property of the party.

A case-insensitive search will be performed for matching keys and values.

Please note that all properties whose key names start with date or time are considered to be ISO-8601 timestamps (1980-04-12T00:00:00.000Z) and will be attempted to be parsed as such. Failure to parse such criteria will result in a 400 Bad Request error.

An example of complex search criteria:

[
   {
    "key": "firstNames",
    "value": "*Bruce*"
   },
   {
    "key": "dateOfBirth",
    "value": "1980-04-12T00:00:00.000Z"
   },
   {
    "key": "gender",
    "value": "MALE"
   },
   {
    "key": "insuranceLevel",
    "value": "5"
   }
]

This will find all parties whose first names include Bruce that have been born on the 12th of April, 1980, are male and have the additional property insuranceLevel set to 9.

For string based values, the * character can be used to indicate wildcard-matching behavior.

An example of a successful response body:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/demographics/party/query/?lastNames=*Way*"
  },
  "action": "RETRIEVE",
  "parties": [
    {
      "id": "1",
      "version": 0,
      "firstNames": "Bruce",
      "lastNames": "Wayne",
      "gender": "MALE",
      "dateOfBirth": "2014-03-03T15:04:24.456Z",
      "address": {
        "id": "1",
        "version": 0,
        "address": "Fake Street 15, Gotham City"
      },
      "partyAdditionalInfo": [
        {
          "id": "7",
          "version": 0,
          "key": "insurance_level",
          "value": "9"
        },
        {
          "id": "6",
          "version": 0,
          "key": "title",
          "value": "Mr"
        },
        {
          "id": "5",
          "version": 0,
          "key": "contact_info_hidden",
          "value": "yes"
        }
      ]
    },
    {
      "id": "9",
      "version": 0,
      "firstNames": "Selina",
      "lastNames": "Wayne",
      "gender": "FEMALE",
      "dateOfBirth": "1980-03-03T15:04:24.456Z",
      "address": {
        "id": "9",
        "version": 0,
        "address": "Fake Street 19, Gotham City"
      },
      "partyAdditionalInfo": [
        {
          "id": "15",
          "version": 0,
          "key": "title",
          "value": "Mrs"
        },
        {
          "id": "16",
          "version": 0,
          "key": "insurance_level",
          "value": "10"
        },
        {
          "id": "10",
          "version": 0,
          "key": "contact_info_hidden",
          "value": "no"
        }
      ]
    }
  ]
}

A note about domains: all demographics operations take place within the requesting user’s default domain. This means that the user can only query for and add parties that are in his default domain. If the user has no default domain set, a 400 Bad Request (DEMO-6088) error will be thrown.

Response codes
  • 200: Success - query successfully executed and result returned.

  • 204: No content - query produced no results.

  • 400: Bad request - no query criteria specified (DEMO-6150), could not parse parameters (DEMO-6151), no domain could be determined for the user (DEMO-6088), could not parse request JSON.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

  • 503: Service unavailable - could not connect to the remote demographics service.

/presentation

Display-ready documents.

POST /presentation

Returns presentation documents for a specified AQL query.

Parameters
  • body (body/PresentationRequestData):

Notes

Returns presentation documents returned by the AQL query. Their content can be filtered by forms specified in request body.

Query should only return COMPOSITIONs, all other values will be ignored.

Several forms can be specified for filtering - they will be matched to the template of each composition. Compositions without a matching form for filtering will be returned with basic reference model filtering.

Here is how parameters (AQL query and its parameters as well as forms) are specified in the JSON body:

{
  "queryRequestData": {
    "aql": "SELECT c FROM Composition c CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.body_temperature-zn.v1] WHERE o/data[at0002]/events[at0003]/data[at0001]/items[at0004]/value/magnitude < :temp FETCH 1",
    "aqlParameters": {
      "temp": 40
    }
  },
  "formData": [
    {
      "formName": "Demo Vitals",
      "versionString": "1.0.0"
    }
  ]
}

The returned result-set is a collection of presentation documents.

An example of a successful response body:

[
    {
      "metadata": {
        "startTime": "2014-03-11T10:27:09.933+01:00",
        "composer": "restTest",
        "name": "Vitals",
        "templateId": "Demo Vitals"
      },
      "composition": {
        "rmType": "COMPOSITION",
        "label": "Vitals",
        "children": [
          {
            "rmType": "SECTION",
            "label": "Vitals",
            "children": [
              {
                "rmType": "OBSERVATION",
                "label": "Body temperature",
                "children": [
                  {
                    "rmType": "DV_QUANTITY",
                    "label": "Temperature",
                    "displayValue": "37.2 °C",
                    "rawValue": {
                      "magnitude": 37.2,
                      "units": "°C",
                      "other_reference_ranges": []
                    },
                    "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]/data[at0002]/events[at0003]/data[at0001]/items[at0004]/value"
                  }
                ],
                "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']/items[openEHR-EHR-OBSERVATION.body_temperature-zn.v1]"
              }
            ],
            "aqlPath": "/content[openEHR-EHR-SECTION.ispek_dialog.v1,'Vitals']"
          }
        ]
      }
    }
]
Response codes
  • 200: Success - at least one document will be returned.

  • 204: No content - no results.

  • 400: Bad request - cannot parse AQL (QRY-4135), EHR placeholder could not be expanded due to EHR not set (EHR-2031).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

/view

Health data views.

GET /view/{ehrId}/allergy

Gets allergies for a patient

Parameters
  • ehrId (path/string): EHR ID

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /view/{ehrId}/blood_pressure

Gets recorded blood pressures for a patient

Parameters
  • ehrId (path/string): EHR ID

  • from (query/string): Limit by date from

  • to (query/string): Limit by date to

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /view/{ehrId}/body_temperature

Gets recorded body temperatures for a patient

Parameters
  • ehrId (path/string): EHR ID

  • from (query/string): Limit by date from

  • to (query/string): Limit by date to

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /view/{ehrId}/height

Gets recorded heights for a patient

Parameters
  • ehrId (path/string): EHR ID

  • from (query/string): Limit by date from

  • to (query/string): Limit by date to

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /view/{ehrId}/labs

Lab results

Parameters
  • ehrId (path/string): EHR ID

  • from (query/string): Limit by date from

  • to (query/string): Limit by date to

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /view/{ehrId}/medication

Gets medications prescribed for a a patient

Parameters
  • ehrId (path/string): EHR ID

  • from (query/string): Limit by date from

  • to (query/string): Limit by date to

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /view/{ehrId}/problem

Gets problems/diagnoses for a patient

Parameters
  • ehrId (path/string): EHR ID

  • from (query/string): Limit by date from

  • to (query/string): Limit by date to

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /view/{ehrId}/pulse

Gets pulse measurements for a patient

Parameters
  • ehrId (path/string): EHR ID

  • from (query/string): Limit by date from

  • to (query/string): Limit by date to

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /view/{ehrId}/spO2

Gets SpO2 measurements for a patient

Parameters
  • ehrId (path/string): EHR ID

  • from (query/string): Limit by date from

  • to (query/string): Limit by date to

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /view/{ehrId}/weight

Gets recorded weights for a patient

Parameters
  • ehrId (path/string): EHR ID

  • from (query/string): Limit by date from

  • to (query/string): Limit by date to

  • limit (query/integer): Maximum number of results to return (default = 10, max = 100)

Response codes
  • 200: Success.

  • 400: Bad request - no such view

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

/smart/records

SMART model resources.

GET /smart/records/{ehrId}/{modelName}

Returns SMART records for a patient.

Parameters
  • ehrId (path/string): EHR id.

  • modelName (path/string): SMART model name.

GET /smart/records/{ehrId}/{modelName}/{recordId}

Returns specific SMART record for a patient.

Parameters
  • ehrId (path/string): EHR id.

  • modelName (path/string): SMART model name.

  • recordId (path/string): Record id.

/tagging

Tagging services.

GET /tagging

Returns objects matching the specified tags.

Parameters
  • tags (query/string): A collection of tags that the returned objects need to be tagged with (a conjunction). Separate them with ;

  • versionsToReturn (query/com.marand.thinkehr.tagging.dto.TagFilteringDto$CompositionVersion): Which composition versions to return. Default: ALL_TAGGED_VERSIONS.

  • includeDeletedVersions (query/boolean): Whether or not to include deleted composition versions. Default: true.

  • includeCurrentlyDeleted (query/boolean): Whether or not to include compositions whose current (last) version is deleted. Default: true.

Notes

Returns a set of objects that are tagged with the specified tags.

The tags query parameter represents a conjunction of tags - an object MUST contain all of these tags to be returned by this call.

This method supports filtering the result-set by the state of the containing compositions. This is done via three optional parameters:

versionsToReturn - Controls which composition versions to return. ALL_TAGGED_VERSIONS returns all versions that are tagged, LAST_VERSION_ONLY only produces a match if the current (that is, last) version of the composition is appropriately tagged and LAST_TAGGED_VERSION returns only the last version of the composition that is tagged. LAST_VERSION_OF_ANY_TAGGED returns the last version of an object whose ANY version of the composition is tagged appropriately.

includeDeletedVersions - When false, will filter out those specific compositions that are deleted (have a null serialized composition).

includeCurrentlyDeleted - When false, will filter out all matches whose current (that is, last) version of the composition is deleted.

Example of a successful call:

{
  "meta": {
    "href": "http://localhost:8082/rest/v1/tagging/?tags=temperature&versionsToReturn=ALL_TAGGED_VERSIONS&includeDeletedVersions=false&includeCurrentlyDeleted=false"
  },
  "action": "RETRIEVE",
  "objects": [
    {
      "value": {
        "magnitude": 37.85083450722678,
        "units": "°C",
        "precision": 1,
        "other_reference_ranges": []
      },
      "name": {
        "value": "Temperature"
      },
      "archetype_node_id": "at0004"
    },
    {
      "value": {
        "magnitude": 37.68536907835939,
        "units": "°C",
        "precision": 1,
        "other_reference_ranges": []
      },
      "name": {
        "value": "Temperature"
      },
      "archetype_node_id": "at0004"
    },
    {
      "value": {
        "magnitude": 37.50576666004852,
        "units": "°C",
        "precision": 1,
        "other_reference_ranges": []
      },
      "name": {
        "value": "Temperature"
      },
      "archetype_node_id": "at0004"
    }
  ]
}
Response codes
  • 200: Success - returns tagged objects.

  • 204: No content - no correspondingly tagged objects found.

  • 400: Bad request - no tags specified (TAGS-7081).

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

POST /tagging

Tags the specified composition and/or its sub-structures.

Parameters
  • body (body/TaggingRequestData): The tag request object specifies what to tag and how.

Notes

Tags something within the specified composition, or else the composition itself.

What to tag and how is specified in the HTTP request body. Please see the model description for the parameter. Basically, it consists of the composition unique ID that we want to tag, then a set of tag-AQL path pairs that specify the string tag and the path within the composition to tag. If this path is null, then the entire composition is considered to be tagged.

Example of a request:

{
  "compositionUid": "843cd28d-5aa7-43cc-b112-b7848a79aea7::default::1",
  "tags": [
    {
      "tag": "ENCOUNTER:1"
    },
    {
      "tag": "CARE"
    },
    {
      "tag": "ENCOUNTER:1",
      "aqlPath": "/content[openEHR-EHR-SECTION.section_a.v1]/items[at0001]/name"
    }
  ]
}
Response codes
  • 204: No content - successfully tagged object.

  • 400: Bad request - no tags specified (TAGS-7081), no request object in HTTP body (TAGS-7281), no composition UID specified (TAGS-7381), composition does not exist (COMP-1021), invalid AQL path to tag (TAGS-7404), other invalid input data.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

DELETE /tagging

Delete a composition’s tags.

Parameters
  • body (body/TaggingRequestData): The tag request object specifies tags on what AQL paths to delete.

Notes

Delete the specified composition’s tags, or the tags of an object contained within that composition.

The request object contains the composition ID of the composition whose tags to delete and a set of tag-AQL path pairs that specify which tags to delete and for which objects within the composition. If the AQL pathis missing then this signifies the removal of the composition tag.

Example of a request:

{
  "compositionUid": "843cd28d-5aa7-43cc-b112-b7848a79aea7::default::1",
  "tags": [
    {
      "tag": "CARE"
    },
    {
      "tag": "ENCOUNTER:1",
      "aqlPath": "/content[openEHR-EHR-SECTION.section_a.v1]/items[at0001]/name"
    }
  ]
}
Response codes
  • 204: No content - successfully tagged object.

  • 400: Bad request - no tags specified (TAGS-7081), no request object in HTTP body (TAGS-7281), no composition UID specified (TAGS-7381), composition does not exist (COMP-1021), other invalid input data.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

GET /tagging/{compositionUid}

Returns tags for the specified composition.

Parameters
  • compositionUid (path/string): The ID of the composition whose tags to return.

Notes

Returns a set of tag-AQL path pairs that show what and how is tagged within the specified composition.

If the returned tag object’s AQL path is null, this signifies that the entire composition is tagged with the returned tag. Otherwise, the AQL path points to the object (composition sub-structure) that is tagged.

Example of a successful call:

{
    "meta": {
        "href": "http://localhost:8082/rest/v1/tagging/843cd28d-5aa7-43cc-b112-b7848a79aea7/"
    },
    "action": "RETRIEVE",
    "tags": [
        {
            "tag": "ENCOUNTER:1"
        },
        {
            "tag": "CARE"
        },
        {
            "tag": "ENCOUNTER:1",
            "aqlPath": "/content[openEHR-EHR-SECTION.section_a.v1]/items[at0001]/name"
        },
        {
            "tag": "SWAGGER4",
            "aqlPath": "/content[openEHR-EHR-SECTION.section_a.v1]/items[at0001]/name"
        },
        {
            "tag": "SWAGGER3"
        },
        {
            "tag": "SWAGGER2"
        },
        {
            "tag": "SWAGGER"
        }
    ]
}
Response codes
  • 200: Success - returns the composition’s tags.

  • 204: No content - composition has no tags or does not exist.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

/import

Tabular data import.

POST /import/csv

Import CSV data.

Parameters
  • body (body/java.io.InputStream):

  • templateId (query/string): Template ID

  • templateLanguage (query/string): Template language

  • converterLocale (query/string): Converter locale - specify when numeric values are formatted in a specific locale.

  • subjectNamespace (query/string): Subject namespace (required when using subjectIds to identify EHRs).

  • composerName (query/string): Composer name (if not specified username is used instead).

  • committerName (query/string): Committer name (if not specified username is used instead).

Notes

Data needs to be properly formatted as CSV. The first row needs to contain column names which must match ids (paths) from web template - specified by query parameter templateId.

EHR matching is possible in 2 ways:

  • a column ehrId is present in which case data is added to existing EHRs

  • a column subjectId is present in which case new EHRs will be created as required (in this case query parameter subjectNamespace is mandatory)

Example of a correct CSV file:

subjectId,ctx/language,ctx/territory,vital_signs/body_temperature:0/any_event:0/temperature|magnitude,vital_signs/body_temperature:0/any_event:0/temperature|unit
1001,en,SI,37.1,°C
1002,en,SI,37.2,°C
1003,en,SI,37.3,°C
1004,en,SI,37.4,°C
1005,en,SI,37.5,°C

Result will be returned as a CSV file as well with 2 additional columns:

  • composition uid for successfully imported rows

  • error message(s) for those rows where import failed

Example response file:

"subjectId","ctx/language","ctx/territory","vital_signs/body_temperature:0/any_event:0/temperature|magnitude","vital_signs/body_temperature:0/any_event:0/temperature|unit","compositionUid","errors"
"1001","en","SI","37.1","°C","326d42ff-fbcb-4c5c-9f59-dab03c035c2d::demo::1",
"1002","en","SI","37.2","°C","513e2bd8-cefc-4423-b84a-97f1436d726f::demo::1",
"1003","en","SI","37.3","°C","e0dcb42f-48c4-4fbe-9843-e45d552720b5::demo::1",
"1004","en","SI","37.4","°C","17663474-0512-4144-a6c2-b531f4073687::demo::1",
"1005","en","SI","37.5","°C","f044855d-5fd4-4106-95e2-9acff6b372c0::demo::1",
Response codes
  • 200: Success - import succeeded.

  • 400: Bad request - invalid template or unreadable CSV data.

  • 401: Unauthenticated - could not authenticate user (SYS-9401).

  • 403: Forbidden - the user does not have the required permissions to execute this request (SYS-9403).

Clinical Decision Support APIs

Lightweight CDS service to support execution of clinical guidelines

/guide

Guideline operations.

GET /guide/execute/{guideId}/{ehrIds}

Execute guide on given EHR IDs

Parameters
  • Ehr-Session (header/string): Active Ehr Session token.

  • Authorization (header/string): ThinkEhr credentials as HTTP Basic Authorization.

  • guideId (path/string): Guide ID.

  • ehrIds (path/string): Comma separated list of EHR ids, * for all.

  • persist (query/string): Should save result of execution into EHR?

Response codes
  • 500: Problem in guide execution.

GET /guide/{guideId}/gdl

Returns guide definition.

Parameters
  • guideId (path/string): Guide ID.

Notes

Guideline is defined in GDL. GDL Specification

Response codes
  • 500: Problem in guide definition.

GET /guide

List available guides.

DELETE /guide/{guideId}

Deletes guide.

Parameters
  • guideId (path/string): Guide ID.

Response codes
  • 500: Problem in guide deletion.

POST /guide/upload

Uploads new guide definition.

Parameters
  • guide (form/string): Base64 encoded guide definition.

Response codes
  • 500: Problem in guide upload.

PUT /guide/{guideId}/toggleGuidePersistence

Toggles default behaviour of persisting guide execution result.

Parameters
  • guideId (path/string): Guide ID.