### AQL Query Example: Paginated Results with LIMIT and OFFSET Source: https://specifications.openehr.org/releases/QUERY/latest/AQL An example AQL query that retrieves the 'Name', 'date_time', and 'Composer' from EHR compositions. It orders the results by event start time and uses LIMIT 10 OFFSET 10 to fetch the second page of results, assuming 10 items per page. ```sql SELECT c/name/value AS Name, c/context/start_time AS date_time, c/composer/name AS Composer FROM EHR e[ehr_id/value=$ehrUid] CONTAINS COMPOSITION c ORDER BY c/context/start_time LIMIT 10 OFFSET 10 ``` -------------------------------- ### AQL SELECT Clause Examples Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Provides examples of the SELECT clause in AQL, demonstrating how to specify the data to be retrieved. This includes selecting specific fields with aliases, entire objects, and using literals and functions. ```aql SELECT c/name/value AS Name, c/context/start_time AS date_time, c/composer/name AS Composer FROM EHR e[ehr_id/value=$ehrUid] CONTAINS COMPOSITION c ``` ```aql SELECT c FROM EHR e[ehr_id/value=$ehrUid] CONTAINS COMPOSITION c ``` ```aql SELECT true AS dangerousBP, "alert" as indication, count(*) as counter FROM EHR [ehr_id/value=$ehrUid] CONTAINS COMPOSITION [openEHR-EHR-COMPOSITION.encounter.v1] CONTAINS OBSERVATION obs [openEHR-EHR-OBSERVATION.blood_pressure.v1] WHERE obs/data[at0001]/events[at0006]/data[at0003]/value/magnitude>= 160 OR obs/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude>= 110 ``` -------------------------------- ### AQL Class Expression Examples Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Provides examples of AQL class expressions, demonstrating their structure and components. This includes specifying the RM class, an optional class identifier/variable, and an optional standard or archetype predicate. ```AQL // EHR class, class identifier/variable, and a standard predicate EHR e[ehr_id/value=$ehrUid] ``` ```AQL // COMPOSITION class, class identifier/variable, and an archetype predicate COMPOSITION c[openEHR-EHR-COMPOSITION.report.v1] ``` -------------------------------- ### AQL Path Syntax Examples Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Demonstrates the different forms an AQL identified path can take, including paths with variable names, predicates, and combinations thereof. These examples illustrate how to access data items within objects based on their structure and criteria. ```AQL o/data[at0001]/.../data[at0003]/items[at0004]/value/value ``` ```AQL o[name/value=$nameValue] ``` ```AQL o[name/value=$nameValue]/data[at0001]/.../data[at0003]/items[at0004]/value/value ``` -------------------------------- ### Example GET Request with EHR and Composition Identifiers Source: https://specifications.openehr.org/releases/ITS-REST/latest/overview This example demonstrates a GET request to an openEHR API, specifying both an EHR identifier and a COMPOSITION identifier within the URI. It showcases how versioned objects are uniquely addressed. ```HTTP GET https://openEHRSys.example.com/v1/ehr/7d44b88c-4199-4bad-97dc-d78268e01398/composition/8849182c-82ad-4088-a07f-48ead4180515::openEHRSys.example.com::1 ``` -------------------------------- ### AQL Example: Blood Pressure Query Source: https://specifications.openehr.org/releases/QUERY/latest/AQL This AQL statement retrieves systolic and diastolic blood pressure values along with the composition start time. It filters compositions based on specific archetypes and applies conditions to the blood pressure readings. The query is ordered by the composition start time in descending order. It requires the EHR ID as a parameter. ```aql SELECT o/data[at0001]/.../items[at0004]/value AS systolic, o/data[at0001]/.../items[at0005]/value AS diastolic, c/context/start_time AS date_time FROM EHR[ehr_id/value=$ehrUid] CONTAINS COMPOSITION c [openEHR-EHR-COMPOSITION.encounter.v1] CONTAINS OBSERVATION o [openEHR-EHR-OBSERVATION.blood_pressure.v1] WHERE o/data[at0001]/.../items[at0004]/value/value >= 140 OR o/data[at0001]/.../items[at0005]/value/value >= 90 ORDER BY c/context/start_time DESC ``` -------------------------------- ### Example HTTP GET Request with Query Parameter Source: https://specifications.openehr.org/releases/ITS-REST/development/query Shows how to execute the AQL query 'myQuery' by providing the 'uid' as a URL query parameter. This is a common pattern for dynamic querying. ```HTTP GET https://openEHRSys.example.com/v1/query/myQuery?uid=90910cf0-66a0-4382-b1f8-c0f27e81b42d::openEHRSys.example.com::1 ``` -------------------------------- ### Example GET Request with Explicit Version Reference Source: https://specifications.openehr.org/releases/ITS-REST/development/overview Demonstrates a GET request to an openEHR API, specifying both the EHR ID and a specific version UID for a composition. This format is used for precise resource access. ```http GET https://openEHRSys.example.com/v1/ehr/7d44b88c-4199-4bad-97dc-d78268e01398/composition/8849182c-82ad-4088-a07f-48ead4180515::openEHRSys.example.com::1 ``` -------------------------------- ### dADL Path Examples for Nested Containers Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Shows path examples for navigating elements within the nested dADL structure defined previously. Paths append indices to traverse through nested lists. ```dADL /list_of_string_lists[1]/[1] /list_of_string_lists[1]/[2] /list_of_string_lists[2]/[1] etc ``` -------------------------------- ### OpenEHR Top-level Structure URI Examples Source: https://specifications.openehr.org/releases/1.0.2/html/architecture/overview/Output/paths_and_locators Provides examples of URIs for identifying a top-level structure within an EHR. The first two examples show identification via a Versioned Object GUID or a commit time. The subsequent examples demonstrate identification using an exact Version identifier. ```URI ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@latest_trunk_version -- a VO Guid ``` ```URI ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00 -- using time ``` ```URI ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B::rmh.nhs.net:2 ``` ```URI ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B::F7C5C7B7-75DB- 4b39-9A1E-C0BA9BFDBDEC:2 ``` -------------------------------- ### AQL Node Predicate Examples with archetype_node_id Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Illustrates various forms of Node Predicates in AQL, focusing on using the 'archetype_node_id' (at-code) for filtering data. It includes examples with and without 'name/value' criteria and their corresponding standard predicate representations. ```AQL [at0002] ``` ```AQL [archetype_node_id=at0002] ``` ```AQL [at0002 and name/value=$nameValue] ``` ```AQL [at0002 and name/value='real name value'] ``` ```AQL [archetype_node_id=at0002 and name/value=$nameValue] ``` ```AQL [archetype_node_id=at0002 and name/value='real name value'] ``` ```AQL [at0002, $nameValue] ``` ```AQL [at0002, 'real name value'] ``` ```AQL [archetype_node_id=at0002 and name/value=$nameValue] ``` ```AQL [archetype_node_id=at0002 and name/value='real name value'] ``` ```AQL [at0002, at0003] ``` ```AQL [at0002, snomed_ct(3.1)::313267000] ``` ```AQL [at0003, icd10AM::F60.1|Schizoid personality disorder|] ``` ```AQL [archetype_node_id=at0002 and name/defining_code/code_string='at0003' and name/defining_code/terminology_id/value='local'] ``` ```AQL [archetype_node_id=at0002 and name/defining_code/code_string='313267000' and name/defining_code/terminology_id/value='snomed_ct(3.1)'] ``` ```AQL [archetype_node_id=at0003 and name/defining_code/code_string='F60.1' and name/defining_code/terminology_id/value='icd10AM'] ``` ```AQL [at0002 and value/defining_code/terminology_id/value=$terminologyId] ``` -------------------------------- ### ADL Path Examples vs. XPath Equivalents Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Compares ADL path syntax examples with their corresponding XPath equivalents. ADL offers syntactic shortcuts for common cases, abstracting away XML-specific distinctions like attributes vs. children. ```text ADL Path: items[1] XPath Equivalent: items[1] ADL Path: items[systolic] XPath Equivalent: items[meaning() = 'systolic'] ADL Path: items[at0001] XPath Equivalent: items[@node_id = 'at0001'] ``` -------------------------------- ### OpenEHR API Request Examples Source: https://specifications.openehr.org/releases/ITS-REST/development/definition Illustrative examples of API request URLs for interacting with the OpenEHR system. These include fetching operational templates by ID and version, and listing stored queries based on a qualified name pattern. ```http GET https://{baseUrl}/v1/definition/template/adl2/{template_id} GET https://{baseUrl}/v1/definition/template/adl2/{template_id}/{version} GET https://openEHRSys.example.com/v1/definition/query/org.openehr GET https://openEHRSys.example.com/v1/definition/query/org.openehr::compositions https://{baseUrl}/v1/definition/query/{qualified_query_name} ``` -------------------------------- ### OpenEHR SQL: Select and Order Blood Pressure Values by Time Source: https://specifications.openehr.org/releases/QUERY/latest/AQL This snippet shows how to select systolic, diastolic blood pressure values, and their corresponding event start times. It aliases the pressure values and orders the results by start time in descending order. ```OpenEHR SQL SELECT obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude AS systolic, obs/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude AS diastlic, c/context/start_time AS date_time FROM EHR [ehr_id/value=$ehrUid] 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 >= 140 OR obs/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude >= 90 ORDER BY c/context/start_time DESC ``` -------------------------------- ### Example Unit Strings Source: https://specifications.openehr.org/releases/RM/Release-1.0.2/data_types Illustrative examples of unit strings that can be formed using the defined syntax. These examples showcase the expressiveness of the unit syntax for common and specialized measurements. ```text "kg/m^2" "m.s^-1" "km/h" "mm[Hg]" ``` -------------------------------- ### Example HTTP GET Request with Multiple Query Parameters Source: https://specifications.openehr.org/releases/ITS-REST/development/query Illustrates passing multiple query parameters, 'temperature_from' and 'temperature_unit', to the AQL query 'com.vendor::compositions'. This enables flexible data retrieval based on specific criteria. ```HTTP GET https://openEHRSys.example.com/v1/query/com.vendor::compositions?temperature_from=36&temperature_unit=Cel ``` -------------------------------- ### AQL FROM Clause: Containment Expression Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Shows how to build a FROM clause with containment expressions to define hierarchical relationships between archetypes. This example includes EHR, Composition, and Observation archetypes. ```aql FROM EHR [ehr_id/value=$ehrUid] CONTAINS COMPOSITION [openEHR-EHR-COMPOSITION.encounter.v1] CONTAINS OBSERVATION [openEHR-EHR-OBSERVATION.blood_pressure.v1] ``` -------------------------------- ### OpenEHR URI Syntax Examples Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Illustrates the representation of Uniform Resource Identifiers (URIs) in dADL, following the standard syntax defined in IETF RFC 3986. Includes examples for http and ftp protocols. ```dADL http://archetypes.are.us/home.html ftp://get.this.file.com#section_5 http://www.mozilla.org/products/firefox/upgrade/?application=thunderbird ``` -------------------------------- ### cADL Path Examples Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Provides examples of valid ADL paths, demonstrating how to reference the root object, attributes, and identified child objects within a cADL structure. ```cADL / -- the HISTORY (root) object /periodic -- the HISTORY.periodic attribute /events[at0002] -- the 1 minute event object /events[at0003] -- the 2 minute event object /events[at0004] -- the 3 minute event object ``` -------------------------------- ### AQL Datetime Filtering with ISO 8601 Extended Format Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Demonstrates filtering AQL queries based on a composition's start time using a complete datetime in ISO 8601 extended format. The AQL processor recognizes this as a datetime value for comparison. ```aql WHERE composition/context/start_time <= '1986-01-01T12:00:00.000+09:30' ``` -------------------------------- ### OpenEHR Folder Path Examples Source: https://specifications.openehr.org/releases/RM/Release-1.0.2/common Illustrates example directory paths within an EHR, demonstrating how folder names are derived and how uniqueness modifiers are appended in brackets when necessary. ```text /folders[hospital episodes]/items[1] /folders[patient entered data]/folders[diabetes monitoring] /folders[homeopathy contacts] ``` ```text [hospital episodes] [hospital episodes(car accident Aug 1998)] ``` -------------------------------- ### EHR Location URI Examples Source: https://specifications.openehr.org/releases/BASE/latest/architecture_overview Provides examples of EHR location URIs. The first example shows an unqualified EHR identifier for the local system. The second example includes a system identifier for specifying a particular EHR instance in a multi-system environment. ```uri ehr:/347a5490-55ee-4da9-b91a-9bba710f730e/ ``` ```uri ehr://rmh.nhs.net/347a5490-55ee-4da9-b91a-9bba710f730e/ ``` -------------------------------- ### OpenEHR URI Header Example Source: https://specifications.openehr.org/releases/ITS-REST/development/overview Shows an example of the `openehr-uri` response header, which may be included if the service supports generating resource URIs in the DV_EHR_URI format. ```http HTTP/1.1 200 Ok ``` -------------------------------- ### OpenEHR AQL TERMINOLOGY Function Example Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Demonstrates how to use the TERMINOLOGY function in the WHERE clause of an AQL query as a right-hand operand for the 'matches' operator. This specific example expands a value set identified by a FHIR URI. ```AQL WHERE e/value/defining_code/code_string matches TERMINOLOGY('expand', 'hl7.org/fhir/4.0', 'http://snomed.info/sct?fhir_vs=isa/50697003') ``` -------------------------------- ### GDL Example: CHA2DS2-Vasc Score Metadata (ODIN) Source: https://specifications.openehr.org/releases/CDS/development/GDL2 This GDL example in ODIN format defines the metadata for the CHA2DS2-Vasc Score guideline. It includes version, ID, concept, language, description (copyright, keywords, purpose, etc.), and author information. This metadata is based on the openEHR Resource model. ```ODIN < gdl_version = <"2.0"> id = <"CHA2DS2-Vasc.v1"> concept = <"gt0001"> original_language = <[ISO_639-1::en]> description = < details = < ["en"] = < copyright = <"Cambio Healthcare Systems"> keywords = <"Atrial Fibrillation", "Stroke", "CHA2DS2-Vasc"> misuse = <"Do not use in patients with no diagnosis of atrial fibrillation."> purpose = <"Calculates stroke risk for patients with atrial fibrillation, possibly better than the CHADS2 score."> use = <"Calculates stroke risk for patients with atrial fibrillation, possibly better than the CHADS2 score."> > > lifecycle_state = <"in_review"> original_author = < ["date"] = <"2016-12-16"> ["email"] = <"rong.chen@cambio.se"> ["name"] = <"Rong Chen"> ["organisation"] = <"Cambio Healthcare Systems"> > other_contributors = <"Carlos Valladares"> > definition = < pre_conditions = <...> data_bindings = < ["gt0006"] = <...> ["gt0007"] = <...> ... > rules = < ["gt0024"] = <...> ["gt0025"] = <...> ... > > terminology = < term_definitions = < ["en"] = < ["gt123"] = < text = <"some text"> description = "some description"> > > > term_bindings = < ["ICD10"] = < ["gt123"] = > > > > ``` -------------------------------- ### Examples of Complete Date/Time Data in openEHR Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Provides concrete examples of complete date, time, and date/time data representations as used in openEHR, demonstrating various formats including fractional seconds and timezone offsets. ```text 1919-01-23 -- birthdate of Django Reinhardt 16:35:04,5 -- rise of Venus in Sydney on 24 Jul 2003 2001-05-12T07:35:20+1000 -- timestamp on an email received from Australia ``` -------------------------------- ### Get EHR by ID API Endpoint Example Source: https://specifications.openehr.org/releases/ITS-REST/development/ehr This example illustrates the GET request to retrieve an EHR by its unique identifier. It specifies the URL structure and the expected path parameter. ```http GET https://{baseUrl}/v1/ehr/{ehr_id} ``` -------------------------------- ### DLM Identification Line Example Source: https://specifications.openehr.org/releases/PROC/development/decision_language Provides an example of the identification line for a DLM, specifying its form (e.g., 'guideline') and a versioned identifier following Semver.org rules. ```DLM dlm guideline chadvasc2.v1.0.5 ``` -------------------------------- ### Get EHR_STATUS at Time API Endpoint Example Source: https://specifications.openehr.org/releases/ITS-REST/development/ehr This example shows the GET request to retrieve an EHR_STATUS version that was extant at a specific time. It includes the EHR ID and an optional query parameter for the version timestamp. ```http GET https://{baseUrl}/v1/ehr/{ehr_id}/ehr_status?version_at_time={version_at_time} ``` -------------------------------- ### AQL WHERE Clause Syntax and Examples Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Illustrates the syntax and usage of the WHERE clause in AQL for applying specific criteria to data items. It shows how to combine conditions using logical operators AND, OR, NOT, and parentheses. ```aql WHERE c/name/value=$nameValue AND c/archetype_details/template_id/value=$templateId ``` ```aql WHERE (c/name/value = $nameValue OR c/archetype_details/template_id/value = $templateId) AND o/data[at0001]/events[at0006]/data[at0003]/value/value >= 140 ``` -------------------------------- ### Get EHR_STATUS by Version ID API Endpoint Example Source: https://specifications.openehr.org/releases/ITS-REST/development/ehr This example demonstrates the GET request to retrieve a specific version of an EHR_STATUS using both the EHR ID and the version UID. It outlines the URL structure with path parameters. ```http GET https://{baseUrl}/v1/ehr/{ehr_id}/ehr_status/{version_uid} ``` -------------------------------- ### AQL FROM Clause Syntax with Containment Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Demonstrates the basic syntax of an AQL FROM clause, including specifying a root EHR and using a containment constraint to filter COMPOSITION objects based on an archetype ID. ```aql FROM EHR e [ehr_id/value=$ehrUid] CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.report.v1] ``` -------------------------------- ### OpenEHR Composition Path Examples Source: https://specifications.openehr.org/releases/1.0.1/html/architecture/overview/Output/paths_and_locators Illustrates how to construct data paths within OpenEHR Compositions, using archetype IDs and name values to navigate through Sections and Entries. ```xpath /content[openEHR-EHR-SECTION.vital_signs.v1 and name/value='Vital signs']/ items[openEHR-EHR-OBSERVATION.heart_rate-pulse.v1 and name/value='Pulse']/ data/events[at0003 and name/value='Any event']/data/items[at1005] ``` ```xpath /content[openEHR-EHR-SECTION.vital_signs.v1 and name/value='Vital signs']/ items[openEHR-EHR-OBSERVATION.blood_pressure.v1 and name/value='Blood pressure']/data/events[at0006 and name/value='any event']/ data/items[at0004] ``` ```xpath /content[openEHR-EHR-SECTION.vital_signs.v1, 'Vital signs']/ items[openEHR-EHR-OBSERVATION.blood_pressure.v1, 'Blood pressure']/ data/events[at0006, 'any event']/data/items[at0005] ``` -------------------------------- ### Get EHR_STATUS Example Source: https://specifications.openehr.org/releases/ITS-REST/development/ehr This example demonstrates how to retrieve an EHR_STATUS resource using its ehr_id. It specifies the URL format and expected response content type. ```OpenAPI GET /ehr/{ehr_id}/ehr_status Host: {baseUrl} Accept: application/json ``` -------------------------------- ### Execute Ad-hoc AQL Query Example (GET Request) Source: https://specifications.openehr.org/releases/ITS-REST/development/query This example shows how to execute an ad-hoc AQL query using a GET request to the OpenEHR API. It includes required and optional query parameters such as the AQL query string, EHR ID, offset, fetch count, and query parameters. ```http GET https://{baseUrl}/v1/query/aql?q=SELECT e/ehr_id/value, c/context/start_time/value as startTime FROM EHR e CONTAINS COMPOSITION c&ehr_id=7d44b88c-4199-4bad-97dc-d78268e01398&offset=10&fetch=10&query_parameters={%22systolic_bp%22:140} ``` -------------------------------- ### OpenEHR Name-Based Predicate Examples Source: https://specifications.openehr.org/releases/BASE/latest/architecture_overview Demonstrates constructing OpenEHR path predicates using archetype node IDs and name values. Includes standard XPath, OpenEHR equivalent, and a shorthand notation for common scenarios. ```OpenEHR Path /data/events[@archetype_node_id = 'at0001' and name/value='standing'] ``` ```OpenEHR Path /data/events[at0001 and name/value='standing'] ``` ```OpenEHR Path /data/events[at0001, 'standing'] ``` -------------------------------- ### AQL FROM Clause: Archetype Expressions Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Illustrates the use of archetype expressions within the FROM clause to specify required archetypes for the query. It shows how to include Composition and Observation archetypes. ```aql COMPOSITION [openEHR-EHR-COMPOSITION.encounter.v1] OBSERVATION [openEHR-EHR-OBSERVATION.blood_pressure.v1] ``` -------------------------------- ### Example GET Request with Implicit Latest Version Reference Source: https://specifications.openehr.org/releases/ITS-REST/development/overview Illustrates a GET request to an openEHR API using only the EHR ID and the versioned object UID for a composition. This implicitly requests the latest version of the composition. ```http GET https://openEHRSys.example.com/v1/ehr/7d44b88c-4199-4bad-97dc-d78268e01398/composition/8849182c-82ad-4088-a07f-48ead4180515 ``` -------------------------------- ### AQL Comparison Operators Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Provides examples of AQL comparison operators used in WHERE clauses for filtering data. It covers equality, inequality, range comparisons, and pattern matching, illustrating how to construct conditions for querying. ```AQL name/value = $nameValue ``` ```AQL o/data[at0001]/…/data[at0003]/items[at0004]/value/value >140 ``` ```AQL o/data[at0001]/…./data[at0003]/items[at0004]/value/value >=140 ``` ```AQL o/data[at0001]/…/data[at0003]/items[at0004]/value/value <160 ``` ```AQL o/data[at0001]/…/data[at0003]/items[at0004]/value/value ⇐160 ``` ```AQL c/archetype_details/template_id/value != '' ``` ```AQL o/data[at0001]/…/name/value LIKE 'left *' ``` ```AQL o/data[at0002]/…/name/defining_code/code_string matches {'18919-1', '18961-3', '19000-9'} ``` -------------------------------- ### ADL2 Template Request Body Example Source: https://specifications.openehr.org/releases/ITS-REST/development/definition An example of the request body for uploading an ADL2 operational template. It specifies the ADL version, RM release, and includes a partial representation of the template structure, starting with composition definition. ```text operational_template (adl_version=2.0.6; rm_release=1.0.2; generated) openEHR-EHR-COMPOSITION.t_clinical_info_ds_sf.v1.0.0 specialize openEHR-EHR-COMPOSITION.discharge.v1 language original_language = <[ISO_639-1::en]> description lifecycle_state = <"unmanaged"> original_author = < ["name"] = <"Ian McNicoll"> ["organisation"] = <"openEHR Foundation"> ["email"] = <"ian.mcnicoll@openehr.org"> ... ``` -------------------------------- ### Location Header Example for Resource Creation Source: https://specifications.openehr.org/releases/ITS-REST/development/overview Demonstrates the `Location` header used in a `201 Created` response to indicate the URL of a newly created resource, as per RFC 9110. ```http HTTP/1.1 201 Created ``` -------------------------------- ### System Options and Conformance Response (JSON) Source: https://specifications.openehr.org/releases/ITS-REST/latest/overview This is a sample JSON response for a successful OPTIONS request, detailing system information, API specifications, and available endpoints. It is used to retrieve system options and conformance details. ```json { "solution": "openEHRSys", "solution_version": "v0.9", "vendor": "My-openEHR", "restapi_specs_version": "v1.0.3", "conformance_profile": "STANDARD", "endpoints": [ "/ehr", "/definition", "/query" ] } ``` -------------------------------- ### OpenEHR Units Syntax Examples Source: https://specifications.openehr.org/releases/RM/Release-1.1.0/data_types Example string representations of units using the defined OpenEHR units syntax. These demonstrate how to express common units with prefixes, exponents, and specific annotations. ```OpenEHR AQL "kg/m^2" "m.s^-1" "km/h" "mm[Hg]" "kg {total}" ``` -------------------------------- ### Regular Expression Delimiter Matching Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Regular expressions for identifying the start and end delimiters of regular expressions within the specification. ```regex "{/" | [^/]*\\\/ | [^/}]*\/ | \^[^^\n]*\^ ``` -------------------------------- ### AQL Archetype Predicate Usage in FROM Clause Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Demonstrates how Archetype Predicates are used in the FROM clause of an AQL query to scope data retrieval by specifying relevant archetype instances. It shows the concise predicate form and its equivalent standard predicate form. ```AQL FROM EHR [ehr_id/value='1234'] CONTAINS COMPOSITION c [openEHR-EHR-COMPOSITION.encounter.v1] CONTAINS OBSERVATION o [openEHR-EHR-OBSERVATION.blood_pressure.v1] ``` ```AQL FROM EHR e CONTAINS COMPOSITION c CONTAINS OBSERVATION o WHERE e/ehr_id/value = '1234' AND c/archetype_node_id = 'openEHR-EHR-COMPOSITION.encounter.v1' AND o/archetype_node_id = 'openEHR-EHR-OBSERVATION.blood_pressure.v1' ``` -------------------------------- ### OpenEHR EL: Accessing Utility Functions Source: https://specifications.openehr.org/releases/LANG/Release-1.0.0/expression_language Provides examples of accessing utility functions available through imported models, such as the openEHR Foundation and Base Types. These functions are not strictly 'built-in' but are resolved via imported models. Examples include getting the current date, finding the maximum value in a list, and retrieving the language from a locale. ```EL {Env}.current_date ``` ```EL {Statistical_evaluator}.max (blood_glucose_list) ``` ```EL {Locale}.language ``` -------------------------------- ### dADL Lexical Analyzer Local Code Format Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Defines the pattern for local code values, which typically start with 'a' followed by digits and potentially decimal points. ```lex ----------/* V_LOCAL_CODE */ ------------------------------------------ a[ct][0-9.]+ ``` -------------------------------- ### dADL Type Section Pattern (ADL 1.4/1.5) Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Regular expression for matching ADL 1.4/1.5 type sections starting with parentheses and angle brackets, used within cADL. ```regex \([A-Z]{IDCHAR}\)*[ \n]*< ``` -------------------------------- ### cADL Grammar Comments - Regular Expressions Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Specifies the syntax for single-line and multi-line comments within the cADL grammar. Comments are ignored during parsing. They start with '--' and can span across lines. ```regex --.* -- Ignore comments --.*\n[ \t\r]* ``` -------------------------------- ### Example OPTIONS Response - JSON Source: https://specifications.openehr.org/releases/ITS-REST/development/system This JSON object represents a successful response (200 OK) to an OPTIONS request. It details the server's solution name, version, vendor, API specification version, conformance profile, and available endpoints. This response helps clients understand the server's capabilities. ```json { "solution": "openEHRSys", "solution_version": "v1.0", "vendor": "My-openEHR", "restapi_specs_version": "1.1.0", "conformance_profile": "STANDARD", "endpoints": [ "/ehr", "/demographic", "/definition", "/query", "/admin" ] } ``` -------------------------------- ### AQL LIMIT and OFFSET Syntax for Pagination Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Demonstrates the use of LIMIT and OFFSET clauses in AQL to control the number of rows returned and to implement pagination. LIMIT specifies the maximum number of rows, while OFFSET skips a specified number of rows before returning results. Both parameters are integers. ```sql LIMIT row_count [OFFSET offset] ``` -------------------------------- ### cADL V_URI Format - Regular Expression Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Defines the regular expression for matching Uniform Resource Identifiers (URIs) within cADL. This pattern is used for external references and typically starts with a scheme followed by a path. ```regex [a-z]+:\/\/[^<>|\\{\}\^~""\[\] ]* ``` -------------------------------- ### AQL Lexer Grammar: Core Keywords and Operators Source: https://specifications.openehr.org/releases/QUERY/latest/AQL This snippet defines essential AQL keywords such as SELECT, FROM, WHERE, ORDER BY, LIMIT, OFFSET, and fundamental operators like CONTAINS, AND, OR, NOT, and EXISTS. It also includes comparison operators. ```ANTLR4 lexer grammar AqlLexer; channels { COMMENT_CHANNEL } // SKIP WS: [ \t\r\n]+ -> skip; UNICODE_BOM: ( '\uEFBBBF' // UTF-8 BOM | '\uFEFF' // UTF16_BOM | '\u0000FEFF' // UTF32_BOM ) -> skip; COMMENT: ( SYM_DOUBLE_DASH ' ' ~[\r\n]* ('\r'? '\n' | EOF) | SYM_DOUBLE_DASH ('\r'? '\n' | EOF) ) -> channel(COMMENT_CHANNEL); // Keywords // Common Keywords SELECT: S E L E C T ; AS: A S ; FROM: F R O M ; WHERE: W H E R E ; ORDER: O R D E R ; BY: B Y ; DESC: D E S C ; DESCENDING: D E S C E N D I N G ; ASC: A S C ; ASCENDING: A S C E N D I N G ; LIMIT: L I M I T ; OFFSET: O F F S E T ; // other keywords DISTINCT: D I S T I N C T ; VERSION : V E R S I O N ; LATEST_VERSION : L A T E S T '_' V E R S I O N ; ALL_VERSIONS : A L L '_' V E R S I O N S ; NULL: N U L L ; // deprecated TOP: T O P ; FORWARD: F O R W A R D ; BACKWARD: B A C K W A R D ; // Operators // Containment operator CONTAINS : C O N T A I N S ; // Logical operators AND : A N D ; OR : O R ; NOT : N O T ; EXISTS: E X I S T S ; // Comparison operators COMPARISON_OPERATOR: SYM_EQ | SYM_NE | SYM_GT | SYM_GE | SYM_LT | SYM_LE ; LIKE: L I K E ; MATCHES: M A T C H E S ; ``` -------------------------------- ### AQL LIKE Operator for Pattern Matching Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Illustrates the usage of the AQL LIKE operator for simple pattern matching on string or date/time values. It demonstrates wildcard usage ('?' for single character, '*' for zero or more characters) and escaping special characters. ```AQL SELECT e/ehr_id/value, c/context/start_time FROM EHR e CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.administrative_encounter.v1] CONTAINS ADMIN_ENTRY admission[openEHR-EHR-ADMIN_ENTRY.admission.v1] WHERE c/context/start_time LIKE '2019-0?-*' ``` -------------------------------- ### Duration Format in dADL (openEHR) Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Shows the dADL format for expressing durations using ISO 8601, starting with 'P' followed by period components (Y, M, W, D, H, M, S). The literal 'T' separates date and time components. ```text P22D4TH15M0S -- period of 22 days, 4 hours, 15 minutes ``` -------------------------------- ### POST / Source: https://specifications.openehr.org/releases/ITS-REST/latest/overview When creating a resource using POST, clients can specify representation preferences using the `Prefer` header. Options include `return=minimal` for a minimal response or `return=representation` for a full representation. The default is `return=minimal`. ```APIDOC ## POST / ### Description Allows clients to create a new resource. Clients can negotiate the desired representation in the response using the `Prefer` header. ### Method POST ### Endpoint `POST /` ### Parameters #### Request Headers - **Prefer** (string) - Optional - Specifies the desired representation in the response. Accepted values include `return=minimal` (default) and `return=representation`. ### Request Example ```json { "Prefer": "return=representation" } ``` ### Response #### Success Response (201 Created or 204 No Content) - **Location** (string) - Required - The URL of the newly created resource. - **Payload** (object) - Present if `Prefer: return=representation` is used, contains the full representation of the created resource. ``` -------------------------------- ### Get ADL 1.4 Template (JSON Web Template Format) Source: https://specifications.openehr.org/releases/ITS-REST/latest/definition Example of retrieving an ADL 1.4 operational template in the simplified JSON web template format. This requires setting the `Accept` header to `application/openehr.wt+json`. This format is often used for front-end development and simplifies template structure. ```json { "template_id": "Vital Signs", "concept": "Vital Signs", "archetype_id": "openEHR-EHR-COMPOSITION.encounter.v1", "created_timestamp": "2017-08-14T19:24:56.639Z", "definition": { "rm_type_name": "COMPOSITION", "occurrences": { "lower_included": true, "upper_included": true, "lower_unbounded": false, "upper_unbounded": false, "lower": 1, "upper": 1 }, "node_id": "at0000", "children": [ { "rm_type_name": "ELEMENT", "occurrences": { "lower_included": true, "upper_included": true, "lower_unbounded": false, "upper_unbounded": false, "lower": 1, "upper": 1 }, "node_id": "at0001", "name": { "value": "Systolic blood pressure" } } ] } } ``` -------------------------------- ### cADL V_LOCAL_TERM_CODE_REF Format - Regular Expression Source: https://specifications.openehr.org/releases/AM/Release-2.0.6/ADL1 Defines the regular expression for unqualified local term code references in cADL, like '[at0001]'. This pattern matches a bracketed string starting with an alphanumeric character followed by name characters. ```regex \[{{ALPHANUM}}{{NAMECHAR}}*\] ``` -------------------------------- ### OpenEHR Chaining Point Predicate Examples Source: https://specifications.openehr.org/releases/BASE/latest/architecture_overview Illustrates using archetype IDs and name values as predicates to navigate and select specific sibling structures within nested OpenEHR compositions, sections, and entries. Includes shorthand notation for archetype ID predicates. ```OpenEHR Path /content[openEHR-EHR-SECTION.vital_signs.v1 and name/value='Vital signs']/items[openEHR-EHR-OBSERVATION.heart_rate-pulse.v1 and name/value='Pulse']/data/events[at0003 and name/value='Any event']/data/items[at1005] ``` ```OpenEHR Path /content[openEHR-EHR-SECTION.vital_signs.v1 and name/value='Blood pressure']/items[openEHR-EHR-OBSERVATION.blood_pressure.v1 and name/value='Blood pressure']/data/events[at0006 and name/value='any event']/data/items[at0004] ``` ```OpenEHR Path /content[openEHR-EHR-SECTION.vital_signs.v1, 'Vital signs']/items[openEHR-EHR-OBSERVATION.blood_pressure.v1, 'Blood pressure']/data/events[at0006, 'any event']/data/items[at0005] ``` -------------------------------- ### AQL Query Example: Get BMI values > 30 Source: https://specifications.openehr.org/releases/BASE/development/architecture_overview This AQL query retrieves Body Mass Index (BMI) values greater than 30 kg/m2 for a specific patient. It demonstrates how to navigate through EHR, Composition, and Observation structures using archetype paths to access specific data points. ```AQL SELECT o/[at0000]/data[at0001]/events[at0002]/data[at0003]/item[0004]/value FROM EHR [uid=@ehrUid] CONTAINS COMPOSITION c [openEHR-EHR-COMPOSITION.report.v1] CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.body_mass_index.v1] WHERE o/[at0000]/data[at0001]/events[at0002]/data[at0003]/item[0004]/value > 30 ``` -------------------------------- ### AQL FROM Clause: Single EHR Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Demonstrates the basic FROM clause for querying a single EHR using a provided EHR UID parameter. This sets the data source for the query. ```aql FROM EHR [ehr_id/value=$ehrUid] ``` -------------------------------- ### AQL: Get Latest 5 Abnormal Blood Pressure Values (Single Subject) Source: https://specifications.openehr.org/releases/QUERY/development/AQL_examples Retrieves the latest 5 abnormal blood pressure readings for a specific patient within a health encounter. It selects systolic and diastolic values, along with the recording start time. Assumes the presence of EHR and COMPOSITION structures with OBSERVATION of blood pressure type. ```aql SELECT obs/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude AS systolic, obs/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude AS diastlic, c/context/start_time AS date_time FROM EHR [ehr_id/value=$ehrUid] 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 >= 140 OR obs/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude >= 90 ORDER BY c/context/start_time DESC LIMIT 5 ``` -------------------------------- ### AQL Parameter Usage Example in WHERE Clause Source: https://specifications.openehr.org/releases/QUERY/latest/AQL Demonstrates how to use an AQL parameter like '$systolicCriteria' within a WHERE clause for flexible query criteria. This allows the query to be reused with different numeric thresholds. ```AQL o/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value > $systolicCriteria ``` -------------------------------- ### DLM Language and Description Sections Example Source: https://specifications.openehr.org/releases/PROC/development/decision_language Demonstrates the structure for the 'language' and 'description' sections within a DLM, similar to openEHR archetypes. Includes metadata like original language, author details, purpose, copyright, and acknowledgements. ```DLM definitions -- Descriptive language = { original_language: [ISO_639-1::en] } ; description = { lifecycle_state: "unmanaged", original_author: { name: "Thomas Beale", email: "thomas.beale@openEHR.org", organisation: "openEHR Foundation ", date: "2021-01-10" }, details: { "en" : { language: [ISO_639-1::en], purpose: "To record an individual's QRISK3 score." } }, copyright: "© 2021 openEHR Foundation", licence: "Creative Commons CC-BY ", ip_acknowledgements: { "ClinRisk" : "This content developed from original publication of © 2017 ClinRisk Ltd., see https://qrisk.org", "QRISK" : "QRISK® is a registered trademark of the University of Nottingham and EMIS" } } ; ```