Add CAPI PDF parser for structured questionnaire documents (issue #57)#124
Merged
woodthom2 merged 1 commit intoharmonydata:mainfrom Dec 17, 2025
Merged
Conversation
Contributor
Author
|
By the way - I tested the integration by calling "convert_pdf_to_instruments()" directly with the MCS2 PDF and successfully detected CAPI format and created an instrument with 298 questions. BUT - Tika server had start up issues on my Windows machine (not sure if this is a universal windows issue or just on my computer, but thought relevant to include), so I pre-extracted the text content for testing. The CAPI detection and parsing logic works correctly with the actual 'pdf_parser.py' integration point. |
Contributor
Author
|
Hi @woodthom2 just thought I'd leave a note here to make sure everything was okay with the above, no rush what-so-ever of course, just happy to look into anything that you're not happy with! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a regex-based parser for CAPI PDF questionnaires. These structured documents from large research studies (e.g., Millennium Cohort Study as test req) have a specific format that the existing DeBERTa parser doesn't handle well.
Changes:
Approach (based on guidance from issue #57):
No new dependencies introduced at all.
Fixes #57
Type of change
Testing
Tested locally with MCS2_CAPI_Questionnaire_Documentation_June_2006_v1-2.pdf (linked in issue #57):
Note: Tika server had startup issues on Windows, so used pdfplumber for local text extraction testing. The CAPI parsing logic itself is independent of the text extraction method.
Test Configuration
Checklist
Note on unchecked items: No formal unit tests or documentation added in this PR - happy to add if requested. The feature was tested manually as described above.