Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1057,6 +1057,13 @@ def _extract_textlayer_rows(pdf_path: str, page_num: int):
|
|
| 1057 |
if not desc:
|
| 1058 |
continue
|
| 1059 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1060 |
rows.append({"date": date_str, "post_date": post_date_str, "desc": desc, "amount": amount_candidate})
|
| 1061 |
|
| 1062 |
# Guard: require at least 2 rows to avoid false positives on non-transaction pages
|
|
|
|
| 1057 |
if not desc:
|
| 1058 |
continue
|
| 1059 |
|
| 1060 |
+
# Guard: description must contain at least one letter.
|
| 1061 |
+
# Rows where description is purely digits/dates/amounts are
|
| 1062 |
+
# DAILY BALANCE rows (e.g. "170,198.04 01-13 45,442.31 01-24"),
|
| 1063 |
+
# not real transactions — skip them.
|
| 1064 |
+
if not re.search(r"[A-Za-z]", desc):
|
| 1065 |
+
continue
|
| 1066 |
+
|
| 1067 |
rows.append({"date": date_str, "post_date": post_date_str, "desc": desc, "amount": amount_candidate})
|
| 1068 |
|
| 1069 |
# Guard: require at least 2 rows to avoid false positives on non-transaction pages
|