Пример #1
0
def dca_narratives(doc: Document, master: Dict, project_name: str) -> None:
    doc.add_paragraph()
    # p = doc.add_paragraph()
    # text = "*Red text highlights changes in narratives from last quarter"
    # p.add_run(text).font.color.rgb = RGBColor(255, 0, 0)

    narrative_keys_list = [
        "SRO YOUR ON OFF TRACK ASSESSMENT:",
        "PRIMARY CONCERN & MITIGATING ACTIONS",
        "SHORT UPDATE FOR PM NOTE",
    ]

    headings_list = [
        "SRO assessment narrative",
        "SRO single biggest concern",
        "Short update for PM",
    ]

    for x in range(len(headings_list)):
        text_one = str(master.master_data[0]["data"][project_name][
            narrative_keys_list[x]])
        try:
            text_two = str(master.master_data[1]["data"][project_name][
                narrative_keys_list[x]])
        except KeyError:
            text_two = text_one
        doc.add_paragraph().add_run(str(headings_list[x])).bold = True
        compare_text_new_and_old(text_one, text_two, doc)
Пример #2
0
def dca_narratives(doc: Document, master: Dict, project_name: str) -> None:
    # doc.add_paragraph()
    # p = doc.add_paragraph()
    # text = "*Red text highlights changes in narratives from last quarter"
    # p.add_run(text).font.color.rgb = RGBColor(255, 0, 0)

    narrative_keys_list = [
        "SRO Narrative",
        "Cost Narrative",
        "Benefit Narrative",
        "Schedule Narrative",
    ]

    headings_list = [
        "SRO assessment narrative",
        "SRO single biggest concern",
        "Short update for PM",
    ]

    for x in range(len(narrative_keys_list)):
        text_one = str(
            master.master_data[0].data[project_name][narrative_keys_list[x]]
        )
        # text_two = str(
        #     master.master_data[1].data[project_name][narrative_keys_list[x]]
        # )
        doc.add_paragraph().add_run(str(narrative_keys_list[x])).bold = True
        compare_text_new_and_old(text_one, text_one, doc)
Пример #3
0
def project_scope_text(doc: Document, master: Master, project_name: str) -> Document:
    doc.add_paragraph().add_run("Short project description").bold = True
    text_one = str(master.master_data[0].data[project_name]["Brief Description"])
    # try:
    # text_two = str(master.master_data[1].data[project_name]["Brief Description"])
    # except IndexError:
    #     text_two = text_one
    compare_text_new_and_old(text_one, text_one, doc)
    return doc
Пример #4
0
def project_scope_text(doc: Document, master: Master,
                       project_name: str) -> Document:
    doc.add_paragraph().add_run("Short project description").bold = True
    text_one = str(master.master_data[0]["data"][project_name]
                   ["SHORT PROJECT DESCRIPTION"])
    try:
        text_two = str(master.master_data[1]["data"][project_name]
                       ["SHORT PROJECT DESCRIPTION"])
    except KeyError:
        text_two = text_one
    compare_text_new_and_old(text_one, text_two, doc)
    return doc
Пример #5
0
def dca_narratives(doc: Document, master: Dict, project_name: str) -> None:
    doc.add_paragraph()

    narrative_keys_list = [
        "SRO YOUR ON OFF TRACK ASSESSMENT:",
        "PRIMARY CONCERN & MITIGATING ACTIONS", "SHORT UPDATE FOR PM NOTE",
        ["IMPACT ON MILESTONES", "COVID CONTINGENCY PLANS"],
        ["CONTRIBUTION TO LEVELLING UP", "CHALLENGES TO LEVELLING UP"]
    ]

    headings_list = [
        "SRO assessment narrative", "SRO single biggest concern",
        "Short update for PM", "Impact and Mitigation to COVID19",
        "Leveling-up aims and challenges"
    ]

    for x, heading in enumerate(narrative_keys_list):
        if type(heading) == list:
            li_one_text_one = str(master.master_data[0]["data"][project_name][
                narrative_keys_list[x][0]])
            li_two_text_one = str(master.master_data[0]["data"][project_name][
                narrative_keys_list[x][1]])
            text_one = li_one_text_one + li_two_text_one
            try:
                li_one_text_two = str(
                    master.master_data[1]["data"][project_name][
                        narrative_keys_list[x][0]])
                li_two_text_two = str(
                    master.master_data[1]["data"][project_name][
                        narrative_keys_list[x][1]])
                text_two = li_one_text_two + li_two_text_two
            except KeyError:
                text_two = text_one
        else:
            text_one = str(master.master_data[0]["data"][project_name][
                narrative_keys_list[x]])
            try:
                text_two = str(master.master_data[1]["data"][project_name][
                    narrative_keys_list[x]])
            except KeyError:
                text_two = text_one
        doc.add_paragraph().add_run(str(headings_list[x])).bold = True
        compare_text_new_and_old(text_one, text_two, doc)
Пример #6
0
def deliverables(doc: Document, master: Dict, project_name: str) -> Document:
    dels = [
        "TOP 3 PROJECT DELIVERABLES 1",  # deliverables
        "TOP 3 PROJECT DELIVERABLES 2",
        "TOP 3 PROJECT DELIVERABLES 3",
    ]

    doc.add_paragraph().add_run("Top 3 Deliverables").bold = True

    for i, d in enumerate(dels):
        text_one = master.master_data[0]["data"][project_name][d]
        try:
            text_two = master.master_data[1]["data"][project_name][d]
        except KeyError:
            text_two = text_one

        try:
            compare_text_new_and_old(text_one, text_two, doc)
        except AttributeError:  # this is necessary as string data contains NBSP and this removes them
            pass

    return doc
Пример #7
0
def ar_narratives(
    doc: Document,
    data: dict,
    project_name: str,
    headings_list: list,
) -> None:
    """Places all narratives into document and checks for differences between
    current and last quarter"""

    for x in range(len(headings_list)):
        try:  # overall try statement relates to data_bridge
            text_one = str(data[project_name][headings_list[x]])
            try:
                text_two = str(data[project_name][headings_list[x]])
            except (KeyError,
                    IndexError):  # index error relates to data_bridge
                text_two = text_one
        except KeyError:
            break

        doc.add_paragraph().add_run(str(headings_list[x])).bold = True

        compare_text_new_and_old(text_one, text_two, doc)