Skip to content

Commit 1d66b0c

Browse files
feat: Store routing in ElementMetadata (#4293)
1 parent cc89c8c commit 1d66b0c

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.22.2
2+
3+
- Store routing in ElementMetadata
4+
15
## 0.22.1
26

37
### Fixes

unstructured/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.22.1" # pragma: no cover
1+
__version__ = "0.22.2" # pragma: no cover

unstructured/documents/elements.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ class ElementMetadata:
195195
page_number: Optional[int]
196196
parent_id: Optional[str]
197197

198+
# -- routing decision (page-level) --
199+
routing: Optional[str]
200+
routing_score: Optional[float]
201+
198202
# -- e-mail specific metadata fields --
199203
bcc_recipient: Optional[list[str]]
200204
cc_recipient: Optional[list[str]]
@@ -250,6 +254,8 @@ def __init__(
250254
page_name: Optional[str] = None,
251255
page_number: Optional[int] = None,
252256
parent_id: Optional[str] = None,
257+
routing: Optional[str] = None,
258+
routing_score: Optional[float] = None,
253259
sent_from: Optional[list[str]] = None,
254260
sent_to: Optional[list[str]] = None,
255261
signature: Optional[str] = None,
@@ -297,6 +303,8 @@ def __init__(
297303
self.page_name = page_name
298304
self.page_number = page_number
299305
self.parent_id = parent_id
306+
self.routing = routing
307+
self.routing_score = routing_score
300308
self.sent_from = sent_from
301309
self.sent_to = sent_to
302310
self.signature = signature
@@ -520,6 +528,8 @@ def field_consolidation_strategies(cls) -> dict[str, ConsolidationStrategy]:
520528
"page_name": cls.FIRST,
521529
"page_number": cls.FIRST,
522530
"parent_id": cls.DROP,
531+
"routing": cls.DROP,
532+
"routing_score": cls.DROP,
523533
"sent_from": cls.FIRST,
524534
"sent_to": cls.FIRST,
525535
"signature": cls.FIRST,

0 commit comments

Comments
 (0)