Filling out long and dense forms can be a chore, it’s an even bigger chore to copy and paste from them. Let’s see how Designer’s Computer Vision tools can help.
Below is a K-1 tax form that Peter Pan has been instructed to copy text from:
![k1.png k1.png](https://community.alteryx.com/t5/image/serverpage/image-id/229868i8468EA6A55E8BD21/image-size/large?v=v2&px=999)
That is a lot of text and Peter has more than one of these to review! He knows he needs to automate extraction of this data so he can get to the important work of analyzing this company’s financial processes to make sure they’re in compliance with tax laws.
But, oh my word (pun intended) that form has a lot of fields… and look at how dense section J is!
![j.png j.png](https://community.alteryx.com/t5/image/serverpage/image-id/229869i31F0541BE48F87D6/image-size/large?v=v2&px=999)
Never fear all Peter needs is a little faith and some computer vision pixie dust. Using a combination of the Image Input, Image Template and Image to Text tools we can automate extracting data from simple and complex forms! Let’s see how Peter can accomplish this for his K1 tax forms.
First we point the Image Input tool at the folder that contains our K1 forms, then using the Image Template tool we “annotate” our document; this is how we tell Designer what values we want to extract and what field names they should be mapped to.
![C3PO_4-1647898379213.png C3PO_4-1647898379213.png](https://community.alteryx.com/t5/image/serverpage/image-id/227504iDAC06898E53B82A5/image-size/medium?v=v2&px=400)
Note on our form how there are many fields per section letter or number (hence forth called an identifier), as well as many values per field. One way to address this is to use a combination of the field name, identifier, and attribute values for annotation field names.
![C3PO_5-1647898379220.png C3PO_5-1647898379220.png](https://community.alteryx.com/t5/image/serverpage/image-id/227503iB49C9B68EF8F8811/image-size/large?v=v2&px=999)
![C3PO_6-1647898379303.png C3PO_6-1647898379303.png](https://community.alteryx.com/t5/image/serverpage/image-id/227507i9100DB322A796ED7/image-size/large?v=v2&px=999)
Best Practice: When extracting data from images a high resolution is recommended (300 DPI).
Hot tip: You can export your annotations as a JSON file. You can use this to share your annotations with someone or perhaps to create annotation standards for other developers.
![C3PO_7-1647898379337.png C3PO_7-1647898379337.png](https://community.alteryx.com/t5/image/serverpage/image-id/227506iD8D4E706F7FFEED5/image-size/large?v=v2&px=999)
Once we’re done annotating our form fields we connect the Image Input and Image Template tools to the Image to Text tool and run our workflow to extract the text. The result is 1 row of data per annotation. From there, using the Text to Columns tool we separate field name, identifier, and field values.
![C3PO_8-1647898379345.png C3PO_8-1647898379345.png](https://community.alteryx.com/t5/image/serverpage/image-id/227505iF05B1731319511D4/image-size/large?v=v2&px=999)
And with a little faith in column and row positions and some Transpose Tool pixie dust we don’t have to walk the copy and paste plank. Instead, we can now use Designer to analyze Partner’s share of profit, loss and capital for beginning and end periods.
![C3PO_9-1647898379364.png C3PO_9-1647898379364.png](https://community.alteryx.com/t5/image/serverpage/image-id/227510i5F424B80C9161D2A/image-size/large?v=v2&px=999)
![C3PO_10-1647898379377.png C3PO_10-1647898379377.png](https://community.alteryx.com/t5/image/serverpage/image-id/227508i6383A2B704B6E11F/image-size/large?v=v2&px=999)
Now that Peter has all his form fields in a format he can analyze, it’s time to put them all together. Recall that the Image to Text tool outputs standard file metadata fields like file name and path. With this file metadata we can group rows from the same file together.
![C3PO_11-1647898379379.png C3PO_11-1647898379379.png](https://community.alteryx.com/t5/image/serverpage/image-id/227509i3A76BB2F508AB014/image-size/large?v=v2&px=999)
![C3PO_12-1647898379384.png C3PO_12-1647898379384.png](https://community.alteryx.com/t5/image/serverpage/image-id/227512iEEBECFFE668015E7/image-size/large?v=v2&px=999)
After grouping rows together, we union them into one data set with the aid of a consistent field schema using the Text Input tool, as well as Join and Union tools. And voila! Peter can now analyze the data from his K1 forms!
![C3PO_13-1647898379386.png C3PO_13-1647898379386.png](https://community.alteryx.com/t5/image/serverpage/image-id/227511i587C73C79D90BFF3/image-size/large?v=v2&px=999)
![C3PO_14-1647898379390.png C3PO_14-1647898379390.png](https://community.alteryx.com/t5/image/serverpage/image-id/227513i793863F7481410CC/image-size/large?v=v2&px=999)
![C3PO_15-1647898379405.png C3PO_15-1647898379405.png](https://community.alteryx.com/t5/image/serverpage/image-id/227514i6A83BF8567CE47DF/image-size/large?v=v2&px=999)
With Designer Peter can complete his work much faster! Which means more time for shenanigans with the lost boys!
via GIPHY
Want to try the Alteryx Intelligence Suite for yourself?
Click here to download a free trial of the Alteryx Intelligence Suite.
Get the workflow in this blog here.