Replies: 5 comments 3 replies
-
Cool thanks. Some questions:
|
Beta Was this translation helpful? Give feedback.
-
Identifier.use is limited to
It seem that it is not possible to specify which identifier to use for sorting. All the values for the different identifiers are stored in the
See approach #/3 . This will leverage on use of an extension and custom search param.
The sortResources take a
If the
The sortResources function supports sorting by |
Beta Was this translation helpful? Give feedback.
-
Here are my 2 cents
Key Characteristics:
Example: Meidcation number to uniquely identify them in a hospital’s system.
Key Characteristics:
Example
Both Identifier and Extension can be used as search parameters in FHIR but in different ways. The identifier is a standard search parameter in FHIR. Extension requires custom search parameters to be explicitly defined to be searchable.
Extension is not automatically a standard search parameter in FHIR. However, you can define custom search parameters for extensions when needed.
Sorting Locally using FHIR Path expression and custom code
|
Beta Was this translation helpful? Give feedback.
-
@Rkareko for the short term depending on deliverable timelines, using the readily available sortfn will yield quicker but dirty result (There's the potential of performance hit especially depending on the list size to be sorted). I therefore suggest quick and dirty for project timelines however we create a separate ticket/roadmap item to track the ultimate sort solution. Another random question: other than identifier what other generic attribute can we use for sorting (looking beyond medication), if we combine the introduction of an extended attribute to sort and custom search param can that leverage DB level sort? |
Beta Was this translation helpful? Give feedback.
-
There appears to be consensus on using the suggested approach #/3. The following tickets track the changes required to be made :-
|
Beta Was this translation helpful? Give feedback.
-
Context
There is a request to sort Medications by master list number (integer). This number is provided by the client and will need to be stored on the Medication resource.
At the moment the list of medications is displayed in a questionnaire using a drop down widget. An
x-fhir-query
expression is used to fetch the medications from the db.The questionnaire item that houses this drop down is of the type
reference
. The medications retrieved from the db are represented as shown belowSample medication resource
Question 1
How should this master list number be stored?
Is there a need to store the serial number (
00206501
in this example) as an identifier?Suggested approach
Store it as a secondary identifier i.e
Question 2
How the sorting will be implemented
Suggested approach 1 LOE Large
Update the
x-fhir-query
expression to sort the medications by the identifier field .i.eThe issue with this approach is that currently the Android SDk only supports sorting of number, string and date search param types as seen here.
Identifiers are indexed as
tokens
which is not supported.We would need to determine how much effort would be required to add this support. This can be done on the android fhir fork as a proof of concept before eventually being moved to the Android SDK repo.
The advantage of this approach is that sorting with be handled at the database level and there aren't any changes to be made on fhircore.
Issues
When a resource has more than 1 identifier, the sort will be affected since all the identifiers are extracted to the
TokenIndexEntity
table with the sameindex_name
Suggested approach 2 - LOE Medium
Use the functionality provided by the rulesEngine sortResources function to sort the resources in the profile config.
After sorting is complete, the references would then be extracted from the resources and then loaded onto the questionnaire for pre-population.
The issue with this approach is that pre-population of drop down widgets is not currently supported.
Processing pre-population values of type
reference
is not currently handled as seen here. This will have to be implemented.Issues
Suggested approach 3 (Thanks @pld and @LZRS for the insights) - LOE Small
Add an extension to the Medication resource that contains the sort value. The value will be of type
valueInteger
Add a custom search param in the configService.provideCustomSearchParameters() function.
This
sort
(find appropriate name for this field) value would be extracted into theNumberIndexEntity
as shown below.Issues
Note that custom search parameters require a fresh install.
In the questionnaire update the
x-fhir-query
to use the custom search param added above i.eThis particular request has some tight timelines. For the short term the question is which approach should we invest time in so as to get this feature out.
For the long term we can share ideas on a more robust solution.
Beta Was this translation helpful? Give feedback.
All reactions