Stream: dotnet
Topic: Pagination implementation microsoft FHIR
shuhaib k (Nov 11 2021 at 08:23):
Can anyone help to understand the concept that, how the pagination did in Microsoft?
I was looking at this class to understand the better way how pagination is done.
fhir-server-main\fhir-server-main\src\Microsoft.Health.Fhir.SqlServer\Features\Search\Expressions\Visitors\QueryGenerators\SqlQueryGenerator.cs.
image.png
Brian Postlethwaite (Nov 11 2021 at 10:30):
The +1 on the count would be to grab 1 extra record that it's not going to return, just to know if there "is" more data and therefore it should include a next link - but I'm not 100% sure.
shuhaib k (Nov 14 2021 at 06:12):
@Brian Postlethwaite : This not even clear in code level as well .
@Gino Canessa : Is Microsoft FHIR server support pagination by default or how is easy to do it when we get mass data from DB query .
Gino Canessa (Nov 15 2021 at 15:35):
Hi Shuhaib, based on that code I would say that pagination is built in by default, but I I'm not familiar with that codebase either. I'm not sure the best way to engage the team on questions like that, so I'm tagging @Brendan Kowitz and @Caitlin Voegele who may know the best route.
Caitlin Voegele (Nov 15 2021 at 15:36):
The Microsoft FHIR server supports self and next links in paging right now. Let me if that clarifies!
Brendan Kowitz (Nov 15 2021 at 18:22):
The continuation token is also an important part of the strategy here. As pointed out above the "+1" is indicating that there are more results to return on the next page, when asking for the "next" page of results it will use the ResourceSurrogateId (e.g. https://github.com/microsoft/fhir-server/blob/main/src/Microsoft.Health.Fhir.SqlServer/Features/Search/Expressions/Visitors/QueryGenerators/SqlQueryGenerator.cs#L899) to move past already returned records. A ResourceSurrogateId is basically that resource's instance in the db.
Donn Relacion (Jan 25 2022 at 11:53):
Are there any plans for Microsoft FHIR server to support a skip parameter? I tried adding it myself, by basically changing usages of TOP into the OFFSET ... ROWS FETCH NEXT ....
image.png
The ct parameter is still there, but is only used for sorting, so most of the time, it is not there (I'm still trying to figure out how to remove it without breaking the tests).
Gino Canessa (Jan 25 2022 at 14:14):
@Caitlin Voegele @Brendan Kowitz
Caitlin Voegele (Jan 25 2022 at 16:11):
We don't have any plans currently but please feel free to open a GitHub issue against our open-source repo and we can add it to our backlog. https://github.com/microsoft/fhir-server/issues
Last updated: Apr 12 2022 at 19:14 UTC