DocsWorkflowsComponentsDatadata:document:extract

data:document:extract

Walks a parsed document by segment pattern and emits keyed items. It reads the flat item list a document parse produces, keeps the items whose path matches the pattern, names the captured segments, and emits one output item per match. Repeated matches collapse into one item when group fields are configured, which is how plurals and arrays come back out of a document as a single entry.

Options

NameTypeDescription
items[]map[string]anyThe parsed document items to walk, usually document selections
matchExtractMatchThe segment pattern deciding which items are extracted
  ↳ pathstringThe item field holding the segments to match, as a dotted path
  ↳ pattern[]stringThe segment pattern an item must match to be extracted
  ↳ exclude_patterns[]stringSegment patterns that drop an otherwise matching item
fieldsanyThe output fields, each named and read from a path, a capture, or a literal
group_by[]stringThe output field names that collapse repeated items into one
aggregatesanyThe collections built from every item in a group
limitintCaps the number of emitted items, zero for all of them

Outputs

NameTypeDescription
items[]map[string]anyThe extracted items

Example

name: Extract document entries
actions:
  - name: entries
    component: data:document:extract
    vars:
      items: "{{ var.selections }}"
      match:
        path: path
        pattern: ["{key...}"]
        exclude_patterns:
          - ["{key...}", "{index#}"]
      fields:
        key:
          capture: key
          join: "."
        value:
          path: value

outputs:
  items: "{{ entries.items }}"