Hi Greg, Rong has indicated there is a paper about archetype query language. Thanks Rong. That paper introduced basic query syntax. It was written at the beginning of this year. The query syntax has been enriched recently in order to support more complicated queries. I've already started to write the specifications, but need to resolve some known issues before release.
Anyway, I handcrafted the following queries for you (I cannot build my query builder at the moment because of some integration issues). The query statement below shows that all observation instances with respiratory rate greater than n will be returned. SELECT o FROM EHR e[ehr_id/value=$ehrId] CONTAINS COMPOSITION CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.respiration.v1.adl] WHERE o/data/events[at0002]/data[at0003]/items[at0004]/value/magnitude>n AND o/data/events[at0002]/data[at0003]/items[at0004]/value/units = '/min' If you want the respiratory quantity object been returned, the query would look like: SELECT o/data/events[at0002]/data[at0003]/items[at0004]/value FROM EHR e[ehr_id/value=$ehrId] CONTAINS COMPOSITION CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.respiration.v1.adl] WHERE o/data/events[at0002]/data[at0003]/items[at0004]/value/magnitude>n AND o/data/events[at0002]/data[at0003]/items[at0004]/value/units = '/min' Just for your information, the single letter 'o' is the observation class variable name, "/data/events[at0002]/data[at0003]/items[at0004]/value" is the archetype path to respiratory quantity node. If you have the archetype workbench running, you can identify this path there. '$ehrId' is the parameter name which can be substituted with real EHR ehr_id value at run time. The query language supports parameterization. Some archetype query statements would be very long if the query criteria are complicated. In fact, we don't need to write the above queries by hand. Ocean Informatics has implemented a tool - Archetype Query Builder, which can be used to create/edit queries easily. Additionally, Ocean has also implemented a query parser and query engine as well. The above query statements are consistent to the query syntax introduced by the MedInfo paper. The current query tools also support this query syntax. However, as I have said that we have enriched the query syntax and all the enhancements can be found from the query specifications. Hope this helps. Regards, Chunlan -----Original Message----- From: [email protected] [mailto:openehr-technical-bounces at openehr.org] On Behalf Of Greg Caulton Sent: Monday, November 05, 2007 6:48 AM To: openEHR-technical at openehr.org Subject: OpenEHR queries Hi, Somewhere I recall reading that there was an OpenEHR query that theoretically an OpenEHR compliant system could execute a return results for. Is there a spec somewhere, preferably with a simple example. So if someone knew my patient and queried for all instances of Respiratory Rate greater than n? openEHR-EHR-OBSERVATION.respiration.v1.adl Rate at0004 > n Units /min (is that a default or are the units passed in the query) Or is this future functionality? thanks Greg http://www.patientos.org _______________________________________________ openEHR-technical mailing list openEHR-technical at openehr.org http://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical

