Support for literals in SELECT clause

Description

Most SQL-like languages have the ability of returning literals (constants) as results of the query. It could be useful for CDSS-like queries. e.g.

SELECT "true" as dangerousBP
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]/items[at0004]/value/magnitude>= 180 OR
obs/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/magnitude>= 40

Bostjan: already implemented in Think!EHR
SA: could be done by a function 'const'?

Activity

Show:
Ian McNicoll
January 14, 2021, 12:10 AM

with all the experience/competency of a clinical hacker I will offer my support for ‘literals’ (sometimes known as ‘constants’ in certain SQL implementations)’).

Edit


Matija Polajnar
January 14, 2021, 7:14 PM

I would actually prefer to only use the term “literal” and never mention “constants” in this context, but if the others wish to have that clarification in the text, I won’t oppose it.

Sebastian Iancu
January 18, 2021, 1:02 AM

ok, agree and changed text according to suggestions above

Thomas Beale
5 days ago

In 3.4.12, the following text “All strings are enclosed in double or single quotes. Line breaks are not supported.” should probably read “All string literals…”.

Sebastian Iancu
4 days ago

done this now in https://github.com/openEHR/specifications-QUERY/commit/095d3a8a3939817e074c4e4ed232368ab71d2272

Reporter

Diego Bosca

Components

Affects versions