File size: 646 Bytes
2d00e5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def get_section_from_report(report: str, section: str):
    section_upper = section.upper()
    section_lower = section.lower()
    findings_start_idx = report.lower().find(f"{section_lower}:") + len(
        f"{section_lower}:"
    )

    if findings_start_idx == -1:
        findings_start_idx = report.lower().find(f"{section_lower}:") + len(
            f"{section_lower}:"
        )
    if findings_start_idx == -1:
        findings_start_idx = report.find(f"{section_upper}") + len(f"{section_upper}")

    if findings_start_idx == -1:
        findings = report
    else:
        findings = report[findings_start_idx:]

    return findings