|
6 | 6 |
|
7 | 7 | from ..enums import TransactionType, CASFileType |
8 | 8 | from ..exceptions import HeaderParseError, CASParseError |
9 | | -from .regex import DETAILED_DATE_RE, FOLIO_RE, SCHEME_RE |
| 9 | +from .regex import DETAILED_DATE_RE, FOLIO_RE, SCHEME_RE, REGISTRAR_RE |
10 | 10 | from .regex import CLOSE_UNITS_RE, NAV_RE, OPEN_UNITS_RE, VALUATION_RE |
11 | 11 | from .regex import DESCRIPTION_TAIL_RE, DIVIDEND_RE, TRANSACTION_RE |
12 | 12 |
|
@@ -80,10 +80,13 @@ def process_detailed_text(text): |
80 | 80 | current_folio = None |
81 | 81 | current_amc = None |
82 | 82 | curr_scheme_data = {} |
83 | | - balance = Decimal(0.0) |
84 | 83 | lines = text.split("\u2029") |
85 | | - for line in lines: |
86 | | - if m := re.search(DESCRIPTION_TAIL_RE, line, re.I | re.DOTALL): |
| 84 | + for idx, line in enumerate(lines): |
| 85 | + # Parse schemes with long names (single line) effectively pushing |
| 86 | + # "Registrar" column to the previous line |
| 87 | + if re.search(REGISTRAR_RE, line): |
| 88 | + line = "\t\t".join([lines[idx + 1], line]) |
| 89 | + elif m := re.search(DESCRIPTION_TAIL_RE, line, re.I | re.DOTALL): |
87 | 90 | description_tail = m.group(1).rstrip() |
88 | 91 | line = line.replace(description_tail, "") |
89 | 92 | else: |
|
0 commit comments