← Back to blog

Spark FHIR Server 3.1.0

Spark FHIR Server 3.1.0 continues the work started in 3.0 where the goal was to make the server easier to maintain across multiple FHIR versions. The main result of that work is support for FHIR R4B and FHIR R5 alongside the existing STU3 and R4 capabilities.

This release also includes a set of practical fixes around request parsing, search behaviour, snapshot storage, and content negotiation. Most of these changes are small on their own, but together they make the server more predictable when it handles invalid input, chained search parameters, and large paged search results.

Bug fixes and some minor/useful features have been backported to 2.6.0. You can find a list at the end of the post describing which parts have been backported to 2.6.0.

Contributors to this release include losolio and kennethmyhra.

You can join our Discord server here: https://discord.gg/M9kp2zGGYF.

What's New in 3.1.0

1. FHIR R4B and R5 Support

PRs: #1337, #1340

Spark now includes dedicated R4B and R5 applications. This follows the same pattern as the existing STU3 and R4 applications, using the shared engine and MongoDB store infrastructure introduced in 3.0.

There are also new version-specific NuGet packages for library consumers: Spark.Engine.R4B and Spark.Engine.R5. Both sit on top of the shared Spark.Engine and Spark.Store.MongoDB packages in the same way as the existing STU3 and R4 packages.

R4B and R5 each have their own web application, frontend, Docker image, and version-specific NuGet packages.

Improvements And Bug Fixes

1. Request Body Parse Failures Return OperationOutcome Responses

PRs: #1352, #1348

Unreadable or malformed request bodies now return client errors and detailed OperationOutcome responses instead of server errors. This makes invalid input easier to diagnose for clients and avoids turning parser failures into generic 500 responses.

2. Chained Search Error Handling and Comparator Prefixes

PRs: #1288, #1290, #1293

Chained search now surfaces inner-query errors more clearly, and comparator prefixes are applied consistently for chained inner search parameters. This includes typed and untyped chained search cases.

3. PatchService where Predicate Handling

PR: #1298

PatchService now handles where predicates correctly. This improves FHIR Patch behaviour for expressions that need to select matching elements before applying an operation.

4. Quantity Indexing Uses Unit When Code Is Missing

PR: #1299

Quantity indexing now includes Unit as a metric when Code is not set. This improves search behaviour for Quantity values where clients populate the display unit but leave the coded unit empty.

5. _pretty Support

PR: #1334

Spark now supports the general FHIR parameter _pretty. Clients can request pretty-printed responses through the standard FHIR parameter instead of relying on server-specific behaviour.

6. Snapshot Pagination Preserves Stored Key Order

PR: #1317

Snapshot pagination now returns entries in the same order as the keys where stored in the snapshot.

7. Chunked Snapshot Storage

PR: #1318

Search snapshots can now be stored in chunks. Previously, large result sets could produce snapshot payloads too large for a single MongoDB document and result in a 500 response. Chunking makes snapshot storage more robust for large result sets.

8. Charset-Qualified FHIR Media Type Negotiation

PR: #1328

Binary content negotiation now handles FHIR media types with parameters such as application/fhir+json; charset=utf-8. These content types are now parsed by media type instead of being rejected because the raw header value contains additional parameters.

9. Pretty-Printed Browser Resource Views

PR: #1366

Resources displayed directly in the resource views of the web app are now pretty-printed. This makes JSON responses easier to inspect when using the server interactively.

10. Thread-Safe MongoDatabaseFactory

PR: #1316

MongoDatabaseFactory is now thread-safe. This avoids race conditions around database creation and lookup when the server is handling concurrent requests.

11. R4B Integration Tests

PR: #1364

The integration-test setup now includes R4B coverage. This gives the R4B application its own test path and helps ensure the version-specific application is exercised directly.

R5 coverage for the integration-tests are currently being worked on.

Features Backported to v2.6.0

The following improvements were made available to the v2 line without requiring an upgrade to v3.

  • Chained search inner-query errors and comparator-prefix behaviour (#1301, #1302)
  • PatchService where predicate handling (#1303, #1304)
  • Quantity indexing uses Unit when Code is absent (#1305, #1306)
  • Thread-safe MongoDatabaseFactory (#1305, #1306)
  • Snapshot pagination preserves stored key order (#1320, #1321)
  • Chunked snapshot storage (#1326, #1327)
  • Charset-qualified FHIR media type negotiation (#1324, #1325)