diff --git a/CHANGELOG.md b/CHANGELOG.md index f22d2f0d..4923caf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Mindee PHP API Library Changelog +## v2.1.0 - 2025-11-13 +### Changes +* :sparkles: add confidence scores comparison operators +* :recycle: update test suite to latest format +### Fixes +* :bug: fix sleep timers not properly taking floats into account +* :bug: fix SDK not working when running in strict types + + ## v2.0.3 - 2025-10-14 ### Changes * :recycle: harmonize getting page count from a local input source diff --git a/composer.json b/composer.json index 18be00f3..b8f65a5a 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "ext-json": "*", "symfony/console": ">=6.0", "setasign/fpdf": "^1.8", - "setasign/fpdi": "^2.6", + "setasign/fpdi": "^2.6.4", "smalot/pdfparser": "^2.12" }, "require-dev": { diff --git a/docs/bank_account_details_v2.md b/docs/bank_account_details_v2.md deleted file mode 100644 index f529365d..00000000 --- a/docs/bank_account_details_v2.md +++ /dev/null @@ -1,140 +0,0 @@ ---- -title: FR Bank Account Details OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-fr-bank-account-details-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Bank Account Details API](https://platform.mindee.com/mindee/bank_account_details). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/bank_account_details/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Bank Account Details sample](https://github.com/mindee/client-lib-test-data/blob/main/products/bank_account_details/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(BankAccountDetailsV2::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: bc8f7265-8dab-49fe-810c-d50049605578 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/bank_account_details v2.0 -:Rotation applied: Yes - -Prediction -========== -:Account Holder's Names: MME HEGALALDIA L ENVOL -:Basic Bank Account Number: - :Bank Code: 13335 - :Branch Code: 00040 - :Key: 06 - :Account Number: 08932891361 -:IBAN: FR7613335000400893289136106 -:SWIFT Code: CEPAFRPP333 - -Page Predictions -================ - -Page 0 ------- -:Account Holder's Names: MME HEGALALDIA L ENVOL -:Basic Bank Account Number: - :Bank Code: 13335 - :Branch Code: 00040 - :Key: 06 - :Account Number: 08932891361 -:IBAN: FR7613335000400893289136106 -:SWIFT Code: CEPAFRPP333 -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Basic Bank Account Number Field -Full extraction of BBAN, including: branch code, bank code, account and key. - -A `BankAccountDetailsV2Bban` implements the following attributes: - -* **bbanBankCode** (`string`): The BBAN bank code outputted as a string. -* **bbanBranchCode** (`string`): The BBAN branch code outputted as a string. -* **bbanKey** (`string`): The BBAN key outputted as a string. -* **bbanNumber** (`string`): The BBAN Account number outputted as a string. - -# Attributes -The following fields are extracted for Bank Account Details V2: - -## Account Holder's Names -**accountHoldersNames** : Full extraction of the account holders names. - -```php -echo $result->document->inference->prediction->accountHoldersNames->value; -``` - -## Basic Bank Account Number -**bban** ([BankAccountDetailsV2Bban](#basic-bank-account-number-field)): Full extraction of BBAN, including: branch code, bank code, account and key. - -```php -echo $result->document->inference->prediction->bban->value; -``` - -## IBAN -**iban** : Full extraction of the IBAN number. - -```php -echo $result->document->inference->prediction->iban->value; -``` - -## SWIFT Code -**swiftCode** : Full extraction of the SWIFT code. - -```php -echo $result->document->inference->prediction->swiftCode->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/bank_check_v1.md b/docs/bank_check_v1.md deleted file mode 100644 index 7254a44d..00000000 --- a/docs/bank_check_v1.md +++ /dev/null @@ -1,189 +0,0 @@ ---- -title: US Bank Check OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-us-bank-check-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Bank Check API](https://platform.mindee.com/mindee/bank_check). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/bank_check/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Bank Check sample](https://github.com/mindee/client-lib-test-data/blob/main/products/bank_check/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(BankCheckV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: b9809586-57ae-4f84-a35d-a85b2be1f2a2 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/bank_check v1.0 -:Rotation applied: Yes - -Prediction -========== -:Check Issue Date: 2022-03-29 -:Amount: 15332.90 -:Payees: JOHN DOE - JANE DOE -:Routing Number: -:Account Number: 7789778136 -:Check Number: 0003401 - -Page Predictions -================ - -Page 0 ------- -:Check Position: Polygon with 21 points. -:Signature Positions: Polygon with 6 points. -:Check Issue Date: 2022-03-29 -:Amount: 15332.90 -:Payees: JOHN DOE - JANE DOE -:Routing Number: -:Account Number: 7789778136 -:Check Number: 0003401 -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - - -### AmountField -The amount field `AmountField` only has one constraint: its **value** is an optional `?float`. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - - -### PositionField -The position field `PositionField` does not implement all the basic `BaseField` attributes, only **boundingBox**, **polygon** and **pageId**. On top of these, it has access to: - -* **rectangle** (`[Point, Point, Point, Point]`): a Polygon with four points that may be oriented (even beyond canvas). -* **quadrangle** (`[Point, Point, Point, Point]`): a free polygon made up of four points. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -## Page-Level Fields -Some fields are constrained to the page level, and so will not be retrievable at document level. - -# Attributes -The following fields are extracted for Bank Check V1: - -## Account Number -**accountNumber** : The check payer's account number. - -```php -echo $result->document->inference->prediction->accountNumber->value; -``` - -## Amount -**amount** : The amount of the check. - -```php -echo $result->document->inference->prediction->amount->value; -``` - -## Check Number -**checkNumber** : The issuer's check number. - -```php -echo $result->document->inference->prediction->checkNumber->value; -``` - -## Check Position -[📄](#page-level-fields "This field is only present on individual pages.")**checkPosition** : The position of the check on the document. - -```php -foreach($result->document->inference->prediction->checkPosition as $checkPositionElem) -{ - echo $checkPositionElem->polygon->getCoordinates(); -} -``` - -## Check Issue Date -**date** : The date the check was issued. - -```php -echo $result->document->inference->prediction->date->value; -``` - -## Payees -**payees** : List of the check's payees (recipients). - -```php -foreach ($result->document->inference->prediction->payees as $payeesElem) -{ - echo $payeesElem->value; -} -``` - -## Routing Number -**routingNumber** : The check issuer's routing number. - -```php -echo $result->document->inference->prediction->routingNumber->value; -``` - -## Signature Positions -[📄](#page-level-fields "This field is only present on individual pages.")**signaturesPositions** : List of signature positions - -```php -foreach ($result->document->inference->pages as $page) -{ - foreach ($page->prediction->signaturesPositions as $signaturesPositionsElem) - { - echo $signaturesPositionsElem->polygon; - echo $signaturesPositionsElem->quadrangle->getCoordinates(); - echo $signaturesPositionsElem->rectangle->getCoordinates(); - echo $signaturesPositionsElem->boundingBox->getCoordinates(); - } -} -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/barcode_reader_v1.md b/docs/barcode_reader_v1.md deleted file mode 100644 index 212774d2..00000000 --- a/docs/barcode_reader_v1.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: Barcode Reader OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-barcode-reader-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Barcode Reader API](https://platform.mindee.com/mindee/barcode_reader). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/barcode_reader/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Barcode Reader sample](https://github.com/mindee/client-lib-test-data/blob/main/products/barcode_reader/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(BarcodeReaderV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: f9c48da1-a306-4805-8da8-f7231fda2d88 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/barcode_reader v1.0 -:Rotation applied: Yes - -Prediction -========== -:Barcodes 1D: Mindee -:Barcodes 2D: https://developers.mindee.com/docs/barcode-reader-ocr - I love paperwork! - Said no one ever - -Page Predictions -================ - -Page 0 ------- -:Barcodes 1D: Mindee -:Barcodes 2D: https://developers.mindee.com/docs/barcode-reader-ocr - I love paperwork! - Said no one ever -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -# Attributes -The following fields are extracted for Barcode Reader V1: - -## Barcodes 1D -**codes1D** : List of decoded 1D barcodes. - -```php -foreach ($result->document->inference->prediction->codes1D as $codes1DElem) -{ - echo $codes1DElem->value; -} -``` - -## Barcodes 2D -**codes2D** : List of decoded 2D barcodes. - -```php -foreach ($result->document->inference->prediction->codes2D as $codes2DElem) -{ - echo $codes2DElem->value; -} -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/bill_of_lading_v1.md b/docs/bill_of_lading_v1.md deleted file mode 100644 index bcb2fe17..00000000 --- a/docs/bill_of_lading_v1.md +++ /dev/null @@ -1,251 +0,0 @@ ---- -title: Bill of Lading OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-bill-of-lading-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Bill of Lading API](https://platform.mindee.com/mindee/bill_of_lading). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/bill_of_lading/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Bill of Lading sample](https://github.com/mindee/client-lib-test-data/blob/main/products/bill_of_lading/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(BillOfLadingV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 3b5250a1-b52c-4e0b-bc3e-2f0146b04e29 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/bill_of_lading v1.1 -:Rotation applied: No - -Prediction -========== -:Bill of Lading Number: XYZ123456 -:Shipper: - :Address: 123 OCEAN DRIVE, SHANGHAI, CHINA - :Email: - :Name: GLOBAL FREIGHT SOLUTIONS INC. - :Phone: 86-21-12345678 -:Consignee: - :Address: 789 TRADE STREET, SINGAPORE 567890, SINGAPORE - :Email: - :Name: PACIFIC TRADING CO. - :Phone: 65-65432100 -:Notify Party: - :Address: 789 TRADE STREET, SINGAPORE 567890, SINGAPORE - :Email: - :Name: PACIFIC TRADING CO. - :Phone: 65-65432100 -:Carrier: - :Name: GLOBAL SHIPPING CO.,LTD. - :Professional Number: - :SCAC: -:Items: - +--------------------------------------+--------------+-------------+------------------+----------+-------------+ - | Description | Gross Weight | Measurement | Measurement Unit | Quantity | Weight Unit | - +======================================+==============+=============+==================+==========+=============+ - | ELECTRONIC COMPONENTS\nP/N: 12345... | 500.00 | 1.50 | cbm | 1.00 | kgs | - +--------------------------------------+--------------+-------------+------------------+----------+-------------+ -:Port of Loading: SHANGHAI, CHINA -:Port of Discharge: LOS ANGELES, USA -:Place of Delivery: LOS ANGELES, USA -:Date of issue: 2022-09-30 -:Departure Date: -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Carrier Field -The shipping company responsible for transporting the goods. - -A `BillOfLadingV1Carrier` implements the following attributes: - -* **name** (`string`): The name of the carrier. -* **professionalNumber** (`string`): The professional number of the carrier. -* **scac** (`string`): The Standard Carrier Alpha Code (SCAC) of the carrier. -Fields which are specific to this product; they are not used in any other product. - -### Consignee Field -The party to whom the goods are being shipped. - -A `BillOfLadingV1Consignee` implements the following attributes: - -* **address** (`string`): The address of the consignee. -* **email** (`string`): The email of the shipper. -* **name** (`string`): The name of the consignee. -* **phone** (`string`): The phone number of the consignee. -Fields which are specific to this product; they are not used in any other product. - -### Items Field -The goods being shipped. - -A `BillOfLadingV1CarrierItem` implements the following attributes: - -* **description** (`string`): A description of the item. -* **grossWeight** (`float`): The gross weight of the item. -* **measurement** (`float`): The measurement of the item. -* **measurementUnit** (`string`): The unit of measurement for the measurement. -* **quantity** (`float`): The quantity of the item being shipped. -* **weightUnit** (`string`): The unit of measurement for weights. -Fields which are specific to this product; they are not used in any other product. - -### Notify Party Field -The party to be notified of the arrival of the goods. - -A `BillOfLadingV1NotifyParty` implements the following attributes: - -* **address** (`string`): The address of the notify party. -* **email** (`string`): The email of the shipper. -* **name** (`string`): The name of the notify party. -* **phone** (`string`): The phone number of the notify party. -Fields which are specific to this product; they are not used in any other product. - -### Shipper Field -The party responsible for shipping the goods. - -A `BillOfLadingV1Shipper` implements the following attributes: - -* **address** (`string`): The address of the shipper. -* **email** (`string`): The email of the shipper. -* **name** (`string`): The name of the shipper. -* **phone** (`string`): The phone number of the shipper. - -# Attributes -The following fields are extracted for Bill of Lading V1: - -## Bill of Lading Number -**billOfLadingNumber** : A unique identifier assigned to a Bill of Lading document. - -```php -echo $result->document->inference->prediction->billOfLadingNumber->value; -``` - -## Carrier -**carrier** ([BillOfLadingV1Carrier](#carrier-field)): The shipping company responsible for transporting the goods. - -```php -echo $result->document->inference->prediction->carrier->value; -``` - -## Items -**carrierItems** ([[BillOfLadingV1CarrierItem](#items-field)]): The goods being shipped. - -```php -foreach ($result->document->inference->prediction->carrierItems as $carrierItemsElem) -{ - echo $carrierItemsElem->value; -} -``` - -## Consignee -**consignee** ([BillOfLadingV1Consignee](#consignee-field)): The party to whom the goods are being shipped. - -```php -echo $result->document->inference->prediction->consignee->value; -``` - -## Date of issue -**dateOfIssue** : The date when the bill of lading is issued. - -```php -echo $result->document->inference->prediction->dateOfIssue->value; -``` - -## Departure Date -**departureDate** : The date when the vessel departs from the port of loading. - -```php -echo $result->document->inference->prediction->departureDate->value; -``` - -## Notify Party -**notifyParty** ([BillOfLadingV1NotifyParty](#notify-party-field)): The party to be notified of the arrival of the goods. - -```php -echo $result->document->inference->prediction->notifyParty->value; -``` - -## Place of Delivery -**placeOfDelivery** : The place where the goods are to be delivered. - -```php -echo $result->document->inference->prediction->placeOfDelivery->value; -``` - -## Port of Discharge -**portOfDischarge** : The port where the goods are unloaded from the vessel. - -```php -echo $result->document->inference->prediction->portOfDischarge->value; -``` - -## Port of Loading -**portOfLoading** : The port where the goods are loaded onto the vessel. - -```php -echo $result->document->inference->prediction->portOfLoading->value; -``` - -## Shipper -**shipper** ([BillOfLadingV1Shipper](#shipper-field)): The party responsible for shipping the goods. - -```php -echo $result->document->inference->prediction->shipper->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/business_card_v1.md b/docs/business_card_v1.md deleted file mode 100644 index f19cfd33..00000000 --- a/docs/business_card_v1.md +++ /dev/null @@ -1,169 +0,0 @@ ---- -title: Business Card OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-business-card-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP 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 -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(BusinessCardV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -# Attributes -The following fields are extracted for Business Card V1: - -## Address -**address** : The address of the person. - -```php -echo $result->document->inference->prediction->address->value; -``` - -## Company -**company** : The company the person works for. - -```php -echo $result->document->inference->prediction->company->value; -``` - -## Email -**email** : The email address of the person. - -```php -echo $result->document->inference->prediction->email->value; -``` - -## Fax Number -**faxNumber** : The Fax number of the person. - -```php -echo $result->document->inference->prediction->faxNumber->value; -``` - -## Firstname -**firstname** : The given name of the person. - -```php -echo $result->document->inference->prediction->firstname->value; -``` - -## Job Title -**jobTitle** : The job title of the person. - -```php -echo $result->document->inference->prediction->jobTitle->value; -``` - -## Lastname -**lastname** : The lastname of the person. - -```php -echo $result->document->inference->prediction->lastname->value; -``` - -## Mobile Number -**mobileNumber** : The mobile number of the person. - -```php -echo $result->document->inference->prediction->mobileNumber->value; -``` - -## Phone Number -**phoneNumber** : The phone number of the person. - -```php -echo $result->document->inference->prediction->phoneNumber->value; -``` - -## Social Media -**socialMedia** : The social media profiles of the person or company. - -```php -foreach ($result->document->inference->prediction->socialMedia as $socialMediaElem) -{ - echo $socialMediaElem->value; -} -``` - -## Website -**website** : The website of the person or company. - -```php -echo $result->document->inference->prediction->website->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/carte_grise_v1.md b/docs/carte_grise_v1.md deleted file mode 100644 index 5131dc5e..00000000 --- a/docs/carte_grise_v1.md +++ /dev/null @@ -1,457 +0,0 @@ ---- -title: FR Carte Grise OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-fr-carte-grise-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Carte Grise API](https://platform.mindee.com/mindee/carte_grise). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/carte_grise/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Carte Grise sample](https://github.com/mindee/client-lib-test-data/blob/main/products/carte_grise/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(CarteGriseV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 4443182b-57c1-4426-a288-01b94f226e84 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/carte_grise v1.1 -:Rotation applied: Yes - -Prediction -========== -:a: AB-123-CD -:b: 1998-01-05 -:c1: DUPONT YVES -:c3: 27 RUE DES ROITELETS 59169 FERIN LES BAINS FRANCE -:c41: 2 DELAROCHE -:c4a: EST LE PROPRIETAIRE DU VEHICULE -:d1: -:d3: MODELE -:e: VFS1V2009AS1V2009 -:f1: 1915 -:f2: 1915 -:f3: 1915 -:g: 3030 -:g1: 1307 -:i: 2009-12-04 -:j: N1 -:j1: VP -:j2: AA -:j3: CI -:p1: 1900 -:p2: 90 -:p3: GO -:p6: 6 -:q: 006 -:s1: 5 -:s2: -:u1: 77 -:u2: 3000 -:v7: 155 -:x1: 2011-07-06 -:y1: 17835 -:y2: -:y3: 0 -:y4: 4 -:y5: 2.5 -:y6: 178.35 -:Formula Number: 2009AS05284 -:Owner's First Name: YVES -:Owner's Surname: DUPONT -:MRZ Line 1: -:MRZ Line 2: CI< **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -# Attributes -The following fields are extracted for Carte Grise V1: - -## a -**a** : The vehicle's license plate number. - -```php -echo $result->document->inference->prediction->a->value; -``` - -## b -**b** : The vehicle's first release date. - -```php -echo $result->document->inference->prediction->b->value; -``` - -## c1 -**c1** : The vehicle owner's full name including maiden name. - -```php -echo $result->document->inference->prediction->c1->value; -``` - -## c3 -**c3** : The vehicle owner's address. - -```php -echo $result->document->inference->prediction->c3->value; -``` - -## c41 -**c41** : Number of owners of the license certificate. - -```php -echo $result->document->inference->prediction->c41->value; -``` - -## c4a -**c4A** : Mentions about the ownership of the vehicle. - -```php -echo $result->document->inference->prediction->c4A->value; -``` - -## d1 -**d1** : The vehicle's brand. - -```php -echo $result->document->inference->prediction->d1->value; -``` - -## d3 -**d3** : The vehicle's commercial name. - -```php -echo $result->document->inference->prediction->d3->value; -``` - -## e -**e** : The Vehicle Identification Number (VIN). - -```php -echo $result->document->inference->prediction->e->value; -``` - -## f1 -**f1** : The vehicle's maximum admissible weight. - -```php -echo $result->document->inference->prediction->f1->value; -``` - -## f2 -**f2** : The vehicle's maximum admissible weight within the license's state. - -```php -echo $result->document->inference->prediction->f2->value; -``` - -## f3 -**f3** : The vehicle's maximum authorized weight with coupling. - -```php -echo $result->document->inference->prediction->f3->value; -``` - -## Formula Number -**formulaNumber** : The document's formula number. - -```php -echo $result->document->inference->prediction->formulaNumber->value; -``` - -## g -**g** : The vehicle's weight with coupling if tractor different than category M1. - -```php -echo $result->document->inference->prediction->g->value; -``` - -## g1 -**g1** : The vehicle's national empty weight. - -```php -echo $result->document->inference->prediction->g1->value; -``` - -## i -**i** : The car registration date of the given certificate. - -```php -echo $result->document->inference->prediction->i->value; -``` - -## j -**j** : The vehicle's category. - -```php -echo $result->document->inference->prediction->j->value; -``` - -## j1 -**j1** : The vehicle's national type. - -```php -echo $result->document->inference->prediction->j1->value; -``` - -## j2 -**j2** : The vehicle's body type (CE). - -```php -echo $result->document->inference->prediction->j2->value; -``` - -## j3 -**j3** : The vehicle's body type (National designation). - -```php -echo $result->document->inference->prediction->j3->value; -``` - -## MRZ Line 1 -**mrz1** : Machine Readable Zone, first line. - -```php -echo $result->document->inference->prediction->mrz1->value; -``` - -## MRZ Line 2 -**mrz2** : Machine Readable Zone, second line. - -```php -echo $result->document->inference->prediction->mrz2->value; -``` - -## Owner's First Name -**ownerFirstName** : The vehicle's owner first name. - -```php -echo $result->document->inference->prediction->ownerFirstName->value; -``` - -## Owner's Surname -**ownerSurname** : The vehicle's owner surname. - -```php -echo $result->document->inference->prediction->ownerSurname->value; -``` - -## p1 -**p1** : The vehicle engine's displacement (cm3). - -```php -echo $result->document->inference->prediction->p1->value; -``` - -## p2 -**p2** : The vehicle's maximum net power (kW). - -```php -echo $result->document->inference->prediction->p2->value; -``` - -## p3 -**p3** : The vehicle's fuel type or energy source. - -```php -echo $result->document->inference->prediction->p3->value; -``` - -## p6 -**p6** : The vehicle's administrative power (fiscal horsepower). - -```php -echo $result->document->inference->prediction->p6->value; -``` - -## q -**q** : The vehicle's power to weight ratio. - -```php -echo $result->document->inference->prediction->q->value; -``` - -## s1 -**s1** : The vehicle's number of seats. - -```php -echo $result->document->inference->prediction->s1->value; -``` - -## s2 -**s2** : The vehicle's number of standing rooms (person). - -```php -echo $result->document->inference->prediction->s2->value; -``` - -## u1 -**u1** : The vehicle's sound level (dB). - -```php -echo $result->document->inference->prediction->u1->value; -``` - -## u2 -**u2** : The vehicle engine's rotation speed (RPM). - -```php -echo $result->document->inference->prediction->u2->value; -``` - -## v7 -**v7** : The vehicle's CO2 emission (g/km). - -```php -echo $result->document->inference->prediction->v7->value; -``` - -## x1 -**x1** : Next technical control date. - -```php -echo $result->document->inference->prediction->x1->value; -``` - -## y1 -**y1** : Amount of the regional proportional tax of the registration (in euros). - -```php -echo $result->document->inference->prediction->y1->value; -``` - -## y2 -**y2** : Amount of the additional parafiscal tax of the registration (in euros). - -```php -echo $result->document->inference->prediction->y2->value; -``` - -## y3 -**y3** : Amount of the additional CO2 tax of the registration (in euros). - -```php -echo $result->document->inference->prediction->y3->value; -``` - -## y4 -**y4** : Amount of the fee for managing the registration (in euros). - -```php -echo $result->document->inference->prediction->y4->value; -``` - -## y5 -**y5** : Amount of the fee for delivery of the registration certificate in euros. - -```php -echo $result->document->inference->prediction->y5->value; -``` - -## y6 -**y6** : Total amount of registration fee to be paid in euros. - -```php -echo $result->document->inference->prediction->y6->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/cropper_v1.md b/docs/cropper_v1.md deleted file mode 100644 index 52efa340..00000000 --- a/docs/cropper_v1.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -title: Cropper OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-cropper-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Cropper API](https://platform.mindee.com/mindee/cropper). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/cropper/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Cropper sample](https://github.com/mindee/client-lib-test-data/blob/main/products/cropper/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(CropperV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 149ce775-8302-4798-8649-7eda9fb84a1a -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/cropper v1.0 -:Rotation applied: No - -Prediction -========== - -Page Predictions -================ - -Page 0 ------- -:Document Cropper: Polygon with 26 points. - Polygon with 25 points. -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - - -### PositionField -The position field `PositionField` does not implement all the basic `BaseField` attributes, only **boundingBox**, **polygon** and **pageId**. On top of these, it has access to: - -* **rectangle** (`[Point, Point, Point, Point]`): a Polygon with four points that may be oriented (even beyond canvas). -* **quadrangle** (`[Point, Point, Point, Point]`): a free polygon made up of four points. - -## Page-Level Fields -Some fields are constrained to the page level, and so will not be retrievable at document level. - -# Attributes -The following fields are extracted for Cropper V1: - -## Document Cropper -[📄](#page-level-fields "This field is only present on individual pages.")**cropping** : List of documents found in the image. - -```php -foreach ($result->document->inference->pages as $page) -{ - foreach ($page->prediction->cropping as $croppingElem) - { - echo $croppingElem->polygon; - echo $croppingElem->quadrangle->getCoordinates(); - echo $croppingElem->rectangle->getCoordinates(); - echo $croppingElem->boundingBox->getCoordinates(); - } -} -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/custom_v1.md b/docs/custom_v1.md deleted file mode 100644 index aacbca72..00000000 --- a/docs/custom_v1.md +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: Custom API PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-api-builder -parentDoc: 658193df8e029d002ad9c89b ---- -> 🚧 This product is still supported, but is considered to be deprecated. If you are looking for the docTI API documentation, you can find it [here](https://developers.mindee.com/docs/php-generated-api). - -# Quick-Start - -```phpsourceFromPath("/path/to/the/file.ext"); - -// Create a custom endpoint -$customEndpoint = $mindeeClient->createEndpoint( - "my-endpoint", - "my-account", -// "my-version" // Optional -); - -// Add the custom endpoint to the prediction options. -$predictOptions = new PredictMethodOptions(); -$predictOptions->setEndpoint($customEndpoint); - -// Parse the file -$apiResponse = $mindeeClient->parse(CustomV1::class, $inputSource, $predictOptions); - -echo strval($apiResponse->document); - -// Iterate over all the fields in the document -foreach ($result->document->fields as field_name => field_values) -{ - echo "$field_name = $field_values"; -} -``` - -# Custom Endpoints - -You may have noticed in the previous step that in order to access a custom build, you will need to provide an account and an endpoint name at the very least. - -Although it is optional, the version number should match the latest version of your build in most use-cases. -If it is not set, it will default to "1". - - -# Field Types - -## Custom Fields - -### List Field - -A `ListField` is a special type of custom list that implements the following: - -* **confidence** (`float`): the confidence score of the field prediction. -* **reconstructed** (`bool`): indicates whether or not an object was reconstructed (not extracted as the API gave it). -* **values** (`List[`[ListFieldValue](#list-field-value)`]`): list of value fields - -Since the inner contents can vary, the value isn't accessed through a property, but rather through the following functions: -* **contentsList()** (`-> array`): returns a list of values for each element. Elements can be `float` or `string`. -* **contentsString($separator=" ")** (`-> string`): returns a list of concatenated values, with an optional **$separator** `string` between them. -* **__toString()**: returns a string representation of all values, with an empty space between each of them. - - -#### List Field Value - -Values of `ListField`s are stored in a `ListFieldValue` structure, which is implemented as follows: -* **content** (`string`): extracted content of the prediction -* **confidence** (`float`): the confidence score of the prediction -* **bounding_box** (`BBox`): 4 relative vertices corrdinates of a rectangle containing the word in the document. -* **polygon** (`Polygon`): vertices of a polygon containing the word. -* **page** (`int`): the ID of the page, not applicable when at document-level. - - -### Classification Field - -A `ClassificationField` is a special type of custom classification that implements the following: - -* **value** (`string`): the value of the classification. Corresponds to one of the values specified during training. -* **confidence** (`float`): the confidence score of the field prediction. -* **__toString()**: returns a string representation of all values, with an empty space between each of them. - -# Attributes - -Custom builds always have access to at least two attributes: - -## Fields - -**fields** (array(`string`=> [ListField](#list-field)[])): - -```php -echo strval($result->document->inference->prediction->fields["my-field"]); -``` - -## Classifications - -**classifications** (array(`string` => [ClassificationField](#classification-field)[])): The purchase category among predefined classes. - -```php -print(string(result.document.inference.prediction.classifications["my-classification"])) -``` - - -# 🧪 Custom Line Items - -> **⚠️ Warning**: Custom Line Items are an **experimental** feature, results may vary. - - -Though not supported directly in the API, sometimes you might need to reconstitute line items by hand. -The library provides a tool for this very purpose: - -## columnsToLineItems() -The **columnsToLineItems()** function can be called from the document and page level prediction objects. - -It takes the following arguments: - -* **$anchorNames** (`string[]`): a list of the names of possible anchor (field) candidate for the horizontal placement a line. If all provided anchors are invalid, the `CustomLine` won't be built. -* **$fieldNames** (`string[]`): a list of fields to retrieve the values from -* **$heightTolerance** (`?float`): Optional, the height tolerance used to build the line. It helps when the height of a line can vary unexpectedly. - -Example use: - -```php -// document-level -$response->document->inference->prediction->columnsToLineItems( - $anchorNames, - $fieldNames, - 0.011 // optional, defaults to 0.01 -); - -// page-level -$response->document->pages[0]->prediction->columnsToLineItems( - $anchorNames, - $fieldNames, - 0.011 // optional, defaults to 0.01 -); -``` - -It returns a list of [CustomLine](#CustomLine) objects. - -## CustomLine - -`CustomLine` represents a line as it has been read from column fields. It has the following attributes: - -* **rowNumber** (`int`): Number of a given line. Starts at 1. -* **fields** (`array(string => ListFieldValue)[]`): List of the fields associated with the line, indexed by their column name. -* **bbox** (`BBox`): Simple bounding box of the current line representing the 4 minimum & maximum coordinates as `float` values. - - -# Questions? - -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/delivery_notes_v1.md b/docs/delivery_notes_v1.md deleted file mode 100644 index 14fe1fb4..00000000 --- a/docs/delivery_notes_v1.md +++ /dev/null @@ -1,142 +0,0 @@ ---- -title: Delivery note OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-delivery-note-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP 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 -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(DeliveryNoteV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - - -### AmountField -The amount field `AmountField` only has one constraint: its **value** is an optional `?float`. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -# Attributes -The following fields are extracted for Delivery note V1: - -## Customer Address -**customerAddress** : The address of the customer receiving the goods. - -```php -echo $result->document->inference->prediction->customerAddress->value; -``` - -## Customer Name -**customerName** : The name of the customer receiving the goods. - -```php -echo $result->document->inference->prediction->customerName->value; -``` - -## Delivery Date -**deliveryDate** : The date on which the delivery is scheduled to arrive. - -```php -echo $result->document->inference->prediction->deliveryDate->value; -``` - -## Delivery Number -**deliveryNumber** : A unique identifier for the delivery note. - -```php -echo $result->document->inference->prediction->deliveryNumber->value; -``` - -## Supplier Address -**supplierAddress** : The address of the supplier providing the goods. - -```php -echo $result->document->inference->prediction->supplierAddress->value; -``` - -## Supplier Name -**supplierName** : The name of the supplier providing the goods. - -```php -echo $result->document->inference->prediction->supplierName->value; -``` - -## Total Amount -**totalAmount** : The total monetary value of the goods being delivered. - -```php -echo $result->document->inference->prediction->totalAmount->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/driver_license_v1.md b/docs/driver_license_v1.md deleted file mode 100644 index 4f8ffd77..00000000 --- a/docs/driver_license_v1.md +++ /dev/null @@ -1,186 +0,0 @@ ---- -title: Driver License OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-driver-license-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Driver License API](https://platform.mindee.com/mindee/driver_license). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/driver_license/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Driver License sample](https://github.com/mindee/client-lib-test-data/blob/main/products/driver_license/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(DriverLicenseV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: fbdeae38-ada3-43ac-aa58-e01a3d47e474 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/driver_license v1.0 -:Rotation applied: Yes - -Prediction -========== -:Country Code: USA -:State: AZ -:ID: D12345678 -:Category: D -:Last Name: Sample -:First Name: Jelani -:Date of Birth: 1957-02-01 -:Place of Birth: -:Expiry Date: 2018-02-01 -:Issued Date: 2013-01-10 -:Issuing Authority: -:MRZ: -:DD Number: DD1234567890123456 -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -# Attributes -The following fields are extracted for Driver License V1: - -## Category -**category** : The category or class of the driver license. - -```php -echo $result->document->inference->prediction->category->value; -``` - -## Country Code -**countryCode** : The alpha-3 ISO 3166 code of the country where the driver license was issued. - -```php -echo $result->document->inference->prediction->countryCode->value; -``` - -## Date of Birth -**dateOfBirth** : The date of birth of the driver license holder. - -```php -echo $result->document->inference->prediction->dateOfBirth->value; -``` - -## DD Number -**ddNumber** : The DD number of the driver license. - -```php -echo $result->document->inference->prediction->ddNumber->value; -``` - -## Expiry Date -**expiryDate** : The expiry date of the driver license. - -```php -echo $result->document->inference->prediction->expiryDate->value; -``` - -## First Name -**firstName** : The first name of the driver license holder. - -```php -echo $result->document->inference->prediction->firstName->value; -``` - -## ID -**id** : The unique identifier of the driver license. - -```php -echo $result->document->inference->prediction->id->value; -``` - -## Issued Date -**issuedDate** : The date when the driver license was issued. - -```php -echo $result->document->inference->prediction->issuedDate->value; -``` - -## Issuing Authority -**issuingAuthority** : The authority that issued the driver license. - -```php -echo $result->document->inference->prediction->issuingAuthority->value; -``` - -## Last Name -**lastName** : The last name of the driver license holder. - -```php -echo $result->document->inference->prediction->lastName->value; -``` - -## MRZ -**mrz** : The Machine Readable Zone (MRZ) of the driver license. - -```php -echo $result->document->inference->prediction->mrz->value; -``` - -## Place of Birth -**placeOfBirth** : The place of birth of the driver license holder. - -```php -echo $result->document->inference->prediction->placeOfBirth->value; -``` - -## State -**state** : Second part of the ISO 3166-2 code, consisting of two letters indicating the US State. - -```php -echo $result->document->inference->prediction->state->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/energy_bill_fra_v1.md b/docs/energy_bill_fra_v1.md deleted file mode 100644 index 63d5c0be..00000000 --- a/docs/energy_bill_fra_v1.md +++ /dev/null @@ -1,319 +0,0 @@ ---- -title: FR Energy Bill OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-fr-energy-bill-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Energy Bill API](https://platform.mindee.com/mindee/energy_bill_fra). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.pdf), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Energy Bill sample](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.pdf?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(EnergyBillV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: ff1f2ca8-4d29-44d8-a564-599a982a4ef7 -:Filename: default_sample.pdf - -Inference -######### -:Product: mindee/energy_bill_fra v1.2 -:Rotation applied: Yes - -Prediction -========== -:Invoice Number: 1234567890 -:Contract ID: 9876543210 -:Delivery Point: 98765432109876 -:Invoice Date: 2021-01-29 -:Due Date: 2021-02-15 -:Total Before Taxes: 1241.03 -:Total Taxes: 238.82 -:Total Amount: 1479.85 -:Energy Supplier: - :Address: TSA 12345, 12345 DEMOCITY CEDEX - :Name: EDF -:Energy Consumer: - :Address: 123 RUE DE L'IMAGINAIRE, 75001 PARIS - :Name: JOHN DOE -:Subscription: - +--------------------------------------+------------+------------+----------+-----------+------------+ - | Description | End Date | Start Date | Tax Rate | Total | Unit Price | - +======================================+============+============+==========+===========+============+ - | Abonnement électricité | 2021-02-28 | 2021-01-01 | 5.50 | 59.00 | 29.50 | - +--------------------------------------+------------+------------+----------+-----------+------------+ -:Energy Usage: - +-------------+--------------------------------------+------------+------------+----------+-----------+-----------------+------------+ - | Consumption | Description | End Date | Start Date | Tax Rate | Total | Unit of Measure | Unit Price | - +=============+======================================+============+============+==========+===========+=================+============+ - | 8581.00 | Consommation électricité | 2021-01-27 | 2020-11-28 | 20.00 | 898.43 | kWh | 0.1047 | - +-------------+--------------------------------------+------------+------------+----------+-----------+-----------------+------------+ -:Taxes and Contributions: - +--------------------------------------+------------+------------+----------+-----------+------------+ - | Description | End Date | Start Date | Tax Rate | Total | Unit Price | - +======================================+============+============+==========+===========+============+ - | Contribution au Service Public de... | 2021-01-27 | 2020-11-28 | 20.00 | 193.07 | 0.0225 | - +--------------------------------------+------------+------------+----------+-----------+------------+ - | Taxe Départementale sur la Conso ... | 2021-01-27 | 2020-11-28 | 20.00 | 13.98 | 0.003315 | - +--------------------------------------+------------+------------+----------+-----------+------------+ - | Taxe Communale sur la Conso Final... | 2021-01-27 | 2020-11-28 | 20.00 | 28.56 | 0.006545 | - +--------------------------------------+------------+------------+----------+-----------+------------+ - | Taxe Communale sur la Conso Final... | 2021-01-27 | 2020-11-28 | 20.00 | 27.96 | 0.00663 | - +--------------------------------------+------------+------------+----------+-----------+------------+ -:Meter Details: - :Meter Number: 620 - :Meter Type: electricity - :Unit of Power: 36kVA -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - - -### AmountField -The amount field `AmountField` only has one constraint: its **value** is an optional `?float`. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Energy Consumer Field -The entity that consumes the energy. - -A `EnergyBillV1EnergyConsumer` implements the following attributes: - -* **address** (`string`): The address of the energy consumer. -* **name** (`string`): The name of the energy consumer. -Fields which are specific to this product; they are not used in any other product. - -### Energy Supplier Field -The company that supplies the energy. - -A `EnergyBillV1EnergySupplier` implements the following attributes: - -* **address** (`string`): The address of the energy supplier. -* **name** (`string`): The name of the energy supplier. -Fields which are specific to this product; they are not used in any other product. - -### Energy Usage Field -Details of energy consumption. - -A `EnergyBillV1EnergyUsage` implements the following attributes: - -* **consumption** (`float`): The price per unit of energy consumed. -* **description** (`string`): Description or details of the energy usage. -* **endDate** (`string`): The end date of the energy usage. -* **startDate** (`string`): The start date of the energy usage. -* **taxRate** (`float`): The rate of tax applied to the total cost. -* **total** (`float`): The total cost of energy consumed. -* **unit** (`string`): The unit of measurement for energy consumption. - -#### Possible values include: - - kWh - - m3 - - L - -* **unitPrice** (`float`): The price per unit of energy consumed. -Fields which are specific to this product; they are not used in any other product. - -### Meter Details Field -Information about the energy meter. - -A `EnergyBillV1MeterDetail` implements the following attributes: - -* **meterNumber** (`string`): The unique identifier of the energy meter. -* **meterType** (`string`): The type of energy meter. - -#### Possible values include: - - electricity - - gas - - water - - None - -* **unit** (`string`): The unit of power for energy consumption. -Fields which are specific to this product; they are not used in any other product. - -### Subscription Field -The subscription details fee for the energy service. - -A `EnergyBillV1Subscription` implements the following attributes: - -* **description** (`string`): Description or details of the subscription. -* **endDate** (`string`): The end date of the subscription. -* **startDate** (`string`): The start date of the subscription. -* **taxRate** (`float`): The rate of tax applied to the total cost. -* **total** (`float`): The total cost of subscription. -* **unitPrice** (`float`): The price per unit of subscription. -Fields which are specific to this product; they are not used in any other product. - -### Taxes and Contributions Field -Details of Taxes and Contributions. - -A `EnergyBillV1TaxesAndContribution` implements the following attributes: - -* **description** (`string`): Description or details of the Taxes and Contributions. -* **endDate** (`string`): The end date of the Taxes and Contributions. -* **startDate** (`string`): The start date of the Taxes and Contributions. -* **taxRate** (`float`): The rate of tax applied to the total cost. -* **total** (`float`): The total cost of Taxes and Contributions. -* **unitPrice** (`float`): The price per unit of Taxes and Contributions. - -# Attributes -The following fields are extracted for Energy Bill V1: - -## Contract ID -**contractId** : The unique identifier associated with a specific contract. - -```php -echo $result->document->inference->prediction->contractId->value; -``` - -## Delivery Point -**deliveryPoint** : The unique identifier assigned to each electricity or gas consumption point. It specifies the exact location where the energy is delivered. - -```php -echo $result->document->inference->prediction->deliveryPoint->value; -``` - -## Due Date -**dueDate** : The date by which the payment for the energy invoice is due. - -```php -echo $result->document->inference->prediction->dueDate->value; -``` - -## Energy Consumer -**energyConsumer** ([EnergyBillV1EnergyConsumer](#energy-consumer-field)): The entity that consumes the energy. - -```php -echo $result->document->inference->prediction->energyConsumer->value; -``` - -## Energy Supplier -**energySupplier** ([EnergyBillV1EnergySupplier](#energy-supplier-field)): The company that supplies the energy. - -```php -echo $result->document->inference->prediction->energySupplier->value; -``` - -## Energy Usage -**energyUsage** ([[EnergyBillV1EnergyUsage](#energy-usage-field)]): Details of energy consumption. - -```php -foreach ($result->document->inference->prediction->energyUsage as $energyUsageElem) -{ - echo $energyUsageElem->value; -} -``` - -## Invoice Date -**invoiceDate** : The date when the energy invoice was issued. - -```php -echo $result->document->inference->prediction->invoiceDate->value; -``` - -## Invoice Number -**invoiceNumber** : The unique identifier of the energy invoice. - -```php -echo $result->document->inference->prediction->invoiceNumber->value; -``` - -## Meter Details -**meterDetails** ([EnergyBillV1MeterDetail](#meter-details-field)): Information about the energy meter. - -```php -echo $result->document->inference->prediction->meterDetails->value; -``` - -## Subscription -**subscription** ([[EnergyBillV1Subscription](#subscription-field)]): The subscription details fee for the energy service. - -```php -foreach ($result->document->inference->prediction->subscription as $subscriptionElem) -{ - echo $subscriptionElem->value; -} -``` - -## Taxes and Contributions -**taxesAndContributions** ([[EnergyBillV1TaxesAndContribution](#taxes-and-contributions-field)]): Details of Taxes and Contributions. - -```php -foreach ($result->document->inference->prediction->taxesAndContributions as $taxesAndContributionsElem) -{ - echo $taxesAndContributionsElem->value; -} -``` - -## Total Amount -**totalAmount** : The total amount to be paid for the energy invoice. - -```php -echo $result->document->inference->prediction->totalAmount->value; -``` - -## Total Before Taxes -**totalBeforeTaxes** : The total amount to be paid for the energy invoice before taxes. - -```php -echo $result->document->inference->prediction->totalBeforeTaxes->value; -``` - -## Total Taxes -**totalTaxes** : Total of taxes applied to the invoice. - -```php -echo $result->document->inference->prediction->totalTaxes->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/expense_receipts_v5.md b/docs/expense_receipts_v5.md deleted file mode 100644 index bf6f35ba..00000000 --- a/docs/expense_receipts_v5.md +++ /dev/null @@ -1,376 +0,0 @@ ---- -title: Receipt OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-receipt-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Receipt API](https://platform.mindee.com/mindee/expense_receipts). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/expense_receipts/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Receipt sample](https://github.com/mindee/client-lib-test-data/blob/main/products/expense_receipts/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(ReceiptV5::class, $inputSource); - -echo $apiResponse->document; -``` - -You can also call this product asynchronously: - -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(ReceiptV5::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: d96fb043-8fb8-4adc-820c-387aae83376d -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/expense_receipts v5.3 -:Rotation applied: Yes - -Prediction -========== -:Expense Locale: en-GB; en; GB; GBP; -:Purchase Category: food -:Purchase Subcategory: restaurant -:Document Type: EXPENSE RECEIPT -:Purchase Date: 2016-02-26 -:Purchase Time: 15:20 -:Total Amount: 10.20 -:Total Net: 8.50 -:Total Tax: 1.70 -:Tip and Gratuity: -:Taxes: - +---------------+--------+----------+---------------+ - | Base | Code | Rate (%) | Amount | - +===============+========+==========+===============+ - | 8.50 | VAT | 20.00 | 1.70 | - +---------------+--------+----------+---------------+ -:Supplier Name: Clachan -:Supplier Company Registrations: Type: VAT NUMBER, Value: 232153895 - Type: VAT NUMBER, Value: 232153895 -:Supplier Address: 34 Kingley Street W1B 50H -:Supplier Phone Number: 02074940834 -:Receipt Number: 54/7500 -:Line Items: - +--------------------------------------+----------+--------------+------------+ - | Description | Quantity | Total Amount | Unit Price | - +======================================+==========+==============+============+ - | Meantime Pale | 2.00 | 10.20 | | - +--------------------------------------+----------+--------------+------------+ - -Page Predictions -================ - -Page 0 ------- -:Expense Locale: en-GB; en; GB; GBP; -:Purchase Category: food -:Purchase Subcategory: restaurant -:Document Type: EXPENSE RECEIPT -:Purchase Date: 2016-02-26 -:Purchase Time: 15:20 -:Total Amount: 10.20 -:Total Net: 8.50 -:Total Tax: 1.70 -:Tip and Gratuity: -:Taxes: - +---------------+--------+----------+---------------+ - | Base | Code | Rate (%) | Amount | - +===============+========+==========+===============+ - | 8.50 | VAT | 20.00 | 1.70 | - +---------------+--------+----------+---------------+ -:Supplier Name: Clachan -:Supplier Company Registrations: Type: VAT NUMBER, Value: 232153895 - Type: VAT NUMBER, Value: 232153895 -:Supplier Address: 34 Kingley Street W1B 50H -:Supplier Phone Number: 02074940834 -:Receipt Number: 54/7500 -:Line Items: - +--------------------------------------+----------+--------------+------------+ - | Description | Quantity | Total Amount | Unit Price | - +======================================+==========+==============+============+ - | Meantime Pale | 2.00 | 10.20 | | - +--------------------------------------+----------+--------------+------------+ -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - - -### AmountField -The amount field `AmountField` only has one constraint: its **value** is an optional `?float`. - - -### ClassificationField -The classification field `ClassificationField` does not implement all the basic `BaseField` attributes. It only implements **value**, **confidence** and **pageId**. - -> Note: a classification field's `value is always a `string`. - - -### CompanyRegistrationField -Aside from the basic `BaseField` attributes, the company registration field `CompanyRegistrationField` also implements the following: - -* **type** (`string`): the type of company. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### LocaleField -The locale field `LocaleField` only implements the **value**, **confidence** and **pageId** base `BaseField` attributes, but it comes with its own: - -* **language** (`string`): ISO 639-1 language code (e.g.: `en` for English). Can be `null`. -* **country** (`string`): ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3 code for countries (e.g.: `GRB` or `GB` for "Great Britain"). Can be `null`. -* **currency** (`string`): ISO 4217 code for currencies (e.g.: `USD` for "US Dollars"). Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -### TaxesField -#### Tax -Aside from the basic `BaseField` attributes, the tax field `TaxField` also implements the following: - -* **rate** (`float`): the tax rate applied to an item expressed as a percentage. Can be `null`. -* **code** (`string`): tax code (or equivalent, depending on the origin of the document). Can be `null`. -* **basis** (`float`): base amount used for the tax. Can be `null`. -* **value** (`float`): the value of the tax. Can be `null`. - -> Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, a list-like structure. - -#### Taxes (Array) -The `Taxes` field represents a list-like collection of `TaxField` objects. As it is the representation of several objects, it has access to a custom `__toString` method that can render a `TaxField` object as a table line. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Line Items Field -List of all line items on the receipt. - -A `ReceiptV5LineItem` implements the following attributes: - -* **description** (`string`): The item description. -* **quantity** (`float`): The item quantity. -* **totalAmount** (`float`): The item total amount. -* **unitPrice** (`float`): The item unit price. - -# Attributes -The following fields are extracted for Receipt V5: - -## Purchase Category -**category** : The purchase category of the receipt. - -#### Possible values include: - - 'toll' - - 'food' - - 'parking' - - 'transport' - - 'accommodation' - - 'gasoline' - - 'telecom' - - 'miscellaneous' - - 'software' - - 'shopping' - - 'energy' - -```php -echo $result->document->inference->prediction->category->value; -``` - -## Purchase Date -**date** : The date the purchase was made. - -```php -echo $result->document->inference->prediction->date->value; -``` - -## Document Type -**documentType** : The type of receipt: EXPENSE RECEIPT or CREDIT CARD RECEIPT. - -#### Possible values include: - - 'EXPENSE RECEIPT' - - 'CREDIT CARD RECEIPT' - -```php -echo $result->document->inference->prediction->documentType->value; -``` - -## Line Items -**lineItems** ([[ReceiptV5LineItem](#line-items-field)]): List of all line items on the receipt. - -```php -foreach ($result->document->inference->prediction->lineItems as $lineItemsElem) -{ - echo $lineItemsElem->value; -} -``` - -## Expense Locale -**locale** : The locale of the document. - -```php -echo $result->document->inference->prediction->locale->value; -``` - -## Receipt Number -**receiptNumber** : The receipt number or identifier. - -```php -echo $result->document->inference->prediction->receiptNumber->value; -``` - -## Purchase Subcategory -**subcategory** : The purchase subcategory of the receipt for transport and food. - -#### Possible values include: - - 'plane' - - 'taxi' - - 'train' - - 'restaurant' - - 'shopping' - - 'other' - - 'groceries' - - 'cultural' - - 'electronics' - - 'office_supplies' - - 'micromobility' - - 'car_rental' - - 'public' - - 'delivery' - - null - -```php -echo $result->document->inference->prediction->subcategory->value; -``` - -## Supplier Address -**supplierAddress** : The address of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierAddress->value; -``` - -## Supplier Company Registrations -**supplierCompanyRegistrations** : List of company registration numbers associated to the supplier. - -```php -foreach ($result->document->inference->prediction->supplierCompanyRegistrations as $supplierCompanyRegistrationsElem) -{ - echo $supplierCompanyRegistrationsElem->value; -} -``` - -## Supplier Name -**supplierName** : The name of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierName->value; -``` - -## Supplier Phone Number -**supplierPhoneNumber** : The phone number of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierPhoneNumber->value; -``` - -## Taxes -**taxes** : The list of taxes present on the receipt. - -```php -foreach ($result->document->inference->prediction->taxes as $taxesElem) -{ - echo $taxesElem->value; -} -``` - -## Purchase Time -**time** : The time the purchase was made. - -```php -echo $result->document->inference->prediction->time->value; -``` - -## Tip and Gratuity -**tip** : The total amount of tip and gratuity. - -```php -echo $result->document->inference->prediction->tip->value; -``` - -## Total Amount -**totalAmount** : The total amount paid: includes taxes, discounts, fees, tips, and gratuity. - -```php -echo $result->document->inference->prediction->totalAmount->value; -``` - -## Total Net -**totalNet** : The net amount paid: does not include taxes, fees, and discounts. - -```php -echo $result->document->inference->prediction->totalNet->value; -``` - -## Total Tax -**totalTax** : The sum of all taxes. - -```php -echo $result->document->inference->prediction->totalTax->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 deleted file mode 100644 index 1a75f403..00000000 --- a/docs/financial_document_v1.md +++ /dev/null @@ -1,577 +0,0 @@ ---- -title: Financial Document OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-financial-document-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Financial Document API](https://platform.mindee.com/mindee/financial_document). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/financial_document/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Financial Document sample](https://github.com/mindee/client-lib-test-data/blob/main/products/financial_document/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(FinancialDocumentV1::class, $inputSource); - -echo $apiResponse->document; -``` - -You can also call this product asynchronously: - -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(FinancialDocumentV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 6dd26385-719b-4527-bf6f-87d9da619de5 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/financial_document v1.14 -:Rotation applied: Yes - -Prediction -========== -:Locale: en-US; en; US; USD; -:Invoice Number: INT-001 -:Purchase Order Number: 2412/2019 -:Receipt Number: -:Document Number: INT-001 -:Reference Numbers: 2412/2019 -:Purchase Date: 2019-11-02 -:Due Date: 2019-11-17 -:Payment Date: 2019-11-17 -:Total Net: 195.00 -:Total Amount: 204.75 -:Taxes: - +---------------+--------+----------+---------------+ - | Base | Code | Rate (%) | Amount | - +===============+========+==========+===============+ - | 195.00 | | 5.00 | 9.75 | - +---------------+--------+----------+---------------+ -:Supplier Payment Details: -:Supplier Name: JOHN SMITH -:Supplier Company Registrations: -:Supplier Address: 4490 Oak Drive Albany, NY 12210 -:Supplier Phone Number: -:Customer Name: JESSIE M HORNE -:Supplier Website: -:Supplier Email: -:Customer Company Registrations: -:Customer Address: 2019 Redbud Drive New York, NY 10011 -:Customer ID: 1234567890 -:Shipping Address: 2019 Redbud Drive New York, NY 10011 -:Billing Address: 4312 Wood Road New York, NY 10031 -:Document Type: INVOICE -:Document Type Extended: INVOICE -:Purchase Subcategory: -:Purchase Category: miscellaneous -:Total Tax: 9.75 -:Tip and Gratuity: -:Purchase Time: -:Line Items: - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price | - +======================================+==============+==========+============+==============+==============+=================+============+ - | Front and rear brake cables | | 1.00 | | | 100.00 | | 100.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | New set of pedal arms | | 2.00 | | | 50.00 | | 25.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | Labor 3hrs | | 3.00 | | | 45.00 | | 15.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - -Page Predictions -================ - -Page 0 ------- -:Locale: en-US; en; US; USD; -:Invoice Number: INT-001 -:Purchase Order Number: 2412/2019 -:Receipt Number: -:Document Number: INT-001 -:Reference Numbers: 2412/2019 -:Purchase Date: 2019-11-02 -:Due Date: 2019-11-17 -:Payment Date: 2019-11-17 -:Total Net: 195.00 -:Total Amount: 204.75 -:Taxes: - +---------------+--------+----------+---------------+ - | Base | Code | Rate (%) | Amount | - +===============+========+==========+===============+ - | 195.00 | | 5.00 | 9.75 | - +---------------+--------+----------+---------------+ -:Supplier Payment Details: -:Supplier Name: JOHN SMITH -:Supplier Company Registrations: -:Supplier Address: 4490 Oak Drive Albany, NY 12210 -:Supplier Phone Number: -:Customer Name: JESSIE M HORNE -:Supplier Website: -:Supplier Email: -:Customer Company Registrations: -:Customer Address: 2019 Redbud Drive New York, NY 10011 -:Customer ID: 1234567890 -:Shipping Address: 2019 Redbud Drive New York, NY 10011 -:Billing Address: 4312 Wood Road New York, NY 10031 -:Document Type: INVOICE -:Document Type Extended: INVOICE -:Purchase Subcategory: -:Purchase Category: miscellaneous -:Total Tax: 9.75 -:Tip and Gratuity: -:Purchase Time: -:Line Items: - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price | - +======================================+==============+==========+============+==============+==============+=================+============+ - | Front and rear brake cables | | 1.00 | | | 100.00 | | 100.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | New set of pedal arms | | 2.00 | | | 50.00 | | 25.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | Labor 3hrs | | 3.00 | | | 45.00 | | 15.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -### AddressField -Aside from the basic `BaseField` attributes, the address field `AddressField` also implements the following: - -* **streetNumber** (`?string`): String representation of the street number. Can be `null`. -* **streetName** (`?string`): Name of the street. Can be `null`. -* **poBox** (`?string`): String representation of the PO Box number. Can be `null`. -* **addressComplement** (`?string`): Address complement. Can be `null`. -* **city** (`?string`): City name. Can be `null`. -* **postalCode** (`?string`): String representation of the postal code. Can be `null`. -* **state** (`?string`): State name. Can be `null`. -* **country** (`?string`): Country name. Can be `null`. - -Note: The `value` field of an AddressField should be a concatenation of the rest of the values. - - -### AmountField -The amount field `AmountField` only has one constraint: its **value** is an optional `?float`. - - -### ClassificationField -The classification field `ClassificationField` does not implement all the basic `BaseField` attributes. It only implements **value**, **confidence** and **pageId**. - -> Note: a classification field's `value is always a `string`. - - -### CompanyRegistrationField -Aside from the basic `BaseField` attributes, the company registration field `CompanyRegistrationField` also implements the following: - -* **type** (`string`): the type of company. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### LocaleField -The locale field `LocaleField` only implements the **value**, **confidence** and **pageId** base `BaseField` attributes, but it comes with its own: - -* **language** (`string`): ISO 639-1 language code (e.g.: `en` for English). Can be `null`. -* **country** (`string`): ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3 code for countries (e.g.: `GRB` or `GB` for "Great Britain"). Can be `null`. -* **currency** (`string`): ISO 4217 code for currencies (e.g.: `USD` for "US Dollars"). Can be `null`. - -### PaymentDetailsField -Aside from the basic `BaseField` attributes, the payment details field `PaymentDetailsField` also implements the following: - -* **accountNumber** (`string`): number of an account, expressed as a string. Can be `null`. -* **iban** (`string`): International Bank Account Number. Can be `null`. -* **routingNumber** (`string`): routing number of an account. Can be `null`. -* **swift** (`string`): the account holder's bank's SWIFT Business Identifier Code (BIC). Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -### TaxesField -#### Tax -Aside from the basic `BaseField` attributes, the tax field `TaxField` also implements the following: - -* **rate** (`float`): the tax rate applied to an item expressed as a percentage. Can be `null`. -* **code** (`string`): tax code (or equivalent, depending on the origin of the document). Can be `null`. -* **basis** (`float`): base amount used for the tax. Can be `null`. -* **value** (`float`): the value of the tax. Can be `null`. - -> Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, a list-like structure. - -#### Taxes (Array) -The `Taxes` field represents a list-like collection of `TaxField` objects. As it is the representation of several objects, it has access to a custom `__toString` method that can render a `TaxField` object as a table line. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Line Items Field -List of line item present on the document. - -A `FinancialDocumentV1LineItem` implements the following attributes: - -* **description** (`string`): The item description. -* **productCode** (`string`): The product code referring to the item. -* **quantity** (`float`): The item quantity -* **taxAmount** (`float`): The item tax amount. -* **taxRate** (`float`): The item tax rate in percentage. -* **totalAmount** (`float`): The item total amount. -* **unitMeasure** (`string`): The item unit of measure. -* **unitPrice** (`float`): The item unit price. - -# Attributes -The following fields are extracted for Financial Document V1: - -## Billing Address -**billingAddress** : The customer's address used for billing. - -```php -echo $result->document->inference->prediction->billingAddress->value; -``` - -## Purchase Category -**category** : The purchase category. - -#### Possible values include: - - 'toll' - - 'food' - - 'parking' - - 'transport' - - 'accommodation' - - 'gasoline' - - 'telecom' - - 'miscellaneous' - - 'software' - - 'shopping' - - 'energy' - -```php -echo $result->document->inference->prediction->category->value; -``` - -## Customer Address -**customerAddress** : The address of the customer. - -```php -echo $result->document->inference->prediction->customerAddress->value; -``` - -## Customer Company Registrations -**customerCompanyRegistrations** : List of company registration numbers associated to the customer. - -```php -foreach ($result->document->inference->prediction->customerCompanyRegistrations as $customerCompanyRegistrationsElem) -{ - echo $customerCompanyRegistrationsElem->value; -} -``` - -## Customer ID -**customerId** : The customer account number or identifier from the supplier. - -```php -echo $result->document->inference->prediction->customerId->value; -``` - -## Customer Name -**customerName** : The name of the customer. - -```php -echo $result->document->inference->prediction->customerName->value; -``` - -## Purchase Date -**date** : The date the purchase was made. - -```php -echo $result->document->inference->prediction->date->value; -``` - -## Document Number -**documentNumber** : The document number or identifier (invoice number or receipt number). - -```php -echo $result->document->inference->prediction->documentNumber->value; -``` - -## Document Type -**documentType** : The type of the document: INVOICE or CREDIT NOTE if it is an invoice, CREDIT CARD RECEIPT or EXPENSE RECEIPT if it is a receipt. - -#### Possible values include: - - 'INVOICE' - - 'CREDIT NOTE' - - 'CREDIT CARD RECEIPT' - - 'EXPENSE RECEIPT' - -```php -echo $result->document->inference->prediction->documentType->value; -``` - -## Document Type Extended -**documentTypeExtended** : Document type extended. - -#### Possible values include: - - 'CREDIT NOTE' - - 'INVOICE' - - 'OTHER' - - 'OTHER_FINANCIAL' - - 'PAYSLIP' - - 'PURCHASE ORDER' - - 'QUOTE' - - 'RECEIPT' - - 'STATEMENT' - -```php -echo $result->document->inference->prediction->documentTypeExtended->value; -``` - -## Due Date -**dueDate** : The date on which the payment is due. - -```php -echo $result->document->inference->prediction->dueDate->value; -``` - -## Invoice Number -**invoiceNumber** : The invoice number or identifier only if document is an invoice. - -```php -echo $result->document->inference->prediction->invoiceNumber->value; -``` - -## Line Items -**lineItems** ([[FinancialDocumentV1LineItem](#line-items-field)]): List of line item present on the document. - -```php -foreach ($result->document->inference->prediction->lineItems as $lineItemsElem) -{ - echo $lineItemsElem->value; -} -``` - -## Locale -**locale** : The locale of the document. - -```php -echo $result->document->inference->prediction->locale->value; -``` - -## Payment Date -**paymentDate** : The date on which the payment is due / fullfilled. - -```php -echo $result->document->inference->prediction->paymentDate->value; -``` - -## Purchase Order Number -**poNumber** : The purchase order number, only if the document is an invoice. - -```php -echo $result->document->inference->prediction->poNumber->value; -``` - -## Receipt Number -**receiptNumber** : The receipt number or identifier only if document is a receipt. - -```php -echo $result->document->inference->prediction->receiptNumber->value; -``` - -## Reference Numbers -**referenceNumbers** : List of Reference numbers, including PO number, only if the document is an invoice. - -```php -foreach ($result->document->inference->prediction->referenceNumbers as $referenceNumbersElem) -{ - echo $referenceNumbersElem->value; -} -``` - -## Shipping Address -**shippingAddress** : The customer's address used for shipping. - -```php -echo $result->document->inference->prediction->shippingAddress->value; -``` - -## Purchase Subcategory -**subcategory** : The purchase subcategory for transport, food and shooping. - -#### Possible values include: - - 'plane' - - 'taxi' - - 'train' - - 'restaurant' - - 'shopping' - - 'other' - - 'groceries' - - 'cultural' - - 'electronics' - - 'office_supplies' - - 'micromobility' - - 'car_rental' - - 'public' - - 'delivery' - - null - -```php -echo $result->document->inference->prediction->subcategory->value; -``` - -## Supplier Address -**supplierAddress** : The address of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierAddress->value; -``` - -## Supplier Company Registrations -**supplierCompanyRegistrations** : List of company registration numbers associated to the supplier. - -```php -foreach ($result->document->inference->prediction->supplierCompanyRegistrations as $supplierCompanyRegistrationsElem) -{ - echo $supplierCompanyRegistrationsElem->value; -} -``` - -## Supplier Email -**supplierEmail** : The email of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierEmail->value; -``` - -## Supplier Name -**supplierName** : The name of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierName->value; -``` - -## Supplier Payment Details -**supplierPaymentDetails** : List of payment details associated to the supplier (only for invoices). - -```php -foreach ($result->document->inference->prediction->supplierPaymentDetails as $supplierPaymentDetailsElem) -{ - echo $supplierPaymentDetailsElem->value; - echo $supplierPaymentDetailsElem->rate; - echo $supplierPaymentDetailsElem->code; - echo $supplierPaymentDetailsElem->basis; -} -``` - -## Supplier Phone Number -**supplierPhoneNumber** : The phone number of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierPhoneNumber->value; -``` - -## Supplier Website -**supplierWebsite** : The website URL of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierWebsite->value; -``` - -## Taxes -**taxes** : List of all taxes on the document. - -```php -foreach ($result->document->inference->prediction->taxes as $taxesElem) -{ - echo $taxesElem->value; -} -``` - -## Purchase Time -**time** : The time the purchase was made (only for receipts). - -```php -echo $result->document->inference->prediction->time->value; -``` - -## Tip and Gratuity -**tip** : The total amount of tip and gratuity - -```php -echo $result->document->inference->prediction->tip->value; -``` - -## Total Amount -**totalAmount** : The total amount paid: includes taxes, tips, fees, and other charges. - -```php -echo $result->document->inference->prediction->totalAmount->value; -``` - -## Total Net -**totalNet** : The net amount paid: does not include taxes, fees, and discounts. - -```php -echo $result->document->inference->prediction->totalNet->value; -``` - -## Total Tax -**totalTax** : The sum of all taxes present on the document. - -```php -echo $result->document->inference->prediction->totalTax->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/french_healthcard_v1.md b/docs/french_healthcard_v1.md deleted file mode 100644 index ca8496e7..00000000 --- a/docs/french_healthcard_v1.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: FR Health Card OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-fr-health-card-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Health Card API](https://platform.mindee.com/mindee/french_healthcard). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/french_healthcard/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Health Card sample](https://github.com/mindee/client-lib-test-data/blob/main/products/french_healthcard/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(HealthCardV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 9ee2733d-933a-4dcd-a73a-a31395e3b288 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/french_healthcard v1.0 -:Rotation applied: Yes - -Prediction -========== -:Given Name(s): NATHALIE -:Surname: DURAND -:Social Security Number: 2 69 05 49 588 157 80 -:Issuance Date: 2007-01-01 -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -# Attributes -The following fields are extracted for Health Card V1: - -## Given Name(s) -**givenNames** : The given names of the card holder. - -```php -foreach ($result->document->inference->prediction->givenNames as $givenNamesElem) -{ - echo $givenNamesElem->value; -} -``` - -## Issuance Date -**issuanceDate** : The date when the carte vitale document was issued. - -```php -echo $result->document->inference->prediction->issuanceDate->value; -``` - -## Social Security Number -**socialSecurity** : The social security number of the card holder. - -```php -echo $result->document->inference->prediction->socialSecurity->value; -``` - -## Surname -**surname** : The surname of the card holder. - -```php -echo $result->document->inference->prediction->surname->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/generated_v1.md b/docs/generated_v1.md deleted file mode 100644 index e59bfc0d..00000000 --- a/docs/generated_v1.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -title: Generated API PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-generated-api -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports generated APIs. -Generated APIs can theoretically support all APIs in a catch-all generic format. - -# Quick-Start - -```php -sourceFromPath("/path/to/the/file.ext"); - -// Create a custom endpoint -$customEndpoint = $mindeeClient->createEndpoint( - "my-endpoint", - "my-account", - "my-version" -); - -// Add the custom endpoint to the prediction options. -$predictOptions = new PredictMethodOptions(); -$predictOptions->setEndpoint($customEndpoint); - -// Parse the file -$apiResponse = $mindeeClient->enqueueAndParse(GeneratedV1::class, $inputSource, $predictOptions); - -echo strval($apiResponse->document); -``` - -# Generated Endpoints - -As shown above, you will need to provide an account and an endpoint name at the very least. - -Although it is optional, the version number should match the latest version of your build in most use-cases. -If it is not set, it will default to "1". - -# Field Types - -## Generated Fields - -### Generated List Field - -A `GeneratedListField` is a special type of custom list that implements the following: - -- **values** (`StringField|`[GeneratedObjectField](#Generated-object-field)): the confidence score of the field prediction. -- **pageId** (`integer`): only available for some documents ATM. - -Since the inner contents can vary, the value isn't accessed through a property, but rather through the following functions: - -- **contentsList()** (`-> string|float`): returns a list of values for each element. -- **contentsString($separator=" ")** (`-> string`): returns a list of concatenated values, with an optional **separator** `string` between them. -> **Note:** the `__toString()` method returns a string representation of all values of this object, with an empty space between each of them. - -### Generated Object Field - -Unrecognized structures and sometimes values of `ListField`s are stored in a `GeneratedObjectField` structure, which is implemented dynamically depending on the object's structure. - -- **pageId** (`integer?`): the ID of the page, is `null` when at document-level. -- **rawValue** (`string?`): an optional field for when some post-processing has been done on fields (e.g. amounts). `null` in most instances. -- **confidence** (`float?`): the confidence score of the field prediction. Warning: support isn't guaranteed on all APIs. - - -> **Other fields**:No matter what, other fields will be stored in a dictionary-like structure with a `key: value` pair where `key` is a string and `value` is a nullable string. They can be accessed like any other regular value, but won't be suggested by your IDE. - - -### StringField -The text field `StringField` only has one constraint: its **value** is an `string?`. - - -# Attributes - -Generated builds always have access to at least two attributes: - -## Fields - -**fields** (`array [GeneratedListField](#generated-list-field)|[GeneratedObjectField](#generated-object-field)|(#stringfield)[StringField]`>`): - -```php -echo $result->document->inference->prediction->fields["my-field"]); -``` - -# Questions? - -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/getting_started.md b/docs/getting_started.md deleted file mode 100644 index 7347c7e4..00000000 --- a/docs/getting_started.md +++ /dev/null @@ -1,278 +0,0 @@ ---- -title: Getting Started -category: 622b805aaec68102ea7fcbc2 -slug: php-getting-started -parentDoc: 658193df8e029d002ad9c89b ---- -This guide will help you get started with the Mindee PHP OCR SDK to easily extract data from your documents. - -The PHP OCR SDK supports [invoice](https://developers.mindee.com/docs/php-invoice-ocr), [passport](https://developers.mindee.com/docs/php-passport-ocr), [receipt](https://developers.mindee.com/docs/php-receipt-ocr) OCR APIs and [custom-built API](https://developers.mindee.com/docs/php-api-builder) from the API Builder. - -You can view the source code on [GitHub](https://github.com/mindee/mindee-api-php), and the package on [PyPI](https://pypi.org/project/mindee/). - -## Prerequisite - -- Download and install [PHP](https://www.php.net/downloads.php). This library is officially supported on PHP `7.4` to `8.2`. -- Download and install [Composer](https://getcomposer.org/download/). - -## Installation - -To quickly get started with the PHP OCR SDK anywhere, the preferred installation method is via `composer`. - -```shell -composer require mindee/mindee -``` - -### Development Installation - -If you'll be modifying the source code, you'll need to install the development requirements to get started. - -1. First clone the repo. - -```shell -git clone git@github.com:mindee/mindee-api-php.git -``` - -2. Then navigate to the cloned directory and install all development requirements. - -```shell -cd mindee-api-php -composer install -``` - -## Updating the Version - -It is important to always check the version of the Mindee OCR SDK you are using, as new and updated features won’t work on old versions. - -To check the installed version: - -```shell -composer show mindee/mindee -``` - -To get the latest version: - -```shell -composer require mindee/mindee -``` - -To install a specific version: - -```shell -composer require mindee/mindee: -``` - -## Usage - -To get started with Mindee's APIs, you need to create a `Client` and you're ready to go. - -Let's take a deep dive into how this works. - -## Initializing the Client - -The `Client` centralizes document configurations in a single object. - -The `Client` requires your [API key](https://developers.mindee.com/docs/make-your-first-request#create-an-api-key). - -You can either pass these directly to the constructor or through environment variables. - -### Pass the API key directly - -```php -sourceFromPath("/path/to/the/file.ext"); -``` - -### File Object - -A normal PHP file object. **Must be in binary mode**. - -```php -$myFile = file("/path/to/the/file.ext"); -$inputSource = $mindeeClient->sourceFromFile($myFile); -``` - -### Base64 - -Requires a base64 encoded string. - -**Note**: The original filename is required when calling the method. - -```php -$b64String = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLD...."; -$inputSource = $mindeeClient->sourceFromB64String($b64String, "receipt.jpg"); -``` - -### Bytes - -Requires raw bytes. - -**Note**: The original filename is required when calling the method. - -```php -$rawBytes = b"%PDF-1.3\n%\xbf\xf7\xa2\xfe\n1 0 ob..."; -$inputSource = $mindeeClient->sourceFromBytes($rawBytes, "receipt.jpg"); -``` - -### URL - -Allows sending a URL directly. - -```php -$remoteInputSource = $mindeeClient->sourceFromUrl("https://www.example.com/invoice.pdf"); -``` - -**Note:** The server will reject files behind a private URL or a redirection, so you can also download those file into -a byte object before loading them as a local input source. - -This also allows you to apply transformations to files before sending them. - -```php -$remoteInputSource = $mindeeClient->sourceFromUrl("https://www.example.com/invoice.pdf"); -$localInputSource = $remoteInputSource->asLocalInputSource(); -``` - -## Sending a File - -To send a file to the API, we need to specify how to process the document. -This will determine which API endpoint is used and how the API return will be handled internally by the library. - -More specifically, we need to set a `Mindee\Product` class as the first parameter of the `parse` method. - -This is because the `parse` method's return type depends on its first argument. - -Product classes inherit from the base `Mindee\Parsing\Common\Inference` class. - -More information is available in each document-specific guide. - -### Off-the-Shelf Documents - -Simply setting the correct class and passing the input document is enough: - -```php -$result = $mindeeClient->parse(InvoiceV4::class, $inputSource); -``` - -### Custom Documents (docTI & Custom APIs) - -The endpoint to use must be created beforehand and subsequently passed to the `endpoint` argument of the `enqueueAndParse` method: - -```php -// Create a custom endpoint -$customEndpoint = $mindeeClient->createEndpoint( - "my-endpoint", - "my-account", -// "my-version" // Optional -); - -// Add the custom endpoint to the prediction options. -$predictOptions = new PredictMethodOptions(); -$predictOptions->setEndpoint($customEndpoint); - -// Parse the file -$apiResponse = $mindeeClient->enqueueAndParse(GeneratedV1::class, $inputSource, $predictOptions); -``` - -This is because the `GeneratedV1` class is enough to handle the return processing, but the actual endpoint needs to be specified. - - -## Processing the Response - -Results of a prediction can be retrieved in two different places: - -- [Document level predictions](#document-level-prediction) -- [Page level predictions](#page-level-prediction) - -### Document Level Prediction - -The `document` attribute is an object specific to the type of document being processed. -It is an instance of the `Document` class, to which a generic type is given. - -It contains the data extracted from the entire document, all pages combined. -It's possible to have the same field in various pages, but at the document level only the highest confidence field data will be shown (this is all done automatically at the API level). - -Usage: -```php -echo $result->document; -``` - -A `document`'s fields (attributes) can be accessed through it's `prediction` attribute, which have types that can vary from one product to another. -These attributes are detailed in each product's respective guide. - -### Page Level Prediction - -The `pages` attribute is a list of `Page` objects. `Page` is a wrapper around elements that extend the [`Document` class](#document-level-prediction). -The `prediction` of a `Page` inherits from the product's own `Document`, and adds all page-specific fields to it. - -The order of the elements in the list matches the order of the pages in the document. - -All response objects have a `pages` property, regardless of the number of pages. -Single-page documents will have a single entry. - -Iteration over `pages` is done like with any list, for example: - -```php -foreach ($response->pages as $page){ - echo $page; -} -``` - -## Questions? - -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/idcard_fr_v2.md b/docs/idcard_fr_v2.md deleted file mode 100644 index fd870656..00000000 --- a/docs/idcard_fr_v2.md +++ /dev/null @@ -1,268 +0,0 @@ ---- -title: FR Carte Nationale d'Identité OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-fr-carte-nationale-didentite-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Carte Nationale d'Identité API](https://platform.mindee.com/mindee/idcard_fr). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/idcard_fr/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Carte Nationale d'Identité sample](https://github.com/mindee/client-lib-test-data/blob/main/products/idcard_fr/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(IdCardV2::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: d33828f1-ef7e-4984-b9df-a2bfaa38a78d -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/idcard_fr v2.0 -:Rotation applied: Yes - -Prediction -========== -:Nationality: -:Card Access Number: 175775H55790 -:Document Number: -:Given Name(s): Victor - Marie -:Surname: DAMBARD -:Alternate Name: -:Date of Birth: 1994-04-24 -:Place of Birth: LYON 4E ARRONDISSEM -:Gender: M -:Expiry Date: 2030-04-02 -:Mrz Line 1: IDFRADAMBARD<<<<<<<<<<<<<<<<<<075025 -:Mrz Line 2: 170775H557903VICTOR< **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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` does not implement all the basic `BaseField` attributes. It only implements **value**, **confidence** and **pageId**. - -> Note: a classification field's `value is always a `string`. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -## Page-Level Fields -Some fields are constrained to the page level, and so will not be retrievable at document level. - -# Attributes -The following fields are extracted for Carte Nationale d'Identité V2: - -## Alternate Name -**alternateName** : The alternate name of the card holder. - -```php -echo $result->document->inference->prediction->alternateName->value; -``` - -## Issuing Authority -**authority** : The name of the issuing authority. - -```php -echo $result->document->inference->prediction->authority->value; -``` - -## Date of Birth -**birthDate** : The date of birth of the card holder. - -```php -echo $result->document->inference->prediction->birthDate->value; -``` - -## Place of Birth -**birthPlace** : The place of birth of the card holder. - -```php -echo $result->document->inference->prediction->birthPlace->value; -``` - -## Card Access Number -**cardAccessNumber** : The card access number (CAN). - -```php -echo $result->document->inference->prediction->cardAccessNumber->value; -``` - -## Document Number -**documentNumber** : The document number. - -```php -echo $result->document->inference->prediction->documentNumber->value; -``` - -## Document Sides -[📄](#page-level-fields "This field is only present on individual pages.")**documentSide** : The sides of the document which are visible. - -#### Possible values include: - - 'RECTO' - - 'VERSO' - - 'RECTO & VERSO' - -```php -foreach($result->document->inference->prediction->documentSide as $documentSideElem) -{ - echo $documentSideElem->value; -} -``` - -## Document Type -[📄](#page-level-fields "This field is only present on individual pages.")**documentType** : The document type or format. - -#### Possible values include: - - 'NEW' - - 'OLD' - -```php -foreach($result->document->inference->prediction->documentType as $documentTypeElem) -{ - echo $documentTypeElem->value; -} -``` - -## Expiry Date -**expiryDate** : The expiry date of the identification card. - -```php -echo $result->document->inference->prediction->expiryDate->value; -``` - -## Gender -**gender** : The gender of the card holder. - -```php -echo $result->document->inference->prediction->gender->value; -``` - -## Given Name(s) -**givenNames** : The given name(s) of the card holder. - -```php -foreach ($result->document->inference->prediction->givenNames as $givenNamesElem) -{ - echo $givenNamesElem->value; -} -``` - -## Date of Issue -**issueDate** : The date of issue of the identification card. - -```php -echo $result->document->inference->prediction->issueDate->value; -``` - -## Mrz Line 1 -**mrz1** : The Machine Readable Zone, first line. - -```php -echo $result->document->inference->prediction->mrz1->value; -``` - -## Mrz Line 2 -**mrz2** : The Machine Readable Zone, second line. - -```php -echo $result->document->inference->prediction->mrz2->value; -``` - -## Mrz Line 3 -**mrz3** : The Machine Readable Zone, third line. - -```php -echo $result->document->inference->prediction->mrz3->value; -``` - -## Nationality -**nationality** : The nationality of the card holder. - -```php -echo $result->document->inference->prediction->nationality->value; -``` - -## Surname -**surname** : The surname of the card holder. - -```php -echo $result->document->inference->prediction->surname->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/ind_passport_v1.md b/docs/ind_passport_v1.md deleted file mode 100644 index 6164f034..00000000 --- a/docs/ind_passport_v1.md +++ /dev/null @@ -1,280 +0,0 @@ ---- -title: IND Passport - India OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-ind-passport---india-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP 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 -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(IndianPassportV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: cf88fd43-eaa1-497a-ba29-a9569a4edaa7 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/ind_passport v1.2 -: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 **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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` does not implement all the basic `BaseField` attributes. It only implements **value**, **confidence** and **pageId**. - -> Note: a classification field's `value is always a `string`. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -# Attributes -The following fields are extracted for Passport - India V1: - -## Address Line 1 -**address1** : The first line of the address of the passport holder. - -```php -echo $result->document->inference->prediction->address1->value; -``` - -## Address Line 2 -**address2** : The second line of the address of the passport holder. - -```php -echo $result->document->inference->prediction->address2->value; -``` - -## Address Line 3 -**address3** : The third line of the address of the passport holder. - -```php -echo $result->document->inference->prediction->address3->value; -``` - -## Birth Date -**birthDate** : The birth date of the passport holder, ISO format: YYYY-MM-DD. - -```php -echo $result->document->inference->prediction->birthDate->value; -``` - -## Birth Place -**birthPlace** : The birth place of the passport holder. - -```php -echo $result->document->inference->prediction->birthPlace->value; -``` - -## Country -**country** : ISO 3166-1 alpha-3 country code (3 letters format). - -```php -echo $result->document->inference->prediction->country->value; -``` - -## Expiry Date -**expiryDate** : The date when the passport will expire, ISO format: YYYY-MM-DD. - -```php -echo $result->document->inference->prediction->expiryDate->value; -``` - -## File Number -**fileNumber** : The file number of the passport document. - -```php -echo $result->document->inference->prediction->fileNumber->value; -``` - -## Gender -**gender** : The gender of the passport holder. - -#### Possible values include: - - 'M' - - 'F' - -```php -echo $result->document->inference->prediction->gender->value; -``` - -## Given Names -**givenNames** : The given names of the passport holder. - -```php -echo $result->document->inference->prediction->givenNames->value; -``` - -## ID Number -**idNumber** : The identification number of the passport document. - -```php -echo $result->document->inference->prediction->idNumber->value; -``` - -## Issuance Date -**issuanceDate** : The date when the passport was issued, ISO format: YYYY-MM-DD. - -```php -echo $result->document->inference->prediction->issuanceDate->value; -``` - -## Issuance Place -**issuancePlace** : The place where the passport was issued. - -```php -echo $result->document->inference->prediction->issuancePlace->value; -``` - -## Legal Guardian -**legalGuardian** : The name of the legal guardian of the passport holder (if applicable). - -```php -echo $result->document->inference->prediction->legalGuardian->value; -``` - -## MRZ Line 1 -**mrz1** : The first line of the machine-readable zone (MRZ) of the passport document. - -```php -echo $result->document->inference->prediction->mrz1->value; -``` - -## MRZ Line 2 -**mrz2** : The second line of the machine-readable zone (MRZ) of the passport document. - -```php -echo $result->document->inference->prediction->mrz2->value; -``` - -## Name of Mother -**nameOfMother** : The name of the mother of the passport holder. - -```php -echo $result->document->inference->prediction->nameOfMother->value; -``` - -## Name of Spouse -**nameOfSpouse** : The name of the spouse of the passport holder (if applicable). - -```php -echo $result->document->inference->prediction->nameOfSpouse->value; -``` - -## Old Passport Date of Issue -**oldPassportDateOfIssue** : The date of issue of the old passport (if applicable), ISO format: YYYY-MM-DD. - -```php -echo $result->document->inference->prediction->oldPassportDateOfIssue->value; -``` - -## Old Passport Number -**oldPassportNumber** : The number of the old passport (if applicable). - -```php -echo $result->document->inference->prediction->oldPassportNumber->value; -``` - -## Old Passport Place of Issue -**oldPassportPlaceOfIssue** : The place of issue of the old passport (if applicable). - -```php -echo $result->document->inference->prediction->oldPassportPlaceOfIssue->value; -``` - -## Page Number -**pageNumber** : The page number of the passport document. - -#### Possible values include: - - '1' - - '2' - -```php -echo $result->document->inference->prediction->pageNumber->value; -``` - -## Surname -**surname** : The surname of the passport holder. - -```php -echo $result->document->inference->prediction->surname->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/international_id_v2.md b/docs/international_id_v2.md deleted file mode 100644 index 670dc3cf..00000000 --- a/docs/international_id_v2.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -title: International ID OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-international-id-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [International ID API](https://platform.mindee.com/mindee/international_id). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/international_id/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![International ID sample](https://github.com/mindee/client-lib-test-data/blob/main/products/international_id/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(InternationalIdV2::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: cfa20a58-20cf-43b6-8cec-9505fa69d1c2 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/international_id v2.0 -:Rotation applied: No - -Prediction -========== -:Document Type: IDENTIFICATION_CARD -:Document Number: 12345678A -:Surnames: MUESTRA - MUESTRA -:Given Names: CARMEN -:Sex: F -:Birth Date: 1980-01-01 -:Birth Place: CAMPO DE CRIPTANA CIUDAD REAL ESPANA -:Nationality: ESP -:Personal Number: BAB1834284<44282767Q0 -:Country of Issue: ESP -:State of Issue: MADRID -:Issue Date: -:Expiration Date: 2030-01-01 -:Address: C/REAL N13, 1 DCHA COLLADO VILLALBA MADRID MADRID MADRID -:MRZ Line 1: IDESPBAB1834284<44282767Q0<<<< -:MRZ Line 2: 8001010F1301017ESP<<<<<<<<<<<3 -:MRZ Line 3: MUESTRA **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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` does not implement all the basic `BaseField` attributes. It only implements **value**, **confidence** and **pageId**. - -> Note: a classification field's `value is always a `string`. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -# Attributes -The following fields are extracted for International ID V2: - -## Address -**address** : The physical address of the document holder. - -```php -echo $result->document->inference->prediction->address->value; -``` - -## Birth Date -**birthDate** : The date of birth of the document holder. - -```php -echo $result->document->inference->prediction->birthDate->value; -``` - -## Birth Place -**birthPlace** : The place of birth of the document holder. - -```php -echo $result->document->inference->prediction->birthPlace->value; -``` - -## Country of Issue -**countryOfIssue** : The country where the document was issued. - -```php -echo $result->document->inference->prediction->countryOfIssue->value; -``` - -## Document Number -**documentNumber** : The unique identifier assigned to the document. - -```php -echo $result->document->inference->prediction->documentNumber->value; -``` - -## Document Type -**documentType** : The type of personal identification document. - -#### Possible values include: - - 'IDENTIFICATION_CARD' - - 'PASSPORT' - - 'DRIVER_LICENSE' - - 'VISA' - - 'RESIDENCY_CARD' - - 'VOTER_REGISTRATION' - -```php -echo $result->document->inference->prediction->documentType->value; -``` - -## Expiration Date -**expiryDate** : The date when the document becomes invalid. - -```php -echo $result->document->inference->prediction->expiryDate->value; -``` - -## Given Names -**givenNames** : The list of the document holder's given names. - -```php -foreach ($result->document->inference->prediction->givenNames as $givenNamesElem) -{ - echo $givenNamesElem->value; -} -``` - -## Issue Date -**issueDate** : The date when the document was issued. - -```php -echo $result->document->inference->prediction->issueDate->value; -``` - -## MRZ Line 1 -**mrzLine1** : The Machine Readable Zone, first line. - -```php -echo $result->document->inference->prediction->mrzLine1->value; -``` - -## MRZ Line 2 -**mrzLine2** : The Machine Readable Zone, second line. - -```php -echo $result->document->inference->prediction->mrzLine2->value; -``` - -## MRZ Line 3 -**mrzLine3** : The Machine Readable Zone, third line. - -```php -echo $result->document->inference->prediction->mrzLine3->value; -``` - -## Nationality -**nationality** : The country of citizenship of the document holder. - -```php -echo $result->document->inference->prediction->nationality->value; -``` - -## Personal Number -**personalNumber** : The unique identifier assigned to the document holder. - -```php -echo $result->document->inference->prediction->personalNumber->value; -``` - -## Sex -**sex** : The biological sex of the document holder. - -```php -echo $result->document->inference->prediction->sex->value; -``` - -## State of Issue -**stateOfIssue** : The state or territory where the document was issued. - -```php -echo $result->document->inference->prediction->stateOfIssue->value; -``` - -## Surnames -**surnames** : The list of the document holder's family names. - -```php -foreach ($result->document->inference->prediction->surnames as $surnamesElem) -{ - echo $surnamesElem->value; -} -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/invoice_splitter_v1.md b/docs/invoice_splitter_v1.md deleted file mode 100644 index 3eb03800..00000000 --- a/docs/invoice_splitter_v1.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: Invoice Splitter OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-invoice-splitter-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Invoice Splitter API](https://platform.mindee.com/mindee/invoice_splitter). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/invoice_splitter/default_sample.pdf), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Invoice Splitter sample](https://github.com/mindee/client-lib-test-data/blob/main/products/invoice_splitter/default_sample.pdf?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(InvoiceSplitterV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 15ad7a19-7b75-43d0-b0c6-9a641a12b49b -:Filename: default_sample.pdf - -Inference -######### -:Product: mindee/invoice_splitter v1.2 -:Rotation applied: No - -Prediction -========== -:Invoice Page Groups: - +--------------------------------------------------------------------------+ - | Page Indexes | - +==========================================================================+ - | 0 | - +--------------------------------------------------------------------------+ - | 1 | - +--------------------------------------------------------------------------+ -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Invoice Page Groups Field -List of page groups. Each group represents a single invoice within a multi-invoice document. - -A `InvoiceSplitterV1InvoicePageGroup` implements the following attributes: - -* **pageIndexes** (`int`): List of page indexes that belong to the same invoice (group). - -# Attributes -The following fields are extracted for Invoice Splitter V1: - -## Invoice Page Groups -**invoicePageGroups** ([[InvoiceSplitterV1InvoicePageGroup](#invoice-page-groups-field)]): List of page groups. Each group represents a single invoice within a multi-invoice document. - -```php -foreach ($result->document->inference->prediction->invoicePageGroups as $invoicePageGroupsElem) -{ - echo $invoicePageGroupsElem->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 deleted file mode 100644 index c8c796ff..00000000 --- a/docs/invoices_v4.md +++ /dev/null @@ -1,538 +0,0 @@ ---- -title: Invoice OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-invoice-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Invoice API](https://platform.mindee.com/mindee/invoices). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/invoices/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Invoice sample](https://github.com/mindee/client-lib-test-data/blob/main/products/invoices/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(InvoiceV4::class, $inputSource); - -echo $apiResponse->document; -``` - -You can also call this product asynchronously: - -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(InvoiceV4::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 744748d5-9051-461c-b70c-bbf81f5ff943 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/invoices v4.11 -:Rotation applied: Yes - -Prediction -========== -: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: -:Total Net: 2145.00 -:Total Amount: 2608.20 -:Total Tax: 193.20 -:Taxes: - +---------------+--------+----------+---------------+ - | Base | Code | Rate (%) | Amount | - +===============+========+==========+===============+ - | 2145.00 | | 8.00 | 193.20 | - +---------------+--------+----------+---------------+ -:Supplier Payment Details: -:Supplier Name: TURNPIKE DESIGNS -:Supplier Company Registrations: -:Supplier Address: 156 University Ave, Toronto ON, Canada, M5H 2H7 -:Supplier Phone Number: 4165551212 -:Supplier Website: -:Supplier Email: j_coi@example.com -:Customer Name: JIRO DOI -:Customer Company Registrations: -:Customer Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada -:Customer ID: -:Shipping Address: -:Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada -:Document Type: INVOICE -:Document Type Extended: INVOICE -:Purchase Subcategory: -:Purchase Category: miscellaneous -:Line Items: - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price | - +======================================+==============+==========+============+==============+==============+=================+============+ - | Platinum web hosting package Down... | | 1.00 | | | 65.00 | | 65.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | 2 page website design Includes ba... | | 3.00 | | | 2100.00 | | 2100.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | Mobile designs Includes responsiv... | | 1.00 | | | 250.00 | 1 | 250.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - -Page Predictions -================ - -Page 0 ------- -: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: -:Total Net: 2145.00 -:Total Amount: 2608.20 -:Total Tax: 193.20 -:Taxes: - +---------------+--------+----------+---------------+ - | Base | Code | Rate (%) | Amount | - +===============+========+==========+===============+ - | 2145.00 | | 8.00 | 193.20 | - +---------------+--------+----------+---------------+ -:Supplier Payment Details: -:Supplier Name: TURNPIKE DESIGNS -:Supplier Company Registrations: -:Supplier Address: 156 University Ave, Toronto ON, Canada, M5H 2H7 -:Supplier Phone Number: 4165551212 -:Supplier Website: -:Supplier Email: j_coi@example.com -:Customer Name: JIRO DOI -:Customer Company Registrations: -:Customer Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada -:Customer ID: -:Shipping Address: -:Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada -:Document Type: INVOICE -:Document Type Extended: INVOICE -:Purchase Subcategory: -:Purchase Category: miscellaneous -:Line Items: - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price | - +======================================+==============+==========+============+==============+==============+=================+============+ - | Platinum web hosting package Down... | | 1.00 | | | 65.00 | | 65.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | 2 page website design Includes ba... | | 3.00 | | | 2100.00 | | 2100.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ - | Mobile designs Includes responsiv... | | 1.00 | | | 250.00 | 1 | 250.00 | - +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+ -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -### AddressField -Aside from the basic `BaseField` attributes, the address field `AddressField` also implements the following: - -* **streetNumber** (`?string`): String representation of the street number. Can be `null`. -* **streetName** (`?string`): Name of the street. Can be `null`. -* **poBox** (`?string`): String representation of the PO Box number. Can be `null`. -* **addressComplement** (`?string`): Address complement. Can be `null`. -* **city** (`?string`): City name. Can be `null`. -* **postalCode** (`?string`): String representation of the postal code. Can be `null`. -* **state** (`?string`): State name. Can be `null`. -* **country** (`?string`): Country name. Can be `null`. - -Note: The `value` field of an AddressField should be a concatenation of the rest of the values. - - -### AmountField -The amount field `AmountField` only has one constraint: its **value** is an optional `?float`. - - -### ClassificationField -The classification field `ClassificationField` does not implement all the basic `BaseField` attributes. It only implements **value**, **confidence** and **pageId**. - -> Note: a classification field's `value is always a `string`. - - -### CompanyRegistrationField -Aside from the basic `BaseField` attributes, the company registration field `CompanyRegistrationField` also implements the following: - -* **type** (`string`): the type of company. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### LocaleField -The locale field `LocaleField` only implements the **value**, **confidence** and **pageId** base `BaseField` attributes, but it comes with its own: - -* **language** (`string`): ISO 639-1 language code (e.g.: `en` for English). Can be `null`. -* **country** (`string`): ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3 code for countries (e.g.: `GRB` or `GB` for "Great Britain"). Can be `null`. -* **currency** (`string`): ISO 4217 code for currencies (e.g.: `USD` for "US Dollars"). Can be `null`. - -### PaymentDetailsField -Aside from the basic `BaseField` attributes, the payment details field `PaymentDetailsField` also implements the following: - -* **accountNumber** (`string`): number of an account, expressed as a string. Can be `null`. -* **iban** (`string`): International Bank Account Number. Can be `null`. -* **routingNumber** (`string`): routing number of an account. Can be `null`. -* **swift** (`string`): the account holder's bank's SWIFT Business Identifier Code (BIC). Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -### TaxesField -#### Tax -Aside from the basic `BaseField` attributes, the tax field `TaxField` also implements the following: - -* **rate** (`float`): the tax rate applied to an item expressed as a percentage. Can be `null`. -* **code** (`string`): tax code (or equivalent, depending on the origin of the document). Can be `null`. -* **basis** (`float`): base amount used for the tax. Can be `null`. -* **value** (`float`): the value of the tax. Can be `null`. - -> Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, a list-like structure. - -#### Taxes (Array) -The `Taxes` field represents a list-like collection of `TaxField` objects. As it is the representation of several objects, it has access to a custom `__toString` method that can render a `TaxField` object as a table line. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Line Items Field -List of all the line items present on the invoice. - -A `InvoiceV4LineItem` implements the following attributes: - -* **description** (`string`): The item description. -* **productCode** (`string`): The product code of the item. -* **quantity** (`float`): The item quantity -* **taxAmount** (`float`): The item tax amount. -* **taxRate** (`float`): The item tax rate in percentage. -* **totalAmount** (`float`): The item total amount. -* **unitMeasure** (`string`): The item unit of measure. -* **unitPrice** (`float`): The item unit price. - -# Attributes -The following fields are extracted for Invoice V4: - -## Billing Address -**billingAddress** : The customer billing address. - -```php -echo $result->document->inference->prediction->billingAddress->value; -``` - -## Purchase Category -**category** : The purchase category. - -#### Possible values include: - - 'toll' - - 'food' - - 'parking' - - 'transport' - - 'accommodation' - - 'telecom' - - 'miscellaneous' - - 'software' - - 'shopping' - - 'energy' - -```php -echo $result->document->inference->prediction->category->value; -``` - -## Customer Address -**customerAddress** : The address of the customer. - -```php -echo $result->document->inference->prediction->customerAddress->value; -``` - -## Customer Company Registrations -**customerCompanyRegistrations** : List of company registration numbers associated to the customer. - -```php -foreach ($result->document->inference->prediction->customerCompanyRegistrations as $customerCompanyRegistrationsElem) -{ - echo $customerCompanyRegistrationsElem->value; -} -``` - -## Customer ID -**customerId** : The customer account number or identifier from the supplier. - -```php -echo $result->document->inference->prediction->customerId->value; -``` - -## Customer Name -**customerName** : The name of the customer or client. - -```php -echo $result->document->inference->prediction->customerName->value; -``` - -## Purchase Date -**date** : The date the purchase was made. - -```php -echo $result->document->inference->prediction->date->value; -``` - -## Document Type -**documentType** : Document type: INVOICE or CREDIT NOTE. - -#### Possible values include: - - 'INVOICE' - - 'CREDIT NOTE' - -```php -echo $result->document->inference->prediction->documentType->value; -``` - -## Document Type Extended -**documentTypeExtended** : Document type extended. - -#### Possible values include: - - 'CREDIT NOTE' - - 'INVOICE' - - 'OTHER' - - 'OTHER_FINANCIAL' - - 'PAYSLIP' - - 'PURCHASE ORDER' - - 'QUOTE' - - 'RECEIPT' - - 'STATEMENT' - -```php -echo $result->document->inference->prediction->documentTypeExtended->value; -``` - -## Due Date -**dueDate** : The date on which the payment is due. - -```php -echo $result->document->inference->prediction->dueDate->value; -``` - -## Invoice Number -**invoiceNumber** : The invoice number or identifier. - -```php -echo $result->document->inference->prediction->invoiceNumber->value; -``` - -## Line Items -**lineItems** ([[InvoiceV4LineItem](#line-items-field)]): List of all the line items present on the invoice. - -```php -foreach ($result->document->inference->prediction->lineItems as $lineItemsElem) -{ - echo $lineItemsElem->value; -} -``` - -## Locale -**locale** : The locale of the document. - -```php -echo $result->document->inference->prediction->locale->value; -``` - -## Payment Date -**paymentDate** : The date on which the payment is due / was full-filled. - -```php -echo $result->document->inference->prediction->paymentDate->value; -``` - -## Purchase Order Number -**poNumber** : The purchase order number. - -```php -echo $result->document->inference->prediction->poNumber->value; -``` - -## Reference Numbers -**referenceNumbers** : List of all reference numbers on the invoice, including the purchase order number. - -```php -foreach ($result->document->inference->prediction->referenceNumbers as $referenceNumbersElem) -{ - echo $referenceNumbersElem->value; -} -``` - -## Shipping Address -**shippingAddress** : Customer's delivery address. - -```php -echo $result->document->inference->prediction->shippingAddress->value; -``` - -## Purchase Subcategory -**subcategory** : The purchase subcategory for transport, food and shopping. - -#### Possible values include: - - 'plane' - - 'taxi' - - 'train' - - 'restaurant' - - 'shopping' - - 'other' - - 'groceries' - - 'cultural' - - 'electronics' - - 'office_supplies' - - 'micromobility' - - 'car_rental' - - 'public' - - 'delivery' - - null - -```php -echo $result->document->inference->prediction->subcategory->value; -``` - -## Supplier Address -**supplierAddress** : The address of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierAddress->value; -``` - -## Supplier Company Registrations -**supplierCompanyRegistrations** : List of company registration numbers associated to the supplier. - -```php -foreach ($result->document->inference->prediction->supplierCompanyRegistrations as $supplierCompanyRegistrationsElem) -{ - echo $supplierCompanyRegistrationsElem->value; -} -``` - -## Supplier Email -**supplierEmail** : The email address of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierEmail->value; -``` - -## Supplier Name -**supplierName** : The name of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierName->value; -``` - -## Supplier Payment Details -**supplierPaymentDetails** : List of payment details associated to the supplier of the invoice. - -```php -foreach ($result->document->inference->prediction->supplierPaymentDetails as $supplierPaymentDetailsElem) -{ - echo $supplierPaymentDetailsElem->value; - echo $supplierPaymentDetailsElem->rate; - echo $supplierPaymentDetailsElem->code; - echo $supplierPaymentDetailsElem->basis; -} -``` - -## Supplier Phone Number -**supplierPhoneNumber** : The phone number of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierPhoneNumber->value; -``` - -## Supplier Website -**supplierWebsite** : The website URL of the supplier or merchant. - -```php -echo $result->document->inference->prediction->supplierWebsite->value; -``` - -## Taxes -**taxes** : List of taxes. Each item contains the detail of the tax. - -```php -foreach ($result->document->inference->prediction->taxes as $taxesElem) -{ - echo $taxesElem->value; -} -``` - -## Total Amount -**totalAmount** : The total amount of the invoice: includes taxes, tips, fees, and other charges. - -```php -echo $result->document->inference->prediction->totalAmount->value; -``` - -## Total Net -**totalNet** : The net amount of the invoice: does not include taxes, fees, and discounts. - -```php -echo $result->document->inference->prediction->totalNet->value; -``` - -## Total Tax -**totalTax** : The total tax: the sum of all the taxes for this invoice. - -```php -echo $result->document->inference->prediction->totalTax->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/multi_receipts_detector_v1.md b/docs/multi_receipts_detector_v1.md deleted file mode 100644 index f9286fc3..00000000 --- a/docs/multi_receipts_detector_v1.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: Multi Receipts Detector OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-multi-receipts-detector-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Multi Receipts Detector API](https://platform.mindee.com/mindee/multi_receipts_detector). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/multi_receipts_detector/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Multi Receipts Detector sample](https://github.com/mindee/client-lib-test-data/blob/main/products/multi_receipts_detector/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(MultiReceiptsDetectorV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: d7c5b25f-e0d3-4491-af54-6183afa1aaab -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/multi_receipts_detector v1.0 -:Rotation applied: Yes - -Prediction -========== -:List of Receipts: Polygon with 4 points. - Polygon with 4 points. - Polygon with 4 points. - Polygon with 4 points. - Polygon with 4 points. - Polygon with 4 points. - -Page Predictions -================ - -Page 0 ------- -:List of Receipts: Polygon with 4 points. - Polygon with 4 points. - Polygon with 4 points. - Polygon with 4 points. - Polygon with 4 points. - Polygon with 4 points. -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - - -### PositionField -The position field `PositionField` does not implement all the basic `BaseField` attributes, only **boundingBox**, **polygon** and **pageId**. On top of these, it has access to: - -* **rectangle** (`[Point, Point, Point, Point]`): a Polygon with four points that may be oriented (even beyond canvas). -* **quadrangle** (`[Point, Point, Point, Point]`): a free polygon made up of four points. - -# Attributes -The following fields are extracted for Multi Receipts Detector V1: - -## List of Receipts -**receipts** : Positions of the receipts on the document. - -```php -foreach ($result->document->inference->prediction->receipts as $receiptsElem) -{ - echo $receiptsElem->polygon; - echo $receiptsElem->quadrangle->getCoordinates(); - echo $receiptsElem->rectangle->getCoordinates(); - echo $receiptsElem->boundingBox->getCoordinates(); -} -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/nutrition_facts_v1.md b/docs/nutrition_facts_v1.md deleted file mode 100644 index fe6cc882..00000000 --- a/docs/nutrition_facts_v1.md +++ /dev/null @@ -1,372 +0,0 @@ ---- -title: Nutrition Facts Label OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-nutrition-facts-label-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Nutrition Facts Label API](https://platform.mindee.com/mindee/nutrition_facts). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/nutrition_facts/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Nutrition Facts Label sample](https://github.com/mindee/client-lib-test-data/blob/main/products/nutrition_facts/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(NutritionFactsLabelV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 38a12fe0-5d69-4ca4-9b30-12f1b659311c -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/nutrition_facts v1.0 -:Rotation applied: No - -Prediction -========== -:Serving per Box: 2.00 -:Serving Size: - :Amount: 228.00 - :Unit: g -:Calories: - :Daily Value: - :Per 100g: - :Per Serving: 250.00 -:Total Fat: - :Daily Value: - :Per 100g: - :Per Serving: 12.00 -:Saturated Fat: - :Daily Value: 15.00 - :Per 100g: - :Per Serving: 3.00 -:Trans Fat: - :Daily Value: - :Per 100g: - :Per Serving: 3.00 -:Cholesterol: - :Daily Value: 10.00 - :Per 100g: - :Per Serving: 30.00 -:Total Carbohydrate: - :Daily Value: 10.00 - :Per 100g: - :Per Serving: 31.00 -:Dietary Fiber: - :Daily Value: 0.00 - :Per 100g: - :Per Serving: 0.00 -:Total Sugars: - :Daily Value: - :Per 100g: - :Per Serving: 5.00 -:Added Sugars: - :Daily Value: - :Per 100g: - :Per Serving: -:Protein: - :Daily Value: - :Per 100g: - :Per Serving: 5.00 -:sodium: - :Daily Value: 20.00 - :Per 100g: - :Per Serving: 470.00 - :Unit: mg -:nutrients: - +-------------+----------------------+----------+-------------+------+ - | Daily Value | Name | Per 100g | Per Serving | Unit | - +=============+======================+==========+=============+======+ - | 12.00 | Vitamin A | | 4.00 | mcg | - +-------------+----------------------+----------+-------------+------+ - | 12.00 | Vitamin C | | 2.00 | mg | - +-------------+----------------------+----------+-------------+------+ - | 12.00 | Calcium | | 45.60 | mg | - +-------------+----------------------+----------+-------------+------+ - | 12.00 | Iron | | 0.90 | mg | - +-------------+----------------------+----------+-------------+------+ -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - - -### AmountField -The amount field `AmountField` only has one constraint: its **value** is an optional `?float`. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Added Sugars Field -The amount of added sugars in the product. - -A `NutritionFactsLabelV1AddedSugar` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of added sugars to consume or not to exceed each day. -* **per100G** (`float`): The amount of added sugars per 100g of the product. -* **perServing** (`float`): The amount of added sugars per serving of the product. -Fields which are specific to this product; they are not used in any other product. - -### Calories Field -The amount of calories in the product. - -A `NutritionFactsLabelV1Calorie` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of calories to consume or not to exceed each day. -* **per100G** (`float`): The amount of calories per 100g of the product. -* **perServing** (`float`): The amount of calories per serving of the product. -Fields which are specific to this product; they are not used in any other product. - -### Cholesterol Field -The amount of cholesterol in the product. - -A `NutritionFactsLabelV1Cholesterol` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of cholesterol to consume or not to exceed each day. -* **per100G** (`float`): The amount of cholesterol per 100g of the product. -* **perServing** (`float`): The amount of cholesterol per serving of the product. -Fields which are specific to this product; they are not used in any other product. - -### Dietary Fiber Field -The amount of dietary fiber in the product. - -A `NutritionFactsLabelV1DietaryFiber` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of dietary fiber to consume or not to exceed each day. -* **per100G** (`float`): The amount of dietary fiber per 100g of the product. -* **perServing** (`float`): The amount of dietary fiber per serving of the product. -Fields which are specific to this product; they are not used in any other product. - -### nutrients Field -The amount of nutrients in the product. - -A `NutritionFactsLabelV1Nutrient` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of nutrients to consume or not to exceed each day. -* **name** (`string`): The name of nutrients of the product. -* **per100G** (`float`): The amount of nutrients per 100g of the product. -* **perServing** (`float`): The amount of nutrients per serving of the product. -* **unit** (`string`): The unit of measurement for the amount of nutrients. -Fields which are specific to this product; they are not used in any other product. - -### Protein Field -The amount of protein in the product. - -A `NutritionFactsLabelV1Protein` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of protein to consume or not to exceed each day. -* **per100G** (`float`): The amount of protein per 100g of the product. -* **perServing** (`float`): The amount of protein per serving of the product. -Fields which are specific to this product; they are not used in any other product. - -### Saturated Fat Field -The amount of saturated fat in the product. - -A `NutritionFactsLabelV1SaturatedFat` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of saturated fat to consume or not to exceed each day. -* **per100G** (`float`): The amount of saturated fat per 100g of the product. -* **perServing** (`float`): The amount of saturated fat per serving of the product. -Fields which are specific to this product; they are not used in any other product. - -### Serving Size Field -The size of a single serving of the product. - -A `NutritionFactsLabelV1ServingSize` implements the following attributes: - -* **amount** (`float`): The amount of a single serving. -* **unit** (`string`): The unit for the amount of a single serving. -Fields which are specific to this product; they are not used in any other product. - -### sodium Field -The amount of sodium in the product. - -A `NutritionFactsLabelV1Sodium` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of sodium to consume or not to exceed each day. -* **per100G** (`float`): The amount of sodium per 100g of the product. -* **perServing** (`float`): The amount of sodium per serving of the product. -* **unit** (`string`): The unit of measurement for the amount of sodium. -Fields which are specific to this product; they are not used in any other product. - -### Total Carbohydrate Field -The total amount of carbohydrates in the product. - -A `NutritionFactsLabelV1TotalCarbohydrate` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of total carbohydrates to consume or not to exceed each day. -* **per100G** (`float`): The amount of total carbohydrates per 100g of the product. -* **perServing** (`float`): The amount of total carbohydrates per serving of the product. -Fields which are specific to this product; they are not used in any other product. - -### Total Fat Field -The total amount of fat in the product. - -A `NutritionFactsLabelV1TotalFat` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of total fat to consume or not to exceed each day. -* **per100G** (`float`): The amount of total fat per 100g of the product. -* **perServing** (`float`): The amount of total fat per serving of the product. -Fields which are specific to this product; they are not used in any other product. - -### Total Sugars Field -The total amount of sugars in the product. - -A `NutritionFactsLabelV1TotalSugar` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of total sugars to consume or not to exceed each day. -* **per100G** (`float`): The amount of total sugars per 100g of the product. -* **perServing** (`float`): The amount of total sugars per serving of the product. -Fields which are specific to this product; they are not used in any other product. - -### Trans Fat Field -The amount of trans fat in the product. - -A `NutritionFactsLabelV1TransFat` implements the following attributes: - -* **dailyValue** (`float`): DVs are the recommended amounts of trans fat to consume or not to exceed each day. -* **per100G** (`float`): The amount of trans fat per 100g of the product. -* **perServing** (`float`): The amount of trans fat per serving of the product. - -# Attributes -The following fields are extracted for Nutrition Facts Label V1: - -## Added Sugars -**addedSugars** ([NutritionFactsLabelV1AddedSugar](#added-sugars-field)): The amount of added sugars in the product. - -```php -echo $result->document->inference->prediction->addedSugars->value; -``` - -## Calories -**calories** ([NutritionFactsLabelV1Calorie](#calories-field)): The amount of calories in the product. - -```php -echo $result->document->inference->prediction->calories->value; -``` - -## Cholesterol -**cholesterol** ([NutritionFactsLabelV1Cholesterol](#cholesterol-field)): The amount of cholesterol in the product. - -```php -echo $result->document->inference->prediction->cholesterol->value; -``` - -## Dietary Fiber -**dietaryFiber** ([NutritionFactsLabelV1DietaryFiber](#dietary-fiber-field)): The amount of dietary fiber in the product. - -```php -echo $result->document->inference->prediction->dietaryFiber->value; -``` - -## nutrients -**nutrients** ([[NutritionFactsLabelV1Nutrient](#nutrients-field)]): The amount of nutrients in the product. - -```php -foreach ($result->document->inference->prediction->nutrients as $nutrientsElem) -{ - echo $nutrientsElem->value; -} -``` - -## Protein -**protein** ([NutritionFactsLabelV1Protein](#protein-field)): The amount of protein in the product. - -```php -echo $result->document->inference->prediction->protein->value; -``` - -## Saturated Fat -**saturatedFat** ([NutritionFactsLabelV1SaturatedFat](#saturated-fat-field)): The amount of saturated fat in the product. - -```php -echo $result->document->inference->prediction->saturatedFat->value; -``` - -## Serving per Box -**servingPerBox** : The number of servings in each box of the product. - -```php -echo $result->document->inference->prediction->servingPerBox->value; -``` - -## Serving Size -**servingSize** ([NutritionFactsLabelV1ServingSize](#serving-size-field)): The size of a single serving of the product. - -```php -echo $result->document->inference->prediction->servingSize->value; -``` - -## sodium -**sodium** ([NutritionFactsLabelV1Sodium](#sodium-field)): The amount of sodium in the product. - -```php -echo $result->document->inference->prediction->sodium->value; -``` - -## Total Carbohydrate -**totalCarbohydrate** ([NutritionFactsLabelV1TotalCarbohydrate](#total-carbohydrate-field)): The total amount of carbohydrates in the product. - -```php -echo $result->document->inference->prediction->totalCarbohydrate->value; -``` - -## Total Fat -**totalFat** ([NutritionFactsLabelV1TotalFat](#total-fat-field)): The total amount of fat in the product. - -```php -echo $result->document->inference->prediction->totalFat->value; -``` - -## Total Sugars -**totalSugars** ([NutritionFactsLabelV1TotalSugar](#total-sugars-field)): The total amount of sugars in the product. - -```php -echo $result->document->inference->prediction->totalSugars->value; -``` - -## Trans Fat -**transFat** ([NutritionFactsLabelV1TransFat](#trans-fat-field)): The amount of trans fat in the product. - -```php -echo $result->document->inference->prediction->transFat->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/passport_v1.md b/docs/passport_v1.md deleted file mode 100644 index 54af922b..00000000 --- a/docs/passport_v1.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -title: Passport OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-passport-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Passport API](https://platform.mindee.com/mindee/passport). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/passport/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Passport sample](https://github.com/mindee/client-lib-test-data/blob/main/products/passport/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file -$apiResponse = $mindeeClient->parse(PassportV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 18e41f6c-16cd-4f8e-8cd2-00ca02a35764 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/passport v1.0 -:Rotation applied: Yes - -Prediction -========== -:Country Code: GBR -:ID Number: 707797979 -:Given Name(s): HENERT -:Surname: PUDARSAN -:Date of Birth: 1995-05-20 -:Place of Birth: CAMTETH -:Gender: M -:Date of Issue: 2012-04-22 -:Expiry Date: 2017-04-22 -:MRZ Line 1: P **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -# Attributes -The following fields are extracted for Passport V1: - -## Date of Birth -**birthDate** : The date of birth of the passport holder. - -```php -echo $result->document->inference->prediction->birthDate->value; -``` - -## Place of Birth -**birthPlace** : The place of birth of the passport holder. - -```php -echo $result->document->inference->prediction->birthPlace->value; -``` - -## Country Code -**country** : The country's 3 letter code (ISO 3166-1 alpha-3). - -```php -echo $result->document->inference->prediction->country->value; -``` - -## Expiry Date -**expiryDate** : The expiry date of the passport. - -```php -echo $result->document->inference->prediction->expiryDate->value; -``` - -## Gender -**gender** : The gender of the passport holder. - -```php -echo $result->document->inference->prediction->gender->value; -``` - -## Given Name(s) -**givenNames** : The given name(s) of the passport holder. - -```php -foreach ($result->document->inference->prediction->givenNames as $givenNamesElem) -{ - echo $givenNamesElem->value; -} -``` - -## ID Number -**idNumber** : The passport's identification number. - -```php -echo $result->document->inference->prediction->idNumber->value; -``` - -## Date of Issue -**issuanceDate** : The date the passport was issued. - -```php -echo $result->document->inference->prediction->issuanceDate->value; -``` - -## MRZ Line 1 -**mrz1** : Machine Readable Zone, first line - -```php -echo $result->document->inference->prediction->mrz1->value; -``` - -## MRZ Line 2 -**mrz2** : Machine Readable Zone, second line - -```php -echo $result->document->inference->prediction->mrz2->value; -``` - -## Surname -**surname** : The surname of the passport holder. - -```php -echo $result->document->inference->prediction->surname->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/payslip_fra_v2.md b/docs/payslip_fra_v2.md deleted file mode 100644 index 288993fe..00000000 --- a/docs/payslip_fra_v2.md +++ /dev/null @@ -1,292 +0,0 @@ ---- -title: FR Payslip OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-fr-payslip-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Payslip API](https://platform.mindee.com/mindee/payslip_fra). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/payslip_fra/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Payslip sample](https://github.com/mindee/client-lib-test-data/blob/main/products/payslip_fra/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(PayslipV2::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 972edba5-25aa-49d0-8431-e2557ddd788e -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/payslip_fra v2.0 -:Rotation applied: No - -Prediction -========== -:Employee: - :Address: 52 RUE DES FLEURS 33500 LIBOURNE FRANCE - :Date of Birth: - :First Name: Jean Luc - :Last Name: Picard - :Phone Number: - :Registration Number: - :Social Security Number: 123456789012345 -:Employer: - :Address: 1 RUE DU TONNOT 25210 DOUBS - :Company ID: 12345678901234 - :Company Site: - :NAF Code: 1234A - :Name: DEMO COMPANY - :Phone Number: - :URSSAF Number: -:Bank Account Details: - :Bank Name: - :IBAN: - :SWIFT: -:Employment: - :Category: Cadre - :Coefficient: 600.00 - :Collective Agreement: Construction -- Promotion - :Job Title: Directeur Régional du Développement - :Position Level: - :Start Date: 2022-05-01 -:Salary Details: - +--------------+-----------+--------------------------------------+-----------+ - | Amount | Base | Description | Rate | - +==============+===========+======================================+===========+ - | 6666.67 | | Salaire de base | | - +--------------+-----------+--------------------------------------+-----------+ - | 9.30 | | Part patronale Mutuelle NR | | - +--------------+-----------+--------------------------------------+-----------+ - | 508.30 | | Avantages en nature voiture | | - +--------------+-----------+--------------------------------------+-----------+ -:Pay Detail: - :Gross Salary: 7184.27 - :Gross Salary YTD: 18074.81 - :Income Tax Rate: 17.60 - :Income Tax Withheld: 1030.99 - :Net Paid: 3868.32 - :Net Paid Before Tax: 4899.31 - :Net Taxable: 5857.90 - :Net Taxable YTD: 14752.73 - :Total Cost Employer: 10486.94 - :Total Taxes and Deductions: 1650.36 -:PTO: - :Accrued This Period: 6.17 - :Balance End of Period: 6.17 - :Used This Period: -:Pay Period: - :End Date: 2023-03-31 - :Month: 03 - :Payment Date: 2023-03-29 - :Start Date: 2023-03-01 - :Year: 2023 -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Bank Account Details Field -Information about the employee's bank account. - -A `PayslipV2BankAccountDetail` implements the following attributes: - -* **bankName** (`string`): The name of the bank. -* **iban** (`string`): The IBAN of the bank account. -* **swift** (`string`): The SWIFT code of the bank. -Fields which are specific to this product; they are not used in any other product. - -### Employee Field -Information about the employee. - -A `PayslipV2Employee` implements the following attributes: - -* **address** (`string`): The address of the employee. -* **dateOfBirth** (`string`): The date of birth of the employee. -* **firstName** (`string`): The first name of the employee. -* **lastName** (`string`): The last name of the employee. -* **phoneNumber** (`string`): The phone number of the employee. -* **registrationNumber** (`string`): The registration number of the employee. -* **socialSecurityNumber** (`string`): The social security number of the employee. -Fields which are specific to this product; they are not used in any other product. - -### Employer Field -Information about the employer. - -A `PayslipV2Employer` implements the following attributes: - -* **address** (`string`): The address of the employer. -* **companyId** (`string`): The company ID of the employer. -* **companySite** (`string`): The site of the company. -* **nafCode** (`string`): The NAF code of the employer. -* **name** (`string`): The name of the employer. -* **phoneNumber** (`string`): The phone number of the employer. -* **urssafNumber** (`string`): The URSSAF number of the employer. -Fields which are specific to this product; they are not used in any other product. - -### Employment Field -Information about the employment. - -A `PayslipV2Employment` implements the following attributes: - -* **category** (`string`): The category of the employment. -* **coefficient** (`float`): The coefficient of the employment. -* **collectiveAgreement** (`string`): The collective agreement of the employment. -* **jobTitle** (`string`): The job title of the employee. -* **positionLevel** (`string`): The position level of the employment. -* **startDate** (`string`): The start date of the employment. -Fields which are specific to this product; they are not used in any other product. - -### Pay Detail Field -Detailed information about the pay. - -A `PayslipV2PayDetail` implements the following attributes: - -* **grossSalary** (`float`): The gross salary of the employee. -* **grossSalaryYtd** (`float`): The year-to-date gross salary of the employee. -* **incomeTaxRate** (`float`): The income tax rate of the employee. -* **incomeTaxWithheld** (`float`): The income tax withheld from the employee's pay. -* **netPaid** (`float`): The net paid amount of the employee. -* **netPaidBeforeTax** (`float`): The net paid amount before tax of the employee. -* **netTaxable** (`float`): The net taxable amount of the employee. -* **netTaxableYtd** (`float`): The year-to-date net taxable amount of the employee. -* **totalCostEmployer** (`float`): The total cost to the employer. -* **totalTaxesAndDeductions** (`float`): The total taxes and deductions of the employee. -Fields which are specific to this product; they are not used in any other product. - -### Pay Period Field -Information about the pay period. - -A `PayslipV2PayPeriod` implements the following attributes: - -* **endDate** (`string`): The end date of the pay period. -* **month** (`string`): The month of the pay period. -* **paymentDate** (`string`): The date of payment for the pay period. -* **startDate** (`string`): The start date of the pay period. -* **year** (`string`): The year of the pay period. -Fields which are specific to this product; they are not used in any other product. - -### PTO Field -Information about paid time off. - -A `PayslipV2Pto` implements the following attributes: - -* **accruedThisPeriod** (`float`): The amount of paid time off accrued in this period. -* **balanceEndOfPeriod** (`float`): The balance of paid time off at the end of the period. -* **usedThisPeriod** (`float`): The amount of paid time off used in this period. -Fields which are specific to this product; they are not used in any other product. - -### Salary Details Field -Detailed information about the earnings. - -A `PayslipV2SalaryDetail` implements the following attributes: - -* **amount** (`float`): The amount of the earnings. -* **base** (`float`): The base value of the earnings. -* **description** (`string`): The description of the earnings. -* **rate** (`float`): The rate of the earnings. - -# Attributes -The following fields are extracted for Payslip V2: - -## Bank Account Details -**bankAccountDetails** ([PayslipV2BankAccountDetail](#bank-account-details-field)): Information about the employee's bank account. - -```php -echo $result->document->inference->prediction->bankAccountDetails->value; -``` - -## Employee -**employee** ([PayslipV2Employee](#employee-field)): Information about the employee. - -```php -echo $result->document->inference->prediction->employee->value; -``` - -## Employer -**employer** ([PayslipV2Employer](#employer-field)): Information about the employer. - -```php -echo $result->document->inference->prediction->employer->value; -``` - -## Employment -**employment** ([PayslipV2Employment](#employment-field)): Information about the employment. - -```php -echo $result->document->inference->prediction->employment->value; -``` - -## Pay Detail -**payDetail** ([PayslipV2PayDetail](#pay-detail-field)): Detailed information about the pay. - -```php -echo $result->document->inference->prediction->payDetail->value; -``` - -## Pay Period -**payPeriod** ([PayslipV2PayPeriod](#pay-period-field)): Information about the pay period. - -```php -echo $result->document->inference->prediction->payPeriod->value; -``` - -## PTO -**pto** ([PayslipV2Pto](#pto-field)): Information about paid time off. - -```php -echo $result->document->inference->prediction->pto->value; -``` - -## Salary Details -**salaryDetails** ([[PayslipV2SalaryDetail](#salary-details-field)]): Detailed information about the earnings. - -```php -foreach ($result->document->inference->prediction->salaryDetails as $salaryDetailsElem) -{ - echo $salaryDetailsElem->value; -} -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/payslip_fra_v3.md b/docs/payslip_fra_v3.md deleted file mode 100644 index 6cb20398..00000000 --- a/docs/payslip_fra_v3.md +++ /dev/null @@ -1,318 +0,0 @@ ---- -title: FR Payslip OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-fr-payslip-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Payslip API](https://platform.mindee.com/mindee/payslip_fra). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/payslip_fra/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Payslip sample](https://github.com/mindee/client-lib-test-data/blob/main/products/payslip_fra/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(PayslipV3::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: a479e3e7-6838-4e82-9a7d-99289f34ec7f -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/payslip_fra v3.0 -:Rotation applied: Yes - -Prediction -========== -:Pay Period: - :End Date: 2023-03-31 - :Month: 03 - :Payment Date: 2023-03-29 - :Start Date: 2023-03-01 - :Year: 2023 -:Employee: - :Address: 52 RUE DES FLEURS 33500 LIBOURNE FRANCE - :Date of Birth: - :First Name: Jean Luc - :Last Name: Picard - :Phone Number: - :Registration Number: - :Social Security Number: 123456789012345 -:Employer: - :Address: 1 RUE DU TONNOT 25210 DOUBS - :Company ID: 12345678901234 - :Company Site: - :NAF Code: 1234A - :Name: DEMO COMPANY - :Phone Number: - :URSSAF Number: -:Bank Account Details: - :Bank Name: - :IBAN: - :SWIFT: -:Employment: - :Category: Cadre - :Coefficient: 600,000 - :Collective Agreement: Construction -- Promotion - :Job Title: Directeur Régional du Développement - :Position Level: Niveau 5 Echelon 3 - :Seniority Date: - :Start Date: 2022-05-01 -:Salary Details: - +--------------+-----------+--------------------------------------+--------+-----------+ - | Amount | Base | Description | Number | Rate | - +==============+===========+======================================+========+===========+ - | 6666.67 | | Salaire de base | | | - +--------------+-----------+--------------------------------------+--------+-----------+ - | 9.30 | | Part patronale Mutuelle NR | | | - +--------------+-----------+--------------------------------------+--------+-----------+ - | 508.30 | | Avantages en nature voiture | | | - +--------------+-----------+--------------------------------------+--------+-----------+ -:Pay Detail: - :Gross Salary: 7184.27 - :Gross Salary YTD: 18074.81 - :Income Tax Rate: 17.60 - :Income Tax Withheld: 1030.99 - :Net Paid: 3868.32 - :Net Paid Before Tax: 4899.31 - :Net Taxable: 5857.90 - :Net Taxable YTD: 14752.73 - :Total Cost Employer: 10486.94 - :Total Taxes and Deductions: 1650.36 -:Paid Time Off: - +-----------+--------+-------------+-----------+-----------+ - | Accrued | Period | Type | Remaining | Used | - +===========+========+=============+===========+===========+ - | | N-1 | VACATION | | | - +-----------+--------+-------------+-----------+-----------+ - | 6.17 | N | VACATION | 6.17 | | - +-----------+--------+-------------+-----------+-----------+ - | 2.01 | N | RTT | 2.01 | | - +-----------+--------+-------------+-----------+-----------+ -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Bank Account Details Field -Information about the employee's bank account. - -A `PayslipV3BankAccountDetail` implements the following attributes: - -* **bankName** (`string`): The name of the bank. -* **iban** (`string`): The IBAN of the bank account. -* **swift** (`string`): The SWIFT code of the bank. -Fields which are specific to this product; they are not used in any other product. - -### Employee Field -Information about the employee. - -A `PayslipV3Employee` implements the following attributes: - -* **address** (`string`): The address of the employee. -* **dateOfBirth** (`string`): The date of birth of the employee. -* **firstName** (`string`): The first name of the employee. -* **lastName** (`string`): The last name of the employee. -* **phoneNumber** (`string`): The phone number of the employee. -* **registrationNumber** (`string`): The registration number of the employee. -* **socialSecurityNumber** (`string`): The social security number of the employee. -Fields which are specific to this product; they are not used in any other product. - -### Employer Field -Information about the employer. - -A `PayslipV3Employer` implements the following attributes: - -* **address** (`string`): The address of the employer. -* **companyId** (`string`): The company ID of the employer. -* **companySite** (`string`): The site of the company. -* **nafCode** (`string`): The NAF code of the employer. -* **name** (`string`): The name of the employer. -* **phoneNumber** (`string`): The phone number of the employer. -* **urssafNumber** (`string`): The URSSAF number of the employer. -Fields which are specific to this product; they are not used in any other product. - -### Employment Field -Information about the employment. - -A `PayslipV3Employment` implements the following attributes: - -* **category** (`string`): The category of the employment. -* **coefficient** (`string`): The coefficient of the employment. -* **collectiveAgreement** (`string`): The collective agreement of the employment. -* **jobTitle** (`string`): The job title of the employee. -* **positionLevel** (`string`): The position level of the employment. -* **seniorityDate** (`string`): The seniority date of the employment. -* **startDate** (`string`): The start date of the employment. -Fields which are specific to this product; they are not used in any other product. - -### Paid Time Off Field -Information about paid time off. - -A `PayslipV3PaidTimeOff` implements the following attributes: - -* **accrued** (`float`): The amount of paid time off accrued in the period. -* **period** (`string`): The paid time off period. - -#### Possible values include: - - N - - N-1 - - N-2 - -* **ptoType** (`string`): The type of paid time off. - -#### Possible values include: - - VACATION - - RTT - - COMPENSATORY - -* **remaining** (`float`): The remaining amount of paid time off at the end of the period. -* **used** (`float`): The amount of paid time off used in the period. -Fields which are specific to this product; they are not used in any other product. - -### Pay Detail Field -Detailed information about the pay. - -A `PayslipV3PayDetail` implements the following attributes: - -* **grossSalary** (`float`): The gross salary of the employee. -* **grossSalaryYtd** (`float`): The year-to-date gross salary of the employee. -* **incomeTaxRate** (`float`): The income tax rate of the employee. -* **incomeTaxWithheld** (`float`): The income tax withheld from the employee's pay. -* **netPaid** (`float`): The net paid amount of the employee. -* **netPaidBeforeTax** (`float`): The net paid amount before tax of the employee. -* **netTaxable** (`float`): The net taxable amount of the employee. -* **netTaxableYtd** (`float`): The year-to-date net taxable amount of the employee. -* **totalCostEmployer** (`float`): The total cost to the employer. -* **totalTaxesAndDeductions** (`float`): The total taxes and deductions of the employee. -Fields which are specific to this product; they are not used in any other product. - -### Pay Period Field -Information about the pay period. - -A `PayslipV3PayPeriod` implements the following attributes: - -* **endDate** (`string`): The end date of the pay period. -* **month** (`string`): The month of the pay period. -* **paymentDate** (`string`): The date of payment for the pay period. -* **startDate** (`string`): The start date of the pay period. -* **year** (`string`): The year of the pay period. -Fields which are specific to this product; they are not used in any other product. - -### Salary Details Field -Detailed information about the earnings. - -A `PayslipV3SalaryDetail` implements the following attributes: - -* **amount** (`float`): The amount of the earning. -* **base** (`float`): The base rate value of the earning. -* **description** (`string`): The description of the earnings. -* **number** (`float`): The number of units in the earning. -* **rate** (`float`): The rate of the earning. - -# Attributes -The following fields are extracted for Payslip V3: - -## Bank Account Details -**bankAccountDetails** ([PayslipV3BankAccountDetail](#bank-account-details-field)): Information about the employee's bank account. - -```php -echo $result->document->inference->prediction->bankAccountDetails->value; -``` - -## Employee -**employee** ([PayslipV3Employee](#employee-field)): Information about the employee. - -```php -echo $result->document->inference->prediction->employee->value; -``` - -## Employer -**employer** ([PayslipV3Employer](#employer-field)): Information about the employer. - -```php -echo $result->document->inference->prediction->employer->value; -``` - -## Employment -**employment** ([PayslipV3Employment](#employment-field)): Information about the employment. - -```php -echo $result->document->inference->prediction->employment->value; -``` - -## Paid Time Off -**paidTimeOff** ([[PayslipV3PaidTimeOff](#paid-time-off-field)]): Information about paid time off. - -```php -foreach ($result->document->inference->prediction->paidTimeOff as $paidTimeOffElem) -{ - echo $paidTimeOffElem->value; -} -``` - -## Pay Detail -**payDetail** ([PayslipV3PayDetail](#pay-detail-field)): Detailed information about the pay. - -```php -echo $result->document->inference->prediction->payDetail->value; -``` - -## Pay Period -**payPeriod** ([PayslipV3PayPeriod](#pay-period-field)): Information about the pay period. - -```php -echo $result->document->inference->prediction->payPeriod->value; -``` - -## Salary Details -**salaryDetails** ([[PayslipV3SalaryDetail](#salary-details-field)]): Detailed information about the earnings. - -```php -foreach ($result->document->inference->prediction->salaryDetails as $salaryDetailsElem) -{ - echo $salaryDetailsElem->value; -} -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/resume_v1.md b/docs/resume_v1.md deleted file mode 100644 index 0e89d5bc..00000000 --- a/docs/resume_v1.md +++ /dev/null @@ -1,366 +0,0 @@ ---- -title: Resume OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-resume-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Resume API](https://platform.mindee.com/mindee/resume). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/resume/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Resume sample](https://github.com/mindee/client-lib-test-data/blob/main/products/resume/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(ResumeV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 9daa3085-152c-454e-9245-636f13fc9dc3 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/resume v1.1 -:Rotation applied: Yes - -Prediction -========== -:Document Language: ENG -:Document Type: RESUME -:Given Names: Christopher -:Surnames: Morgan -:Nationality: -:Email Address: christoper.m@gmail.com -:Phone Number: +44 (0)20 7666 8555 -:Address: 177 Great Portland Street, London, W5W 6PQ -:Social Networks: - +----------------------+----------------------------------------------------+ - | Name | URL | - +======================+====================================================+ - | LinkedIn | linkedin.com/christopher.morgan | - +----------------------+----------------------------------------------------+ -:Profession: Senior Web Developer -:Job Applied: -:Languages: - +----------+----------------------+ - | Language | Level | - +==========+======================+ - | SPA | Fluent | - +----------+----------------------+ - | ZHO | Beginner | - +----------+----------------------+ - | DEU | Beginner | - +----------+----------------------+ -:Hard Skills: HTML5 - PHP OOP - JavaScript - CSS - MySQL - SQL -:Soft Skills: Project management - Creative design - Strong decision maker - Innovative - Complex problem solver - Service-focused -:Education: - +-----------------+---------------------------+-----------+----------+---------------------------+-------------+------------+ - | Domain | Degree | End Month | End Year | School | Start Month | Start Year | - +=================+===========================+===========+==========+===========================+=============+============+ - | Computer Inf... | Bachelor | | 2014 | Columbia University, NY | | | - +-----------------+---------------------------+-----------+----------+---------------------------+-------------+------------+ -:Professional Experiences: - +-----------------+------------+--------------------------------------+---------------------------+-----------+----------+----------------------+-------------+------------+ - | 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)... | | | - +------------+--------------------------------+---------------------------+------+ -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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` does not implement all the basic `BaseField` attributes. It only implements **value**, **confidence** and **pageId**. - -> Note: a classification field's `value is always a `string`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Certificates Field -The list of certificates obtained by the candidate. - -A `ResumeV1Certificate` implements the following attributes: - -* **grade** (`string`): The grade obtained for the certificate. -* **name** (`string`): The name of certification. -* **provider** (`string`): The organization or institution that issued the certificate. -* **year** (`string`): The year when a certificate was issued or received. -Fields which are specific to this product; they are not used in any other product. - -### Education Field -The list of the candidate's educational background. - -A `ResumeV1Education` implements the following attributes: - -* **degreeDomain** (`string`): The area of study or specialization. -* **degreeType** (`string`): The type of degree obtained, such as Bachelor's, Master's, or Doctorate. -* **endMonth** (`string`): The month when the education program or course was completed. -* **endYear** (`string`): The year when the education program or course was completed. -* **school** (`string`): The name of the school. -* **startMonth** (`string`): The month when the education program or course began. -* **startYear** (`string`): The year when the education program or course began. -Fields which are specific to this product; they are not used in any other product. - -### Languages Field -The list of languages that the candidate is proficient in. - -A `ResumeV1Language` implements the following attributes: - -* **language** (`string`): The language's ISO 639 code. -* **level** (`string`): The candidate's level for the language. - -#### Possible values include: - - Native - - Fluent - - Proficient - - Intermediate - - Beginner - -Fields which are specific to this product; they are not used in any other product. - -### Professional Experiences Field -The list of the candidate's professional experiences. - -A `ResumeV1ProfessionalExperience` implements the following attributes: - -* **contractType** (`string`): The type of contract for the professional experience. - -#### Possible values include: - - Full-Time - - Part-Time - - Internship - - 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. -* **role** (`string`): The position or job title held by the candidate. -* **startMonth** (`string`): The month when the professional experience began. -* **startYear** (`string`): The year when the professional experience began. -Fields which are specific to this product; they are not used in any other product. - -### Social Networks Field -The list of social network profiles of the candidate. - -A `ResumeV1SocialNetworksUrl` implements the following attributes: - -* **name** (`string`): The name of the social network. -* **url** (`string`): The URL of the social network. - -# Attributes -The following fields are extracted for Resume V1: - -## Address -**address** : The location information of the candidate, including city, state, and country. - -```php -echo $result->document->inference->prediction->address->value; -``` - -## Certificates -**certificates** ([[ResumeV1Certificate](#certificates-field)]): The list of certificates obtained by the candidate. - -```php -foreach ($result->document->inference->prediction->certificates as $certificatesElem) -{ - echo $certificatesElem->value; -} -``` - -## Document Language -**documentLanguage** : The ISO 639 code of the language in which the document is written. - -```php -echo $result->document->inference->prediction->documentLanguage->value; -``` - -## Document Type -**documentType** : The type of the document sent. - -#### Possible values include: - - 'RESUME' - - 'MOTIVATION_LETTER' - - 'RECOMMENDATION_LETTER' - -```php -echo $result->document->inference->prediction->documentType->value; -``` - -## Education -**education** ([[ResumeV1Education](#education-field)]): The list of the candidate's educational background. - -```php -foreach ($result->document->inference->prediction->education as $educationElem) -{ - echo $educationElem->value; -} -``` - -## Email Address -**emailAddress** : The email address of the candidate. - -```php -echo $result->document->inference->prediction->emailAddress->value; -``` - -## Given Names -**givenNames** : The candidate's first or given names. - -```php -foreach ($result->document->inference->prediction->givenNames as $givenNamesElem) -{ - echo $givenNamesElem->value; -} -``` - -## Hard Skills -**hardSkills** : The list of the candidate's technical abilities and knowledge. - -```php -foreach ($result->document->inference->prediction->hardSkills as $hardSkillsElem) -{ - echo $hardSkillsElem->value; -} -``` - -## Job Applied -**jobApplied** : The position that the candidate is applying for. - -```php -echo $result->document->inference->prediction->jobApplied->value; -``` - -## Languages -**languages** ([[ResumeV1Language](#languages-field)]): The list of languages that the candidate is proficient in. - -```php -foreach ($result->document->inference->prediction->languages as $languagesElem) -{ - echo $languagesElem->value; -} -``` - -## Nationality -**nationality** : The ISO 3166 code for the country of citizenship of the candidate. - -```php -echo $result->document->inference->prediction->nationality->value; -``` - -## Phone Number -**phoneNumber** : The phone number of the candidate. - -```php -echo $result->document->inference->prediction->phoneNumber->value; -``` - -## Profession -**profession** : The candidate's current profession. - -```php -echo $result->document->inference->prediction->profession->value; -``` - -## Professional Experiences -**professionalExperiences** ([[ResumeV1ProfessionalExperience](#professional-experiences-field)]): The list of the candidate's professional experiences. - -```php -foreach ($result->document->inference->prediction->professionalExperiences as $professionalExperiencesElem) -{ - echo $professionalExperiencesElem->value; -} -``` - -## Social Networks -**socialNetworksUrls** ([[ResumeV1SocialNetworksUrl](#social-networks-field)]): The list of social network profiles of the candidate. - -```php -foreach ($result->document->inference->prediction->socialNetworksUrls as $socialNetworksUrlsElem) -{ - echo $socialNetworksUrlsElem->value; -} -``` - -## Soft Skills -**softSkills** : The list of the candidate's interpersonal and communication abilities. - -```php -foreach ($result->document->inference->prediction->softSkills as $softSkillsElem) -{ - echo $softSkillsElem->value; -} -``` - -## Surnames -**surnames** : The candidate's last names. - -```php -foreach ($result->document->inference->prediction->surnames as $surnamesElem) -{ - echo $surnamesElem->value; -} -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/us_healthcare_cards_v1.md b/docs/us_healthcare_cards_v1.md deleted file mode 100644 index df50d7a7..00000000 --- a/docs/us_healthcare_cards_v1.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -title: US Healthcare Card OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-us-healthcare-card-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [Healthcare Card API](https://platform.mindee.com/mindee/us_healthcare_cards). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/us_healthcare_cards/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![Healthcare Card sample](https://github.com/mindee/client-lib-test-data/blob/main/products/us_healthcare_cards/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(HealthcareCardV1::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: 5e917fc8-5c13-42b2-967f-954f4eed9959 -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/us_healthcare_cards v1.3 -:Rotation applied: Yes - -Prediction -========== -:Company Name: UnitedHealthcare -:Plan Name: Choice Plus -:Member Name: SUBSCRIBER SMITH -:Member ID: 123456789 -:Issuer 80840: -:Dependents: SPOUSE SMITH - CHILD1 SMITH - CHILD2 SMITH - CHILD3 SMITH -:Group Number: 98765 -:Payer ID: 87726 -:RX BIN: 610279 -:RX ID: -:RX GRP: UHEALTH -:RX PCN: 9999 -:Copays: - +--------------+----------------------+ - | Service Fees | Service Name | - +==============+======================+ - | 20.00 | office_visit | - +--------------+----------------------+ - | 300.00 | emergency_room | - +--------------+----------------------+ - | 75.00 | urgent_care | - +--------------+----------------------+ - | 30.00 | specialist | - +--------------+----------------------+ -:Enrollment Date: -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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. - -### DateField -Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following: - -* **dateObject** (`date`): an accessible representation of the value as a php object. Can be `null`. - -### StringField -The text field `StringField` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Copays Field -Copayments for covered services. - -A `HealthcareCardV1Copay` implements the following attributes: - -* **serviceFees** (`float`): The price of the service. -* **serviceName** (`string`): The name of the service. - -#### Possible values include: - - primary_care - - emergency_room - - urgent_care - - specialist - - office_visit - - prescription - - -# Attributes -The following fields are extracted for Healthcare Card V1: - -## Company Name -**companyName** : The name of the company that provides the healthcare plan. - -```php -echo $result->document->inference->prediction->companyName->value; -``` - -## Copays -**copays** ([[HealthcareCardV1Copay](#copays-field)]): Copayments for covered services. - -```php -foreach ($result->document->inference->prediction->copays as $copaysElem) -{ - echo $copaysElem->value; -} -``` - -## Dependents -**dependents** : The list of dependents covered by the healthcare plan. - -```php -foreach ($result->document->inference->prediction->dependents as $dependentsElem) -{ - echo $dependentsElem->value; -} -``` - -## Enrollment Date -**enrollmentDate** : The date when the member enrolled in the healthcare plan. - -```php -echo $result->document->inference->prediction->enrollmentDate->value; -``` - -## Group Number -**groupNumber** : The group number associated with the healthcare plan. - -```php -echo $result->document->inference->prediction->groupNumber->value; -``` - -## Issuer 80840 -**issuer80840** : The organization that issued the healthcare plan. - -```php -echo $result->document->inference->prediction->issuer80840->value; -``` - -## Member ID -**memberId** : The unique identifier for the member in the healthcare system. - -```php -echo $result->document->inference->prediction->memberId->value; -``` - -## Member Name -**memberName** : The name of the member covered by the healthcare plan. - -```php -echo $result->document->inference->prediction->memberName->value; -``` - -## Payer ID -**payerId** : The unique identifier for the payer in the healthcare system. - -```php -echo $result->document->inference->prediction->payerId->value; -``` - -## Plan Name -**planName** : The name of the healthcare plan. - -```php -echo $result->document->inference->prediction->planName->value; -``` - -## RX BIN -**rxBin** : The BIN number for prescription drug coverage. - -```php -echo $result->document->inference->prediction->rxBin->value; -``` - -## RX GRP -**rxGrp** : The group number for prescription drug coverage. - -```php -echo $result->document->inference->prediction->rxGrp->value; -``` - -## RX ID -**rxId** : The ID number for prescription drug coverage. - -```php -echo $result->document->inference->prediction->rxId->value; -``` - -## RX PCN -**rxPcn** : The PCN number for prescription drug coverage. - -```php -echo $result->document->inference->prediction->rxPcn->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/docs/us_mail_v3.md b/docs/us_mail_v3.md deleted file mode 100644 index c7012a11..00000000 --- a/docs/us_mail_v3.md +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: US US Mail OCR PHP -category: 622b805aaec68102ea7fcbc2 -slug: php-us-us-mail-ocr -parentDoc: 658193df8e029d002ad9c89b ---- -The PHP OCR SDK supports the [US Mail API](https://platform.mindee.com/mindee/us_mail). - -Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/us_mail/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK. -![US Mail sample](https://github.com/mindee/client-lib-test-data/blob/main/products/us_mail/default_sample.jpg?raw=true) - -# Quick-Start -```php -sourceFromPath("/path/to/the/file.ext"); - -// Parse the file asynchronously -$apiResponse = $mindeeClient->enqueueAndParse(UsMailV3::class, $inputSource); - -echo $apiResponse->document; -``` - -**Output (RST):** -```rst -######## -Document -######## -:Mindee ID: f9c36f59-977d-4ddc-9f2d-31c294c456ac -:Filename: default_sample.jpg - -Inference -######### -:Product: mindee/us_mail v3.0 -:Rotation applied: Yes - -Prediction -========== -:Sender Name: company zed -:Sender Address: - :City: Dallas - :Complete Address: 54321 Elm Street, Dallas, Texas 54321 - :Postal Code: 54321 - :State: TX - :Street: 54321 Elm Street -:Recipient Names: Jane Doe -:Recipient Addresses: - +-----------------+-------------------------------------+-------------------+-------------+------------------------+-------+---------------------------+-----------------+ - | City | Complete Address | Is Address Change | Postal Code | Private Mailbox Number | State | Street | Unit | - +=================+=====================================+===================+=============+========================+=======+===========================+=================+ - | Detroit | 1234 Market Street PMB 4321, Det... | False | 12345 | 4321 | MI | 1234 Market Street | | - +-----------------+-------------------------------------+-------------------+-------------+------------------------+-------+---------------------------+-----------------+ -:Return to Sender: False -``` - -# 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: - -* **value** (`float|string`): corresponds to the field value. Can be `null` if no value was extracted. -* **confidence** (`float`): the confidence score of the field prediction. -* **boundingBox** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. -* **polygon** (`Point[]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image. -* **pageId** (`integer`): the ID of the page, always `null` when at document-level. -* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it). - -> **Note:** A `Point` simply refers to a list of two numbers (`[float, float]`). - - -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` implements the following: -* **value** (`string`): represents the value of the field as a string. -* **rawValue** (`string`): the value of the string as it appears on the document. - -### BooleanField -The boolean field `BooleanField` only has one constraint: its **value** is an optional `?bool`. - -## Specific Fields -Fields which are specific to this product; they are not used in any other product. - -### Recipient Addresses Field -The addresses of the recipients. - -A `UsMailV3RecipientAddress` implements the following attributes: - -* **city** (`string`): The city of the recipient's address. -* **complete** (`string`): The complete address of the recipient. -* **isAddressChange** (`bool`): Indicates if the recipient's address is a change of address. -* **postalCode** (`string`): The postal code of the recipient's address. -* **privateMailboxNumber** (`string`): The private mailbox number of the recipient's address. -* **state** (`string`): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State. -* **street** (`string`): The street of the recipient's address. -* **unit** (`string`): The unit number of the recipient's address. -Fields which are specific to this product; they are not used in any other product. - -### Sender Address Field -The address of the sender. - -A `UsMailV3SenderAddress` implements the following attributes: - -* **city** (`string`): The city of the sender's address. -* **complete** (`string`): The complete address of the sender. -* **postalCode** (`string`): The postal code of the sender's address. -* **state** (`string`): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State. -* **street** (`string`): The street of the sender's address. - -# Attributes -The following fields are extracted for US Mail V3: - -## Return to Sender -**isReturnToSender** : Whether the mailing is marked as return to sender. - -```php -echo $result->document->inference->prediction->isReturnToSender->value; -``` - -## Recipient Addresses -**recipientAddresses** ([[UsMailV3RecipientAddress](#recipient-addresses-field)]): The addresses of the recipients. - -```php -foreach ($result->document->inference->prediction->recipientAddresses as $recipientAddressesElem) -{ - echo $recipientAddressesElem->value; -} -``` - -## Recipient Names -**recipientNames** : The names of the recipients. - -```php -foreach ($result->document->inference->prediction->recipientNames as $recipientNamesElem) -{ - echo $recipientNamesElem->value; -} -``` - -## Sender Address -**senderAddress** ([UsMailV3SenderAddress](#sender-address-field)): The address of the sender. - -```php -echo $result->document->inference->prediction->senderAddress->value; -``` - -## Sender Name -**senderName** : The name of the sender. - -```php -echo $result->document->inference->prediction->senderName->value; -``` - -# Questions? -[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g) diff --git a/src/version.php b/src/version.php index c3153736..29b6a021 100644 --- a/src/version.php +++ b/src/version.php @@ -2,4 +2,4 @@ namespace Mindee; -const VERSION = '2.0.3'; +const VERSION = '2.1.0';