@@ -10,6 +10,7 @@ def __init__(self, file_path: str=None):
10
10
self .submit_list = []
11
11
self .conduct_list = []
12
12
self .residency_list = []
13
+ self .test_list = []
13
14
14
15
self .consultant_list = []
15
16
self .new_consultant_list = []
@@ -253,21 +254,28 @@ def separate_list_section(self, apps: list, start: tuple, end: str, end_lines: i
253
254
if str (items ).startswith (start ) and change_check_flag == 0 :
254
255
start_idx = idx
255
256
change_check_flag = 1
256
- elif str (items ).startswith (end ):
257
+ elif str (items ).startswith (end ) or start_idx == len (apps )- 1 :
258
+ end_idx = idx + end_lines
257
259
if change_check_flag != 0 :
258
- # raise IndexError('Could not find a start point to separate.')
259
- separate_list .append (apps [start_idx :idx + end_lines ])
260
+ if start_idx == len (apps )- 1 :
261
+ end_idx = len (apps )
262
+ separate_list .append (apps [start_idx :end_idx ])
260
263
for remove in range ((idx + end_lines )- start_idx ):
261
264
apps .pop (start_idx )
262
- else :
263
- separate_list .append ([])
265
+ return
266
+
267
+ if change_check_flag == 0 :
268
+ separate_list .append ([])
269
+ return
270
+
271
+ separate_list .append ([])
264
272
265
- def separate_list_question (self , apps : list , app_idx : int , start : list , end_lines : int , separate_list : list ) -> None :
273
+ def separate_list_question (self , apps : list , app_idx : int , start_end : list , end_lines : int , separate_list : list ) -> None :
266
274
267
275
change_check_flag = 0
268
276
269
277
for idx , items in enumerate (apps ):
270
- if str (items ).startswith (start ) or str (items ).endswith (start ):
278
+ if str (items ).startswith (start_end ) or str (items ).endswith (start_end ):
271
279
change_check_flag = 1
272
280
273
281
while not str (apps [idx + end_lines ]).startswith ('MSG!' ):
@@ -294,54 +302,64 @@ def merge_list_question(self, separate_list: list) -> list:
294
302
# Convert dictionary values to a list of lists
295
303
return list (grouped_data .values ())
296
304
297
- def new_rearrange_list (self , _list : list , app_type : str ) -> list :
305
+ def new_rearrange_list (self , app_type : str , _list : list ) -> list :
306
+
307
+ if app_type == 'None' :
308
+ new_list = _list .copy ()
309
+ else :
310
+ new_list = []
298
311
299
- new_list = []
312
+ _types = self . find_app_types ( _list )
300
313
301
- _types = self .find_app_types (_list )
314
+ # Focuses on only one app_type at a time
315
+ for idx , app in enumerate (_types ):
316
+ if app == app_type :
317
+ new_list .append (_list [idx ])
302
318
303
- # Focuses on only one app_type at a time
304
- for idx , app in enumerate (_types ):
305
- if app == app_type :
306
- new_list .append (_list [idx ])
319
+ pprint (new_list [- 7 ])
307
320
308
321
for idx , apps in enumerate (new_list ):
309
322
self .separate_list_section (apps , 'RQS!AQ!ZZ!FERPA CERT SWITCH!' , 'RQS!AQ!ZZ!TRUTH CERT SWITCH!' , 1 , self .cert_list )
310
323
self .separate_list_section (apps , 'SSE!' , 'RQS!AQ!ZZ!APP SUBMIT/TRANSMIT!!' , 1 , self .submit_list )
311
324
self .separate_list_section (apps , ('RQS!AQ!ZZ!$ 4!!' , 'RQS!AQ!ZZ!$ 9!!' ), 'RQS!AQ!ZZ!$ 11!!' , 5 , self .conduct_list )
312
- self .separate_list_section (apps , ('RQS!AQ!ZZ!RES: PREVIOUS ENROLLMENT!!' ), 'RQS!AQ!ZZ!RES: DETERM!' , 1 , self .residency_list )
313
- self .separate_list_question (apps , idx , ('Consultant Agency\\ ' , 'Consultant/Agency\\ ' ), 3 , self .consultant_list )
325
+ self .separate_list_section (apps , 'RQS!AQ!ZZ!RES: PREVIOUS ENROLLMENT!!' , 'RQS!AQ!ZZ!RES: DETERM!' , 1 , self .residency_list )
326
+ self .separate_list_section (apps , 'TST!' , 'PCL' , 0 , self .test_list )
327
+ # self.separate_list_question(apps, idx, ('Consultant Agency\\', 'Consultant/Agency\\'), 3, self.consultant_list)
314
328
self .separate_list_question (apps , idx , 'RQS!AQ!ZZ!$ 1!!' , 4 , self .concentration_list )
315
329
self .separate_list_question (apps , idx , 'Faculty Mentor\\ ' , 4 , self .faculty_list )
316
330
317
- if len (self .consultant_list ) != len (new_list ):
318
- self .new_consultant_list = self .merge_list_question (self .consultant_list )
331
+ # if len(self.consultant_list) != len(new_list):
332
+ # self.new_consultant_list = self.merge_list_question(self.consultant_list)
319
333
320
- # pprint(self.consultant_list)
321
- pprint (len (self .consultant_list ))
322
- print (len (self .new_consultant_list ))
323
- print (len (self .faculty_list ))
324
- print (len (self .concentration_list ))
325
- # pprint(new_list[4])
326
- print (len (new_list ))
334
+ # print(len(self.cert_list), len(self.submit_list), len(self.conduct_list), len(self.residency_list), len(self.test_list), len(self.consultant_list), len(self.concentration_list), len(self.faculty_list))
335
+ # print(len(new_list))
327
336
328
- # for apps in new_list:
329
- # print(len(apps ))
337
+ # pprint(self.residency_list[-7])
338
+ # print(len(self.residency_list ))
330
339
331
340
# Relocate each item in the separated list into the proper index
332
- # for idx, apps in enumerate(new_list):
333
- # for items in submit_transmit_app[idx]:
334
- # apps.insert(0, items)
335
- # # for items in residency_list_holder[idx]:
336
- # # apps.append(items)
337
- # for items in conduct_list_holder[idx]:
338
- # apps.append(items)
339
- # for items in cert_list_holder[idx]:
340
- # apps.append(items)
341
-
342
- # from pprint import pprint
343
- # pprint(residency_list_holder)
344
- # pprint(new_list[15])
341
+ for idx , apps in enumerate (new_list ):
342
+ for items in range (len (self .concentration_list [idx ])- 1 ):
343
+ for internals in self .concentration_list [idx ][items ]:
344
+ apps .insert (0 , internals )
345
+ for items in self .submit_list [idx ]:
346
+ apps .insert (0 , items )
347
+ # for items in range(len(self.consultant_list[idx])-1):
348
+ # for internals in self.consultant_list[idx][items]:
349
+ # apps.append(internals)
350
+ for items in range (len (self .faculty_list [idx ])- 1 ):
351
+ for internals in self .faculty_list [idx ][items ]:
352
+ apps .append (internals )
353
+ for items in self .test_list [idx ]:
354
+ apps .append (items )
355
+ for items in self .residency_list [idx ]:
356
+ apps .append (items )
357
+ for items in self .conduct_list [idx ]:
358
+ apps .append (items )
359
+ for items in self .cert_list [idx ]:
360
+ apps .append (items )
361
+
362
+ # pprint(new_list[-7])
345
363
# print(len(new_list))
346
364
347
365
return new_list
0 commit comments