Skip to content

feat: sql run operation#2579

Open
jkiddo wants to merge 6 commits intoaehrc:mainfrom
trifork:feat/sql-run-operation
Open

feat: sql run operation#2579
jkiddo wants to merge 6 commits intoaehrc:mainfrom
trifork:feat/sql-run-operation

Conversation

@jkiddo
Copy link
Copy Markdown
Collaborator

@jkiddo jkiddo commented Mar 26, 2026

A yolo implementation of #2561 :

This pull request introduces support for the $sqlquery-run FHIR operation, enabling execution of SQL queries defined in FHIR Library resources. It adds new providers, configuration options, and parsing logic to handle SQLQuery Libraries, their parameters, and dependencies. The changes also ensure that the new operation is configurable and properly registered within the server.

New SQL Query Operation Support:

  • Added new providers: SqlQueryRunProvider and SqlQueryInstanceRunProvider to handle both type-level and instance-level $sqlquery-run operations for FHIR Library resources, including parameter binding and output formatting. ([[1]](https://github.com/aehrc/pathling/pull/2579/files#diff-7441f4e261837a0c47fe3ba576c977a207bbdc04c5aaadb30c844232af85cdebR177-R184), [[2]](https://github.com/aehrc/pathling/pull/2579/files#diff-7441f4e261837a0c47fe3ba576c977a207bbdc04c5aaadb30c844232af85cdebL233-R248), [[3]](https://github.com/aehrc/pathling/pull/2579/files#diff-7441f4e261837a0c47fe3ba576c977a207bbdc04c5aaadb30c844232af85cdebR277-R278), [[4]](https://github.com/aehrc/pathling/pull/2579/files#diff-5acafa29251cd0573c336431c5e7f133d74246a4f80c9281d3216e3dbc3b83bbR1-R160))

  • Registered the new SQL query run providers within the FhirServer initialization logic, gated by a new configuration flag. ([server/src/main/java/au/csiro/pathling/FhirServer.javaR397-R402](https://github.com/aehrc/pathling/pull/2579/files#diff-7441f4e261837a0c47fe3ba576c977a207bbdc04c5aaadb30c844232af85cdebR397-R402))

Configuration and Capability Statement:

  • Introduced a new configuration property sqlQueryRunEnabled to enable or disable the $sqlquery-run operation. ([server/src/main/java/au/csiro/pathling/config/OperationConfiguration.javaR73-R75](https://github.com/aehrc/pathling/pull/2579/files#diff-d253d305020a8cff17b5936c099e7e2e7d731120bcc273135f5973795605eaccR73-R75))

  • Updated the conformance/capability statement logic to advertise the $sqlquery-run operation when enabled. ([server/src/main/java/au/csiro/pathling/fhir/ConformanceProvider.javaR507-R509](https://github.com/aehrc/pathling/pull/2579/files#diff-dd39c622cbec81a9a667a477be7664401ec1272b7a9d1445a2bd2a5791c8c1e5R507-R509))

SQLQuery Library Parsing:

  • Added SqlQueryLibraryParser, which parses FHIR Library resources conforming to the SQLQuery profile, extracting SQL text, ViewDefinition dependencies, and parameter declarations. ([server/src/main/java/au/csiro/pathling/operations/sqlquery/SqlQueryLibraryParser.javaR1-R143](https://github.com/aehrc/pathling/pull/2579/files#diff-1f739feb2f4b660e33bb7305adbdbbd1cbb1bbc1e9531ef64010f931193a8495R1-R143))

  • Introduced supporting classes: ParsedSqlQuery (holds parsed SQL, dependencies, parameters) and SqlParameterDeclaration (represents a named, typed parameter). ([[1]](https://github.com/aehrc/pathling/pull/2579/files#diff-2e4ab2cf0cdde8df9f81de693a4b02979a8b9aad69dc64988fa3690fd1523a63R1-R39), [[2]](https://github.com/aehrc/pathling/pull/2579/files#diff-dcc4e4e7afa0be80e5b6930026fd9a0d0f141902bbe9983bb1b8ca72d636987aR1-R35))

@jkiddo jkiddo requested a review from johngrimes March 26, 2026 15:51
@johngrimes johngrimes added the new feature New feature or request label Mar 30, 2026
@github-project-automation github-project-automation bot moved this to Backlog in Pathling Mar 30, 2026
@johngrimes johngrimes moved this from Backlog to In progress in Pathling Mar 30, 2026
jkiddo and others added 4 commits April 1, 2026 16:05
…eDatasets config

The StorageConfiguration.cacheDatasets setting existed but was never
wired into the data loading path. Every query re-read FHIR resource
data from S3 via Delta Lake. This change applies .cache() to datasets
returned by DynamicDeltaSource.read(), gated by the cacheDatasets flag.
Cache invalidation is already handled by CacheableDatabase.invalidate()
which calls spark.sqlContext().clearCache().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature or request

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants