Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 Integrated Care EHR (Electronic Health Record) is defined as:
"a repository of information regarding the health of a suject of care in computer processable form, stored and transmitted securely, and accessible by multiple authorised users" [1].  

To make EHR be accessible by For an EHR accessible to multiple authorised users, it means the EHR data (both coarse-grained and fine-grained data) can should be able to be searched and retrieved by the authorised users who may use the same EHR systems or different EHR systems. It is not possible at the current stagewith most of today's systems. To achieve this, it is required that:

...

  • The above three forms are the most common node predicates. A more advanced form is to include a general criteria instead of the name/value criteria within the predicate. The general criteria consists of left operand, operator, and right operand, e.g.
    No Format
    
    [at0002 and value/defining_code/terminology_id/value=$terminologyId]
    

Node predicate defines criteria on fine-grained data. It is only used within an identified path.

...

Operator

Meaning

Example

=

Equal

No Format
name/value = $nameValue

>

Greater than

No Format
o/data[at0001]/.../data[at0003]/items[at0004]/value/value >140

>=

Greater than or equal to

No Format
o/data[at0001]/..../data[at0003]/items[at0004]/value/value >=140

<

Smaller than

No Format
o/data[at0001]/.../data[at0003]/items[at0004]/value/value <160

<=

Smaller than or equal to

No Format
o/data[at0001]/.../data[at0003]/items[at0004]/value/value <=160

!=

not equals to

No Format
c/archetype_details/template_id/value != ''

 

 

 

Advanced AQL operators

These advanced operators are not supported by the BNF. These operator syntax are borrowed from ADLspecifications. These are proposed to improve the richness and flexibility of AQL so that AQL syntax supports more complicated query scenarios. This linkshows these operators, scenarios and the syntax.

...

  • consisting an AQL variable name defined within the FROM clause, followed by an openEHR path, e.g.
    No Format
    
    o/data[at0001]/.../data[at0003]/items[at0004]/value/value
    
  • consisting an AQL variable name followed by a predicate, e.g.
    No Format
    
    o[name/value=$nameValue]
    
  • consisting an AQL variable name followed by a predicate and an openEHR path, e.g.
    No Format
    
    o[name/value=$nameValue]/data[at0001]/.../data[at0003]/items[at0004]/value/value
    

    AQL structure

Overview

AQL structure has been briefly introduced in Section 2.2. This section introduces AQL structure in details.

...

 A FROM clause consists of three parts: keyword - FROM, class expression and/or containment constraints, e.g.

No Format

FROM EHR e [ehr_id/value=$ehrId] CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.report.v1]
Class expressions

Two examples of a class expression are shown below:

No Format

EHR e [ehr_id/value=$ehrId

...

]\\
COMPOSITION c[openEHR-EHR-COMPOSITION.report.v1]


Class expressions are used for two purposes:

  1. indicating the constraints on RM classes so as to scope the data source for the query. For instance, EHR e[ehr_id/value='123456'] indicates that the required data must be from a specific EHR with ehr_id value '123456'; while "COMPOSITION c[openEHR-EHR-COMPOSITION.report.v1] " indicates the required data must be from or must be associated with a composition instance with archetype id - openEHR-EHR-COMPOSITION.report.v1.
  2. defining a RM class variable that may be used by other clauses to indicate the required data or data items on which query criteria are applied. The example below uses the class expression to define a variable e which is used by the SELECT clause indicating all relevant ehr_id values are retrieved, and a variable c used by WHERE clause indicating that the query criteria is set on the composition template id value.
    No Format
    
    SELECT e/ehr_id/value

    
    FROM EHR e CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.referral.v1

    ]
    WHERE c/archetype_details/template_id/value=$templateId
    

Class expressions syntax include three parts. A class expression must have part one and at least one of part two or part three.

...

The syntax of containment constraint is very simple: using keyword CONTAINS between two class expressions. Left class expression is the the parent object of the right class expression, e.g.

No Format

EHR e CONTAINS COMPOSITION c [openEHR-EHR-COMPOSITION.referral.v1]


Boolean operators (AND, OR, NOT) and parentheses are used when multiple containment constrains are required, e.g.

No Format

EHR e CONTAINS COMPOSITION c [openEHR-EHR-COMPOSITION.referral.v1] AND

...


COMPOSITION c1 [openEHR-EHR-COMPOSITION.report.v1]
No Format

EHRR e CONTAINS COMPOSITION c [openEHR-EHR-COMPOSITION.referral.v1] CONTAINS

...


(OBSERVATION o openEHR-EHR-OBSERVATION-laboratory-hba1c.v1 AND

...


OBSERVATION o1 openEHR-EHR-OBSERVATION-laboratory-glucose.v1)


WHERE

AQL WHERE clause is used to represent further criteria applied to the data items within the objects declared in the FROM clause. WHERE clause expresses the query criteria that cannot be represented in other AQL clauses, such as criteria on archetype id, composition committal date time, and the criteria on in which order the returned results should be listed.

...

WHERE clause syntax has the following parts (in order): keyword WHERE and identified expression(s). Boolean operator (AND, OR, NOT) and parenthesis can be used to represent multiple identified expressions. The examples are listed below.

No Format

WHERE c/name/value=$nameValue AND c/archetype_details/template_id/value=

...

$templateId
No Format

WHERE (c/name/value=$nameValue OR c/archetype_details/template_id/value=$templateId) AND

...


o/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value >= 140


Identified expression

Identified expression specifies the criteria within WHERE clause. It consists of left operand, operator and right operand.

...

  • Left operand is an identified path and right operand is a real criteria value - primitive type:
    No Format
    
    o/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value >= 140

    
    c/archetype_details/template_id/value='health_encounter'
    
  • Left operand is an identified path and right operand is a parameter:
    No Format
    
    c/archetype_details/template_id/value=$templateParameter
    
  • Both left operand and right operand are an identified path (this is an advanced feature):
    No Format
    
    o/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value >

    
    o1/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value
    

3.9.4 SELECT

SELECT clause specifies what data is to be retrieved by the AQL query. The data can be any types from openEHR RM and any primitive data types. In addition, SELECT clause uses TOP to indicate the number of result setS that should be returned and name alias to rename the retrieved data.

...