I read your medium blog post and it was very helpful. First on line 35 of pdf_processing. You have ==['/Widget'] but in your blog post you have =='/Widget' in your description. The latter case seems to work. perhaps you mean in ['/Widget']. Also you have an import to fitz which I don't think is necessary.
Finally, you didn't describe what FORM_KEYS is and a better description of data would help your readers.
I'd suggest putting those into the comments in the code.