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 whenopts.title_columnis unset or absent from this record.
Returns:
Document– The built Document.
Raises:
MalformedRecordError–opts.id_columnis configured but missing, null, or blank in this record, or a configured date value is not an ISO date or date-time.