Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] ValidationError ResumePersonalInfo affinda #225

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 29 additions & 24 deletions edenai_apis/apis/affinda/standardization.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
from typing import Any, Dict, List, Optional, Sequence, Tuple

from edenai_apis.features.ocr.financial_parser import (
FinancialBankInformation,
FinancialBarcode,
FinancialCustomerInformation,
FinancialDocumentInformation,
FinancialDocumentMetadata,
FinancialLineItem,
FinancialLocalInformation,
FinancialMerchantInformation,
FinancialParserDataClass,
FinancialParserObjectDataClass,
FinancialPaymentInformation,
)
from edenai_apis.features.ocr.identity_parser import (
IdentityParserDataClass,
InfoCountry,
Expand All @@ -10,14 +23,12 @@
)
from edenai_apis.features.ocr.invoice_parser import (
BankInvoice,
CustomerInformationInvoice,
InfosInvoiceParserDataClass,
InvoiceParserDataClass,
ItemLinesInvoice,
TaxesInvoice,
)
from edenai_apis.features.ocr.invoice_parser import (
MerchantInformationInvoice,
CustomerInformationInvoice,
TaxesInvoice,
)
from edenai_apis.features.ocr.receipt_parser import (
InfosReceiptParserDataClass,
Expand All @@ -31,36 +42,24 @@
from edenai_apis.features.ocr.resume_parser import (
ResumeEducation,
ResumeEducationEntry,
ResumeLocation,
ResumePersonalInfo,
ResumePersonalName,
ResumeExtractedData,
ResumeLang,
ResumeLocation,
ResumeParserDataClass,
ResumePersonalInfo,
ResumePersonalName,
ResumeSkill,
ResumeWorkExp,
ResumeWorkExpEntry,
)
from edenai_apis.features.ocr.financial_parser import (
FinancialBankInformation,
FinancialBarcode,
FinancialCustomerInformation,
FinancialDocumentInformation,
FinancialDocumentMetadata,
FinancialLineItem,
FinancialLocalInformation,
FinancialMerchantInformation,
FinancialParserDataClass,
FinancialParserObjectDataClass,
FinancialPaymentInformation,
)
from edenai_apis.utils.conversion import (
combine_date_with_time,
convert_string_to_number,
)
from .models import Document, DocumentError, DocumentMeta
from edenai_apis.utils.parsing import extract

from .models import Document, DocumentError, DocumentMeta


class ResumeStandardizer:
__document: Document
Expand Down Expand Up @@ -113,13 +112,19 @@ def std_personnal_information(self) -> ResumePersonalInfo:
name=self.__std_names(),
address=self.__std_location(key="location"),
phones=[
phone.get("raw")
phone["raw"]
for phone in self.__data.get("phoneNumber", []) or []
if phone.get("raw")
],
mails=[
email["parsed"]
for email in self.__data.get("email", []) or []
if email.get("parsed")
],
mails=[email.get("parsed") for email in self.__data.get("email", []) or []],
urls=[
website.get("raw")
website["raw"]
for website in self.__data.get("website", []) or []
if website.get("raw")
],
self_summary=extract(self.__data, ["summary", "parsed"]),
current_profession=self.__data.get("profession"),
Expand Down
Loading