Skip to main content
Version: latest

agrag.loaders.common.build_record_document

build_record_document(*, source:SourceRef, decoded:DecodedText, source_format:SourceFormat, loader_name:str, opts:ReadOptions, record_index:int, record:dict, source_hash:str, title:str) -> Document

Build a record-family Document from one row.

Parameters:

  • source (SourceRef) – The source the record came from.
  • decoded (DecodedText) – The decoded text and its metadata.
  • source_format (SourceFormat) – The format the loader used.
  • loader_name (str) – The name to record for the loader.
  • opts (ReadOptions) – The read options, used for the id, title, date, and text columns.
  • record_index (int) – The 0-based row number.
  • record (dict) – The parsed record data.
  • source_hash (str) – The sha256 of the whole source file.
  • title (str) – The fallback document title, used when opts.title_column is unset or absent from this record.

Returns:

Raises:

  • MalformedRecordError – opts.id_column is configured but missing, null, or blank in this record, or a configured date value is not an ISO date or date-time.