File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ def handler(event, context):
2525 Process a single section of a document for information extraction
2626 """
2727 logger .info (f"Event: { json .dumps (event )} " )
28+
2829 # Load configuration
2930 config = get_config ()
3031 logger .info (f"Config: { json .dumps (config )} " )
@@ -75,10 +76,6 @@ def handler(event, context):
7576 if section_document .status == Status .FAILED :
7677 error_message = f"Extraction failed for document { section_document .id } , section { section_id } "
7778 logger .error (error_message )
78- # Update status in AppSync before raising exception
79- full_document .status = Status .FAILED
80- full_document .errors .append (error_message )
81- appsync_service .update_document (full_document )
8279 raise Exception (error_message )
8380
8481 # Return section extraction result with the document
Original file line number Diff line number Diff line change @@ -44,11 +44,12 @@ def handler(event, context):
4444
4545 # Combine all section results
4646 for result in extraction_results :
47- # Get section document from extraction result
48- if "document" in result :
47+ # Get section document from assessment result (if populated)
48+ # or extraction result if assessment is disabled
49+ section_document = Document .from_dict (result .get ("AssessmentResult" , {}).get ("document" , {}))
50+ if not section_document :
4951 section_document = Document .from_dict (result .get ("document" , {}))
50- section_id = result .get ("section_id" )
51-
52+ if section_document :
5253 # Add section to document if present
5354 if section_document .sections :
5455 section = section_document .sections [0 ]
You can’t perform that action at this time.
0 commit comments