Skip to content

Commit e60ceb1

Browse files
committed
updated service to log page level metadata
1 parent ee4b2b9 commit e60ceb1

File tree

1 file changed

+14
-0
lines changed
  • lib/idp_common_pkg/idp_common/classification

1 file changed

+14
-0
lines changed

lib/idp_common_pkg/idp_common/classification/service.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,13 @@ def classify_document(self, document: Document) -> Document:
12491249
page_id
12501250
].confidence = cached_result.classification.confidence
12511251

1252+
# Copy metadata (including boundary information) to the page
1253+
if hasattr(document.pages[page_id], 'metadata'):
1254+
document.pages[page_id].metadata = cached_result.classification.metadata
1255+
else:
1256+
# If the page doesn't have a metadata attribute, add it
1257+
setattr(document.pages[page_id], 'metadata', cached_result.classification.metadata)
1258+
12521259
# Merge cached metering data
12531260
page_metering = cached_result.classification.metadata.get(
12541261
"metering", {}
@@ -1297,6 +1304,13 @@ def classify_document(self, document: Document) -> Document:
12971304
page_id
12981305
].confidence = page_result.classification.confidence
12991306

1307+
# Copy metadata (including boundary information) to the page
1308+
if hasattr(document.pages[page_id], 'metadata'):
1309+
document.pages[page_id].metadata = page_result.classification.metadata
1310+
else:
1311+
# If the page doesn't have a metadata attribute, add it
1312+
setattr(document.pages[page_id], 'metadata', page_result.classification.metadata)
1313+
13001314
# Merge metering data
13011315
page_metering = page_result.classification.metadata.get(
13021316
"metering", {}

0 commit comments

Comments
 (0)