Guides

Page through lists

Every list method returns a Page: data holds this page's items, total the item count

  • Stable unknown
  • Release candidate since 0.1.0-rc.3
  • Development since 0.1.0-dev.21+c43ebba

Every list method returns a Page: data holds this page's items, total the item count when the API reports it, and has_more whether a later page exists.

Walk every item

auto_paging_iter() yields each item and loads later pages as the loop reaches them:

for patient in ovok.fhir.search("Patient", {"_count": "100"}).auto_paging_iter():
    print(patient["id"])

Load one page at a time

page = ovok.slim.patients.list({"count": 20})
while page is not None:
    render(page.data)
    page = page.next_page()

next_page() returns None after the last page. FHIR searches, page-numbered lists, cursor lists and CMS lists all follow this shape, so the same loop works for each.

Last updated on

On this page