Created
March 11, 2019 14:28
-
-
Save kubaracek/3de395f644c4f4be7b6be20bd2ef0c07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):141:0> data | |
=> [{:id=>"197466", :category=>"section", :schema_id=>"invoice_info_section", :children=>[{:id=>"197467", :category=>"datapoint", :schema_id=>"invoice_number", :page=>1, :position=>[916, 168, 1190, 222], :value=>"FV103828806S", :validation_sources=>["score"], :type=>"string"}, {:id=>"197468", :category=>"datapoint", :schema_id=>"date_due", :page=>1, :position=>[938, 618, 1000, 654], :value=>"12/22/2018", :validation_sources=>["score"], :type=>"date"}, {:id=>"197469", :category=>"datapoint", :schema_id=>"amount_due", :page=>1, :position=>[1134, 1050, 1190, 1080], :value=>"55.20", :validation_sources=>["human"], :type=>"number"}]}, {:id=>"197500", :category=>"section", :schema_id=>"line_items_section", :children=>[{:id=>"197501", :category=>"multivalue", :schema_id=>"line_items", :children=>[{:id=>"198139", :category=>"tuple", :schema_id=>"line_item", :children=>[{:id=>"198140", :category=>"datapoint", :schema_id=>"item_desc", :page=>1, :position=>[173, 883, 395, 904], :value=>"Red Rose", :validation_sources=>[], :type=>"string"}, {:id=>"198142", :category=>"datapoint", :schema_id=>"item_net_unit_price", :page=>1, :position=>[714, 846, 768, 870], :value=>"1532.02", :validation_sources=>["human"], :type=>"number"}]}]}]}] | |
irb(main):142:0> data.map {|x| build_schema(x)} | |
=> [{"invoice_info_section"=>[{"invoice_number"=>{"value"=>"FV103828806S"}}, {"date_due"=>{"value"=>"12/22/2018"}}, {"amount_due"=>{"value"=>"55.20"}}]}, {"line_items_section"=>[{"line_items"=>[{"line_item"=>[{"item_desc"=>{"value"=>"Red Rose"}}, {"item_net_unit_price"=>{"value"=>"1532.02"}}]}]}]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment