in invoice-processing-pipeline/processor/process.py [0:0]
def document_info(document):
info = {"lines": []}
for entity in document.entities:
if entity.type_ == "line_item":
line = {}
for property in entity.properties:
line[property.type_] = property.mention_text
info["lines"].append(line)
else:
info[entity.type_] = entity.mention_text
return info