microsoft / fhir-server

A service that implements the FHIR standard
MIT License
1.17k stars 499 forks source link

Search Result (_sort) - Ability to Search by additional clinical date columns (MedicationRequest.authoredon, MedicationDispense.whenprepared) #4035

Closed LKShankarKarthik closed 1 week ago

LKShankarKarthik commented 4 weeks ago

Describe the bug We have hosted this OSS in Azure App Service with appropriate configuration change to support _sort on below resources (clinical date columns). But its not behaving as expected (seems to work intermittently)

image

FHIR Version R4

Data provider CosmosDB

To Reproduce Steps to reproduce the behavior:

  1. Run the below Query MedicationDispense?patient=XXXXXX&whenprepared=ge2023-08-17T12%3A00&whenprepared=le2024-07-17T23%3A59&_count=100&_sort=-whenprepared
  2. Above request returns bundle with HTTP 200 but with below warning (which is not expected).

image

Expected behavior FHIR Response shouldnt have the above warning and it should return results.

Actual behavior Returns HTTP 200 Bundle Response, but with OperationOutcome (Warning)

EXPEkesheth commented 3 weeks ago

@LKShankarKarthik - The sort capability with Cosmos DB is supported on when the above config is updated prior to creating he database. After the data base is created, updating the config would not enable the sort capability on search parameters added.

LKShankarKarthik commented 3 weeks ago

@EXPEkesheth - Thanks for the update. Is there a way to check when it was added? As I remember, we updated the config before we loaded the data (or as part of initial deployment).

brendankowitz commented 3 weeks ago

Hi @LKShankarKarthik, yes, this config only applies when it initializes the collection. We only invested minimally in sort support for Cosmos since we had much richer support for free in SQL.

As such, there isn't a UI or API for this, I'd advise its not something we're looking to expand or support beyond what's currently there. Internally, you can update the status in the DB to "Supported", restart the service, then follow the $reindex guidance which should populate the sortable index and enable it. This only works on strings and dates.

image

EXPEkesheth commented 1 week ago

Closing with no response and question is answered