Project Record
Research Document Data Pipeline
Preview prompt
Summarize the Ionitsa project record titled "Research Document Data Pipeline" for a technical reader. Cover the problem or research question, implementation or method, evidence or results, and limitations. Separate facts stated on the page from your own assessment, note anything unclear or unverified, and avoid promotional language. Primary source: https://ionitsa.com/projects/pdf-parser-sed.md Canonical page: https://ionitsa.com/projects/pdf-parser-sed/
Research operations pipeline for turning PDF reports and disclosures into auditable, normalized text feeds.
Executive Summary
Research teams and operations groups work with PDF-only reports and disclosures. Extracting clean text for search, feature creation, or downstream pipelines usually means messy output: inconsistent spacing, stray line breaks, and encoding issues. I built a repeatable pipeline using pdftotext and sed command templates that normalizes whitespace, removes empty lines, and supports preset cleanup rules for different document types.
The workflow is scriptable, auditable, and previewable in the app—so teams can verify output before running shell commands in production.
This demonstrates document data pipelines, shell-based ETL, and research operations tooling with minimal dependencies.
Problem
Raw PDF text extraction is messy: inconsistent spacing, stray line breaks, and non-ASCII characters. We need a repeatable pipeline that (1) extracts text with layout preserved where useful, (2) normalizes spaces and blank lines, and (3) optionally applies further sed-style rules for field extraction or cleanup. The solution should work in scripts and in an internal tool that previews or applies the same logic to pasted text.
Shell Pipeline
pdftotext -layout report.pdf - | sed -E 's/[[:space:]]+/ /g' | sed '/^$/d'
First stage extracts text; subsequent sed steps collapse whitespace and remove empty lines. Additional rules can strip headers, normalize dates, or extract tables.
Implementation
- Command templates: parameterized by input path and optional sed script name.
- In the static-first app: the module generates command previews and can apply the same sed-like cleanup to user-provided text snippets so that output can be checked without running shell commands.
- Optional: store favorite sed presets (e.g. “earnings report”, “regulatory filing”) for one-click application.
Trade-offs
Layout extraction is best-effort; complex tables or multi-column PDFs may need dedicated tools (e.g. tabula, camelot). Sed is powerful but brittle for highly variable formats; for production data extraction, consider structured extraction or ML once the pipeline is stable.