Skip to main content
Long reports mix sections that need different fields. Instead of one large schema, use Split to find each section’s pages, then run a small schema on only those pages.

What you need

  • The Python SDK and an API key, set up as in Cookbooks.
  • A long document. This recipe uses the 10-K Annual Report sample, which has 12 pages.

Build it

1

Parse the report

This code starts an async parse and polls it until it ends. wait works for any job: pass it the status call of that job’s endpoint, such as client.extract.get.
2

Find each section's pages

Name each section as a topic, with a description of what’s on its pages. This call waits for the split to finish, then reads each topic’s page numbers.
Every topic comes back, in the order you sent it. A topic’s pages is empty when the report has no such section.
3

Extract each section

Write a small schema for each topic. This code starts one async extract per topic that has pages, each reading only that topic’s pages through page_range.
Each extract only reads the parse, so you can start them all before you wait for any of them.
4

Collect the values

This code waits for each extract and reads its result.
Every value carries its citation, the parse elements it was read from, and a confidence score. For the values alone, add "format": ["raw"] to the extract’s config and read extraction.raw.

How it works

Every step reads the same parse. Split decides which of its pages each schema sees: The calls in order: The recipe never reads the parse’s own result, so it also works where your organization deletes a result the first time it’s read. The split is billed for every page of the parse, whatever the number of topics, while each extract is billed only for the pages in its page_range. See Pricing.

Tips

  • Name topics that are easy to describe and rarely overlap. A page can belong to more than one topic.
  • Check each topic’s pages on a few reports before you trust its values.
  • A pipeline can run the parse and the split in one call. The extracts still start after it, because they need the split’s pages.
  • Once the topics and schemas work across several reports, store them as saved configs.

Next steps

Split

Topics, effort and how a split numbers its pages.

Extract

Schemas, page ranges, effort and confidence.