Skip to content

Feature/ppa page alignment - #285

Merged
rlskoeser merged 52 commits into
developfrom
feature/ppa-page-alignment
Sep 4, 2026
Merged

rlskoeser merged 52 commits into
developfrom
feature/ppa-page-alignment

Conversation

@rlskoeser

@rlskoeser rlskoeser commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

Associated Issue(s): resolves #284 #277

Changes in this PR

  • New script & methods to combine PPA page-level text corpus with images to prep dataset for publication
  • Uses rapidfuzz to match pages for HathiTrust works that were updated between PPA export version and image dataset

Notes

  • I suggest focusing your attention on align_shifted_pages and align_pages - this is the core of the logic for matching up HathiTrust pages with images
  • I did the initial scaffolding and planning, but a fair bit of the refactoring and restructuring and most (all?) of the unit tests has been supposed by agentic ai, as you'll see in the commit history - various claude models, run through Zed, OpenCode, and ClaudeCode
  • I added the version of the code with the continue flag because that was the easiest way to fix the broken unit tests

Assisted-by: Zed:claude-sonnet-4-6
Assisted-by: Zed:claude-sonnet-4-6
Assisted-by: ClaudeCode:claude-sonnet-4-6
Assisted-by: Zed:claude-sonnet-4-6
Assisted-by: Zed:claude-sonnet-4-6
per review from ClaudeCode:claude-sonnet-4-6
Assisted-by: ClaudeCode:claude-opus-4.7
Assisted-by: ClaudeCode:claude-opus-4.7
Assisted-by: ClaudeCode:claude-opus-4.7
Assisted-by: ClaudeCode:claude-opus-4.7
Assisted-by: OpenCode:claude-opus-4.8
Assisted-by: OpenCode:claude-opus-4.8
Assisted-by: OpenCode:claude-opus-4.8
@rlskoeser
rlskoeser requested a review from laurejt September 3, 2026 14:42
@codecov

codecov Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.93388% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.63%. Comparing base (bc6a28f) to head (7b37893).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #285      +/-   ##
===========================================
+ Coverage    82.18%   83.63%   +1.44%     
===========================================
  Files           23       24       +1     
  Lines         2156     2468     +312     
===========================================
+ Hits          1772     2064     +292     
- Misses         384      404      +20     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@laurejt laurejt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed dataset_prep.py. It seemed good overall, but I think it might be changing the shift logic a bit so that the shift value is more intuitive (and would correspond to the appropriate shift action in polars).

Note that most of the comments will be misaligned due to file changes while drafting my review.

Comment thread src/corppa/utils/dataset_prep.py Outdated
Comment thread src/corppa/utils/dataset_prep.py Outdated
Comment thread src/corppa/utils/dataset_prep.py Outdated
Comment thread src/corppa/utils/dataset_prep.py Outdated
Comment on lines +85 to +86
a single vectorized fuzzy comparison; short pages inherit the shift of the
surrounding long pages. Contiguous runs of equal shift are handled

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the two long pages shift in different ways, how does inheritance work?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the code does a forward fill and then a backward fill - so any short pages at beginning and end of a work or excerpt would get the shift of the nearest long page. Not sure how it works if this happens in the middle but seems like a reasonable solution

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth a test case so we know what the expected behavior, but seems reasonable to me.

Comment thread src/corppa/utils/dataset_prep.py Outdated
Comment thread src/corppa/utils/dataset_prep.py Outdated
Comment thread src/corppa/utils/dataset_prep.py Outdated
Comment thread src/corppa/utils/dataset_prep.py Outdated
Comment thread src/corppa/utils/dataset_prep.py Outdated
Comment thread src/corppa/utils/dataset_prep.py
@rlskoeser

Copy link
Copy Markdown
Collaborator Author

I'm going to merge this into develop and consider the script portion done - the page shift logic still needs to be revised, and there may be other small additions (1930 images, old/new ocr), but there are enough changes already that I think merging this set in will be useful.

@rlskoeser
rlskoeser merged commit 9621d53 into develop Sep 4, 2026
9 checks passed
@rlskoeser
rlskoeser deleted the feature/ppa-page-alignment branch September 4, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants