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

Missing "total" field for bundle pagination in CQL requests with Blaze 0.28 #2185

Closed
djuarezgf opened this issue Nov 13, 2024 · 10 comments
Closed
Assignees
Labels
discussion Issues which are not decided yet.

Comments

@djuarezgf
Copy link
Member

djuarezgf commented Nov 13, 2024

Description: In previous versions of Blaze, executing a CQL query that returned a large response (requiring pagination across multiple bundles) included a "total" field within each bundle. This field provided the total number of bundles, allowing us to calculate the estimated remaining time for the process interacting with Blaze.

However, in version 0.28, this "total" information is no longer included in the bundle response. This change significantly impacts our ability to gauge progress and manage resources effectively.

Blaze Version: 0.28 (previous versions included the "total" field as expected)

Query (FHIR-Search): /Patient

According to the FHIR specification, the "Bundle" resource should contain a "total" field indicating the total count of matching resources (see FHIR Bundle Documentation). Could you clarify whether this is an intentional change or an issue in the latest release?

The "total" field is essential for our processes, and we would greatly appreciate any guidance on restoring this functionality or alternative solutions.

@djuarezgf djuarezgf added the bug Something isn't working label Nov 13, 2024
@djuarezgf djuarezgf changed the title Number of Bundles not provided Total number of bundles not provided Nov 13, 2024
@djuarezgf djuarezgf changed the title Total number of bundles not provided Missing "total" field for bundle pagination in CQL requests with Blaze 0.28 Nov 13, 2024
@allentiak allentiak added discussion Issues which are not decided yet. and removed bug Something isn't working labels Nov 13, 2024
@alexanderkiel
Copy link
Member

Hi David, your problem is about a FHIR Search query you do after you executed the CQL Query via $evaluate-measure to receive the Patients - right? Do you use the _list search param like I have documented here?

On Blaze v0.28 the following FHIR Search query with a List resource containing only 1 patient works:

curl -s 'http://localhost:8080/fhir/Patient?_list=DEZLRKBIRZDQJC73' | jq .total
1

Is that your scenario? Or do you use a different FHIR Search query?

@djuarezgf
Copy link
Member Author

djuarezgf commented Nov 15, 2024

Oh, yes, you are right. I have tested it again. When I send a fhir search like /Patient, I get the "total" in the bundle. But when I use a CQL query and get the _list, then, I don't get the "total" in the bundle.

@alexanderkiel
Copy link
Member

alexanderkiel commented Nov 18, 2024

Do you have the exact FHIR Search query which doesn't return a total value?

@djuarezgf
Copy link
Member Author

djuarezgf commented Nov 29, 2024

@alexanderkiel
Copy link
Member

So is it only /Patient?_list=<list-id>? Without anything else?

@alexanderkiel
Copy link
Member

Do you have to use paging? E.g. are there more results as will fit on the first page?

@djuarezgf
Copy link
Member Author

This is the FHIR search query I send to the HAPI FHIR client. I also provide the _revinclude parameters, which the HAPI FHIR client library appends to construct the final URL. Essentially, we're requesting Blaze to return a significant amount of related information for each patient.

We are using pagination and can successfully read all the pages provided by Blaze. However, the issue arises because the "total" number of pages is missing in the response bundle. Without this, we cannot calculate or display the progress of the operation.

@djuarezgf
Copy link
Member Author

As I said, it only happens with _list

@alexanderkiel
Copy link
Member

Unfortunately, Blaze will not output a total value if the search contains at least one search parameter and the results will not fit on the first page. The reason is that I had to calculate the whole search result before seeing able to output the page only to calculate the total value. As I don't like to spend that time, I simply skipped outputting the total value. If you really need it, you can append _summary=count to the query which will force Blaze to calculate the total value but doesn't return the actual data. You could however issue two queries, first with _summary=count and then without.

In FHIR there is the special search parameter _total. I could implement it. With that, you could force the calculation of total also on your normal query. If you think that _total parameter would be useful for you, please open an issue. Thanks,

@djuarezgf
Copy link
Member Author

In our case, I believe it would make more sense to include the _total search parameter. I’ll go ahead and create an issue for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Issues which are not decided yet.
Projects
None yet
Development

No branches or pull requests

3 participants