mindee 4.1.2 → 4.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32781169244b37ef1d839e05d09ffc0c58a677b33a3f7266a2a0597e9dc0e114
4
- data.tar.gz: 9d3793675e7bef501031be3f70454c7681b48317bffaf61be576a13c043c5c1a
3
+ metadata.gz: e6c09d5108c2470661075484f14849c7205cbef88d481427bcb612d36ede9835
4
+ data.tar.gz: e7b6fa99499a9c3a3d82a9c87ab40dc07cbecd48a4f2d82200cfea2729f9d5cb
5
5
  SHA512:
6
- metadata.gz: bb14b3e6a1fe2e52bdc1d93836f0b70f91e0ddf8a3fd667ca68cc2661f145da9e3a070c0d6124d5e9ce916a1e0110abd8723afd43312043c04b2138e311c0372
7
- data.tar.gz: 12a99519ce9fbf03c69aea9651205aa17fdd96ab8bdbd2a54ad1768304baf374c1e3f53d791375ce0f91fe66589d84bf24c3d496dc294212913dd409ce8d6322
6
+ metadata.gz: b97c068ddeefb0908e7d9753c0439c86393d1a04b13bf8f256c3dbc93399f213b0405375a036715906a8087eba3eb5126d8e69880c819ef4b0d5b7bf61459e88
7
+ data.tar.gz: a15ff1b478675ec58dfd61d0f0483dcc7ab23df1fc02624e8133d5f636101e82f1eeb4f823ebe19a3a06ce70c4288270ebaca7029514e91f204298ad5843c924
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Mindee Ruby API Library Changelog
2
2
 
3
+ ## v4.2.0 - 2025-03-28
4
+ ### Changes
5
+ * :coffin: remove support for US W9
6
+
7
+
3
8
  ## v4.1.2 - 2025-03-26
4
9
  ### Fixes
5
10
  * :wrench: loosen version restrictions on most dependencies
@@ -18,6 +23,7 @@
18
23
  ### Fixes
19
24
  * :recycle: update CLI syntax for easier product creation
20
25
 
26
+
21
27
  ## v4.0.0 - 2025-02-27
22
28
  ### ¡Breaking Changes!
23
29
  * :boom: drop support for ruby versions < 3.0
data/bin/cli_products.rb CHANGED
@@ -163,10 +163,4 @@ PRODUCTS = {
163
163
  sync: false,
164
164
  async: true,
165
165
  },
166
- "us-w9" => {
167
- description: "W9",
168
- doc_class: Mindee::Product::US::W9::W9V1,
169
- sync: true,
170
- async: false,
171
- },
172
166
  }
@@ -227,6 +227,7 @@ Aside from the basic `Field` attributes, the tax field `TaxField` also implement
227
227
  * **rate** (`Float`): the tax rate applied to an item can be expressed as a percentage. Can be `nil`.
228
228
  * **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
229
229
  * **base** (`Float`): base amount used for the tax. Can be `nil`.
230
+ * **value** (`Float`): the value of the tax. Can be `nil`.
230
231
 
231
232
  > Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, an array-like
232
233
  structure.
@@ -272,6 +272,7 @@ Aside from the basic `Field` attributes, the tax field `TaxField` also implement
272
272
  * **rate** (`Float`): the tax rate applied to an item can be expressed as a percentage. Can be `nil`.
273
273
  * **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
274
274
  * **base** (`Float`): base amount used for the tax. Can be `nil`.
275
+ * **value** (`Float`): the value of the tax. Can be `nil`.
275
276
 
276
277
  > Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, an array-like
277
278
  structure.
@@ -260,6 +260,7 @@ Aside from the basic `Field` attributes, the tax field `TaxField` also implement
260
260
  * **rate** (`Float`): the tax rate applied to an item can be expressed as a percentage. Can be `nil`.
261
261
  * **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
262
262
  * **base** (`Float`): base amount used for the tax. Can be `nil`.
263
+ * **value** (`Float`): the value of the tax. Can be `nil`.
263
264
 
264
265
  > Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, an array-like
265
266
  structure.
@@ -31,4 +31,3 @@ require_relative 'product/us/bank_check/bank_check_v1'
31
31
  require_relative 'product/us/healthcare_card/healthcare_card_v1'
32
32
  require_relative 'product/us/us_mail/us_mail_v2'
33
33
  require_relative 'product/us/us_mail/us_mail_v3'
