Smile CDR v2024.08.PRE
On this page:

37.1.1HFQL SQL Syntax


The HFQL SQL syntax is designed to feel natural to users who are familiar with standard SQL.

A simple example is shown below:

    name[0].family as family,
    name[0].given[0] as given, 
    identifier.where(system='').first().value as SSN
    active = true

This example selects all resources of type Patient from the repository with an active value of true. This is equivalent to performing the following REST query:

This query returns four columns, containing the first family and given name, the birthDate, and the first identifier with a specific Identifier.system value.

HFQL is inspired by the Firely Query Language, although it also has significant differences. Our original intention was to implement the same FQL syntax, but once the JDBC driver was created it became apparent during testing that JDBC-compliant tools became very fussy about the differences between FQL and SQL such as:

  • The FROM clause coming before the SELECT clause
  • Repeating elements returning an array or a scalar for a column depending on the underlying data

In the end, we decided that the intended use cases for HFQL are different enough that a different syntax that was closer to raw SQL was justified.

37.1.2Syntax Overview


See the following pages to learn more about the HFQL SQL syntax: