Skip to content
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

Modified Date is needed as sorting parameter for all FHIR resources #1956

Closed
khyativyasargus opened this issue Apr 6, 2023 · 10 comments · Fixed by #2030
Closed

Modified Date is needed as sorting parameter for all FHIR resources #1956

khyativyasargus opened this issue Apr 6, 2023 · 10 comments · Fixed by #2030
Assignees

Comments

@khyativyasargus
Copy link
Contributor

khyativyasargus commented Apr 6, 2023

Describe the bug
Currently while querying resources from SDC , sort() method is available which can be used to get sorted data specially while we want to query resources with pagination, but currently modified date is stored only in meta data , not available for sort method parameter.

Component
Engine library

To Reproduce
Steps to reproduce the behavior:

  1. Go to PatientListViewModel file in demo app
  2. check getSearchResults method to get Patient resource list
  3. sort(Patient.GIVEN, Order.ASCENDING) method is used in that method which is available at query level sorting
  4. But when you check other available sorting parameters for Patient as GIVEN, Modified date can not be found which is needed in some cases for example, while we want to fetch last modified patients at top!
  5. Same applies on all the resources

Expected behavior
For sort(Patient.GIVEN, Order.ASCENDING), Modified date should be available as well,

@jingtang10

@aditya-07
Copy link
Collaborator

@khyativyasargus Is the expectation to sort by the server assigned lastUpdated date or the local lastUpdated ?

@khyativyasargus
Copy link
Contributor Author

@aditya-07 local assigned lastUpdated is needed

@santosh-pingle
Copy link
Collaborator

@khyativyasargus is it okay to change component from sdc library to engine library?

@khyativyasargus
Copy link
Contributor Author

@santosh-pingle can you provide more context on this?
cc @jingtang10 @aditya-07

@santosh-pingle santosh-pingle changed the title SDC : Modified Date is needed as sorting parameter for all FHIR resources Modified Date is needed as sorting parameter for all FHIR resources Apr 18, 2023
@santosh-pingle
Copy link
Collaborator

@santosh-pingle can you provide more context on this? cc @jingtang10 @aditya-07

@khyativyasargus
I intended to remove the SDC library from the component in the description of the issue. You can ignore it now, as I have updated the corresponding change. thanks!

@khyativyasargus
Copy link
Contributor Author

@santosh-pingle Okay got it. Thanks!

@aditya-07 aditya-07 self-assigned this Apr 24, 2023
@jingtang10
Copy link
Collaborator

jingtang10 commented Apr 24, 2023

As we don't store the local last updated timestamp, we will need to start storing it when we update resources locally.

Options:

  1. use the meta element's last updated timestamp locally
  2. add a new db column in resources table
  3. same as 2 but add a new meta table which includes last updated timestamp
  4. add a new default custom index in the date index table for all resources by default

Comparison:

Update resource meta data New column in resource table New meta data table New custom index
DB change ✅ No db change ⛔️ Need db change ⛔️ Need db change ✅ No db change
Preserve server last updated ⛔️ No ✅ Yes ✅ Yes ✅ Yes

So it seems like first we need to make a decision about if we want to overwrite server-side last updated timestamp.

@aditya-07
Copy link
Collaborator

@jingtang10 Another option could be to same as 4 but add a custom search parameter exclusively for local_lastUpdated . That way, we won't have to do a DB change and we can preserve server lastUpdated as well.

@aditya-07
Copy link
Collaborator

@omarismail94 @khyativyasargus @joiskash @ellykits @ekigamba Do you have any inputs or thoughts about the options listed above?

@khyativyasargus
Copy link
Contributor Author

khyativyasargus commented Apr 26, 2023

@aditya-07 I agree with your option as in metadata lastUpdated is already present and currently we are using that only to do sorting, altough for pagination query custom parameter is required so yes it can work with your approach!

Just one question is lastUpdated stored in metadata server_lastUpdated or local_lastUpdated ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging a pull request may close this issue.

4 participants