Skip to content

Fix Indonesian currency parsing and pdfoxide preprocessing - #29

Open
rager306 wants to merge 1 commit into
mainfrom
fix-indonesian-format-and-preprocessing-9625070368568826983
Open

Fix Indonesian currency parsing and pdfoxide preprocessing#29
rager306 wants to merge 1 commit into
mainfrom
fix-indonesian-format-and-preprocessing-9625070368568826983

Conversation

@rager306

@rager306 rager306 commented Feb 4, 2026

Copy link
Copy Markdown
Owner

Updated _AMOUNT_PATTERN to support Indonesian currency format (comma decimal).
Restored preprocess_text in pdfparser/pdfoxide_parser.py to handle smashed text columns.
Added tests for Indonesian formats and preprocessing logic.


PR created automatically by Jules for task 9625070368568826983 started by @rager306

Summary by CodeRabbit

  • New Features

    • Added text preprocessing to handle "smashed" PDF column text by inserting line breaks between adjacent amounts
    • Extended currency format support to include Indonesian comma-decimal notation (e.g., 1.000,00) alongside US dot-decimal format
  • Tests

    • Added test coverage for Indonesian and US currency formats
    • Added tests for PDF text preprocessing functionality

Co-authored-by: rager306 <248269686+rager306@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Feb 4, 2026

Copy link
Copy Markdown

Walkthrough

The changes add text preprocessing functionality to handle PDF extraction artifacts by separating "smashed" adjacent amounts, extend the amount pattern regex to support both US and Indonesian number formats, and introduce comprehensive test coverage for the new preprocessing logic and currency format handling.

Changes

Cohort / File(s) Summary
PDF Text Preprocessing
pdfparser/pdfoxide_parser.py
Added preprocess_text() function using regex patterns to insert line breaks between adjacent numeric groups in US and Indonesian decimal formats; integrated into parse_pdf_pdfoxide() to clean text before transaction extraction.
Amount Pattern Regex
pdfparser/utils.py
Extended _AMOUNT_PATTERN to accept both US format (dot separator for thousands, dot for decimals) and Indonesian format (dot separators for thousands, comma for decimals).
Preprocessing Tests
tests/test_pdfoxide_preprocessing.py
Added test suite validating preprocess_text() behavior: separating smashed US/Indonesian amounts, handling chained amounts, distinguishing amounts from unrelated digits, preserving valid text.
Currency Format Tests
tests/test_indonesian_formats.py
Added test suite validating _AMOUNT_PATTERN matching and extract_transactions() behavior across Indonesian and US formats with various user field scenarios.

Sequence Diagram(s)

sequenceDiagram
    participant Input as PDF Input
    participant Parser as PDF Parser
    participant Preprocess as Text Preprocessor
    participant Extract as Transaction Extractor
    participant Summary as Summary Generator
    participant Output as Output

    Input->>Parser: Raw PDF pages
    Parser->>Parser: Iterate & accumulate text
    Parser->>Preprocess: Full text with smashed amounts
    Preprocess->>Preprocess: Insert line breaks<br/>(regex patterns)
    Preprocess->>Extract: Cleaned text
    Extract->>Extract: Parse transactions<br/>with amount pattern
    Extract->>Summary: Transaction list
    Summary->>Summary: Generate totals
    Summary->>Output: Results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main changes: fixing Indonesian currency parsing and adding pdfoxide preprocessing functionality, which are the core objectives of this PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-indonesian-format-and-preprocessing-9625070368568826983

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant