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,344 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: FR Payslip
|
|
3
|
-
category: 622b805aaec68102ea7fcbc2
|
|
4
|
-
slug: ruby-fr-payslip-ocr
|
|
5
|
-
parentDoc: 67b49e29a2cd6f08d69a40d8
|
|
6
|
-
---
|
|
7
|
-
The Ruby Client Library supports the [Payslip API](https://platform.mindee.com/mindee/payslip_fra).
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
> 📝 Product Specs
|
|
11
|
-
>
|
|
12
|
-
> | Specification | Details |
|
|
13
|
-
> | ------------------------------ | -------------------------------------------------- |
|
|
14
|
-
> | Endpoint Name | `payslip_fra` |
|
|
15
|
-
> | Recommended Version | `v3.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/payslip_fra/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::Payslip::PayslipV3
|
|
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: a479e3e7-6838-4e82-9a7d-99289f34ec7f
|
|
67
|
-
:Filename: default_sample.jpg
|
|
68
|
-
|
|
69
|
-
Inference
|
|
70
|
-
#########
|
|
71
|
-
:Product: mindee/payslip_fra v3.0
|
|
72
|
-
:Rotation applied: Yes
|
|
73
|
-
|
|
74
|
-
Prediction
|
|
75
|
-
==========
|
|
76
|
-
:Pay Period:
|
|
77
|
-
:End Date: 2023-03-31
|
|
78
|
-
:Month: 03
|
|
79
|
-
:Payment Date: 2023-03-29
|
|
80
|
-
:Start Date: 2023-03-01
|
|
81
|
-
:Year: 2023
|
|
82
|
-
:Employee:
|
|
83
|
-
:Address: 52 RUE DES FLEURS 33500 LIBOURNE FRANCE
|
|
84
|
-
:Date of Birth:
|
|
85
|
-
:First Name: Jean Luc
|
|
86
|
-
:Last Name: Picard
|
|
87
|
-
:Phone Number:
|
|
88
|
-
:Registration Number:
|
|
89
|
-
:Social Security Number: 123456789012345
|
|
90
|
-
:Employer:
|
|
91
|
-
:Address: 1 RUE DU TONNOT 25210 DOUBS
|
|
92
|
-
:Company ID: 12345678901234
|
|
93
|
-
:Company Site:
|
|
94
|
-
:NAF Code: 1234A
|
|
95
|
-
:Name: DEMO COMPANY
|
|
96
|
-
:Phone Number:
|
|
97
|
-
:URSSAF Number:
|
|
98
|
-
:Bank Account Details:
|
|
99
|
-
:Bank Name:
|
|
100
|
-
:IBAN:
|
|
101
|
-
:SWIFT:
|
|
102
|
-
:Employment:
|
|
103
|
-
:Category: Cadre
|
|
104
|
-
:Coefficient: 600,000
|
|
105
|
-
:Collective Agreement: Construction -- Promotion
|
|
106
|
-
:Job Title: Directeur Régional du Développement
|
|
107
|
-
:Position Level: Niveau 5 Echelon 3
|
|
108
|
-
:Seniority Date:
|
|
109
|
-
:Start Date: 2022-05-01
|
|
110
|
-
:Salary Details:
|
|
111
|
-
+--------------+-----------+--------------------------------------+--------+-----------+
|
|
112
|
-
| Amount | Base | Description | Number | Rate |
|
|
113
|
-
+==============+===========+======================================+========+===========+
|
|
114
|
-
| 6666.67 | | Salaire de base | | |
|
|
115
|
-
+--------------+-----------+--------------------------------------+--------+-----------+
|
|
116
|
-
| 9.30 | | Part patronale Mutuelle NR | | |
|
|
117
|
-
+--------------+-----------+--------------------------------------+--------+-----------+
|
|
118
|
-
| 508.30 | | Avantages en nature voiture | | |
|
|
119
|
-
+--------------+-----------+--------------------------------------+--------+-----------+
|
|
120
|
-
:Pay Detail:
|
|
121
|
-
:Gross Salary: 7184.27
|
|
122
|
-
:Gross Salary YTD: 18074.81
|
|
123
|
-
:Income Tax Rate: 17.60
|
|
124
|
-
:Income Tax Withheld: 1030.99
|
|
125
|
-
:Net Paid: 3868.32
|
|
126
|
-
:Net Paid Before Tax: 4899.31
|
|
127
|
-
:Net Taxable: 5857.90
|
|
128
|
-
:Net Taxable YTD: 14752.73
|
|
129
|
-
:Total Cost Employer: 10486.94
|
|
130
|
-
:Total Taxes and Deductions: 1650.36
|
|
131
|
-
:Paid Time Off:
|
|
132
|
-
+-----------+--------+-------------+-----------+-----------+
|
|
133
|
-
| Accrued | Period | Type | Remaining | Used |
|
|
134
|
-
+===========+========+=============+===========+===========+
|
|
135
|
-
| | N-1 | VACATION | | |
|
|
136
|
-
+-----------+--------+-------------+-----------+-----------+
|
|
137
|
-
| 6.17 | N | VACATION | 6.17 | |
|
|
138
|
-
+-----------+--------+-------------+-----------+-----------+
|
|
139
|
-
| 2.01 | N | RTT | 2.01 | |
|
|
140
|
-
+-----------+--------+-------------+-----------+-----------+
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
# Field Types
|
|
144
|
-
## Standard Fields
|
|
145
|
-
These fields are generic and used in several products.
|
|
146
|
-
|
|
147
|
-
### Basic Field
|
|
148
|
-
Each prediction object contains a set of fields that inherit from the generic `Field` class.
|
|
149
|
-
A typical `Field` object will have the following attributes:
|
|
150
|
-
|
|
151
|
-
* **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
|
|
152
|
-
* **confidence** (Float, nil): the confidence score of the field prediction.
|
|
153
|
-
* **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
|
|
154
|
-
* **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
|
|
155
|
-
* **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
|
|
156
|
-
* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
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.
|
|
160
|
-
|
|
161
|
-
## Specific Fields
|
|
162
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
163
|
-
|
|
164
|
-
### Pay Period Field
|
|
165
|
-
Information about the pay period.
|
|
166
|
-
|
|
167
|
-
A `PayslipV3PayPeriod` implements the following attributes:
|
|
168
|
-
|
|
169
|
-
* `end_date` (String): The end date of the pay period.
|
|
170
|
-
* `month` (String): The month of the pay period.
|
|
171
|
-
* `payment_date` (String): The date of payment for the pay period.
|
|
172
|
-
* `start_date` (String): The start date of the pay period.
|
|
173
|
-
* `year` (String): The year of the pay period.
|
|
174
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
175
|
-
|
|
176
|
-
### Employee Field
|
|
177
|
-
Information about the employee.
|
|
178
|
-
|
|
179
|
-
A `PayslipV3Employee` implements the following attributes:
|
|
180
|
-
|
|
181
|
-
* `address` (String): The address of the employee.
|
|
182
|
-
* `date_of_birth` (String): The date of birth of the employee.
|
|
183
|
-
* `first_name` (String): The first name of the employee.
|
|
184
|
-
* `last_name` (String): The last name of the employee.
|
|
185
|
-
* `phone_number` (String): The phone number of the employee.
|
|
186
|
-
* `registration_number` (String): The registration number of the employee.
|
|
187
|
-
* `social_security_number` (String): The social security number of the employee.
|
|
188
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
189
|
-
|
|
190
|
-
### Employer Field
|
|
191
|
-
Information about the employer.
|
|
192
|
-
|
|
193
|
-
A `PayslipV3Employer` implements the following attributes:
|
|
194
|
-
|
|
195
|
-
* `address` (String): The address of the employer.
|
|
196
|
-
* `company_id` (String): The company ID of the employer.
|
|
197
|
-
* `company_site` (String): The site of the company.
|
|
198
|
-
* `naf_code` (String): The NAF code of the employer.
|
|
199
|
-
* `name` (String): The name of the employer.
|
|
200
|
-
* `phone_number` (String): The phone number of the employer.
|
|
201
|
-
* `urssaf_number` (String): The URSSAF number of the employer.
|
|
202
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
203
|
-
|
|
204
|
-
### Bank Account Details Field
|
|
205
|
-
Information about the employee's bank account.
|
|
206
|
-
|
|
207
|
-
A `PayslipV3BankAccountDetail` implements the following attributes:
|
|
208
|
-
|
|
209
|
-
* `bank_name` (String): The name of the bank.
|
|
210
|
-
* `iban` (String): The IBAN of the bank account.
|
|
211
|
-
* `swift` (String): The SWIFT code of the bank.
|
|
212
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
213
|
-
|
|
214
|
-
### Employment Field
|
|
215
|
-
Information about the employment.
|
|
216
|
-
|
|
217
|
-
A `PayslipV3Employment` implements the following attributes:
|
|
218
|
-
|
|
219
|
-
* `category` (String): The category of the employment.
|
|
220
|
-
* `coefficient` (String): The coefficient of the employment.
|
|
221
|
-
* `collective_agreement` (String): The collective agreement of the employment.
|
|
222
|
-
* `job_title` (String): The job title of the employee.
|
|
223
|
-
* `position_level` (String): The position level of the employment.
|
|
224
|
-
* `seniority_date` (String): The seniority date of the employment.
|
|
225
|
-
* `start_date` (String): The start date of the employment.
|
|
226
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
227
|
-
|
|
228
|
-
### Salary Details Field
|
|
229
|
-
Detailed information about the earnings.
|
|
230
|
-
|
|
231
|
-
A `PayslipV3SalaryDetail` implements the following attributes:
|
|
232
|
-
|
|
233
|
-
* `amount` (Float): The amount of the earning.
|
|
234
|
-
* `base` (Float): The base rate value of the earning.
|
|
235
|
-
* `description` (String): The description of the earnings.
|
|
236
|
-
* `number` (Float): The number of units in the earning.
|
|
237
|
-
* `rate` (Float): The rate of the earning.
|
|
238
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
239
|
-
|
|
240
|
-
### Pay Detail Field
|
|
241
|
-
Detailed information about the pay.
|
|
242
|
-
|
|
243
|
-
A `PayslipV3PayDetail` implements the following attributes:
|
|
244
|
-
|
|
245
|
-
* `gross_salary` (Float): The gross salary of the employee.
|
|
246
|
-
* `gross_salary_ytd` (Float): The year-to-date gross salary of the employee.
|
|
247
|
-
* `income_tax_rate` (Float): The income tax rate of the employee.
|
|
248
|
-
* `income_tax_withheld` (Float): The income tax withheld from the employee's pay.
|
|
249
|
-
* `net_paid` (Float): The net paid amount of the employee.
|
|
250
|
-
* `net_paid_before_tax` (Float): The net paid amount before tax of the employee.
|
|
251
|
-
* `net_taxable` (Float): The net taxable amount of the employee.
|
|
252
|
-
* `net_taxable_ytd` (Float): The year-to-date net taxable amount of the employee.
|
|
253
|
-
* `total_cost_employer` (Float): The total cost to the employer.
|
|
254
|
-
* `total_taxes_and_deductions` (Float): The total taxes and deductions of the employee.
|
|
255
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
256
|
-
|
|
257
|
-
### Paid Time Off Field
|
|
258
|
-
Information about paid time off.
|
|
259
|
-
|
|
260
|
-
A `PayslipV3PaidTimeOff` implements the following attributes:
|
|
261
|
-
|
|
262
|
-
* `accrued` (Float): The amount of paid time off accrued in the period.
|
|
263
|
-
* `period` (String): The paid time off period.
|
|
264
|
-
|
|
265
|
-
#### Possible values include:
|
|
266
|
-
- N
|
|
267
|
-
- N-1
|
|
268
|
-
- N-2
|
|
269
|
-
|
|
270
|
-
* `pto_type` (String): The type of paid time off.
|
|
271
|
-
|
|
272
|
-
#### Possible values include:
|
|
273
|
-
- VACATION
|
|
274
|
-
- RTT
|
|
275
|
-
- COMPENSATORY
|
|
276
|
-
|
|
277
|
-
* `remaining` (Float): The remaining amount of paid time off at the end of the period.
|
|
278
|
-
* `used` (Float): The amount of paid time off used in the period.
|
|
279
|
-
|
|
280
|
-
# Attributes
|
|
281
|
-
The following fields are extracted for Payslip V3:
|
|
282
|
-
|
|
283
|
-
## Bank Account Details
|
|
284
|
-
**bank_account_details** ([PayslipV3BankAccountDetail](#bank-account-details-field)): Information about the employee's bank account.
|
|
285
|
-
|
|
286
|
-
```rb
|
|
287
|
-
puts result.document.inference.prediction.bank_account_details.value
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
## Employee
|
|
291
|
-
**employee** ([PayslipV3Employee](#employee-field)): Information about the employee.
|
|
292
|
-
|
|
293
|
-
```rb
|
|
294
|
-
puts result.document.inference.prediction.employee.value
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
## Employer
|
|
298
|
-
**employer** ([PayslipV3Employer](#employer-field)): Information about the employer.
|
|
299
|
-
|
|
300
|
-
```rb
|
|
301
|
-
puts result.document.inference.prediction.employer.value
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
## Employment
|
|
305
|
-
**employment** ([PayslipV3Employment](#employment-field)): Information about the employment.
|
|
306
|
-
|
|
307
|
-
```rb
|
|
308
|
-
puts result.document.inference.prediction.employment.value
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
## Paid Time Off
|
|
312
|
-
**paid_time_off** (Array<[PayslipV3PaidTimeOff](#paid-time-off-field)>): Information about paid time off.
|
|
313
|
-
|
|
314
|
-
```rb
|
|
315
|
-
result.document.inference.prediction.paid_time_off do |paid_time_off_elem|
|
|
316
|
-
puts paid_time_off_elem.value
|
|
317
|
-
end
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
## Pay Detail
|
|
321
|
-
**pay_detail** ([PayslipV3PayDetail](#pay-detail-field)): Detailed information about the pay.
|
|
322
|
-
|
|
323
|
-
```rb
|
|
324
|
-
puts result.document.inference.prediction.pay_detail.value
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
## Pay Period
|
|
328
|
-
**pay_period** ([PayslipV3PayPeriod](#pay-period-field)): Information about the pay period.
|
|
329
|
-
|
|
330
|
-
```rb
|
|
331
|
-
puts result.document.inference.prediction.pay_period.value
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
## Salary Details
|
|
335
|
-
**salary_details** (Array<[PayslipV3SalaryDetail](#salary-details-field)>): Detailed information about the earnings.
|
|
336
|
-
|
|
337
|
-
```rb
|
|
338
|
-
result.document.inference.prediction.salary_details do |salary_details_elem|
|
|
339
|
-
puts salary_details_elem.value
|
|
340
|
-
end
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
# Questions?
|
|
344
|
-
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: US Healthcare Card
|
|
3
|
-
category: 622b805aaec68102ea7fcbc2
|
|
4
|
-
slug: ruby-us-healthcare-card-ocr
|
|
5
|
-
parentDoc: 67b49e29a2cd6f08d69a40d8
|
|
6
|
-
---
|
|
7
|
-
The Ruby Client Library supports the [Healthcare Card API](https://platform.mindee.com/mindee/us_healthcare_cards).
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
> 📝 Product Specs
|
|
11
|
-
>
|
|
12
|
-
> | Specification | Details |
|
|
13
|
-
> | ------------------------------ | -------------------------------------------------- |
|
|
14
|
-
> | Endpoint Name | `us_healthcare_cards` |
|
|
15
|
-
> | Recommended Version | `v1.3` |
|
|
16
|
-
> | Supports Polling/Webhooks | ✔️ Yes |
|
|
17
|
-
> | Support Synchronous HTTP Calls | ❌ No |
|
|
18
|
-
> | Geography | 🇺🇸 United States |
|
|
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/us_healthcare_cards/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::US::HealthcareCard::HealthcareCardV1
|
|
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: 5e917fc8-5c13-42b2-967f-954f4eed9959
|
|
67
|
-
:Filename: default_sample.jpg
|
|
68
|
-
|
|
69
|
-
Inference
|
|
70
|
-
#########
|
|
71
|
-
:Product: mindee/us_healthcare_cards v1.3
|
|
72
|
-
:Rotation applied: Yes
|
|
73
|
-
|
|
74
|
-
Prediction
|
|
75
|
-
==========
|
|
76
|
-
:Company Name: UnitedHealthcare
|
|
77
|
-
:Plan Name: Choice Plus
|
|
78
|
-
:Member Name: SUBSCRIBER SMITH
|
|
79
|
-
:Member ID: 123456789
|
|
80
|
-
:Issuer 80840:
|
|
81
|
-
:Dependents: SPOUSE SMITH
|
|
82
|
-
CHILD1 SMITH
|
|
83
|
-
CHILD2 SMITH
|
|
84
|
-
CHILD3 SMITH
|
|
85
|
-
:Group Number: 98765
|
|
86
|
-
:Payer ID: 87726
|
|
87
|
-
:RX BIN: 610279
|
|
88
|
-
:RX ID:
|
|
89
|
-
:RX GRP: UHEALTH
|
|
90
|
-
:RX PCN: 9999
|
|
91
|
-
:Copays:
|
|
92
|
-
+--------------+----------------------+
|
|
93
|
-
| Service Fees | Service Name |
|
|
94
|
-
+==============+======================+
|
|
95
|
-
| 20.00 | office_visit |
|
|
96
|
-
+--------------+----------------------+
|
|
97
|
-
| 300.00 | emergency_room |
|
|
98
|
-
+--------------+----------------------+
|
|
99
|
-
| 75.00 | urgent_care |
|
|
100
|
-
+--------------+----------------------+
|
|
101
|
-
| 30.00 | specialist |
|
|
102
|
-
+--------------+----------------------+
|
|
103
|
-
:Enrollment Date:
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
# Field Types
|
|
107
|
-
## Standard Fields
|
|
108
|
-
These fields are generic and used in several products.
|
|
109
|
-
|
|
110
|
-
### Basic Field
|
|
111
|
-
Each prediction object contains a set of fields that inherit from the generic `Field` class.
|
|
112
|
-
A typical `Field` object will have the following attributes:
|
|
113
|
-
|
|
114
|
-
* **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
|
|
115
|
-
* **confidence** (Float, nil): the confidence score of the field prediction.
|
|
116
|
-
* **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
|
|
117
|
-
* **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
|
|
118
|
-
* **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
|
|
119
|
-
* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
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.
|
|
123
|
-
|
|
124
|
-
### Date Field
|
|
125
|
-
Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
|
|
126
|
-
|
|
127
|
-
* **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
|
|
128
|
-
|
|
129
|
-
### String Field
|
|
130
|
-
The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
|
|
131
|
-
|
|
132
|
-
## Specific Fields
|
|
133
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
134
|
-
|
|
135
|
-
### Copays Field
|
|
136
|
-
Copayments for covered services.
|
|
137
|
-
|
|
138
|
-
A `HealthcareCardV1Copay` implements the following attributes:
|
|
139
|
-
|
|
140
|
-
* `service_fees` (Float): The price of the service.
|
|
141
|
-
* `service_name` (String): The name of the service.
|
|
142
|
-
|
|
143
|
-
#### Possible values include:
|
|
144
|
-
- primary_care
|
|
145
|
-
- emergency_room
|
|
146
|
-
- urgent_care
|
|
147
|
-
- specialist
|
|
148
|
-
- office_visit
|
|
149
|
-
- prescription
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
# Attributes
|
|
153
|
-
The following fields are extracted for Healthcare Card V1:
|
|
154
|
-
|
|
155
|
-
## Company Name
|
|
156
|
-
**company_name** ([StringField](#string-field)): The name of the company that provides the healthcare plan.
|
|
157
|
-
|
|
158
|
-
```rb
|
|
159
|
-
puts result.document.inference.prediction.company_name.value
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## Copays
|
|
163
|
-
**copays** (Array<[HealthcareCardV1Copay](#copays-field)>): Copayments for covered services.
|
|
164
|
-
|
|
165
|
-
```rb
|
|
166
|
-
result.document.inference.prediction.copays do |copays_elem|
|
|
167
|
-
puts copays_elem.value
|
|
168
|
-
end
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Dependents
|
|
172
|
-
**dependents** (Array<[StringField](#string-field)>): The list of dependents covered by the healthcare plan.
|
|
173
|
-
|
|
174
|
-
```rb
|
|
175
|
-
result.document.inference.prediction.dependents do |dependents_elem|
|
|
176
|
-
puts dependents_elem.value
|
|
177
|
-
end
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Enrollment Date
|
|
181
|
-
**enrollment_date** ([DateField](#date-field)): The date when the member enrolled in the healthcare plan.
|
|
182
|
-
|
|
183
|
-
```rb
|
|
184
|
-
puts result.document.inference.prediction.enrollment_date.value
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Group Number
|
|
188
|
-
**group_number** ([StringField](#string-field)): The group number associated with the healthcare plan.
|
|
189
|
-
|
|
190
|
-
```rb
|
|
191
|
-
puts result.document.inference.prediction.group_number.value
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
## Issuer 80840
|
|
195
|
-
**issuer80840** ([StringField](#string-field)): The organization that issued the healthcare plan.
|
|
196
|
-
|
|
197
|
-
```rb
|
|
198
|
-
puts result.document.inference.prediction.issuer80840.value
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Member ID
|
|
202
|
-
**member_id** ([StringField](#string-field)): The unique identifier for the member in the healthcare system.
|
|
203
|
-
|
|
204
|
-
```rb
|
|
205
|
-
puts result.document.inference.prediction.member_id.value
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
## Member Name
|
|
209
|
-
**member_name** ([StringField](#string-field)): The name of the member covered by the healthcare plan.
|
|
210
|
-
|
|
211
|
-
```rb
|
|
212
|
-
puts result.document.inference.prediction.member_name.value
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
## Payer ID
|
|
216
|
-
**payer_id** ([StringField](#string-field)): The unique identifier for the payer in the healthcare system.
|
|
217
|
-
|
|
218
|
-
```rb
|
|
219
|
-
puts result.document.inference.prediction.payer_id.value
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
## Plan Name
|
|
223
|
-
**plan_name** ([StringField](#string-field)): The name of the healthcare plan.
|
|
224
|
-
|
|
225
|
-
```rb
|
|
226
|
-
puts result.document.inference.prediction.plan_name.value
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
## RX BIN
|
|
230
|
-
**rx_bin** ([StringField](#string-field)): The BIN number for prescription drug coverage.
|
|
231
|
-
|
|
232
|
-
```rb
|
|
233
|
-
puts result.document.inference.prediction.rx_bin.value
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
## RX GRP
|
|
237
|
-
**rx_grp** ([StringField](#string-field)): The group number for prescription drug coverage.
|
|
238
|
-
|
|
239
|
-
```rb
|
|
240
|
-
puts result.document.inference.prediction.rx_grp.value
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
## RX ID
|
|
244
|
-
**rx_id** ([StringField](#string-field)): The ID number for prescription drug coverage.
|
|
245
|
-
|
|
246
|
-
```rb
|
|
247
|
-
puts result.document.inference.prediction.rx_id.value
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
## RX PCN
|
|
251
|
-
**rx_pcn** ([StringField](#string-field)): The PCN number for prescription drug coverage.
|
|
252
|
-
|
|
253
|
-
```rb
|
|
254
|
-
puts result.document.inference.prediction.rx_pcn.value
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
# Questions?
|
|
258
|
-
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
|