mindee 4.7.2 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +6 -6
- data/Rakefile +1 -0
- data/lib/mindee/errors/mindee_http_error_v2.rb +23 -4
- data/lib/mindee/errors/mindee_http_unknown_error_v2.rb +18 -0
- data/lib/mindee/http/endpoint.rb +1 -0
- data/lib/mindee/parsing/v2/error_item.rb +21 -0
- data/lib/mindee/parsing/v2/error_response.rb +18 -3
- data/lib/mindee/parsing/v2/inference_result.rb +4 -0
- data/lib/mindee/parsing/v2/rag_metadata.rb +17 -0
- data/lib/mindee/version.rb +1 -1
- data/mindee.gemspec +1 -0
- data/sig/mindee/errors/mindee_http_error_v2.rbs +4 -1
- data/sig/mindee/errors/mindee_http_unknown_error_v2.rbs +9 -0
- data/sig/mindee/http/endpoint.rbs +1 -0
- data/sig/mindee/parsing/v2/error_item.rbs +13 -0
- data/sig/mindee/parsing/v2/error_response.rbs +3 -0
- data/sig/mindee/parsing/v2/inference_result.rbs +1 -0
- data/sig/mindee/parsing/v2/rag_metadata.rbs +13 -0
- metadata +22 -34
- data/docs/advanced_file_operations.md +0 -109
- data/docs/getting_started.md +0 -257
- data/docs/global_products/barcode_reader_v1.md +0 -125
- data/docs/global_products/bill_of_lading_v1.md +0 -276
- data/docs/global_products/business_card_v1.md +0 -194
- data/docs/global_products/cropper_v1.md +0 -123
- data/docs/global_products/delivery_notes_v1.md +0 -168
- data/docs/global_products/driver_license_v1.md +0 -212
- data/docs/global_products/expense_receipts_v5.md +0 -415
- data/docs/global_products/financial_document_v1.md +0 -615
- data/docs/global_products/international_id_v2.md +0 -264
- data/docs/global_products/invoice_splitter_v1.md +0 -127
- data/docs/global_products/invoices_v4.md +0 -576
- data/docs/global_products/multi_receipts_detector_v1.md +0 -131
- data/docs/global_products/nutrition_facts_v1.md +0 -399
- data/docs/global_products/passport_v1.md +0 -207
- data/docs/global_products/resume_v1.md +0 -384
- data/docs/global_products/universal.md +0 -113
- data/docs/global_products.md +0 -6
- data/docs/loading_a_document.md +0 -330
- data/docs/localized_products/bank_account_details_v2.md +0 -158
- data/docs/localized_products/bank_check_v1.md +0 -205
- data/docs/localized_products/bank_statement_fr_v2.md +0 -269
- data/docs/localized_products/carte_grise_v1.md +0 -475
- data/docs/localized_products/energy_bill_fra_v1.md +0 -342
- data/docs/localized_products/french_healthcard_v1.md +0 -142
- data/docs/localized_products/idcard_fr_v2.md +0 -284
- data/docs/localized_products/ind_passport_v1.md +0 -307
- data/docs/localized_products/payslip_fra_v3.md +0 -344
- data/docs/localized_products/us_healthcare_cards_v1.md +0 -258
- data/docs/localized_products/us_mail_v3.md +0 -152
- data/docs/localized_products.md +0 -6
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: FR Bank Statement
|
|
3
|
-
category: 622b805aaec68102ea7fcbc2
|
|
4
|
-
slug: ruby-fr-bank-statement-ocr
|
|
5
|
-
parentDoc: 67b49e29a2cd6f08d69a40d8
|
|
6
|
-
---
|
|
7
|
-
The Ruby Client Library supports the [Bank Statement API](https://platform.mindee.com/mindee/bank_statement_fr).
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
> 📝 Product Specs
|
|
11
|
-
>
|
|
12
|
-
> | Specification | Details |
|
|
13
|
-
> | ------------------------------ | -------------------------------------------------- |
|
|
14
|
-
> | Endpoint Name | `bank_statement_fr` |
|
|
15
|
-
> | Recommended Version | `v2.0` |
|
|
16
|
-
> | Supports Polling/Webhooks | ✔️ Yes |
|
|
17
|
-
> | Support Synchronous HTTP Calls | ❌ No |
|
|
18
|
-
> | Geography | 🇫🇷 France |
|
|
19
|
-
|
|
20
|
-
> 🔐 Polling Limitations
|
|
21
|
-
>
|
|
22
|
-
> | Setting | Parameter name | Default Value |
|
|
23
|
-
> | ------------------------------- | ----------------------- | ------------- |
|
|
24
|
-
> | Initial Delay Before Polling | `initial_delay_seconds` | 2 seconds |
|
|
25
|
-
> | Default Delay Between Calls | `delay_sec` | 1.5 seconds |
|
|
26
|
-
> | Polling Attempts Before Timeout | `max_retries` | 80 retries |
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/bank_statement_fr/default_sample.jpg),
|
|
30
|
-
we are going to illustrate how to extract the data that we want using the Ruby Client Library.
|
|
31
|
-

|
|
32
|
-
|
|
33
|
-
# Quick-Start
|
|
34
|
-
```rb
|
|
35
|
-
#
|
|
36
|
-
# Install the Ruby client library by running:
|
|
37
|
-
# gem install mindee
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
require 'mindee'
|
|
41
|
-
|
|
42
|
-
# Init a new client
|
|
43
|
-
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
|
44
|
-
|
|
45
|
-
# Load a file from disk
|
|
46
|
-
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
47
|
-
|
|
48
|
-
# Parse the file
|
|
49
|
-
result = mindee_client.parse(
|
|
50
|
-
input_source,
|
|
51
|
-
Mindee::Product::FR::BankStatement::BankStatementV2
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
# Print a full summary of the parsed data in RST format
|
|
55
|
-
puts result.document
|
|
56
|
-
|
|
57
|
-
# Print the document-level parsed data
|
|
58
|
-
# puts result.document.inference.prediction
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**Output (RST):**
|
|
62
|
-
```rst
|
|
63
|
-
########
|
|
64
|
-
Document
|
|
65
|
-
########
|
|
66
|
-
:Mindee ID: 3c1811c0-9876-45ae-91ad-c2e9cd75dd83
|
|
67
|
-
:Filename: default_sample.jpg
|
|
68
|
-
|
|
69
|
-
Inference
|
|
70
|
-
#########
|
|
71
|
-
:Product: mindee/bank_statement_fr v2.0
|
|
72
|
-
:Rotation applied: Yes
|
|
73
|
-
|
|
74
|
-
Prediction
|
|
75
|
-
==========
|
|
76
|
-
:Account Number: XXXXXXXXXXXXXX
|
|
77
|
-
:Bank Name: Banque lafinancepourtous
|
|
78
|
-
:Bank Address: 1 rue de la Banque, 100210 Cassette
|
|
79
|
-
:Client Names: Karine Plume
|
|
80
|
-
:Client Address: 1 rue des Cigales, 100210 Cassette
|
|
81
|
-
:Statement Date: 2002-02-28
|
|
82
|
-
:Statement Start Date: 2002-02-01
|
|
83
|
-
:Statement End Date: 2002-02-28
|
|
84
|
-
:Opening Balance: 22.15
|
|
85
|
-
:Closing Balance: -278.96
|
|
86
|
-
:Transactions:
|
|
87
|
-
+------------+------------+--------------------------------------+
|
|
88
|
-
| Amount | Date | Description |
|
|
89
|
-
+============+============+======================================+
|
|
90
|
-
| 1240.00 | 2002-02-01 | Virement salaire |
|
|
91
|
-
+------------+------------+--------------------------------------+
|
|
92
|
-
| -520.00 | 2002-02-02 | Virement loyer |
|
|
93
|
-
+------------+------------+--------------------------------------+
|
|
94
|
-
| -312.00 | 2002-02-03 | Débit Carte nºxxxx |
|
|
95
|
-
+------------+------------+--------------------------------------+
|
|
96
|
-
| 12.47 | 2002-02-04 | Virement CPAM |
|
|
97
|
-
+------------+------------+--------------------------------------+
|
|
98
|
-
| 65.00 | 2002-02-05 | Virement APL |
|
|
99
|
-
+------------+------------+--------------------------------------+
|
|
100
|
-
| -110.00 | 2002-02-07 | Débit Carte nxxxxxxxxxxxxxxxx |
|
|
101
|
-
+------------+------------+--------------------------------------+
|
|
102
|
-
| -3.30 | 2002-02-08 | Cotisation mensuelle carte bancaire |
|
|
103
|
-
+------------+------------+--------------------------------------+
|
|
104
|
-
| -120.00 | 2002-02-09 | Chèque n° xxxxxx98 |
|
|
105
|
-
+------------+------------+--------------------------------------+
|
|
106
|
-
| -60.00 | 2002-02-09 | Retrait espèces DAB |
|
|
107
|
-
+------------+------------+--------------------------------------+
|
|
108
|
-
| -55.00 | 2002-02-15 | Chèque n° xxxxxx99 |
|
|
109
|
-
+------------+------------+--------------------------------------+
|
|
110
|
-
| -80.00 | 2002-02-16 | Prélèvement supercrédit |
|
|
111
|
-
+------------+------------+--------------------------------------+
|
|
112
|
-
| -120.00 | 2002-02-17 | Chèque n° xxxxx 100 |
|
|
113
|
-
+------------+------------+--------------------------------------+
|
|
114
|
-
| -163.25 | 2002-02-20 | Débit Carte nºxxxxxxxxxxxxx |
|
|
115
|
-
+------------+------------+--------------------------------------+
|
|
116
|
-
| -25.50 | 2002-02-21 | Débit Carte n°xxxxxxxxxxxxxxxxxx |
|
|
117
|
-
+------------+------------+--------------------------------------+
|
|
118
|
-
| -30.00 | 2002-02-24 | Prélèvement Opérateur téléphonique |
|
|
119
|
-
+------------+------------+--------------------------------------+
|
|
120
|
-
| -6.53 | 2002-02-25 | Agios |
|
|
121
|
-
+------------+------------+--------------------------------------+
|
|
122
|
-
| -13.00 | 2002-02-28 | Frais irrégularités et incidents ... |
|
|
123
|
-
+------------+------------+--------------------------------------+
|
|
124
|
-
:Total Debits: 1618.58
|
|
125
|
-
:Total Credits: 1339.62
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
# Field Types
|
|
129
|
-
## Standard Fields
|
|
130
|
-
These fields are generic and used in several products.
|
|
131
|
-
|
|
132
|
-
### Basic Field
|
|
133
|
-
Each prediction object contains a set of fields that inherit from the generic `Field` class.
|
|
134
|
-
A typical `Field` object will have the following attributes:
|
|
135
|
-
|
|
136
|
-
* **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
|
|
137
|
-
* **confidence** (Float, nil): the confidence score of the field prediction.
|
|
138
|
-
* **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
|
|
139
|
-
* **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
|
|
140
|
-
* **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
|
|
141
|
-
* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
Aside from the previous attributes, all basic fields have access to a `to_s` method that can be used to print their value as a string.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
### Amount Field
|
|
148
|
-
The amount field `AmountField` only has one constraint: its **value** is a `Float` (or `nil`).
|
|
149
|
-
|
|
150
|
-
### Date Field
|
|
151
|
-
Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
|
|
152
|
-
|
|
153
|
-
* **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
|
|
154
|
-
|
|
155
|
-
### String Field
|
|
156
|
-
The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
|
|
157
|
-
|
|
158
|
-
## Specific Fields
|
|
159
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
160
|
-
|
|
161
|
-
### Transactions Field
|
|
162
|
-
The list of values that represent the financial transactions recorded in a bank statement.
|
|
163
|
-
|
|
164
|
-
A `BankStatementV2Transaction` implements the following attributes:
|
|
165
|
-
|
|
166
|
-
* `amount` (Float): The monetary amount of the transaction.
|
|
167
|
-
* `date` (String): The date on which the transaction occurred.
|
|
168
|
-
* `description` (String): The additional information about the transaction.
|
|
169
|
-
|
|
170
|
-
# Attributes
|
|
171
|
-
The following fields are extracted for Bank Statement V2:
|
|
172
|
-
|
|
173
|
-
## Account Number
|
|
174
|
-
**account_number** ([StringField](#string-field)): The unique identifier for a customer's account in the bank's system.
|
|
175
|
-
|
|
176
|
-
```rb
|
|
177
|
-
puts result.document.inference.prediction.account_number.value
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Bank Address
|
|
181
|
-
**bank_address** ([StringField](#string-field)): The physical location of the bank where the statement was issued.
|
|
182
|
-
|
|
183
|
-
```rb
|
|
184
|
-
puts result.document.inference.prediction.bank_address.value
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Bank Name
|
|
188
|
-
**bank_name** ([StringField](#string-field)): The name of the bank that issued the statement.
|
|
189
|
-
|
|
190
|
-
```rb
|
|
191
|
-
puts result.document.inference.prediction.bank_name.value
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
## Client Address
|
|
195
|
-
**client_address** ([StringField](#string-field)): The address of the client associated with the bank statement.
|
|
196
|
-
|
|
197
|
-
```rb
|
|
198
|
-
puts result.document.inference.prediction.client_address.value
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Client Names
|
|
202
|
-
**client_names** (Array<[StringField](#string-field)>): The name of the clients who own the bank statement.
|
|
203
|
-
|
|
204
|
-
```rb
|
|
205
|
-
result.document.inference.prediction.client_names do |client_names_elem|
|
|
206
|
-
puts client_names_elem.value
|
|
207
|
-
end
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Closing Balance
|
|
211
|
-
**closing_balance** ([AmountField](#amount-field)): The final amount of money in the account at the end of the statement period.
|
|
212
|
-
|
|
213
|
-
```rb
|
|
214
|
-
puts result.document.inference.prediction.closing_balance.value
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## Opening Balance
|
|
218
|
-
**opening_balance** ([AmountField](#amount-field)): The initial amount of money in an account at the start of the period.
|
|
219
|
-
|
|
220
|
-
```rb
|
|
221
|
-
puts result.document.inference.prediction.opening_balance.value
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
## Statement Date
|
|
225
|
-
**statement_date** ([DateField](#date-field)): The date on which the bank statement was generated.
|
|
226
|
-
|
|
227
|
-
```rb
|
|
228
|
-
puts result.document.inference.prediction.statement_date.value
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
## Statement End Date
|
|
232
|
-
**statement_end_date** ([DateField](#date-field)): The date when the statement period ends.
|
|
233
|
-
|
|
234
|
-
```rb
|
|
235
|
-
puts result.document.inference.prediction.statement_end_date.value
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## Statement Start Date
|
|
239
|
-
**statement_start_date** ([DateField](#date-field)): The date when the bank statement period begins.
|
|
240
|
-
|
|
241
|
-
```rb
|
|
242
|
-
puts result.document.inference.prediction.statement_start_date.value
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
## Total Credits
|
|
246
|
-
**total_credits** ([AmountField](#amount-field)): The total amount of money deposited into the account.
|
|
247
|
-
|
|
248
|
-
```rb
|
|
249
|
-
puts result.document.inference.prediction.total_credits.value
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
## Total Debits
|
|
253
|
-
**total_debits** ([AmountField](#amount-field)): The total amount of money debited from the account.
|
|
254
|
-
|
|
255
|
-
```rb
|
|
256
|
-
puts result.document.inference.prediction.total_debits.value
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
## Transactions
|
|
260
|
-
**transactions** (Array<[BankStatementV2Transaction](#transactions-field)>): The list of values that represent the financial transactions recorded in a bank statement.
|
|
261
|
-
|
|
262
|
-
```rb
|
|
263
|
-
result.document.inference.prediction.transactions do |transactions_elem|
|
|
264
|
-
puts transactions_elem.value
|
|
265
|
-
end
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
# Questions?
|
|
269
|
-
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
|