DocsWorkflowsComponentsDatadata:shape:read

data:shape:read

Reports the structure of a document a run is holding.

Options

NameTypeDescription
contentstringThe document to report the structure of
namestringThe file name the document came under, read as a hint where its bytes match no known kind
formatstringOverrides the detection, one of xml, csv, json, pdf, html or zip
delimiterstringThe field separator of a delimited document, worked out from the first rows when left out
max_nodesintHow many distinct paths the report names
max_rowsintHow many rows of a delimited document the report samples

Outputs

NameTypeDescription
formatstringWhat the document turned out to be
readableboolWhether the structure below is a reading of the document
completeboolWhether nothing was left out of the report
clipped[]stringEach bound the reading reached
notes[]stringWhat to know before trusting the report
nodes[]NodeThe tree, for a document read as an element tree or as nested keys
  ↳ pathstringLocates the node from the document root. An attribute is written with a leading at sign on its last segment and an array's elements are written with an empty pair of brackets.
  ↳ kindstringIs what the node is, one of element, attribute, object, array, string, number, boolean or null.
  ↳ countintIs how many times the path occurred in what was read.
  ↳ max_per_parentintIs the most occurrences under a single parent, which is what separates a repeating node that becomes rows from a single one that becomes a field.
  ↳ types[]stringNames every scalar type seen at this path where more than one was, which is how a field that is a number in most records and text in a few shows itself before somebody types it as a number.
  ↳ samplestringIs one value from the node, cut to the reading's sample length.
tableTableThe reading of a delimited document
  ↳ delimiterstringIs the field separator that was used, as one character.
  ↳ delimiter_detectedboolSays the separator was worked out from the first lines rather than stated by the caller.
  ↳ header[]stringIs the first row, which is taken as the column names.
  ↳ rowsintIs how many rows followed the header in what was read.
  ↳ raggedintIs how many of those rows carried a different number of fields than the header did.
  ↳ sample[]stringIs the first rows after the header, each value cut to the reading's sample length.
pagesPagesWhat a page description document says about itself
  ↳ versionstringIs the format version from the file header.
  ↳ encryptedboolSays the file declares encryption, which is why no content could be read even where a reader for it existed.
  ↳ page_objects_seenintIs how many page objects were found in the parts of the file that are not compressed, which is a floor rather than the page count. It is zero for a file that keeps its object tree compressed.
headstringA short printable sample of the start of a document whose structure was not read

Example

name: Work out what an exported file holds
actions:
  - name: exported
    component: storage:local:file:read
    vars:
      path: export.xml

  - name: structure
    component: data:shape:read
    vars:
      content: "{{ exported.content }}"
      name: export.xml

outputs:
  format: "{{ structure.format }}"
  complete: "{{ structure.complete }}"
  nodes: "{{ structure.nodes }}"