-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting supported to extension fields? #3616
Comments
Hi @Sameer2810. Under Health Data Services/SQL you can sort on string and date search parameters, so if you create a custom search parameter for the extension (then reindex) it would work. |
Hi @brendankowitz I have created Health Data Services and in that I have added ImagingStudy with date extension and perform reindex on that. The extension field (date field) is now searchable but for sorting it is not giving any result. Example - fhirurl/ImagingStudy?customdate={actual date} For searching above is working Example - fhirurl/ImagingStudy?_sort=customdate Is above correct or I am missing something here |
@Sameer2810 - can you please help clarify if you are getting empty response or result with resources but not sorted? |
@EXPEkesheth - I am getting empty response below is screen shot for that |
@Sameer2810 - can you provide the expression for the |
@mikaelweave following is the expression ImagingStudy.extension.where(url = 'CreatedDate').value |
@Sameer2810 - The I'd suggest using a SearchParameter like below. I don't have time to test this now but this is what I'd try. Also if there are other ways to capture this data without a custom extension I've found that best. For example, if ImagingStudy resources are always part of Procedure resources, you could maybe use {
"resourceType" : "SearchParameter",
"id" : "resource-created-date",
"url" : "http://mycompany.org/fhir/SearchParameter/resource-created-date",
"version" : "1.0.0",
"name" : "ResourceCreatedDate",
"status" : "active",
"date" : "2023-12-12",
"publisher" : "My Company",
"description" : "Returns the created date on resources.",
"code" : "CreatedDate",
"base" : [
"DomainResource"
],
"type" : "date",
"expression" : "DomainResource.extension.where(url='http://mycompany.org/fhir/StructureDefinition/resource-created-date').value"
} |
@mikaelweave I did that what you mentioned, getting result but for some reason sorting not applied on result (for date type) Also when I try with string type extension sorting applied to result (note - It gives result for those record which don't have that extension) |
@mikaelweave and @EXPEkesheth Can you suggest further action |
@Sameer2810 - there was an error in the custom search parameter I posted. I updated the above comment and verified it works locally. Make sure the expression is correct and you remove the old search parameter first. Make sure to reindex and that all of your resources get reindexed by inspecting the response. I find it easier to test on querying the data first vs sorting to ensure the custom search parameter is getting applied correctly (e.g. Also check out the examples in the linked PR - you can use the |
Thanks @mikaelweave for addressing the questions! @Sameer2810 - closing this as no further comments post Dec 21st. Please feel free to re-open the issue, if the issue is not addressed. |
Question
Does sorting supported for extension fields
Tasks
The text was updated successfully, but these errors were encountered: