Open SebaMutuku opened 1 month ago
updateIndicesForResource()
executed, there'll be multiple DateTimeIndexEntity
entries for that resource. searchForwardReferencedResources()
This is a result of the LEFT JOIN DateTimeIndexEntity
Hey @SebaMutuku. You are probably right in why duplicate resources are being returned in search - because of duplicate DateTimeIndexEntity records. However, I am not able to observe duplicate DateTimeIndexEntity records when updating same resource locally.
Can you provide steps to replicate it ? Is it happening when the resource is synced and then one is making local changes ?
Hello @MJ1998? attached is the SQLite DB for patient shown on the screenshot below
Patient ID 119c3d24-123b-4719-b39d-5e9be05f8e85
Check the record on LocalChangeEntity
and to answer your question, this only happens on local changes. When you sync data to the server, the issue is solved.
resources_duplication_db.zip
LocalChangeEntity
has one record per resource. Do you mean to check DateTimeIndexEntity
table ?
@MJ1998 yes, that's the entry causing duplication. If you check it on this line https://github.com/google/android-fhir/blob/master/engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt#L58 you will see what the query returns
@SebaMutuku @allan-on Can you please add the Search Query passed into the fhirEngine.search<Resource>(search)
.
Also, can you specify the engine version that's being used.
@aditya-07 are you available for us to have a debugging session? If yes, let me know when I can set one up.
@aditya-07 are you available for us to have a debugging session? If yes, let me know when I can set one up.
Yes, that sounds like a good idea. Feel free to setup one today (Wednesday) or tomorrow between 11am-6pm IST.
@aditya-07 here's the sample database we have had a look at together resources_db.zip
Describe the bug When editing or updating resources in the db, severral resources with the same last updated exist on the db. When searching for the resources on code at
the query
Result - Records 2 & 4 are similar
Component
To Reproduce Update any resource, save it in the app SQlite DB then try querying them. Several records will be returned depending on how many times you have made changes on the resources
Expected behavior A single record of any resources should be returned when we make any changes to a resource.
Screenshots An example is when updating a patient active status to false. Patients
Adrew Kife
returns two resources with same details.