Aidbox Becomes the First FHIR Server to Pass All SQL-on-FHIR Tests

Aleksandr Kislitsyn
November 6, 2025
3 minutes

We’ve recently added support for the repeat element from the SQL-on-FHIR Specification —making Aidbox the first FHIR server to passing all tests from the SQL-on-FHIR test suite .

SQL-on-FHIR test suite results

This milestone reflects our ongoing work to make structured clinical data easier to query, analyze, and reuse — without complex transformations or custom logic. SQL-on-FHIR bridges the gap between FHIR’s flexible data model and the simplicity of SQL, enabling healthcare teams to unlock insights directly from their FHIR data.

What is the repeat Element and How It Works?

The select.repeat allows you to specify a list of FHIRPath expressions, each of them defines a path to traverse a FHIR resource recursively. Aidbox then automatically follows each path to any depth, collecting the results from all levels.

In simple terms, it helps flatten complex, deeply nested healthcare data into an easy-to-query table — saving hours of manual setup and data preparation.

For instance, a FHIR QuestionnaireResponse resource may contain sections, questions, and follow-up items organized hierarchically. Each item element can include other item elements of the same type — and those can include additional ones, forming a recursive structure with any level of nesting.

Consider the following example:

{
 "resourceType": "QuestionnaireResponse",
 "status": "amended",
 "id": "qr1",
 "item": [
  {
   "linkId": "1",
   "text": "Group 1",
   "item": [
    {
     "linkId": "1.1",
     "text": "Question 1.1",
     "answer": [
      {
       "valueString": "Answer 1.1",
       "item": [
        {
         "linkId": "1.1.1",
         "text": "Follow-up to 1.1"
        }
       ]
      }
     ]
    },
    {
     "linkId": "1.2",
     "text": "Question 1.2",
     "item": [
      {
       "linkId": "1.2.1",
       "text": "Question 1.2.1"
      }
     ]
    }
   ]
  },
  {
   "linkId": "2",
   "text": "Group 2"
  }
 ]
}

Instead of having a separate forEach element for each level of nesting, you can use repeat to traverse the entire structure recursively, and extract all the item elements at once:

ViewDefinition:

{
  "resource": "QuestionnaireResponse",
  "status": "active",
  "select": [
    {
      "column": [
        {
          "name": "id",
          "path": "id",
          "type": "id"
        }
      ]
    },
    {
      "repeat": [
        "item"
      ],
      "column": [
        {
          "name": "linkId",
          "path": "linkId",
          "type": "string"
        },
        {
          "name": "text",
          "path": "text",
          "type": "string"
        }
      ]
    }
  ]
}

Result of running this ViewDefinition will be a table with the following columns:

id linkId text
qr11Group 1
qr11.1Question 1.1
qr11.2Question 1.2
qr11.2.1Question 1.2.1
qr12Group 2

Try it yourself

You can try it yourself by running a new Aidbox instance by following the instructions in the Run Aidbox locally guide.

How did you like the article?

contact us

Get in touch with us today!

By submitting the form you agree to Privacy Policy and Cookie Policy.
Thank you!
We’ll be in touch soon.

In the meantime, you can:
Oops! Something went wrong while submitting the form.

Never miss a thing
Subscribe for more content!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
By clicking “Subscribe” you agree to Health Samurai Privacy Policy and consent to Health Samurai using your contact data for newsletter purposes