docs
UAEN
Docs/Output Formats/Graph Structure

Document Graph Structure

Rekognita parses the document and builds a complete graph structure — an hierarchy of document elements with types, relationships, and metadata. This is a unique feature that competitors don't have.

What is a document graph?

Unlike standard OCR, which produces flat text, Rekognita returns a structured tree of elements. Each element (node) has:

  • type — element type (heading, paragraph, table, figure, list, etc.)
  • content — textual content
  • children — child elements
  • bbox — coordinates on the page (bounding box)
  • metadata — additional metadata (heading level, table number, etc.)

Response Example

{
  "document": {
    "id": "doc_abc123",
    "pages": 2,
    "root": {
      "type": "document",
      "children": [
        {
          "type": "heading",
          "level": 1,
          "content": "Quarterly Financial Report",
          "bbox": [72, 45, 540, 75],
          "page": 1
        },
        {
          "type": "paragraph",
          "content": "This report summarizes the financial...",
          "bbox": [72, 90, 540, 130],
          "page": 1
        },
        {
          "type": "table",
          "caption": "Revenue by Quarter",
          "bbox": [72, 150, 540, 320],
          "page": 1,
          "children": [
            {
              "type": "table_header",
              "cells": ["Quarter", "Revenue", "Expenses", "Profit"]
            },
            {
              "type": "table_row",
              "cells": ["Q1", "$2.4M", "$1.8M", "$600K"]
            },
            {
              "type": "table_row",
              "cells": ["Q2", "$3.1M", "$2.1M", "$1.0M"]
            }
          ]
        },
        {
          "type": "figure",
          "caption": "Revenue Growth Chart",
          "bbox": [72, 340, 540, 520],
          "page": 1,
          "image_url": "/api/v1/documents/doc_abc123/images/fig_1.png"
        },
        {
          "type": "section",
          "heading": "Notes",
          "children": [
            {
              "type": "list",
              "ordered": false,
              "items": [
                "Net profit increased by 67% QoQ",
                "New product line launched in Q2"
              ]
            }
          ]
        }
      ]
    }
  }
}

Element Types

TypeDescription
documentRoot document element
headingHeading (levels 1-6)
paragraphText paragraph
tableTable with rows and cells
table_headerTable header
table_rowTable row
figureImage, diagram, or chart
listNumbered or bulleted list
sectionLogical document section
footnoteFootnote or remark
referenceLink or citation
code_blockCode block or formula

Using the SDK

from rekognita import RekognitaClient

client = RekognitaClient()

result = client.documents.parse(
    file="financial_report.pdf",
    output_format="graph",
    model="rekognita-accurate"
)

# Traverse the graph
for node in result.root.children:
    print(f"[{node.type}] {node.content[:50] if node.content else ''}")
    
    if node.type == "table":
        for row in node.children:
            print(f"  Row: {row.cells}")

    if node.type == "figure":
        print(f"  Image: {node.image_url}")
        print(f"  Caption: {node.caption}")

Benefits of Graph Structure

  • RAG-ready — the perfect format for semantic chunking and RAG pipelines
  • Auditability — each element has a bbox for tracing back to the original
  • Completeness — all document elements: tables, images, lists, footnotes
  • Convertibility — the graph can be converted into any format (Markdown, HTML, JSON)