From c757ca63c9d26948f6d692648470f4523bf43978 Mon Sep 17 00:00:00 2001 From: Preston Neal Date: Mon, 22 Jan 2024 07:54:27 -0800 Subject: [PATCH 1/9] new summary error dialog --- src/ui/summaryform.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/ui/summaryform.py b/src/ui/summaryform.py index 98d0498..3bf9736 100644 --- a/src/ui/summaryform.py +++ b/src/ui/summaryform.py @@ -1,7 +1,7 @@ from datetime import datetime -from tkinter import Toplevel, Button, Label, Entry, StringVar, Text, LabelFrame, Radiobutton +from tkinter import Toplevel, Button, Label, Entry, StringVar, Text, LabelFrame, Radiobutton, LEFT from tkinter.ttk import Combobox - +from traceback import format_exc from src.helpers import get_save_path, get_file_path, get_age, get_age_at_onset from src.pdf.scanner import scan_for_comments, scan_pdf_for_summary from src.ui.workhistoryform import WorkHistoryForm @@ -179,9 +179,20 @@ def _get_summary_data(self): modal.grab_set() modal.geometry("+%d+%d" % (self.winfo_rootx()+50, self.winfo_rooty()+50)) self.update() - self.medical_record = scan_pdf_for_summary(self.pdf_path) - self._fill_entry_fields() - modal.destroy() + try: + self.medical_record = scan_pdf_for_summary(self.pdf_path) + self._fill_entry_fields() + modal.destroy() + except Exception as e: + print(e) + modal.destroy() + error_modal = Toplevel(self) + error_modal.title("An Error Occured") + Label(error_modal, text=format_exc(), anchor='w', justify=LEFT, font='Consolas').pack(pady=20) + error_modal.transient(self) + error_modal.grab_set() + error_modal.geometry("+%d+%d" % (self.winfo_rootx()+50, self.winfo_rooty()+50)) + self.update() def _fill_entry_fields(self): mr = self.medical_record From 4094e31592ff7016d08ecec9cee616c1f6a49fb7 Mon Sep 17 00:00:00 2001 From: Preston Neal Date: Mon, 22 Jan 2024 08:15:47 -0800 Subject: [PATCH 2/9] error dialog works --- src/ui/errordialog.py | 14 ++++++++++++++ src/ui/summaryform.py | 12 ++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 src/ui/errordialog.py diff --git a/src/ui/errordialog.py b/src/ui/errordialog.py new file mode 100644 index 0000000..e3a3537 --- /dev/null +++ b/src/ui/errordialog.py @@ -0,0 +1,14 @@ +from tkinter import Toplevel, Label, LEFT, Button + + +class ErrorDialog(Toplevel): + def __init__(self, parent, error): + super().__init__(parent) + self.title("Error") + Label(self, text=error, anchor='w', justify=LEFT).pack(pady=5, padx=5) + + Button(self, text='Close', command=self.destroy).pack(pady=10) + + self.transient(parent) + self.grab_set() + self.geometry("+%d+%d" % (parent.winfo_rootx()+50, parent.winfo_rooty()+50)) diff --git a/src/ui/summaryform.py b/src/ui/summaryform.py index 3bf9736..0d997df 100644 --- a/src/ui/summaryform.py +++ b/src/ui/summaryform.py @@ -5,6 +5,7 @@ from src.helpers import get_save_path, get_file_path, get_age, get_age_at_onset from src.pdf.scanner import scan_for_comments, scan_pdf_for_summary from src.ui.workhistoryform import WorkHistoryForm +from src.ui.errordialog import ErrorDialog from src.exporter import generate_summary @@ -183,15 +184,10 @@ def _get_summary_data(self): self.medical_record = scan_pdf_for_summary(self.pdf_path) self._fill_entry_fields() modal.destroy() - except Exception as e: - print(e) + except Exception: modal.destroy() - error_modal = Toplevel(self) - error_modal.title("An Error Occured") - Label(error_modal, text=format_exc(), anchor='w', justify=LEFT, font='Consolas').pack(pady=20) - error_modal.transient(self) - error_modal.grab_set() - error_modal.geometry("+%d+%d" % (self.winfo_rootx()+50, self.winfo_rooty()+50)) + error = format_exc() + error_modal = ErrorDialog(self, error) self.update() def _fill_entry_fields(self): From 33fb69d17b4078e3e6fa8059bdab8f1258c4c27a Mon Sep 17 00:00:00 2001 From: Preston Neal Date: Mon, 22 Jan 2024 09:21:55 -0800 Subject: [PATCH 3/9] title parse function test --- pytest.ini | 2 + src/pdf/scanner.py | 84 ++++++++++++++++++++++++++++------------ tests/test_pdfscanner.py | 42 ++++++++++++++++---- 3 files changed, 95 insertions(+), 33 deletions(-) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..a635c5c --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +pythonpath = . diff --git a/src/pdf/scanner.py b/src/pdf/scanner.py index 69f51aa..2760f17 100644 --- a/src/pdf/scanner.py +++ b/src/pdf/scanner.py @@ -157,36 +157,70 @@ def parse_work_history(page_text): def get_exhibits_from_pdf(doc): - try: - outlines = doc.get_outlines() - sys.setrecursionlimit(999999999) - index = 1 - provider = '' - exhibits = {} - for (level, title, dest, a, se) in outlines: - if level == 2: - provider = title - id = provider.split(":")[0] - provider_name = provider.split(":")[1].replace("Doc. Dt.", "").replace("Tmt. Dt.", "").strip() - provider_dates = re.sub(r"\(\d* page.*", "", provider.split(":")[2]).strip() - from_date = provider_dates.split("-")[0] - try: - to_date = provider_dates.split("-")[1] - except IndexError: - to_date = from_date - ex = Exhibit(provider_name=provider_name, from_date=from_date, to_date=to_date, comments=[]) - exhibits[id] = ex - if level == 3: - index += 1 - except PDFNoOutlines: - exhibits = {} - sys.setrecursionlimit(1000) - print('PDF has no outlines to reference.') + exhibits = {} + outlines = doc.get_outlines() + sys.setrecursionlimit(999999999) + index = 1 + provider = '' + for (level, title, dest, a, se) in outlines: + if level == 2: + provider = title + id = provider.split(":")[0] + provider_name = provider.split(":")[1].replace("Doc. Dt.", "").replace("Tmt. Dt.", "").strip() + provider_dates = re.sub(r"\(\d* page.*", "", provider.split(":")[2]).strip() + from_date = provider_dates.split("-")[0] + try: + to_date = provider_dates.split("-")[1] + except IndexError: + to_date = from_date + ex = Exhibit(provider_name=provider_name, from_date=from_date, to_date=to_date, comments=[]) + exhibits[id] = ex + if level == 3: + index += 1 + exhibits = {} sys.setrecursionlimit(1000) return exhibits +def parse_title(title): + split_title = title.split(":") + id = split_title[0] + provider_name = split_title[1].replace("Doc. Dt.", "").replace("Tmt. Dt.", "").strip() + + # if no dates, return empty + if len(split_title) == 2: + provider_name = re.sub(r"\(\d* page.*", "", provider_name).strip() + return { + "id": id, + "provider_name": provider_name, + "from_date": "", + "to_date": "" + } + + provider_dates = re.sub(r"\(\d* page.*", "", split_title[2]).strip().split("-") + + # if one date, return both as date + if len(provider_dates) == 1: + date = provider_dates[0] + return { + "id": id, + "provider_name": provider_name, + "from_date": date, + "to_date": date + } + + from_date = provider_dates[0] + to_date = provider_dates[1] + + return { + "id": id, + "provider_name": provider_name, + "from_date": from_date, + "to_date": to_date + } + + def parse_page_comments(annots): page_comments = [] diff --git a/tests/test_pdfscanner.py b/tests/test_pdfscanner.py index d090945..5bdb251 100644 --- a/tests/test_pdfscanner.py +++ b/tests/test_pdfscanner.py @@ -1,11 +1,37 @@ -from modules.pdfscanner import * +from src.pdf.scanner import parse_title -file_path = r'.\\files\\2909274-cecilia_phillips-case_file_exhibited_bookmarked-8-10-2022- w notes.pdf' -def test_read_medical_record(): - medical_record = MedicalRecord(file_path) - assert(medical_record) +def test_parse_title(): + test_cases = [ + { + "test": "6F: 6F - 1 of 13 Office Treatment Records - OFFCREC LIFESTREAM BEHAIVORAL CENTER Tmt. Dt.: 12/28/2016-08/30/2021 (23 pages)", + "expected": { + "id": "6F", + "provider_name": "6F - 1 of 13 Office Treatment Records - OFFCREC LIFESTREAM BEHAIVORAL CENTER", + "from_date": "12/28/2016", + "to_date": "08/30/2021", + } + }, + { + "test": "16F: 16F - 1 of 112 Emergency Department Records - EMERREC UF HEALTH GAINESVILLE Tmt. Dt.: 01/09/2023 (17 pages)", + "expected": { + "id": "16F", + "provider_name": "16F - 1 of 112 Emergency Department Records - EMERREC UF HEALTH GAINESVILLE", + "from_date": "01/09/2023", + "to_date": "01/09/2023", + } + }, + { + "test": "19F: 19F - 1 of 23 Medical Evidence of Record - MER VOCATIONAL REHABILITATION (12 pages)", + "expected": { + "id": "19F", + "provider_name": "19F - 1 of 23 Medical Evidence of Record - MER VOCATIONAL REHABILITATION", + "from_date": "", + "to_date": "", + } + }, + ] -def test_get_exhibits_from_medical_record(): - medical_record = MedicalRecord(file_path) - exhibits = medical_record.exhibits \ No newline at end of file + for case in test_cases: + result = parse_title(case["test"]) + assert result == case["expected"] From df4950faa376e7ddf853b5d650ea3d19f2404925 Mon Sep 17 00:00:00 2001 From: Preston Neal Date: Mon, 22 Jan 2024 09:29:19 -0800 Subject: [PATCH 4/9] parse title return tuple --- src/pdf/scanner.py | 32 ++++---------------------------- tests/test_pdfscanner.py | 36 ++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 46 deletions(-) diff --git a/src/pdf/scanner.py b/src/pdf/scanner.py index 2760f17..a76f85c 100644 --- a/src/pdf/scanner.py +++ b/src/pdf/scanner.py @@ -161,18 +161,9 @@ def get_exhibits_from_pdf(doc): outlines = doc.get_outlines() sys.setrecursionlimit(999999999) index = 1 - provider = '' for (level, title, dest, a, se) in outlines: if level == 2: - provider = title - id = provider.split(":")[0] - provider_name = provider.split(":")[1].replace("Doc. Dt.", "").replace("Tmt. Dt.", "").strip() - provider_dates = re.sub(r"\(\d* page.*", "", provider.split(":")[2]).strip() - from_date = provider_dates.split("-")[0] - try: - to_date = provider_dates.split("-")[1] - except IndexError: - to_date = from_date + id, provider_name, from_date, to_date = parse_title(title) ex = Exhibit(provider_name=provider_name, from_date=from_date, to_date=to_date, comments=[]) exhibits[id] = ex if level == 3: @@ -191,34 +182,19 @@ def parse_title(title): # if no dates, return empty if len(split_title) == 2: provider_name = re.sub(r"\(\d* page.*", "", provider_name).strip() - return { - "id": id, - "provider_name": provider_name, - "from_date": "", - "to_date": "" - } + return (id, provider_name, "", "") provider_dates = re.sub(r"\(\d* page.*", "", split_title[2]).strip().split("-") # if one date, return both as date if len(provider_dates) == 1: date = provider_dates[0] - return { - "id": id, - "provider_name": provider_name, - "from_date": date, - "to_date": date - } + return (id, provider_name, date, date) from_date = provider_dates[0] to_date = provider_dates[1] - return { - "id": id, - "provider_name": provider_name, - "from_date": from_date, - "to_date": to_date - } + return (id, provider_name, from_date, to_date) def parse_page_comments(annots): diff --git a/tests/test_pdfscanner.py b/tests/test_pdfscanner.py index 5bdb251..4fc5f67 100644 --- a/tests/test_pdfscanner.py +++ b/tests/test_pdfscanner.py @@ -5,30 +5,30 @@ def test_parse_title(): test_cases = [ { "test": "6F: 6F - 1 of 13 Office Treatment Records - OFFCREC LIFESTREAM BEHAIVORAL CENTER Tmt. Dt.: 12/28/2016-08/30/2021 (23 pages)", - "expected": { - "id": "6F", - "provider_name": "6F - 1 of 13 Office Treatment Records - OFFCREC LIFESTREAM BEHAIVORAL CENTER", - "from_date": "12/28/2016", - "to_date": "08/30/2021", - } + "expected": ( + "6F", + "6F - 1 of 13 Office Treatment Records - OFFCREC LIFESTREAM BEHAIVORAL CENTER", + "12/28/2016", + "08/30/2021", + ) }, { "test": "16F: 16F - 1 of 112 Emergency Department Records - EMERREC UF HEALTH GAINESVILLE Tmt. Dt.: 01/09/2023 (17 pages)", - "expected": { - "id": "16F", - "provider_name": "16F - 1 of 112 Emergency Department Records - EMERREC UF HEALTH GAINESVILLE", - "from_date": "01/09/2023", - "to_date": "01/09/2023", - } + "expected": ( + "16F", + "16F - 1 of 112 Emergency Department Records - EMERREC UF HEALTH GAINESVILLE", + "01/09/2023", + "01/09/2023", + ) }, { "test": "19F: 19F - 1 of 23 Medical Evidence of Record - MER VOCATIONAL REHABILITATION (12 pages)", - "expected": { - "id": "19F", - "provider_name": "19F - 1 of 23 Medical Evidence of Record - MER VOCATIONAL REHABILITATION", - "from_date": "", - "to_date": "", - } + "expected": ( + "19F", + "19F - 1 of 23 Medical Evidence of Record - MER VOCATIONAL REHABILITATION", + "", + "", + ) }, ] From c63a6d893785493ab1d41052632877d8f7134a5f Mon Sep 17 00:00:00 2001 From: Preston Neal Date: Mon, 22 Jan 2024 10:16:11 -0800 Subject: [PATCH 5/9] return none age when onset date is n/a --- .gitignore | 1 + src/pdf/__init__.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index fd9daae..f95c179 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ lib/* *.json files *.drawio* +*.docx .venv diff --git a/src/pdf/__init__.py b/src/pdf/__init__.py index f3d3a90..ba9878a 100644 --- a/src/pdf/__init__.py +++ b/src/pdf/__init__.py @@ -27,6 +27,10 @@ def age(self) -> int: return None def age_at_onset(self) -> int: + + if self.onset_date == "N/A": + return None + if self.birthdate and self.onset_date: birthdate = datetime.strptime(self.birthdate, '%m/%d/%Y') onset_date = datetime.strptime(self.onset_date, '%m/%d/%Y') From 66030ee1e0319c269ca39a2754b9747556000d7c Mon Sep 17 00:00:00 2001 From: Preston Neal Date: Mon, 22 Jan 2024 18:43:45 -0800 Subject: [PATCH 6/9] rewrite parse client info fn --- src/pdf/scanner.py | 32 +++++++++++++++++----- tests/helpers/example_page_1.txt | 27 ++++++++++++++++++ tests/helpers/example_page_1_alt.txt | 41 ++++++++++++++++++++++++++++ tests/test_pdfscanner.py | 36 +++++++++++++++++++++++- 4 files changed, 128 insertions(+), 8 deletions(-) create mode 100644 tests/helpers/example_page_1.txt create mode 100644 tests/helpers/example_page_1_alt.txt diff --git a/src/pdf/scanner.py b/src/pdf/scanner.py index a76f85c..eab0836 100644 --- a/src/pdf/scanner.py +++ b/src/pdf/scanner.py @@ -129,14 +129,32 @@ def scan_pdf_for_summary(pdf_path): def parse_client_info(page_text): - - lines = page_text.splitlines() - lines = [line for line in lines if line] - client_data = lines[:7] client_info = {} - for e in client_data: - e = e.split(':') - client_info[e[0]] = e[1].lstrip() + lines = page_text.splitlines() + + for line in lines: + if line.startswith("Alleged Onset:"): + client_info["Alleged Onset"] = line.split(":")[1].strip() + continue + if line.startswith("Application:"): + client_info["Application"] = line.split(":")[1].strip() + continue + if line.startswith("Claim Type:"): + client_info["Claim Type"] = line.split(":")[1].strip() + continue + if line.startswith("Claimant:"): + client_info["Claimant"] = line.split(":")[1].strip() + continue + if line.startswith("Last Change:"): + client_info["Last Change"] = line.split(":")[1].strip() + continue + if line.startswith("Last Insured:"): + client_info["Last Insured"] = line.split(":")[1].strip() + continue + if line.startswith("SSN:"): + client_info["SSN"] = line.split(":")[1].strip() + continue + return client_info diff --git a/tests/helpers/example_page_1.txt b/tests/helpers/example_page_1.txt new file mode 100644 index 0000000..3f1a0b6 --- /dev/null +++ b/tests/helpers/example_page_1.txt @@ -0,0 +1,27 @@ +Claimant: John Person Doe +SSN: 000-00-0000 +Last Change: 01/01/1970 +Alleged Onset: N/A + +Claim Type: T16 +Application: 01/01/2023 +Last Insured: N/A + +A. Payment Documents/Decisions +Title +1A: Disability Determination Explanation - DDE +2A: Disability Determination Transmittal - 831 +3A: T16 Cease/Continue Disability Determination and Transmittal - 832 +4A: Disability Determination Explanation - DDE +5A: Disability Determination Explanation - DDE +6A: T16 Cease/Continue Disability Determination and Transmittal - 832 +7A: Disability Determination Explanation - DDE + +Decision Date +08/06/2018 +08/06/2018 +08/30/2022 +08/30/2022 +02/23/2023 +05/17/2023 +05/17/2023 diff --git a/tests/helpers/example_page_1_alt.txt b/tests/helpers/example_page_1_alt.txt new file mode 100644 index 0000000..748ceab --- /dev/null +++ b/tests/helpers/example_page_1_alt.txt @@ -0,0 +1,41 @@ +Claimant: Jane Person Doe +SSN: 000-00-0000 +Last Change: 01/01/1970 +Alleged Onset: 01/01/2009 + +A. Payment Documents/Decisions +Title +1A: Disability Determination Transmittal - 831 +2A: Disability Determination Explanation - DDE +3A: Disability Determination Transmittal - 831 +4A: Disability Determination Explanation - DDE + +Claim Type: T16 +Application: 02/26/2022 +Last Insured: N/A + +B. Jurisdictional Documents/Notices +Title +1B: T16 Notice of Disapproved Claim - L444 +2B: Request for Reconsideration - 561 +3B: T16 Disability Reconsideration Notice - L1130 +4B: SSA-1696 - Claimant’s Appointment of a Representative - 1696 +5B: Fee Agreement for Representation before SSA - FEEAGRMT +6B: SSA-1696 - Claimant’s Appointment of a Representative - 1696 +7B: Fee Agreement for Representation before SSA - FEEAGRMT +8B: Request for Hearing by ALJ - 501 +9B: Hearing Agreement Form - HRNGAGREEFRM +10B: Outgoing ODAR Correspondence - OUTODARC +11B: Outgoing ODAR Correspondence - OUTODARC +12B: Request for Hearing Acknowledgement Letter - HRGACK +13B: Hearing Agreement Form - HRNGAGREEFRM +14B: Hearing Notice - 507 +15B: Acknowledge Notice of Hearing - 504 + +D. Non-Disability Development +Title +1D: Application for Supplemental Security Income Benefits - 8000 +2D: Detailed Earnings Query - DEQY +3D: Summary Earnings Query - SEQY +4D: Certified Earnings Records - CERTERN +5D: New Hire, Quarter Wage, Unemployment Query (NDNH) - NDNH diff --git a/tests/test_pdfscanner.py b/tests/test_pdfscanner.py index 4fc5f67..377ff7c 100644 --- a/tests/test_pdfscanner.py +++ b/tests/test_pdfscanner.py @@ -1,4 +1,4 @@ -from src.pdf.scanner import parse_title +from src.pdf.scanner import parse_title, parse_client_info def test_parse_title(): @@ -35,3 +35,37 @@ def test_parse_title(): for case in test_cases: result = parse_title(case["test"]) assert result == case["expected"] + + +def test_parse_client_info(): + expected = [ + { + "Alleged Onset": "N/A", + "Application": "01/01/2023", + "Claim Type": "T16", + "Claimant": "John Person Doe", + "Last Change": "01/01/1970", + "Last Insured": "N/A", + "SSN": "000-00-0000", + }, + { + "Alleged Onset": "01/01/2009", + "Application": "02/26/2022", + "Claim Type": "T16", + "Claimant": "Jane Person Doe", + "Last Change": "01/01/1970", + "Last Insured": "N/A", + "SSN": "000-00-0000", + } + ] + + inputs = [ + "tests/helpers/example_page_1.txt", + "tests/helpers/example_page_1_alt.txt" + ] + + for i, file in enumerate(inputs): + fd = open(file, "r") + page_one = str(fd.read()) + result = parse_client_info(page_one) + assert result == expected[i] From 17b890f372945f51659af885d1e77bb71df3552f Mon Sep 17 00:00:00 2001 From: Preston Neal Date: Mon, 22 Jan 2024 19:05:07 -0800 Subject: [PATCH 7/9] fix exhibit bug --- src/pdf/scanner.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pdf/scanner.py b/src/pdf/scanner.py index eab0836..b2f81aa 100644 --- a/src/pdf/scanner.py +++ b/src/pdf/scanner.py @@ -170,7 +170,7 @@ def parse_work_history(page_text): 'job_title': e.split(": ")[1], 'intensity': '', 'skill_level': '', - } + } return work_history @@ -186,8 +186,6 @@ def get_exhibits_from_pdf(doc): exhibits[id] = ex if level == 3: index += 1 - exhibits = {} - sys.setrecursionlimit(1000) return exhibits From c5708b28dd632966d416a6b45fc32787fc28bcdc Mon Sep 17 00:00:00 2001 From: Preston Neal Date: Mon, 22 Jan 2024 19:09:29 -0800 Subject: [PATCH 8/9] add date last insured to bell --- src/exporter/bell_summary.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/exporter/bell_summary.py b/src/exporter/bell_summary.py index 03e7dca..609c1d6 100644 --- a/src/exporter/bell_summary.py +++ b/src/exporter/bell_summary.py @@ -20,6 +20,7 @@ def generate_bell_format_summary(data): doc.add_paragraph(f'ALLEGED ONSET DATE:\t{data["onset_date"]}') doc.add_paragraph(f'DOB:\t\t\t\t{data["birthdate"]}') doc.add_paragraph(f'AGE:\t\t\t\t{data["age"]}') + doc.add_paragraph(f'DATE LATE INSURED:\t\t{data["claimant"].last_insured_date}') doc.add_paragraph(f'EDUCATION:\t\t\t{data["education"]}') if len(data["work_history"]) == 0: doc.add_paragraph('PAST WORK:\t\t\t') From 5b3e074d79a6b9d1149d1e867b19e97ae535e4ac Mon Sep 17 00:00:00 2001 From: Preston Neal Date: Mon, 22 Jan 2024 19:13:16 -0800 Subject: [PATCH 9/9] add section headers to bottom of bell format --- src/exporter/bell_summary.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/exporter/bell_summary.py b/src/exporter/bell_summary.py index 609c1d6..1d40da4 100644 --- a/src/exporter/bell_summary.py +++ b/src/exporter/bell_summary.py @@ -18,9 +18,9 @@ def generate_bell_format_summary(data): doc.add_paragraph(f'TYPE OF CLAIM:\t\t{data["claimant"].claim}') doc.add_paragraph(f'DATE OF APPLICATION:\t{datetime.strftime(data["claimant"].pdof, "%m/%d/%Y")}') doc.add_paragraph(f'ALLEGED ONSET DATE:\t{data["onset_date"]}') + doc.add_paragraph(f'DATE LATE INSURED:\t\t{data["claimant"].last_insured_date}') doc.add_paragraph(f'DOB:\t\t\t\t{data["birthdate"]}') doc.add_paragraph(f'AGE:\t\t\t\t{data["age"]}') - doc.add_paragraph(f'DATE LATE INSURED:\t\t{data["claimant"].last_insured_date}') doc.add_paragraph(f'EDUCATION:\t\t\t{data["education"]}') if len(data["work_history"]) == 0: doc.add_paragraph('PAST WORK:\t\t\t') @@ -67,6 +67,19 @@ def generate_bell_format_summary(data): p = doc.add_paragraph() p.add_run(f'{comment.date}: {comment.text} ({exhibit}/{comment.exhibit_page})') + doc.add_paragraph('') + doc.add_paragraph('') + + doc.add_paragraph('CONSULTATIVE EXAM:') + + doc.add_paragraph('') + doc.add_paragraph('') + + doc.add_paragraph('MEDICAL-VOCATIONAL GRIDRULE AND/OR RULING:') + + doc.add_paragraph('') + doc.add_paragraph('') + for section in doc.sections: section.left_margin = Inches(1) section.right_margin = Inches(1)