Skip to content

Commit

Permalink
Update worker.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DrRSatzteil authored Mar 14, 2024
1 parent 9a55cc9 commit 7cfb9ce
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mayanmindee/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def getattritem(obj, attr: str) -> Any:
obj = operator.attrgetter(steps[-1].lstrip("."))(obj)
return obj


def process_standard(document_id: int, document_type: str) -> None:
apis = load_config(document_type, "standard")

Expand Down Expand Up @@ -302,9 +301,15 @@ def process_custom(document_id: int, document_type: str, synchronous: False) ->

for field_name, tag_mappings in required_fields.items():
try:
result = parsed_doc.document.inference.prediction.fields[field_name].value
field = parsed_doc.document.inference.prediction.fields[field_name]
except:
result = parsed_doc.document.inference.prediction.classifications[field_name].value
field = parsed_doc.document.inference.prediction.classifications[field_name]

if hasattr(field, "value"):
result = field.value
else:
result = field.contents_string()

if result:
for tag_mapping in tag_mappings:
if is_similar(
Expand Down

0 comments on commit 7cfb9ce

Please sign in to comment.