android-fhir
android-fhir copied to clipboard
Fhir engine search does not return correct data.
Describe the Issue Fhir engine search does not return correct data when using include.
when try to replicate the query
%HOST_URL%/Encounter?type=%SYSTEM_URL%|%CODE%&status=%STATUS%&_include=Encounter:patient:Patient&_elements=_id,type,status&_total=accurate
with fhir engine search method :
fhirEngine.search(ResourceType.Encounter) {
filter(
Encounter.TYPE, {
value = of(Coding("%SYSTEM_URL%", "%CODE%", ""))
}
)
filter(
Encounter.STATUS, {
value = of("%STATUS%")
}
)
include(ResourceType.Patient, Encounter.SUBJECT)
}
The fhir engine does not return any Patient resouce (patient resource should be returned, checked on our server)
Tried using Encounter.Patient in resource reference as well.
I could not find any documentation on how to use include with the search in fhir engine. Is the code incorrect, or is it not returning the correct value?
@jingtang10 @fredhersch help would be appreciated.
Would you like to work on the issue?
@mansikalraa Could you please provide some test data ( encounters + associated patients) for us to test on our end?
@williamito can you please help improving documentation for include / revinclude.
@mansikalraa thanks for raising this issue. can you please provide some test data as @aditya-07 requested?
@jingtang10 @aditya-07 Thank you for the response. While exploring the search feature, I was able to find how to retrieve the included resouce successfully.
fhirEngine.search(ResourceType.Encounter) {
filter(
Encounter.TYPE, {
value = of(Coding("%SYSTEM_URL%", "%CODE%", ""))
}
)
filter(
Encounter.STATUS, {
value = of("%STATUS%")
}
)
include(ResourceType.Patient, Encounter.SUBJECT)
}.forEach { searchResult ->
val includedResource = searchResult.included?.get(Encounter.SUBJECT.paramName)[0] as Patient
}
}