Split A Scanned Records Packet Into Separate Documents
Last updated: November 29, 2026
Quick Overview
A medical records packet arrives as one long PDF. Given per-page predictions (provider, date of service, whether the page looks like a first page, and that prediction's confidence), return the page ranges that form separate documents.
EvenUp
November 29, 20260
0
0 solved
A medical records packet arrives as one long PDF. Given per-page predictions (provider, date of service, whether the page looks like a first page, and that prediction's confidence), return the page ranges that form separate documents.
EvenUp receives record dumps of hundreds or thousands of pages where many visits and providers are stapled together, and downstream extraction works per document. This onsite coding question tests turning noisy model outputs into deterministic segmentation logic, including carrying state across pages that lack headers.
What the Interviewer Expects
- Treats segmentation as a single left-to-right pass with state
- Carries forward last known provider and date for pages with missing metadata
- Combines a confidence-gated first-page signal with metadata changes
- Produces contiguous, non-overlapping ranges covering every page
- Explains how thresholds would be tuned against labeled packets
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you handle interleaved pages where a document resumes later in the packet?
- How would you tune `min_conf` using labeled data?
- When is a learned sequence model (CRF, transformer over pages) better than these rules?
- How would you let a human reviewer correct a split cheaply?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Each page is {provider, date, is_first, conf}; provider and date can be None when the page has no header (continuation pages, lab tables). Output is a list of inclusive (start, end) page index r...
High-Level Design
Walk the pages once. Keep start of the current document and the document's known provider and date. On each page, check boundary conditions against the carried metadata (not just the previous page, ...