diff --git a/docs/business_card_v1.md b/docs/business_card_v1.md new file mode 100644 index 000000000..8f2f3e87b --- /dev/null +++ b/docs/business_card_v1.md @@ -0,0 +1,194 @@ +--- +title: Business Card OCR Java +category: 622b805aaec68102ea7fcbc2 +slug: java-business-card-ocr +parentDoc: 631a062c3718850f3519b793 +--- +The Java OCR SDK supports the [Business Card API](https://platform.mindee.com/mindee/business_card). + +Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/business_card/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. +![Business Card sample](https://github.com/mindee/client-lib-test-data/blob/main/products/business_card/default_sample.jpg?raw=true) + +# Quick-Start +```java +import com.mindee.MindeeClient; +import com.mindee.input.LocalInputSource; +import com.mindee.parsing.common.AsyncPredictResponse; +import com.mindee.product.businesscard.BusinessCardV1; +import java.io.File; +import java.io.IOException; + +public class SimpleMindeeClient { + + public static void main(String[] args) throws IOException, InterruptedException { + String apiKey = "my-api-key"; + String filePath = "/path/to/the/file.ext"; + + // Init a new client + MindeeClient mindeeClient = new MindeeClient(apiKey); + + // Load a file from disk + LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + + // Parse the file asynchronously + AsyncPredictResponse response = mindeeClient.enqueueAndParse( + BusinessCardV1.class, + inputSource + ); + + // Print a summary of the response + System.out.println(response.toString()); + + // Print a summary of the predictions +// System.out.println(response.getDocumentObj().toString()); + + // Print the document-level predictions +// System.out.println(response.getDocumentObj().getInference().getPrediction().toString()); + + // Print the page-level predictions +// response.getDocumentObj().getInference().getPages().forEach( +// page -> System.out.println(page.toString()) +// ); + } + +} + +``` + +**Output (RST):** +```rst +######## +Document +######## +:Mindee ID: 6f9a261f-7609-4687-9af0-46a45156566e +:Filename: default_sample.jpg + +Inference +######### +:Product: mindee/business_card v1.0 +:Rotation applied: Yes + +Prediction +========== +:Firstname: Andrew +:Lastname: Morin +:Job Title: Founder & CEO +:Company: RemoteGlobal +:Email: amorin@remoteglobalconsulting.com +:Phone Number: +14015555555 +:Mobile Number: +13015555555 +:Fax Number: +14015555556 +:Address: 178 Main Avenue, Providence, RI 02111 +:Website: www.remoteglobalconsulting.com +:Social Media: https://www.linkedin.com/in/johndoe + https://twitter.com/johndoe +``` + +# Field Types +## Standard Fields +These fields are generic and used in several products. + +### BaseField +Each prediction object contains a set of fields that inherit from the generic `BaseField` class. +A typical `BaseField` object will have the following attributes: + +* **confidence** (`Double`): the confidence score of the field prediction. +* **boundingBox** (`Polygon`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. +* **polygon** (`Polygon`): contains the relative vertices coordinates (`polygon` extends `List`) of a polygon containing the field in the image. +* **pageId** (`Integer`): the ID of the page, always `null` when at document-level. + +> **Note:** A `Point` simply refers to a List of `Double`. + + +Aside from the previous attributes, all basic fields have access to a custom `toString` method that can be used to print their value as a string. + +### StringField +The text field `StringField` extends `BaseField`, but also implements: +* **value** (`String`): corresponds to the field value. +* **rawValue** (`String`): corresponds to the raw value as it appears on the document. + +# Attributes +The following fields are extracted for Business Card V1: + +## Address +**address**: The address of the person. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getAddress().value); +``` + +## Company +**company**: The company the person works for. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getCompany().value); +``` + +## Email +**email**: The email address of the person. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getEmail().value); +``` + +## Fax Number +**faxNumber**: The Fax number of the person. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getFaxNumber().value); +``` + +## Firstname +**firstname**: The given name of the person. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getFirstname().value); +``` + +## Job Title +**jobTitle**: The job title of the person. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getJobTitle().value); +``` + +## Lastname +**lastname**: The lastname of the person. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getLastname().value); +``` + +## Mobile Number +**mobileNumber**: The mobile number of the person. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getMobileNumber().value); +``` + +## Phone Number +**phoneNumber**: The phone number of the person. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getPhoneNumber().value); +``` + +## Social Media +**socialMedia**: The social media profiles of the person or company. + +```java +for (socialMediaElem : result.getDocument().getInference().getPrediction().getSocialMedia()) +{ + System.out.println(socialMediaElem.value); +} +``` + +## Website +**website**: The website of the person or company. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getWebsite().value); +``` + +# Questions? +[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/code_samples/business_card_v1_async.txt b/docs/code_samples/business_card_v1_async.txt new file mode 100644 index 000000000..c8ceefdf3 --- /dev/null +++ b/docs/code_samples/business_card_v1_async.txt @@ -0,0 +1,41 @@ +import com.mindee.MindeeClient; +import com.mindee.input.LocalInputSource; +import com.mindee.parsing.common.AsyncPredictResponse; +import com.mindee.product.businesscard.BusinessCardV1; +import java.io.File; +import java.io.IOException; + +public class SimpleMindeeClient { + + public static void main(String[] args) throws IOException, InterruptedException { + String apiKey = "my-api-key"; + String filePath = "/path/to/the/file.ext"; + + // Init a new client + MindeeClient mindeeClient = new MindeeClient(apiKey); + + // Load a file from disk + LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + + // Parse the file asynchronously + AsyncPredictResponse response = mindeeClient.enqueueAndParse( + BusinessCardV1.class, + inputSource + ); + + // Print a summary of the response + System.out.println(response.toString()); + + // Print a summary of the predictions +// System.out.println(response.getDocumentObj().toString()); + + // Print the document-level predictions +// System.out.println(response.getDocumentObj().getInference().getPrediction().toString()); + + // Print the page-level predictions +// response.getDocumentObj().getInference().getPages().forEach( +// page -> System.out.println(page.toString()) +// ); + } + +} diff --git a/docs/code_samples/delivery_notes_v1_async.txt b/docs/code_samples/delivery_notes_v1_async.txt new file mode 100644 index 000000000..aaf2743ae --- /dev/null +++ b/docs/code_samples/delivery_notes_v1_async.txt @@ -0,0 +1,41 @@ +import com.mindee.MindeeClient; +import com.mindee.input.LocalInputSource; +import com.mindee.parsing.common.AsyncPredictResponse; +import com.mindee.product.deliverynote.DeliveryNoteV1; +import java.io.File; +import java.io.IOException; + +public class SimpleMindeeClient { + + public static void main(String[] args) throws IOException, InterruptedException { + String apiKey = "my-api-key"; + String filePath = "/path/to/the/file.ext"; + + // Init a new client + MindeeClient mindeeClient = new MindeeClient(apiKey); + + // Load a file from disk + LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + + // Parse the file asynchronously + AsyncPredictResponse response = mindeeClient.enqueueAndParse( + DeliveryNoteV1.class, + inputSource + ); + + // Print a summary of the response + System.out.println(response.toString()); + + // Print a summary of the predictions +// System.out.println(response.getDocumentObj().toString()); + + // Print the document-level predictions +// System.out.println(response.getDocumentObj().getInference().getPrediction().toString()); + + // Print the page-level predictions +// response.getDocumentObj().getInference().getPages().forEach( +// page -> System.out.println(page.toString()) +// ); + } + +} diff --git a/docs/code_samples/ind_passport_v1_async.txt b/docs/code_samples/ind_passport_v1_async.txt new file mode 100644 index 000000000..fea275bca --- /dev/null +++ b/docs/code_samples/ind_passport_v1_async.txt @@ -0,0 +1,41 @@ +import com.mindee.MindeeClient; +import com.mindee.input.LocalInputSource; +import com.mindee.parsing.common.AsyncPredictResponse; +import com.mindee.product.ind.indianpassport.IndianPassportV1; +import java.io.File; +import java.io.IOException; + +public class SimpleMindeeClient { + + public static void main(String[] args) throws IOException, InterruptedException { + String apiKey = "my-api-key"; + String filePath = "/path/to/the/file.ext"; + + // Init a new client + MindeeClient mindeeClient = new MindeeClient(apiKey); + + // Load a file from disk + LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + + // Parse the file asynchronously + AsyncPredictResponse response = mindeeClient.enqueueAndParse( + IndianPassportV1.class, + inputSource + ); + + // Print a summary of the response + System.out.println(response.toString()); + + // Print a summary of the predictions +// System.out.println(response.getDocumentObj().toString()); + + // Print the document-level predictions +// System.out.println(response.getDocumentObj().getInference().getPrediction().toString()); + + // Print the page-level predictions +// response.getDocumentObj().getInference().getPages().forEach( +// page -> System.out.println(page.toString()) +// ); + } + +} diff --git a/docs/delivery_notes_v1.md b/docs/delivery_notes_v1.md new file mode 100644 index 000000000..388449498 --- /dev/null +++ b/docs/delivery_notes_v1.md @@ -0,0 +1,158 @@ +--- +title: Delivery note OCR Java +category: 622b805aaec68102ea7fcbc2 +slug: java-delivery-note-ocr +parentDoc: 631a062c3718850f3519b793 +--- +The Java OCR SDK supports the [Delivery note API](https://platform.mindee.com/mindee/delivery_notes). + +Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/delivery_notes/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. +![Delivery note sample](https://github.com/mindee/client-lib-test-data/blob/main/products/delivery_notes/default_sample.jpg?raw=true) + +# Quick-Start +```java +import com.mindee.MindeeClient; +import com.mindee.input.LocalInputSource; +import com.mindee.parsing.common.AsyncPredictResponse; +import com.mindee.product.deliverynote.DeliveryNoteV1; +import java.io.File; +import java.io.IOException; + +public class SimpleMindeeClient { + + public static void main(String[] args) throws IOException, InterruptedException { + String apiKey = "my-api-key"; + String filePath = "/path/to/the/file.ext"; + + // Init a new client + MindeeClient mindeeClient = new MindeeClient(apiKey); + + // Load a file from disk + LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + + // Parse the file asynchronously + AsyncPredictResponse response = mindeeClient.enqueueAndParse( + DeliveryNoteV1.class, + inputSource + ); + + // Print a summary of the response + System.out.println(response.toString()); + + // Print a summary of the predictions +// System.out.println(response.getDocumentObj().toString()); + + // Print the document-level predictions +// System.out.println(response.getDocumentObj().getInference().getPrediction().toString()); + + // Print the page-level predictions +// response.getDocumentObj().getInference().getPages().forEach( +// page -> System.out.println(page.toString()) +// ); + } + +} + +``` + +**Output (RST):** +```rst +######## +Document +######## +:Mindee ID: d5ead821-edec-4d31-a69a-cf3998d9a506 +:Filename: default_sample.jpg + +Inference +######### +:Product: mindee/delivery_notes v1.0 +:Rotation applied: Yes + +Prediction +========== +:Delivery Date: 2019-10-02 +:Delivery Number: INT-001 +:Supplier Name: John Smith +:Supplier Address: 4490 Oak Drive, Albany, NY 12210 +:Customer Name: Jessie M Horne +:Customer Address: 4312 Wood Road, New York, NY 10031 +:Total Amount: 204.75 +``` + +# Field Types +## Standard Fields +These fields are generic and used in several products. + +### BaseField +Each prediction object contains a set of fields that inherit from the generic `BaseField` class. +A typical `BaseField` object will have the following attributes: + +* **confidence** (`Double`): the confidence score of the field prediction. +* **boundingBox** (`Polygon`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. +* **polygon** (`Polygon`): contains the relative vertices coordinates (`polygon` extends `List`) of a polygon containing the field in the image. +* **pageId** (`Integer`): the ID of the page, always `null` when at document-level. + +> **Note:** A `Point` simply refers to a List of `Double`. + + +Aside from the previous attributes, all basic fields have access to a custom `toString` method that can be used to print their value as a string. + +### StringField +The text field `StringField` extends `BaseField`, but also implements: +* **value** (`String`): corresponds to the field value. +* **rawValue** (`String`): corresponds to the raw value as it appears on the document. + +# Attributes +The following fields are extracted for Delivery note V1: + +## Customer Address +**customerAddress**: The Customer Address field is used to store the address of the customer receiving the goods. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getCustomerAddress().value); +``` + +## Customer Name +**customerName**: The Customer Name field is used to store the name of the customer who is receiving the goods. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getCustomerName().value); +``` + +## Delivery Date +**deliveryDate**: Delivery Date is the date when the goods are expected to be delivered to the customer. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getDeliveryDate().value); +``` + +## Delivery Number +**deliveryNumber**: Delivery Number is a unique identifier for a Global Delivery Note document. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getDeliveryNumber().value); +``` + +## Supplier Address +**supplierAddress**: The Supplier Address field is used to store the address of the supplier from whom the goods were purchased. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getSupplierAddress().value); +``` + +## Supplier Name +**supplierName**: Supplier Name field is used to capture the name of the supplier from whom the goods are being received. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getSupplierName().value); +``` + +## Total Amount +**totalAmount**: Total Amount field is the sum of all line items on the Global Delivery Note. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getTotalAmount().value); +``` + +# Questions? +[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/financial_document_v1.md b/docs/financial_document_v1.md index fea87f16d..a1aa024ea 100644 --- a/docs/financial_document_v1.md +++ b/docs/financial_document_v1.md @@ -107,17 +107,17 @@ public class SimpleMindeeClient { ######## Document ######## -:Mindee ID: 340ee4ae-b4da-41f0-b5ea-81ae29852b57 +:Mindee ID: b26161ce-35d0-4984-b1ff-886645e160e6 :Filename: default_sample.jpg Inference ######### -:Product: mindee/financial_document v1.10 +:Product: mindee/financial_document v1.11 :Rotation applied: Yes Prediction ========== -:Locale: en; en; USD; +:Locale: en-US; en; US; USD; :Invoice Number: INT-001 :Purchase Order Number: 2412/2019 :Receipt Number: @@ -169,7 +169,7 @@ Page Predictions Page 0 ------ -:Locale: en; en; USD; +:Locale: en-US; en; US; USD; :Invoice Number: INT-001 :Purchase Order Number: 2412/2019 :Receipt Number: diff --git a/docs/ind_passport_v1.md b/docs/ind_passport_v1.md new file mode 100644 index 000000000..5d93194b7 --- /dev/null +++ b/docs/ind_passport_v1.md @@ -0,0 +1,307 @@ +--- +title: IND Passport - India OCR Java +category: 622b805aaec68102ea7fcbc2 +slug: java-ind-passport---india-ocr +parentDoc: 631a062c3718850f3519b793 +--- +The Java OCR SDK supports the [Passport - India API](https://platform.mindee.com/mindee/ind_passport). + +Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/ind_passport/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. +![Passport - India sample](https://github.com/mindee/client-lib-test-data/blob/main/products/ind_passport/default_sample.jpg?raw=true) + +# Quick-Start +```java +import com.mindee.MindeeClient; +import com.mindee.input.LocalInputSource; +import com.mindee.parsing.common.AsyncPredictResponse; +import com.mindee.product.ind.indianpassport.IndianPassportV1; +import java.io.File; +import java.io.IOException; + +public class SimpleMindeeClient { + + public static void main(String[] args) throws IOException, InterruptedException { + String apiKey = "my-api-key"; + String filePath = "/path/to/the/file.ext"; + + // Init a new client + MindeeClient mindeeClient = new MindeeClient(apiKey); + + // Load a file from disk + LocalInputSource inputSource = new LocalInputSource(new File(filePath)); + + // Parse the file asynchronously + AsyncPredictResponse response = mindeeClient.enqueueAndParse( + IndianPassportV1.class, + inputSource + ); + + // Print a summary of the response + System.out.println(response.toString()); + + // Print a summary of the predictions +// System.out.println(response.getDocumentObj().toString()); + + // Print the document-level predictions +// System.out.println(response.getDocumentObj().getInference().getPrediction().toString()); + + // Print the page-level predictions +// response.getDocumentObj().getInference().getPages().forEach( +// page -> System.out.println(page.toString()) +// ); + } + +} + +``` + +**Output (RST):** +```rst +######## +Document +######## +:Mindee ID: cf88fd43-eaa1-497a-ba29-a9569a4edaa7 +:Filename: default_sample.jpg + +Inference +######### +:Product: mindee/ind_passport v1.0 +:Rotation applied: Yes + +Prediction +========== +:Page Number: 1 +:Country: IND +:ID Number: J8369854 +:Given Names: JOCELYN MICHELLE +:Surname: DOE +:Birth Date: 1959-09-23 +:Birth Place: GUNDUGOLANU +:Issuance Place: HYDERABAD +:Gender: F +:Issuance Date: 2011-10-11 +:Expiry Date: 2021-10-10 +:MRZ Line 1: P`) of a polygon containing the field in the image. +* **pageId** (`Integer`): the ID of the page, always `null` when at document-level. + +> **Note:** A `Point` simply refers to a List of `Double`. + + +Aside from the previous attributes, all basic fields have access to a custom `toString` method that can be used to print their value as a string. + + +### ClassificationField +The classification field `ClassificationField` extends `BaseField`, but also implements: +* **value** (`strong`): corresponds to the field value. +* **confidence** (`double`): the confidence score of the field prediction. + +> Note: a classification field's `value is always a `String`. + +### StringField +The text field `StringField` extends `BaseField`, but also implements: +* **value** (`String`): corresponds to the field value. +* **rawValue** (`String`): corresponds to the raw value as it appears on the document. + +### DateField +The date field `DateField` extends `BaseField`, but also implements: + +* **value** (`LocalDate`): an accessible representation of the value as a Java object. Can be `null`. + +# Attributes +The following fields are extracted for Passport - India V1: + +## Address Line 1 +**address1**: The first line of the address of the passport holder. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getAddress1().value); +``` + +## Address Line 2 +**address2**: The second line of the address of the passport holder. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getAddress2().value); +``` + +## Address Line 3 +**address3**: The third line of the address of the passport holder. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getAddress3().value); +``` + +## Birth Date +**birthDate**: The birth date of the passport holder, ISO format: YYYY-MM-DD. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getBirthDate().value); +``` + +## Birth Place +**birthPlace**: The birth place of the passport holder. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getBirthPlace().value); +``` + +## Country +**country**: ISO 3166-1 alpha-3 country code (3 letters format). + +```java +System.out.println(result.getDocument().getInference().getPrediction().getCountry().value); +``` + +## Expiry Date +**expiryDate**: The date when the passport will expire, ISO format: YYYY-MM-DD. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getExpiryDate().value); +``` + +## File Number +**fileNumber**: The file number of the passport document. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getFileNumber().value); +``` + +## Gender +**gender**: The gender of the passport holder. + +#### Possible values include: + - M + - F + +```java +System.out.println(result.getDocument().getInference().getPrediction().getGender().value); +``` + +## Given Names +**givenNames**: The given names of the passport holder. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getGivenNames().value); +``` + +## ID Number +**idNumber**: The identification number of the passport document. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getIdNumber().value); +``` + +## Issuance Date +**issuanceDate**: The date when the passport was issued, ISO format: YYYY-MM-DD. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getIssuanceDate().value); +``` + +## Issuance Place +**issuancePlace**: The place where the passport was issued. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getIssuancePlace().value); +``` + +## Legal Guardian +**legalGuardian**: The name of the legal guardian of the passport holder (if applicable). + +```java +System.out.println(result.getDocument().getInference().getPrediction().getLegalGuardian().value); +``` + +## MRZ Line 1 +**mrz1**: The first line of the machine-readable zone (MRZ) of the passport document. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getMrz1().value); +``` + +## MRZ Line 2 +**mrz2**: The second line of the machine-readable zone (MRZ) of the passport document. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getMrz2().value); +``` + +## Name of Mother +**nameOfMother**: The name of the mother of the passport holder. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getNameOfMother().value); +``` + +## Name of Spouse +**nameOfSpouse**: The name of the spouse of the passport holder (if applicable). + +```java +System.out.println(result.getDocument().getInference().getPrediction().getNameOfSpouse().value); +``` + +## Old Passport Date of Issue +**oldPassportDateOfIssue**: The date of issue of the old passport (if applicable), ISO format: YYYY-MM-DD. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getOldPassportDateOfIssue().value); +``` + +## Old Passport Number +**oldPassportNumber**: The number of the old passport (if applicable). + +```java +System.out.println(result.getDocument().getInference().getPrediction().getOldPassportNumber().value); +``` + +## Old Passport Place of Issue +**oldPassportPlaceOfIssue**: The place of issue of the old passport (if applicable). + +```java +System.out.println(result.getDocument().getInference().getPrediction().getOldPassportPlaceOfIssue().value); +``` + +## Page Number +**pageNumber**: The page number of the passport document. + +#### Possible values include: + - 1 + - 2 + +```java +System.out.println(result.getDocument().getInference().getPrediction().getPageNumber().value); +``` + +## Surname +**surname**: The surname of the passport holder. + +```java +System.out.println(result.getDocument().getInference().getPrediction().getSurname().value); +``` + +# Questions? +[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/invoices_v4.md b/docs/invoices_v4.md index 4b9fbcdaa..28b20c593 100644 --- a/docs/invoices_v4.md +++ b/docs/invoices_v4.md @@ -107,23 +107,23 @@ public class SimpleMindeeClient { ######## Document ######## -:Mindee ID: 651b6417-bc50-496e-aa81-207219f0b9f4 +:Mindee ID: a67b70ea-4b1e-4eac-ae75-dda47a7064ae :Filename: default_sample.jpg Inference ######### -:Product: mindee/invoices v4.8 +:Product: mindee/invoices v4.9 :Rotation applied: Yes Prediction ========== -:Locale: en; en; CAD; +:Locale: en-CA; en; CA; CAD; :Invoice Number: 14 :Purchase Order Number: AD29094 :Reference Numbers: AD29094 :Purchase Date: 2018-09-25 -:Due Date: -:Payment Date: +:Due Date: 2011-12-01 +:Payment Date: 2011-12-01 :Total Net: 2145.00 :Total Amount: 2608.20 :Total Tax: 193.20 @@ -163,13 +163,13 @@ Page Predictions Page 0 ------ -:Locale: en; en; CAD; +:Locale: en-CA; en; CA; CAD; :Invoice Number: 14 :Purchase Order Number: AD29094 :Reference Numbers: AD29094 :Purchase Date: 2018-09-25 -:Due Date: -:Payment Date: +:Due Date: 2011-12-01 +:Payment Date: 2011-12-01 :Total Net: 2145.00 :Total Amount: 2608.20 :Total Tax: 193.20 diff --git a/docs/resume_v1.md b/docs/resume_v1.md index 66c66d939..7ba993e91 100644 --- a/docs/resume_v1.md +++ b/docs/resume_v1.md @@ -60,13 +60,13 @@ public class SimpleMindeeClient { ######## Document ######## -:Mindee ID: bc80bae0-af75-4464-95a9-2419403c75bf +:Mindee ID: 9daa3085-152c-454e-9245-636f13fc9dc3 :Filename: default_sample.jpg Inference ######### -:Product: mindee/resume v1.0 -:Rotation applied: No +:Product: mindee/resume v1.1 +:Rotation applied: Yes Prediction ========== @@ -76,8 +76,8 @@ Prediction :Surnames: Morgan :Nationality: :Email Address: christoper.m@gmail.com -:Phone Number: +44 (0) 20 7666 8555 -:Address: 177 Great Portland Street, London W5W 6PQ +:Phone Number: +44 (0)20 7666 8555 +:Address: 177 Great Portland Street, London, W5W 6PQ :Social Networks: +----------------------+----------------------------------------------------+ | Name | URL | @@ -94,38 +94,37 @@ Prediction +----------+----------------------+ | ZHO | Beginner | +----------+----------------------+ - | DEU | Intermediate | + | DEU | Beginner | +----------+----------------------+ :Hard Skills: HTML5 PHP OOP JavaScript CSS MySQL + SQL :Soft Skills: Project management + Creative design Strong decision maker Innovative Complex problem solver - Creative design Service-focused :Education: +-----------------+---------------------------+-----------+----------+---------------------------+-------------+------------+ | Domain | Degree | End Month | End Year | School | Start Month | Start Year | +=================+===========================+===========+==========+===========================+=============+============+ - | Computer Inf... | Bachelor | | | Columbia University, NY | | 2014 | + | Computer Inf... | Bachelor | | 2014 | Columbia University, NY | | | +-----------------+---------------------------+-----------+----------+---------------------------+-------------+------------+ :Professional Experiences: - +-----------------+------------+---------------------------+-----------+----------+----------------------+-------------+------------+ - | Contract Type | Department | Employer | End Month | End Year | Role | Start Month | Start Year | - +=================+============+===========================+===========+==========+======================+=============+============+ - | Full-Time | | Luna Web Design, New York | 05 | 2019 | Web Developer | 09 | 2015 | - +-----------------+------------+---------------------------+-----------+----------+----------------------+-------------+------------+ + +-----------------+------------+--------------------------------------+---------------------------+-----------+----------+----------------------+-------------+------------+ + | Contract Type | Department | Description | Employer | End Month | End Year | Role | Start Month | Start Year | + +=================+============+======================================+===========================+===========+==========+======================+=============+============+ + | | | Cooperate with designers to creat... | Luna Web Design, New York | 05 | 2019 | Web Developer | 09 | 2015 | + +-----------------+------------+--------------------------------------+---------------------------+-----------+----------+----------------------+-------------+------------+ :Certificates: +------------+--------------------------------+---------------------------+------+ | Grade | Name | Provider | Year | +============+================================+===========================+======+ - | | PHP Framework (certificate)... | | 2014 | - +------------+--------------------------------+---------------------------+------+ - | | Programming Languages: Java... | | | + | | PHP Framework (certificate)... | | | +------------+--------------------------------+---------------------------+------+ ``` @@ -197,6 +196,7 @@ A `ResumeV1Language` implements the following attributes: * **level** (`String`): The candidate's level for the language. #### Possible values include: + - Native - Fluent - Proficient - Intermediate @@ -218,6 +218,7 @@ A `ResumeV1ProfessionalExperience` implements the following attributes: - Freelance * **department** (`String`): The specific department or division within the company. +* **description** (`String`): The description of the professional experience as written in the document. * **employer** (`String`): The name of the company or organization. * **endMonth** (`String`): The month when the professional experience ended. * **endYear** (`String`): The year when the professional experience ended. diff --git a/src/main/java/com/mindee/AsyncPollingOptions.java b/src/main/java/com/mindee/AsyncPollingOptions.java index 1b27d8a73..23390af69 100644 --- a/src/main/java/com/mindee/AsyncPollingOptions.java +++ b/src/main/java/com/mindee/AsyncPollingOptions.java @@ -27,8 +27,8 @@ private AsyncPollingOptions( Double intervalSec, Integer maxRetries ) { - this.initialDelaySec = initialDelaySec == null ? 4.0 : initialDelaySec; - this.intervalSec = intervalSec == null ? 2.0 : intervalSec; + this.initialDelaySec = initialDelaySec == null ? 2.0 : initialDelaySec; + this.intervalSec = intervalSec == null ? 1.5 : intervalSec; this.maxRetries = maxRetries == null ? 30 : maxRetries; } } diff --git a/src/main/java/com/mindee/MindeeClient.java b/src/main/java/com/mindee/MindeeClient.java index 78f9829d3..19db40d47 100644 --- a/src/main/java/com/mindee/MindeeClient.java +++ b/src/main/java/com/mindee/MindeeClient.java @@ -261,7 +261,7 @@ public AsyncPredictResponse enqueueAndParse( private void validateAsyncParams(AsyncPollingOptions pollingOptions) throws MindeeException { Double minimumInitialDelaySec = 1.0; - Double minimumIntervalSec = 2.0; + Double minimumIntervalSec = 1.0; Integer minimumRetry = 2; if (pollingOptions.getInitialDelaySec() < minimumInitialDelaySec) { throw new MindeeException(String.format( diff --git a/src/main/java/com/mindee/product/businesscard/BusinessCardV1.java b/src/main/java/com/mindee/product/businesscard/BusinessCardV1.java new file mode 100644 index 000000000..9cfd76b27 --- /dev/null +++ b/src/main/java/com/mindee/product/businesscard/BusinessCardV1.java @@ -0,0 +1,16 @@ +package com.mindee.product.businesscard; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.mindee.http.EndpointInfo; +import com.mindee.parsing.common.Inference; +import lombok.Getter; + +/** + * Business Card API version 1 inference prediction. + */ +@Getter +@JsonIgnoreProperties(ignoreUnknown = true) +@EndpointInfo(endpointName = "business_card", version = "1") +public class BusinessCardV1 + extends Inference { +} diff --git a/src/main/java/com/mindee/product/businesscard/BusinessCardV1Document.java b/src/main/java/com/mindee/product/businesscard/BusinessCardV1Document.java new file mode 100644 index 000000000..99c72783b --- /dev/null +++ b/src/main/java/com/mindee/product/businesscard/BusinessCardV1Document.java @@ -0,0 +1,136 @@ +package com.mindee.product.businesscard; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.mindee.parsing.SummaryHelper; +import com.mindee.parsing.common.Prediction; +import com.mindee.parsing.standard.StringField; +import java.util.ArrayList; +import java.util.List; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +/** + * Business Card API version 1.0 document data. + */ +@Getter +@EqualsAndHashCode(callSuper = false) +@JsonIgnoreProperties(ignoreUnknown = true) +public class BusinessCardV1Document extends Prediction { + + /** + * The address of the person. + */ + @JsonProperty("address") + protected StringField address; + /** + * The company the person works for. + */ + @JsonProperty("company") + protected StringField company; + /** + * The email address of the person. + */ + @JsonProperty("email") + protected StringField email; + /** + * The Fax number of the person. + */ + @JsonProperty("fax_number") + protected StringField faxNumber; + /** + * The given name of the person. + */ + @JsonProperty("firstname") + protected StringField firstname; + /** + * The job title of the person. + */ + @JsonProperty("job_title") + protected StringField jobTitle; + /** + * The lastname of the person. + */ + @JsonProperty("lastname") + protected StringField lastname; + /** + * The mobile number of the person. + */ + @JsonProperty("mobile_number") + protected StringField mobileNumber; + /** + * The phone number of the person. + */ + @JsonProperty("phone_number") + protected StringField phoneNumber; + /** + * The social media profiles of the person or company. + */ + @JsonProperty("social_media") + protected List socialMedia = new ArrayList<>(); + /** + * The website of the person or company. + */ + @JsonProperty("website") + protected StringField website; + + @Override + public boolean isEmpty() { + return ( + this.firstname == null + && this.lastname == null + && this.jobTitle == null + && this.company == null + && this.email == null + && this.phoneNumber == null + && this.mobileNumber == null + && this.faxNumber == null + && this.address == null + && this.website == null + && (this.socialMedia == null || this.socialMedia.isEmpty()) + ); + } + + @Override + public String toString() { + StringBuilder outStr = new StringBuilder(); + outStr.append( + String.format(":Firstname: %s%n", this.getFirstname()) + ); + outStr.append( + String.format(":Lastname: %s%n", this.getLastname()) + ); + outStr.append( + String.format(":Job Title: %s%n", this.getJobTitle()) + ); + outStr.append( + String.format(":Company: %s%n", this.getCompany()) + ); + outStr.append( + String.format(":Email: %s%n", this.getEmail()) + ); + outStr.append( + String.format(":Phone Number: %s%n", this.getPhoneNumber()) + ); + outStr.append( + String.format(":Mobile Number: %s%n", this.getMobileNumber()) + ); + outStr.append( + String.format(":Fax Number: %s%n", this.getFaxNumber()) + ); + outStr.append( + String.format(":Address: %s%n", this.getAddress()) + ); + outStr.append( + String.format(":Website: %s%n", this.getWebsite()) + ); + String socialMedia = SummaryHelper.arrayToString( + this.getSocialMedia(), + "%n " + ); + outStr.append( + String.format(":Social Media: %s%n", socialMedia) + ); + return SummaryHelper.cleanSummary(outStr.toString()); + } +} diff --git a/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1.java b/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1.java new file mode 100644 index 000000000..d953e0e92 --- /dev/null +++ b/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1.java @@ -0,0 +1,16 @@ +package com.mindee.product.deliverynote; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.mindee.http.EndpointInfo; +import com.mindee.parsing.common.Inference; +import lombok.Getter; + +/** + * Delivery note API version 1 inference prediction. + */ +@Getter +@JsonIgnoreProperties(ignoreUnknown = true) +@EndpointInfo(endpointName = "delivery_notes", version = "1") +public class DeliveryNoteV1 + extends Inference { +} diff --git a/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1Document.java b/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1Document.java new file mode 100644 index 000000000..13bc549ec --- /dev/null +++ b/src/main/java/com/mindee/product/deliverynote/DeliveryNoteV1Document.java @@ -0,0 +1,94 @@ +package com.mindee.product.deliverynote; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.mindee.parsing.SummaryHelper; +import com.mindee.parsing.common.Prediction; +import com.mindee.parsing.standard.StringField; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +/** + * Delivery note API version 1.0 document data. + */ +@Getter +@EqualsAndHashCode(callSuper = false) +@JsonIgnoreProperties(ignoreUnknown = true) +public class DeliveryNoteV1Document extends Prediction { + + /** + * The Customer Address field is used to store the address of the customer receiving the goods. + */ + @JsonProperty("customer_address") + protected StringField customerAddress; + /** + * The Customer Name field is used to store the name of the customer who is receiving the goods. + */ + @JsonProperty("customer_name") + protected StringField customerName; + /** + * Delivery Date is the date when the goods are expected to be delivered to the customer. + */ + @JsonProperty("delivery_date") + protected StringField deliveryDate; + /** + * Delivery Number is a unique identifier for a Global Delivery Note document. + */ + @JsonProperty("delivery_number") + protected StringField deliveryNumber; + /** + * The Supplier Address field is used to store the address of the supplier from whom the goods were purchased. + */ + @JsonProperty("supplier_address") + protected StringField supplierAddress; + /** + * Supplier Name field is used to capture the name of the supplier from whom the goods are being received. + */ + @JsonProperty("supplier_name") + protected StringField supplierName; + /** + * Total Amount field is the sum of all line items on the Global Delivery Note. + */ + @JsonProperty("total_amount") + protected StringField totalAmount; + + @Override + public boolean isEmpty() { + return ( + this.deliveryDate == null + && this.deliveryNumber == null + && this.supplierName == null + && this.supplierAddress == null + && this.customerName == null + && this.customerAddress == null + && this.totalAmount == null + ); + } + + @Override + public String toString() { + StringBuilder outStr = new StringBuilder(); + outStr.append( + String.format(":Delivery Date: %s%n", this.getDeliveryDate()) + ); + outStr.append( + String.format(":Delivery Number: %s%n", this.getDeliveryNumber()) + ); + outStr.append( + String.format(":Supplier Name: %s%n", this.getSupplierName()) + ); + outStr.append( + String.format(":Supplier Address: %s%n", this.getSupplierAddress()) + ); + outStr.append( + String.format(":Customer Name: %s%n", this.getCustomerName()) + ); + outStr.append( + String.format(":Customer Address: %s%n", this.getCustomerAddress()) + ); + outStr.append( + String.format(":Total Amount: %s%n", this.getTotalAmount()) + ); + return SummaryHelper.cleanSummary(outStr.toString()); + } +} diff --git a/src/main/java/com/mindee/product/financialdocument/FinancialDocumentV1Document.java b/src/main/java/com/mindee/product/financialdocument/FinancialDocumentV1Document.java index 89d3132c5..c8a96897a 100644 --- a/src/main/java/com/mindee/product/financialdocument/FinancialDocumentV1Document.java +++ b/src/main/java/com/mindee/product/financialdocument/FinancialDocumentV1Document.java @@ -20,7 +20,7 @@ import lombok.Getter; /** - * Financial Document API version 1.10 document data. + * Financial Document API version 1.11 document data. */ @Getter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/mindee/product/ind/indianpassport/IndianPassportV1.java b/src/main/java/com/mindee/product/ind/indianpassport/IndianPassportV1.java new file mode 100644 index 000000000..76dfdb7cb --- /dev/null +++ b/src/main/java/com/mindee/product/ind/indianpassport/IndianPassportV1.java @@ -0,0 +1,16 @@ +package com.mindee.product.ind.indianpassport; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.mindee.http.EndpointInfo; +import com.mindee.parsing.common.Inference; +import lombok.Getter; + +/** + * Passport - India API version 1 inference prediction. + */ +@Getter +@JsonIgnoreProperties(ignoreUnknown = true) +@EndpointInfo(endpointName = "ind_passport", version = "1") +public class IndianPassportV1 + extends Inference { +} diff --git a/src/main/java/com/mindee/product/ind/indianpassport/IndianPassportV1Document.java b/src/main/java/com/mindee/product/ind/indianpassport/IndianPassportV1Document.java new file mode 100644 index 000000000..9f034a38a --- /dev/null +++ b/src/main/java/com/mindee/product/ind/indianpassport/IndianPassportV1Document.java @@ -0,0 +1,240 @@ +package com.mindee.product.ind.indianpassport; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.mindee.parsing.SummaryHelper; +import com.mindee.parsing.common.Prediction; +import com.mindee.parsing.standard.ClassificationField; +import com.mindee.parsing.standard.DateField; +import com.mindee.parsing.standard.StringField; +import lombok.EqualsAndHashCode; +import lombok.Getter; + +/** + * Passport - India API version 1.0 document data. + */ +@Getter +@EqualsAndHashCode(callSuper = false) +@JsonIgnoreProperties(ignoreUnknown = true) +public class IndianPassportV1Document extends Prediction { + + /** + * The first line of the address of the passport holder. + */ + @JsonProperty("address1") + protected StringField address1; + /** + * The second line of the address of the passport holder. + */ + @JsonProperty("address2") + protected StringField address2; + /** + * The third line of the address of the passport holder. + */ + @JsonProperty("address3") + protected StringField address3; + /** + * The birth date of the passport holder, ISO format: YYYY-MM-DD. + */ + @JsonProperty("birth_date") + protected DateField birthDate; + /** + * The birth place of the passport holder. + */ + @JsonProperty("birth_place") + protected StringField birthPlace; + /** + * ISO 3166-1 alpha-3 country code (3 letters format). + */ + @JsonProperty("country") + protected StringField country; + /** + * The date when the passport will expire, ISO format: YYYY-MM-DD. + */ + @JsonProperty("expiry_date") + protected DateField expiryDate; + /** + * The file number of the passport document. + */ + @JsonProperty("file_number") + protected StringField fileNumber; + /** + * The gender of the passport holder. + */ + @JsonProperty("gender") + protected ClassificationField gender; + /** + * The given names of the passport holder. + */ + @JsonProperty("given_names") + protected StringField givenNames; + /** + * The identification number of the passport document. + */ + @JsonProperty("id_number") + protected StringField idNumber; + /** + * The date when the passport was issued, ISO format: YYYY-MM-DD. + */ + @JsonProperty("issuance_date") + protected DateField issuanceDate; + /** + * The place where the passport was issued. + */ + @JsonProperty("issuance_place") + protected StringField issuancePlace; + /** + * The name of the legal guardian of the passport holder (if applicable). + */ + @JsonProperty("legal_guardian") + protected StringField legalGuardian; + /** + * The first line of the machine-readable zone (MRZ) of the passport document. + */ + @JsonProperty("mrz1") + protected StringField mrz1; + /** + * The second line of the machine-readable zone (MRZ) of the passport document. + */ + @JsonProperty("mrz2") + protected StringField mrz2; + /** + * The name of the mother of the passport holder. + */ + @JsonProperty("name_of_mother") + protected StringField nameOfMother; + /** + * The name of the spouse of the passport holder (if applicable). + */ + @JsonProperty("name_of_spouse") + protected StringField nameOfSpouse; + /** + * The date of issue of the old passport (if applicable), ISO format: YYYY-MM-DD. + */ + @JsonProperty("old_passport_date_of_issue") + protected DateField oldPassportDateOfIssue; + /** + * The number of the old passport (if applicable). + */ + @JsonProperty("old_passport_number") + protected StringField oldPassportNumber; + /** + * The place of issue of the old passport (if applicable). + */ + @JsonProperty("old_passport_place_of_issue") + protected StringField oldPassportPlaceOfIssue; + /** + * The page number of the passport document. + */ + @JsonProperty("page_number") + protected ClassificationField pageNumber; + /** + * The surname of the passport holder. + */ + @JsonProperty("surname") + protected StringField surname; + + @Override + public boolean isEmpty() { + return ( + this.pageNumber == null + && this.country == null + && this.idNumber == null + && this.givenNames == null + && this.surname == null + && this.birthDate == null + && this.birthPlace == null + && this.issuancePlace == null + && this.gender == null + && this.issuanceDate == null + && this.expiryDate == null + && this.mrz1 == null + && this.mrz2 == null + && this.legalGuardian == null + && this.nameOfSpouse == null + && this.nameOfMother == null + && this.oldPassportDateOfIssue == null + && this.oldPassportNumber == null + && this.address1 == null + && this.address2 == null + && this.address3 == null + && this.oldPassportPlaceOfIssue == null + && this.fileNumber == null + ); + } + + @Override + public String toString() { + StringBuilder outStr = new StringBuilder(); + outStr.append( + String.format(":Page Number: %s%n", this.getPageNumber()) + ); + outStr.append( + String.format(":Country: %s%n", this.getCountry()) + ); + outStr.append( + String.format(":ID Number: %s%n", this.getIdNumber()) + ); + outStr.append( + String.format(":Given Names: %s%n", this.getGivenNames()) + ); + outStr.append( + String.format(":Surname: %s%n", this.getSurname()) + ); + outStr.append( + String.format(":Birth Date: %s%n", this.getBirthDate()) + ); + outStr.append( + String.format(":Birth Place: %s%n", this.getBirthPlace()) + ); + outStr.append( + String.format(":Issuance Place: %s%n", this.getIssuancePlace()) + ); + outStr.append( + String.format(":Gender: %s%n", this.getGender()) + ); + outStr.append( + String.format(":Issuance Date: %s%n", this.getIssuanceDate()) + ); + outStr.append( + String.format(":Expiry Date: %s%n", this.getExpiryDate()) + ); + outStr.append( + String.format(":MRZ Line 1: %s%n", this.getMrz1()) + ); + outStr.append( + String.format(":MRZ Line 2: %s%n", this.getMrz2()) + ); + outStr.append( + String.format(":Legal Guardian: %s%n", this.getLegalGuardian()) + ); + outStr.append( + String.format(":Name of Spouse: %s%n", this.getNameOfSpouse()) + ); + outStr.append( + String.format(":Name of Mother: %s%n", this.getNameOfMother()) + ); + outStr.append( + String.format(":Old Passport Date of Issue: %s%n", this.getOldPassportDateOfIssue()) + ); + outStr.append( + String.format(":Old Passport Number: %s%n", this.getOldPassportNumber()) + ); + outStr.append( + String.format(":Address Line 1: %s%n", this.getAddress1()) + ); + outStr.append( + String.format(":Address Line 2: %s%n", this.getAddress2()) + ); + outStr.append( + String.format(":Address Line 3: %s%n", this.getAddress3()) + ); + outStr.append( + String.format(":Old Passport Place of Issue: %s%n", this.getOldPassportPlaceOfIssue()) + ); + outStr.append( + String.format(":File Number: %s%n", this.getFileNumber()) + ); + return SummaryHelper.cleanSummary(outStr.toString()); + } +} diff --git a/src/main/java/com/mindee/product/invoice/InvoiceV4Document.java b/src/main/java/com/mindee/product/invoice/InvoiceV4Document.java index af22f37ac..b81a1e7f1 100644 --- a/src/main/java/com/mindee/product/invoice/InvoiceV4Document.java +++ b/src/main/java/com/mindee/product/invoice/InvoiceV4Document.java @@ -20,7 +20,7 @@ import lombok.Getter; /** - * Invoice API version 4.8 document data. + * Invoice API version 4.9 document data. */ @Getter @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/mindee/product/resume/ResumeV1Document.java b/src/main/java/com/mindee/product/resume/ResumeV1Document.java index c1c9e6b70..bf6faf4b5 100644 --- a/src/main/java/com/mindee/product/resume/ResumeV1Document.java +++ b/src/main/java/com/mindee/product/resume/ResumeV1Document.java @@ -12,7 +12,7 @@ import lombok.Getter; /** - * Resume API version 1.0 document data. + * Resume API version 1.1 document data. */ @Getter @EqualsAndHashCode(callSuper = false) @@ -232,11 +232,12 @@ public String toString() { ); String professionalExperiencesSummary = ""; if (!this.getProfessionalExperiences().isEmpty()) { - int[] professionalExperiencesColSizes = new int[]{17, 12, 27, 11, 10, 22, 13, 12}; + int[] professionalExperiencesColSizes = new int[]{17, 12, 38, 27, 11, 10, 22, 13, 12}; professionalExperiencesSummary = String.format("%n%s%n ", SummaryHelper.lineSeparator(professionalExperiencesColSizes, "-")) + "| Contract Type " + "| Department " + + "| Description " + "| Employer " + "| End Month " + "| End Year " diff --git a/src/main/java/com/mindee/product/resume/ResumeV1ProfessionalExperience.java b/src/main/java/com/mindee/product/resume/ResumeV1ProfessionalExperience.java index fca723c2a..cd6964539 100644 --- a/src/main/java/com/mindee/product/resume/ResumeV1ProfessionalExperience.java +++ b/src/main/java/com/mindee/product/resume/ResumeV1ProfessionalExperience.java @@ -26,6 +26,11 @@ public class ResumeV1ProfessionalExperience extends BaseField implements LineIte */ @JsonProperty("department") String department; + /** + * The description of the professional experience as written in the document. + */ + @JsonProperty("description") + String description; /** * The name of the company or organization. */ @@ -61,6 +66,7 @@ public boolean isEmpty() { return ( (contractType == null || contractType.isEmpty()) && (department == null || department.isEmpty()) + && (description == null || description.isEmpty()) && (employer == null || employer.isEmpty()) && (endMonth == null || endMonth.isEmpty()) && (endYear == null || endYear.isEmpty()) @@ -75,6 +81,7 @@ private Map tablePrintableValues() { printable.put("contractType", SummaryHelper.formatForDisplay(this.contractType, 15)); printable.put("department", SummaryHelper.formatForDisplay(this.department, 10)); + printable.put("description", SummaryHelper.formatForDisplay(this.description, 36)); printable.put("employer", SummaryHelper.formatForDisplay(this.employer, 25)); printable.put("endMonth", SummaryHelper.formatForDisplay(this.endMonth, null)); printable.put("endYear", SummaryHelper.formatForDisplay(this.endYear, null)); @@ -91,6 +98,7 @@ public String toTableLine() { Map printable = this.tablePrintableValues(); return String.format("| %-15s ", printable.get("contractType")) + String.format("| %-10s ", printable.get("department")) + + String.format("| %-36s ", printable.get("description")) + String.format("| %-25s ", printable.get("employer")) + String.format("| %-9s ", printable.get("endMonth")) + String.format("| %-8s ", printable.get("endYear")) @@ -104,6 +112,7 @@ public String toString() { Map printable = this.printableValues(); return String.format("Contract Type: %s", printable.get("contractType")) + String.format(", Department: %s", printable.get("department")) + + String.format(", Description: %s", printable.get("description")) + String.format(", Employer: %s", printable.get("employer")) + String.format(", End Month: %s", printable.get("endMonth")) + String.format(", End Year: %s", printable.get("endYear")) @@ -117,6 +126,7 @@ private Map printableValues() { printable.put("contractType", SummaryHelper.formatForDisplay(this.contractType, null)); printable.put("department", SummaryHelper.formatForDisplay(this.department, null)); + printable.put("description", SummaryHelper.formatForDisplay(this.description, null)); printable.put("employer", SummaryHelper.formatForDisplay(this.employer, null)); printable.put("endMonth", SummaryHelper.formatForDisplay(this.endMonth, null)); printable.put("endYear", SummaryHelper.formatForDisplay(this.endYear, null)); diff --git a/src/test/java/com/mindee/product/businesscard/BusinessCardV1Test.java b/src/test/java/com/mindee/product/businesscard/BusinessCardV1Test.java new file mode 100644 index 000000000..dca6cf157 --- /dev/null +++ b/src/test/java/com/mindee/product/businesscard/BusinessCardV1Test.java @@ -0,0 +1,60 @@ +package com.mindee.product.businesscard; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.mindee.parsing.common.Document; +import com.mindee.parsing.common.PredictResponse; +import com.mindee.parsing.standard.ClassificationField; +import com.mindee.product.ProductTestHelper; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.IOException; + +/** + * Unit tests for BusinessCardV1. + */ +public class BusinessCardV1Test { + + protected PredictResponse getPrediction(String name) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.findAndRegisterModules(); + + JavaType type = objectMapper.getTypeFactory().constructParametricType( + PredictResponse.class, + BusinessCardV1.class + ); + return objectMapper.readValue( + new File("src/test/resources/products/business_card/response_v1/" + name + ".json"), + type + ); + } + + @Test + void whenEmptyDeserialized_mustHaveValidProperties() throws IOException { + PredictResponse response = getPrediction("empty"); + BusinessCardV1Document docPrediction = response.getDocument().getInference().getPrediction(); + Assertions.assertNull(docPrediction.getFirstname().getValue()); + Assertions.assertNull(docPrediction.getLastname().getValue()); + Assertions.assertNull(docPrediction.getJobTitle().getValue()); + Assertions.assertNull(docPrediction.getCompany().getValue()); + Assertions.assertNull(docPrediction.getEmail().getValue()); + Assertions.assertNull(docPrediction.getPhoneNumber().getValue()); + Assertions.assertNull(docPrediction.getMobileNumber().getValue()); + Assertions.assertNull(docPrediction.getFaxNumber().getValue()); + Assertions.assertNull(docPrediction.getAddress().getValue()); + Assertions.assertNull(docPrediction.getWebsite().getValue()); + Assertions.assertTrue(docPrediction.getSocialMedia().isEmpty()); + } + + @Test + void whenCompleteDeserialized_mustHaveValidDocumentSummary() throws IOException { + PredictResponse response = getPrediction("complete"); + Document doc = response.getDocument(); + ProductTestHelper.assertStringEqualsFile( + doc.toString(), + "src/test/resources/products/business_card/response_v1/summary_full.rst" + ); + } + +} diff --git a/src/test/java/com/mindee/product/deliverynote/DeliveryNoteV1Test.java b/src/test/java/com/mindee/product/deliverynote/DeliveryNoteV1Test.java new file mode 100644 index 000000000..8653d2160 --- /dev/null +++ b/src/test/java/com/mindee/product/deliverynote/DeliveryNoteV1Test.java @@ -0,0 +1,56 @@ +package com.mindee.product.deliverynote; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.mindee.parsing.common.Document; +import com.mindee.parsing.common.PredictResponse; +import com.mindee.parsing.standard.ClassificationField; +import com.mindee.product.ProductTestHelper; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.IOException; + +/** + * Unit tests for DeliveryNoteV1. + */ +public class DeliveryNoteV1Test { + + protected PredictResponse getPrediction(String name) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.findAndRegisterModules(); + + JavaType type = objectMapper.getTypeFactory().constructParametricType( + PredictResponse.class, + DeliveryNoteV1.class + ); + return objectMapper.readValue( + new File("src/test/resources/products/delivery_notes/response_v1/" + name + ".json"), + type + ); + } + + @Test + void whenEmptyDeserialized_mustHaveValidProperties() throws IOException { + PredictResponse response = getPrediction("empty"); + DeliveryNoteV1Document docPrediction = response.getDocument().getInference().getPrediction(); + Assertions.assertNull(docPrediction.getDeliveryDate().getValue()); + Assertions.assertNull(docPrediction.getDeliveryNumber().getValue()); + Assertions.assertNull(docPrediction.getSupplierName().getValue()); + Assertions.assertNull(docPrediction.getSupplierAddress().getValue()); + Assertions.assertNull(docPrediction.getCustomerName().getValue()); + Assertions.assertNull(docPrediction.getCustomerAddress().getValue()); + Assertions.assertNull(docPrediction.getTotalAmount().getValue()); + } + + @Test + void whenCompleteDeserialized_mustHaveValidDocumentSummary() throws IOException { + PredictResponse response = getPrediction("complete"); + Document doc = response.getDocument(); + ProductTestHelper.assertStringEqualsFile( + doc.toString(), + "src/test/resources/products/delivery_notes/response_v1/summary_full.rst" + ); + } + +} diff --git a/src/test/java/com/mindee/product/ind/indianpassport/IndianPassportV1Test.java b/src/test/java/com/mindee/product/ind/indianpassport/IndianPassportV1Test.java new file mode 100644 index 000000000..dd47b743e --- /dev/null +++ b/src/test/java/com/mindee/product/ind/indianpassport/IndianPassportV1Test.java @@ -0,0 +1,72 @@ +package com.mindee.product.ind.indianpassport; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.mindee.parsing.common.Document; +import com.mindee.parsing.common.PredictResponse; +import com.mindee.parsing.standard.ClassificationField; +import com.mindee.product.ProductTestHelper; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.IOException; + +/** + * Unit tests for IndianPassportV1. + */ +public class IndianPassportV1Test { + + protected PredictResponse getPrediction(String name) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.findAndRegisterModules(); + + JavaType type = objectMapper.getTypeFactory().constructParametricType( + PredictResponse.class, + IndianPassportV1.class + ); + return objectMapper.readValue( + new File("src/test/resources/products/ind_passport/response_v1/" + name + ".json"), + type + ); + } + + @Test + void whenEmptyDeserialized_mustHaveValidProperties() throws IOException { + PredictResponse response = getPrediction("empty"); + IndianPassportV1Document docPrediction = response.getDocument().getInference().getPrediction(); + Assertions.assertInstanceOf(ClassificationField.class, docPrediction.getPageNumber()); + Assertions.assertNull(docPrediction.getCountry().getValue()); + Assertions.assertNull(docPrediction.getIdNumber().getValue()); + Assertions.assertNull(docPrediction.getGivenNames().getValue()); + Assertions.assertNull(docPrediction.getSurname().getValue()); + Assertions.assertNull(docPrediction.getBirthDate().getValue()); + Assertions.assertNull(docPrediction.getBirthPlace().getValue()); + Assertions.assertNull(docPrediction.getIssuancePlace().getValue()); + Assertions.assertInstanceOf(ClassificationField.class, docPrediction.getGender()); + Assertions.assertNull(docPrediction.getIssuanceDate().getValue()); + Assertions.assertNull(docPrediction.getExpiryDate().getValue()); + Assertions.assertNull(docPrediction.getMrz1().getValue()); + Assertions.assertNull(docPrediction.getMrz2().getValue()); + Assertions.assertNull(docPrediction.getLegalGuardian().getValue()); + Assertions.assertNull(docPrediction.getNameOfSpouse().getValue()); + Assertions.assertNull(docPrediction.getNameOfMother().getValue()); + Assertions.assertNull(docPrediction.getOldPassportDateOfIssue().getValue()); + Assertions.assertNull(docPrediction.getOldPassportNumber().getValue()); + Assertions.assertNull(docPrediction.getAddress1().getValue()); + Assertions.assertNull(docPrediction.getAddress2().getValue()); + Assertions.assertNull(docPrediction.getAddress3().getValue()); + Assertions.assertNull(docPrediction.getOldPassportPlaceOfIssue().getValue()); + Assertions.assertNull(docPrediction.getFileNumber().getValue()); + } + + @Test + void whenCompleteDeserialized_mustHaveValidDocumentSummary() throws IOException { + PredictResponse response = getPrediction("complete"); + Document doc = response.getDocument(); + ProductTestHelper.assertStringEqualsFile( + doc.toString(), + "src/test/resources/products/ind_passport/response_v1/summary_full.rst" + ); + } + +} diff --git a/src/test/resources b/src/test/resources index e93f49c8a..025c3df9d 160000 --- a/src/test/resources +++ b/src/test/resources @@ -1 +1 @@ -Subproject commit e93f49c8a78ba3d71c35a8fe2219d973cfcb1334 +Subproject commit 025c3df9db4f1ba23e3b7fc86e9539f37ec9ba5e