34
- require_relative 'product/us/w9/w9_v1'
@@ -3,7 +3,7 @@
3
3
  # Mindee
4
4
  module Mindee
5
5
  # Current version.
6
- VERSION = '4.1.2'
6
+ VERSION = '4.2.0'
7
7
 
8
8
  # Finds and return the current platform.
9
9
  # @return [Symbol, Hash[Symbol | String, Regexp], Nil?]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mindee
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindee, SA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-26 00:00:00.000000000 Z
11
+ date: 2025-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -245,7 +245,6 @@ files:
245
245
  - docs/code_samples/us_healthcare_cards_v1_async.txt
246
246
  - docs/code_samples/us_mail_v2_async.txt
247
247
  - docs/code_samples/us_mail_v3_async.txt
248
- - docs/code_samples/us_w9_v1.txt
249
248
  - docs/code_samples/workflow_execution.txt
250
249
  - docs/getting_started.md
251
250
  - docs/global_products.md
@@ -278,7 +277,6 @@ files:
278
277
  - docs/localized_products/payslip_fra_v3.md
279
278
  - docs/localized_products/us_healthcare_cards_v1.md
280
279
  - docs/localized_products/us_mail_v3.md
281
- - docs/localized_products/us_w9_v1.md
282
280
  - examples/auto_invoice_splitter_extraction.rb
283
281
  - examples/auto_multi_receipts_detector_extraction.rb
284
282
  - lib/mindee.rb
@@ -535,9 +533,6 @@ files:
535
533
  - lib/mindee/product/us/us_mail/us_mail_v3_recipient_address.rb
536
534
  - lib/mindee/product/us/us_mail/us_mail_v3_recipient_addresses.rb
537
535
  - lib/mindee/product/us/us_mail/us_mail_v3_sender_address.rb
538
- - lib/mindee/product/us/w9/w9_v1.rb
539
- - lib/mindee/product/us/w9/w9_v1_document.rb
540
- - lib/mindee/product/us/w9/w9_v1_page.rb
541
536
  - lib/mindee/version.rb
542
537
  - mindee.gemspec
543
538
  - sig/custom/marcel.rbs
