@@ -31,7 +31,6 @@ def process_summary_text(text):
3131 folios = {}
3232 current_folio = None
3333 current_amc = "N/A"
34- curr_scheme_data = {}
3534 lines = text .split ("\u2029 " )
3635 for line in lines :
3736 if len (folios ) > 0 and re .search ("Total" , line , re .I ):
@@ -49,31 +48,27 @@ def process_summary_text(text):
4948 "schemes" : [],
5049 }
5150 scheme = re .sub (r"\(formerly.+?\)" , "" , m .group (3 ), flags = re .I | re .DOTALL ).strip ()
52- if curr_scheme_data .get ("scheme" ) != scheme :
53- if curr_scheme_data :
54- folios [current_folio ]["schemes" ].append (curr_scheme_data )
55- rta = m .group (8 ).strip ()
56- rta_code = m .group (2 ).strip ()
57- isin , amfi , scheme_type = isin_search (scheme , rta , rta_code )
58- curr_scheme_data = {
59- "scheme" : scheme ,
60- "advisor" : "N/A" ,
61- "rta_code" : rta_code ,
62- "rta" : rta ,
63- "isin" : isin ,
64- "amfi" : amfi ,
65- "type" : scheme_type or "N/A" ,
66- "open" : Decimal (m .group (4 ).replace ("," , "_" )),
67- "close" : Decimal (m .group (4 ).replace ("," , "_" )),
68- "valuation" : {
69- "date" : date_parser .parse (m .group (5 )).date (),
70- "nav" : Decimal (m .group (6 ).replace ("," , "_" )),
71- "value" : Decimal (m .group (7 ).replace ("," , "_" )),
72- },
73- "transactions" : [],
74- }
75- if curr_scheme_data :
76- folios [current_folio ]["schemes" ].append (curr_scheme_data )
51+ rta = m .group (8 ).strip ()
52+ rta_code = m .group (2 ).strip ()
53+ isin , amfi , scheme_type = isin_search (scheme , rta , rta_code )
54+ scheme_data = {
55+ "scheme" : scheme ,
56+ "advisor" : "N/A" ,
57+ "rta_code" : rta_code ,
58+ "rta" : rta ,
59+ "isin" : isin ,
60+ "amfi" : amfi ,
61+ "type" : scheme_type or "N/A" ,
62+ "open" : Decimal (m .group (4 ).replace ("," , "_" )),
63+ "close" : Decimal (m .group (4 ).replace ("," , "_" )),
64+ "valuation" : {
65+ "date" : date_parser .parse (m .group (5 )).date (),
66+ "nav" : Decimal (m .group (6 ).replace ("," , "_" )),
67+ "value" : Decimal (m .group (7 ).replace ("," , "_" )),
68+ },
69+ "transactions" : [],
70+ }
71+ folios [current_folio ]["schemes" ].append (scheme_data )
7772 return {
7873 "cas_type" : CASFileType .SUMMARY .name ,
7974 "statement_period" : statement_period ,
0 commit comments