Execute ad-hoc AQL
Execute a given ad-hoc AQL query, supplied by q parameter, fetching fetch numbers of rows from offset and passing query_parameters to the underlying query engine.
See also details on usage of query parameters.
- Type: string · AQL
q requiredThe AQL query to be executed.
- Type: string
ehr _id An optional parameter to execute the query within an EHR context.
- Type: integer · OffsetFormat: int32
offset The row number in result-set to start result-set from (
0-based), default is0. - Type: integer · FetchFormat: int32
fetch Number of rows to fetch (the default depends on the implementation).
- Type: object · QueryParameters
query _parameters Query parameters (can appear multiple times).
- Type: anything
property Name
- application/json
400 400 Bad Requestis returned when the server was unable to execute the query due to invalid input, e.g. a required parameter is missing, or at least one of the parameters has an invalid syntax.408 408 Request Timeoutis returned when there is a query execution timeout (i.e. maximum query execution time reached, therefore the server aborted the execution of the query).
curl 'https://openEHRSys.example.com/v1/query/aql?q=SELECT%20e%2Fehr_id%2Fvalue%2C%20c%2Fcontext%2Fstart_time%2Fvalue%20as%20startTime%2C%20obs%2Fdata%5Bat0001%5D%2Fevents%5Bat0006%5D%2Fdata%5Bat0003%5D%2Fitems%5Bat0004%5D%2Fvalue%2Fmagnitude%20AS%20systolic%2C%20c%2Fuid%2Fvalue%20AS%20cid%2C%20c%2Fname%20FROM%20EHR%20e%20CONTAINS%20COMPOSITION%20c%5BopenEHR-EHR-COMPOSITION.encounter.v1%5D%20CONTAINS%20OBSERVATION%20obs%5BopenEHR-EHR-OBSERVATION.blood_pressure.v1%5D%20WHERE%20obs%2Fdata%5Bat0001%5D%2Fevents%5Bat0006%5D%2Fdata%5Bat0003%5D%2Fitems%5Bat0004%5D%2Fvalue%2Fmagnitude%20%3E%3D%20%24systolic_bp&ehr_id=7d44b88c-4199-4bad-97dc-d78268e01398&offset=10&fetch=10&ehr_id=7d44b88c-4199-4bad-97dc-d78268e01398&systolic_bp=140'
{
"meta": {
"_href": "https://openEHRSys.example.com/v1/query/org.openehr::compositions",
"_type": "RESULTSET",
"_schema_version": "1.0.0",
"_created": "2017-08-19T00:25:47.568+02:00",
"_generator": "openEHRSys.ResultSets.Serialization.Json.ResultSetJsonWriter (5.0.0.0)",
"_executed_aql": "SELECT e/ehr_id/value, c/context/start_time/value as startTime, obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude AS systolic, c/uid/value AS cid, c/name FROM EHR e CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.encounter.v1] CONTAINS OBSERVATION obs[openEHR-EHR-OBSERVATION.blood_pressure.v1] WHERE obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude >= 50"
},
"name": "org.openehr::compositions",
"q": "SELECT e/ehr_id/value, c/context/start_time/value as startTime, obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude AS systolic, c/uid/value AS cid, c/name FROM EHR e CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.encounter.v1] CONTAINS OBSERVATION obs[openEHR-EHR-OBSERVATION.blood_pressure.v1] WHERE obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude >= $systolic_bp",
"columns": [
{
"name": "#0",
"path": "/ehr_id/value"
},
{
"name": "startTime",
"path": "/context/start_time/value"
},
{
"name": "systolic",
"path": "/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude"
},
{
"name": "cid",
"path": "/uid/value"
},
{
"name": "#4",
"path": "/name"
}
],
"rows": [
[
"81433066-c417-4813-9b29-79783e7bed23",
"2017-02-16T13:50:11.308+01:00",
140,
"90910cf0-66a0-4382-b1f8-c0f27e81b42d::openEHRSys.example.com::1",
{
"_type": "DV_TEXT",
"value": "Labs"
}
]
]
}