@@ -1,21 +0,0 @@
1
- #
2
- # Install the Ruby client library by running:
3
- # gem install mindee
4
- #
5
-
6
- require 'mindee'
7
-
8
- # Init a new client
9
- mindee_client = Mindee::Client.new(api_key: 'my-api-key')
10
-
11
- # Load a file from disk
12
- input_source = mindee_client.source_from_path('/path/to/the/file.ext')
13
-
14
- # Parse the file
15
- result = mindee_client.parse(
16
- input_source,
17
- Mindee::Product::US::W9::W9V1
18
- )
19
-
20
- # Print a full summary of the parsed data in RST format
21
- puts result.document
@@ -1,230 +0,0 @@
1
- ---
2
- title: US W9
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-us-w9-ocr
5
- parentDoc: 67b49e29a2cd6f08d69a40d8
6
- ---
7
- The Ruby Client Library supports the [W9 API](https://platform.mindee.com/mindee/us_w9).
8
-
9
-
10
- > 📝 Product Specs
11
- >
12
- > | Specification | Details |
13
- > | ------------------------------ | -------------------------------------------------- |
14
- > | Endpoint Name | `us_w9` |
15
- > | Recommended Version | `v1.0` |
16
- > | Supports Polling/Webhooks | ❌ No |
17
- > | Support Synchronous HTTP Calls | ✔️ Yes |
18
- > | Geography | 🇺🇸 United States |
19
-
20
-
21
- Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/us_w9/default_sample.jpg),
22
- we are going to illustrate how to extract the data that we want using the Ruby Client Library.
23
- ![W9 sample](https://github.com/mindee/client-lib-test-data/blob/main/products/us_w9/default_sample.jpg?raw=true)
24
-
25
- # Quick-Start
26
- ```rb
27
- #
28
- # Install the Ruby client library by running:
29
- # gem install mindee
30
- #
31
-
32
- require 'mindee'
33
-
34
- # Init a new client
35
- mindee_client = Mindee::Client.new(api_key: 'my-api-key')
36
-
37
- # Load a file from disk
38
- input_source = mindee_client.source_from_path('/path/to/the/file.ext')
39
-
40
- # Parse the file
41
- result = mindee_client.parse(
42
- input_source,
43
- Mindee::Product::US::W9::W9V1
44
- )
45
-
46
- # Print a full summary of the parsed data in RST format
47
- puts result.document
48
- ```
49
-
50
- **Output (RST):**
51
- ```rst
52
- ########
53
- Document
54
- ########
55
- :Mindee ID: d7c5b25f-e0d3-4491-af54-6183afa1aaab
56
- :Filename: default_sample.jpg
57
-
58
- Inference
59
- #########
60
- :Product: mindee/us_w9 v1.0
61
- :Rotation applied: Yes
62
-
63
- Prediction
64
- ==========
65
-
66
- Page Predictions
67
- ================
68
-
69
- Page 0
70
- ------
71
- :Name: Stephen W Hawking
72
- :SSN: 560758145
73
- :Address: Somewhere In Milky Way
74
- :City State Zip: Probably Still At Cambridge P O Box CB1
75
- :Business Name:
76
- :EIN: 942203664
77
- :Tax Classification: individual
78
- :Tax Classification Other Details:
79
- :W9 Revision Date: august 2013
80
- :Signature Position: Polygon with 4 points.
81
- :Signature Date Position:
82
- :Tax Classification LLC:
83
- ```
84
-
85
- # Field Types
86
- ## Standard Fields
87
- These fields are generic and used in several products.
88
-
89
- ### Basic Field
90
- Each prediction object contains a set of fields that inherit from the generic `Field` class.
91
- A typical `Field` object will have the following attributes:
92
-
93
- * **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
94
- * **confidence** (Float, nil): the confidence score of the field prediction.
95
- * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
96
- * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
97
- * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
98
- * **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
99
-
100
-
101
- 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.
102
-
103
-
104
- ### Position Field
105
- The position field `PositionField` does not implement all the basic `Field` attributes, only **bounding_box**,
106
- **polygon** and **page_id**. On top of these, it has access to:
107
-
108
- * **rectangle** (`Mindee::Geometry::Quadrilateral`): a Polygon with four points that may be oriented (even beyond
109
- canvas).
110
- * **quadrangle** (`Mindee::Geometry::Quadrilateral`): a free polygon made up of four points.
111
-
112
- ### String Field
113
- The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
114
-
115
- ## Page-Level Fields
116
- Some fields are constrained to the page level, and so will not be retrievable at document level.
117
-
118
- # Attributes
119
- The following fields are extracted for W9 V1:
120
-
121
- ## Address
122
- [📄](#page-level-fields "This field is only present on individual pages.")**address** ([StringField](#string-field)): The street address (number, street, and apt. or suite no.) of the applicant.
123
-
124
- ```rb
125
- result.document.address.each do |address_elem|
126
- puts address_elem.value
127
- end
128
- ```
129
-
130
- ## Business Name
131
- [📄](#page-level-fields "This field is only present on individual pages.")**business_name** ([StringField](#string-field)): The business name or disregarded entity name, if different from Name.
132
-
133
- ```rb
134
- result.document.business_name.each do |business_name_elem|
135
- puts business_name_elem.value
136
- end
137
- ```
138
-
139
- ## City State Zip
140
- [📄](#page-level-fields "This field is only present on individual pages.")**city_state_zip** ([StringField](#string-field)): The city, state, and ZIP code of the applicant.
141
-
142
- ```rb
143
- result.document.city_state_zip.each do |city_state_zip_elem|
144
- puts city_state_zip_elem.value
145
- end
146
- ```
147
-
148
- ## EIN
149
- [📄](#page-level-fields "This field is only present on individual pages.")**ein** ([StringField](#string-field)): The employer identification number.
150
-
151
- ```rb
152
- result.document.ein.each do |ein_elem|
153
- puts ein_elem.value
154
- end
155
- ```
156
-
157
- ## Name
158
- [📄](#page-level-fields "This field is only present on individual pages.")**name** ([StringField](#string-field)): Name as shown on the applicant's income tax return.
159
-
160
- ```rb
161
- result.document.name.each do |name_elem|
162
- puts name_elem.value
163
- end
164
- ```
165
-
166
- ## Signature Date Position
167
- [📄](#page-level-fields "This field is only present on individual pages.")**signature_date_position** ([PositionField](#position-field)): Position of the signature date on the document.
168
-
169
- ```rb
170
- result.document.signature_date_position.each do |signature_date_position_elem|
171
- puts signature_date_position_elem.polygon
172
- end
173
- ```
174
-
175
- ## Signature Position
176
- [📄](#page-level-fields "This field is only present on individual pages.")**signature_position** ([PositionField](#position-field)): Position of the signature on the document.
177
-
178
- ```rb
179
- result.document.signature_position.each do |signature_position_elem|
180
- puts signature_position_elem.polygon
181
- end
182
- ```
183
-
184
- ## SSN
185
- [📄](#page-level-fields "This field is only present on individual pages.")**ssn** ([StringField](#string-field)): The applicant's social security number.
186
-
187
- ```rb
188
- result.document.ssn.each do |ssn_elem|
189
- puts ssn_elem.value
190
- end
191
- ```
192
-
193
- ## Tax Classification
194
- [📄](#page-level-fields "This field is only present on individual pages.")**tax_classification** ([StringField](#string-field)): The federal tax classification, which can vary depending on the revision date.
195
-
196
- ```rb
197
- result.document.tax_classification.each do |tax_classification_elem|
198
- puts tax_classification_elem.value
199
- end
200
- ```
201
-
202
- ## Tax Classification LLC
203
- [📄](#page-level-fields "This field is only present on individual pages.")**tax_classification_llc** ([StringField](#string-field)): Depending on revision year, among S, C, P or D for Limited Liability Company Classification.
204
-
205
- ```rb
206
- result.document.tax_classification_llc.each do |tax_classification_llc_elem|
207
- puts tax_classification_llc_elem.value
208
- end
209
- ```
210
-
211
- ## Tax Classification Other Details
212
- [📄](#page-level-fields "This field is only present on individual pages.")**tax_classification_other_details** ([StringField](#string-field)): Tax Classification Other Details.
213
-
214
- ```rb
215
- result.document.tax_classification_other_details.each do |tax_classification_other_details_elem|
216
- puts tax_classification_other_details_elem.value
217
- end
218
- ```
219
-
220
- ## W9 Revision Date
221
- [📄](#page-level-fields "This field is only present on individual pages.")**w9_revision_date** ([StringField](#string-field)): The Revision month and year of the W9 form.
222
-
223
- ```rb
224
- result.document.w9_revision_date.each do |w9_revision_date_elem|
225
- puts w9_revision_date_elem.value
226
- end
227
- ```
228
-
229
- # Questions?
230
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'w9_v1_document'
5
- require_relative 'w9_v1_page'
6
-
7
- module Mindee
8
- module Product
9
- module US
10
- # W9 module.
11
- module W9
12
- # W9 API version 1 inference prediction.
13
- class W9V1 < Mindee::Parsing::Common::Inference
14
- @endpoint_name = 'us_w9'
15
- @endpoint_version = '1'
16
- @has_async = false
17
- @has_sync = true
18
-
19
- # @param prediction [Hash]
20
- def initialize(prediction)
21
- super
22
- @prediction = W9V1Document.new(prediction['prediction'], nil)
23
- @pages = []
24
- prediction['pages'].each do |page|
25
- @pages.push(W9V1Page.new(page))
26
- end
27
- end
28
-
29
- class << self
30
- # Name of the endpoint for this product.
31
- # @return [String]
32
- attr_reader :endpoint_name
33
- # Version for this product.
34
- # @return [String]
35
- attr_reader :endpoint_version
36
- # Whether this product has access to an asynchronous endpoint.
37
- # @return [bool]
38
- attr_reader :has_async
39
- # Whether this product has access to synchronous endpoint.
40
- # @return [bool]
41
- attr_reader :has_sync
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
-
5
- module Mindee
6
- module Product
7
- module US
8
- module W9
9
- # W9 API version 1.0 document data.
10
- class W9V1Document < Mindee::Parsing::Common::Prediction
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,133 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'w9_v1_document'
5
-
6
- module Mindee
7
- module Product
8
- module US
9
- module W9
10
- # W9 API version 1.0 page data.
11
- class W9V1Page < Mindee::Parsing::Common::Page
12
- # @param prediction [Hash]
13
- def initialize(prediction)
14
- super
15
- @prediction = if prediction['prediction'].empty?
16
- nil
17
- else
18
- W9V1PagePrediction.new(
19
- prediction['prediction'],
20
- prediction['id']
21
- )
22
- end
23
- end
24
- end
25
-
26
- # W9 V1 page prediction.
27
- class W9V1PagePrediction < W9V1Document
28
- include Mindee::Parsing::Standard
29
-
30
- # The street address (number, street, and apt. or suite no.) of the applicant.
31
- # @return [Mindee::Parsing::Standard::StringField]
32
- attr_reader :address
33
- # The business name or disregarded entity name, if different from Name.
34
- # @return [Mindee::Parsing::Standard::StringField]
35
- attr_reader :business_name
36
- # The city, state, and ZIP code of the applicant.
37
- # @return [Mindee::Parsing::Standard::StringField]
38
- attr_reader :city_state_zip
39
- # The employer identification number.
40
- # @return [Mindee::Parsing::Standard::StringField]
41
- attr_reader :ein
42
- # Name as shown on the applicant's income tax return.
43
- # @return [Mindee::Parsing::Standard::StringField]
44
- attr_reader :name
45
- # Position of the signature date on the document.
46
- # @return [Mindee::Parsing::Standard::PositionField]
47
- attr_reader :signature_date_position
48
- # Position of the signature on the document.
49
- # @return [Mindee::Parsing::Standard::PositionField]
50
- attr_reader :signature_position
51
- # The applicant's social security number.
52
- # @return [Mindee::Parsing::Standard::StringField]
53
- attr_reader :ssn
54
- # The federal tax classification, which can vary depending on the revision date.
55
- # @return [Mindee::Parsing::Standard::StringField]
56
- attr_reader :tax_classification
57
- # Depending on revision year, among S, C, P or D for Limited Liability Company Classification.
58
- # @return [Mindee::Parsing::Standard::StringField]
59
- attr_reader :tax_classification_llc
60
- # Tax Classification Other Details.
61
- # @return [Mindee::Parsing::Standard::StringField]
62
- attr_reader :tax_classification_other_details
63
- # The Revision month and year of the W9 form.
64
- # @return [Mindee::Parsing::Standard::StringField]
65
- attr_reader :w9_revision_date
66
-
67
- # @param prediction [Hash]
68
- # @param page_id [Integer, nil]
69
- def initialize(prediction, page_id)
70
- @address = Parsing::Standard::StringField.new(
71
- prediction['address'],
72
- page_id
73
- )
74
- @business_name = Parsing::Standard::StringField.new(
75
- prediction['business_name'],
76
- page_id
77
- )
78
- @city_state_zip = Parsing::Standard::StringField.new(
79
- prediction['city_state_zip'],
80
- page_id
81
- )
82
- @ein = Parsing::Standard::StringField.new(prediction['ein'], page_id)
83
- @name = Parsing::Standard::StringField.new(prediction['name'], page_id)
84
- @signature_date_position = Parsing::Standard::PositionField.new(
85
- prediction['signature_date_position'],
86
- page_id
87
- )
88
- @signature_position = Parsing::Standard::PositionField.new(
89
- prediction['signature_position'],
90
- page_id
91
- )
92
- @ssn = Parsing::Standard::StringField.new(prediction['ssn'], page_id)
93
- @tax_classification = Parsing::Standard::StringField.new(
94
- prediction['tax_classification'],
95
- page_id
96
- )
97
- @tax_classification_llc = Parsing::Standard::StringField.new(
98
- prediction['tax_classification_llc'],
99
- page_id
100
- )
101
- @tax_classification_other_details = Parsing::Standard::StringField.new(
102
- prediction['tax_classification_other_details'],
103
- page_id
104
- )
105
- @w9_revision_date = Parsing::Standard::StringField.new(
106
- prediction['w9_revision_date'],
107
- page_id
108
- )
109
- super
110
- end
111
-
112
- # @return [String]
113
- def to_s
114
- out_str = String.new
115
- out_str << "\n:Name: #{@name}".rstrip
116
- out_str << "\n:SSN: #{@ssn}".rstrip
117
- out_str << "\n:Address: #{@address}".rstrip
118
- out_str << "\n:City State Zip: #{@city_state_zip}".rstrip
119
- out_str << "\n:Business Name: #{@business_name}".rstrip
120
- out_str << "\n:EIN: #{@ein}".rstrip
121
- out_str << "\n:Tax Classification: #{@tax_classification}".rstrip
122
- out_str << "\n:Tax Classification Other Details: #{@tax_classification_other_details}".rstrip
123
- out_str << "\n:W9 Revision Date: #{@w9_revision_date}".rstrip
124
- out_str << "\n:Signature Position: #{@signature_position}".rstrip
125
- out_str << "\n:Signature Date Position: #{@signature_date_position}".rstrip
126
- out_str << "\n:Tax Classification LLC: #{@tax_classification_llc}".rstrip
127
- out_str
128
- end
129
- end
130
- end
131
- end
132
- end
133
- end