Skip to content

Commit c6c8c48

Browse files
committed
Getting double residency questions. Need to figure out consultant questions.
1 parent 59b5d67 commit c6c8c48

File tree

4 files changed

+71
-53
lines changed

4 files changed

+71
-53
lines changed

.DS_Store

6 KB
Binary file not shown.

core/process.py

+58-40
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def __init__(self, file_path: str=None):
1010
self.submit_list = []
1111
self.conduct_list = []
1212
self.residency_list = []
13+
self.test_list = []
1314

1415
self.consultant_list = []
1516
self.new_consultant_list = []
@@ -253,21 +254,28 @@ def separate_list_section(self, apps: list, start: tuple, end: str, end_lines: i
253254
if str(items).startswith(start) and change_check_flag == 0:
254255
start_idx = idx
255256
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
257259
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])
260263
for remove in range((idx+end_lines)-start_idx):
261264
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([])
264272

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:
266274

267275
change_check_flag = 0
268276

269277
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):
271279
change_check_flag = 1
272280

273281
while not str(apps[idx+end_lines]).startswith('MSG!'):
@@ -294,54 +302,64 @@ def merge_list_question(self, separate_list: list) -> list:
294302
# Convert dictionary values to a list of lists
295303
return list(grouped_data.values())
296304

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 = []
298311

299-
new_list = []
312+
_types = self.find_app_types(_list)
300313

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])
302318

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])
307320

308321
for idx, apps in enumerate(new_list):
309322
self.separate_list_section(apps, 'RQS!AQ!ZZ!FERPA CERT SWITCH!', 'RQS!AQ!ZZ!TRUTH CERT SWITCH!', 1, self.cert_list)
310323
self.separate_list_section(apps, 'SSE!', 'RQS!AQ!ZZ!APP SUBMIT/TRANSMIT!!', 1, self.submit_list)
311324
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)
314328
self.separate_list_question(apps, idx, 'RQS!AQ!ZZ!$ 1!!', 4, self.concentration_list)
315329
self.separate_list_question(apps, idx, 'Faculty Mentor\\', 4, self.faculty_list)
316330

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)
319333

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))
327336

328-
# for apps in new_list:
329-
# print(len(apps))
337+
# pprint(self.residency_list[-7])
338+
# print(len(self.residency_list))
330339

331340
# 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])
345363
# print(len(new_list))
346364

347365
return new_list

main.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,24 @@ def run(file_path: str, filename: str) -> None:
6565
spe_list = p.read_spe_file()
6666

6767
clean_list = p.remove_markdown_items(spe_list)
68-
new_list = p.new_rearrange_list(clean_list, 'U.S. Transfer Admission')
68+
new_list = p.new_rearrange_list('U.S. Freshman Admission', clean_list)
6969
# new_list = p.rearrange_list(clean_list)
7070

71-
# translated_spe = []
72-
# markdown_spe = []
71+
translated_spe = []
72+
markdown_spe = []
7373

74-
# for idx, item in enumerate(new_list):
75-
# s = core.Structure(item, idx)
76-
# translated_spe.append(s.translate())
77-
# markdown_spe.append(s.markdown)
74+
for idx, item in enumerate(new_list):
75+
s = core.Structure(item, idx)
76+
translated_spe.append(s.translate())
77+
markdown_spe.append(s.markdown)
7878

79-
# r = core.PDF(translated_spe)
80-
# r.capture_student_name()
81-
# r.capture_app_type()
79+
r = core.PDF(translated_spe)
80+
r.capture_student_name()
81+
r.capture_app_type()
8282

83-
# for idx, item in enumerate(translated_spe):
84-
# _list = r.fit_student_data(item)
85-
# r.create_page_structure(folder, filename, _list, idx)
83+
for idx, item in enumerate(translated_spe):
84+
_list = r.fit_student_data(item)
85+
r.create_page_structure(folder, filename, _list, idx)
8686

8787
except BaseException as b:
8888
print(sys.exc_info())

templates/template_9.pdf

30.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)