FR Energy Bill OCR PHP
The PHP OCR SDK supports the Energy Bill API.
The sample below can be used for testing purposes.
Quick-Start
<?php
use Mindee\Client;
use Mindee\Product\Fr\EnergyBill\EnergyBillV1;
// Init a new client
$mindeeClient = new Client("my-api-key");
// Load a file from disk
$inputSource = $mindeeClient->sourceFromPath("/path/to/the/file.ext");
// Parse the file asynchronously
$apiResponse = $mindeeClient->enqueueAndParse(EnergyBillV1::class, $inputSource);
echo $apiResponse->document;
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 benull
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, alwaysnull
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 benull
.
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:
- 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. - 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 measurement for energy consumption, which can be kW, m³, or L.
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.
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.
echo $result->document->inference->prediction->deliveryPoint->value;
Due Date
dueDate : The date by which the payment for the energy invoice is due.
echo $result->document->inference->prediction->dueDate->value;
Energy Consumer
energyConsumer (EnergyBillV1EnergyConsumer): The entity that consumes the energy.
echo $result->document->inference->prediction->energyConsumer->value;
Energy Supplier
energySupplier (EnergyBillV1EnergySupplier): The company that supplies the energy.
echo $result->document->inference->prediction->energySupplier->value;
Energy Usage
energyUsage ([EnergyBillV1EnergyUsage]): Details of energy consumption.
foreach ($result->document->inference->prediction->energyUsage as $energyUsageElem)
{
echo $energyUsageElem->value;
}
Invoice Date
invoiceDate : The date when the energy invoice was issued.
echo $result->document->inference->prediction->invoiceDate->value;
Invoice Number
invoiceNumber : The unique identifier of the energy invoice.
echo $result->document->inference->prediction->invoiceNumber->value;
Meter Details
meterDetails (EnergyBillV1MeterDetail): Information about the energy meter.
echo $result->document->inference->prediction->meterDetails->value;
Subscription
subscription ([EnergyBillV1Subscription]): The subscription details fee for the energy service.
foreach ($result->document->inference->prediction->subscription as $subscriptionElem)
{
echo $subscriptionElem->value;
}
Taxes and Contributions
taxesAndContributions ([EnergyBillV1TaxesAndContribution]): Details of Taxes and Contributions.
foreach ($result->document->inference->prediction->taxesAndContributions as $taxesAndContributionsElem)
{
echo $taxesAndContributionsElem->value;
}
Total Amount
totalAmount : The total amount to be paid for the energy invoice.
echo $result->document->inference->prediction->totalAmount->value;
Total Before Taxes
totalBeforeTaxes : The total amount to be paid for the energy invoice before taxes.
echo $result->document->inference->prediction->totalBeforeTaxes->value;
Total Taxes
totalTaxes : Total of taxes applied to the invoice.
echo $result->document->inference->prediction->totalTaxes->value;
Questions?
Updated 21 days ago