Exemplo n.º 1
0
    def get_organisation_projects(self, table_text: str):
        projects_list_table = WikiTableService().get_text_table(table_text)
        projects_list_data = projects_list_table.data(span=False)
        organisation_projects = []

        for table_row_number, table_row_data in enumerate(
                projects_list_data[1:], start=1):
            project_wiki_page_hyperlink = projects_list_table.cells(
                row=table_row_number,
                column=self.templates.projects_list_project_name_column,
            ).value
            project_name = WikiTextService(
            ).get_page_link_and_text_from_wiki_page_hyperlink(
                project_wiki_page_hyperlink)[1]

            project_author = projects_list_table.cells(
                row=table_row_number,
                column=self.templates.projects_list_project_author_column,
            ).value

            project_status = projects_list_table.cells(
                row=table_row_number,
                column=self.templates.projects_list_project_status_column,
            ).value

            organisation_projects.append({
                "name": project_name.strip(),
                "author": project_author.strip(),
                "status": project_status.strip(),
            })

        return organisation_projects
Exemplo n.º 2
0
    def generate_projects_list_table_row(self,
                                         organisation_page_data: dict) -> str:
        """
        Generates a new table row for projects list table

        organisation_page_data -- Dict containing only the required data
                                  for the organisation page

        Returns:
        new_row -- String in wikitext format for a new table row
        """
        wikitext = WikiTextService()

        platform_url = wikitext.hyperlink_external_link(
            organisation_page_data["platform"]["name"],
            organisation_page_data["platform"]["url"],
        )

        project_wiki_page = wikitext.hyperlink_wiki_page(
            wiki_page=(
                f"{self.templates.oeg_page}/Projects/"
                f'{organisation_page_data["project"]["name"].capitalize()}'),
            text=organisation_page_data["project"]["name"].capitalize(),
        )

        new_row = (f"\n| {project_wiki_page}\n| {platform_url}\n| "
                   f"{organisation_page_data['project']['author']}\n| "
                   f"{organisation_page_data['project']['status']}\n|-")
        return new_row
Exemplo n.º 3
0
    def generate_activities_list_table_row(self,
                                           overview_page_data: dict) -> str:
        """
        Generates a new table row for activities list table

        overview_page_data -- Dict containing only the required data
                              for the overview page

        Returns:
        new_row -- String in wikitext format for a new table row
        """
        wikitext = WikiTextService()

        organisation_name = overview_page_data["organisation"][
            "name"].capitalize()
        organisation_page_title = f"{self.templates.oeg_page}/" f"{organisation_name}"

        organisation_link = wikitext.hyperlink_wiki_page(
            organisation_page_title, organisation_name)

        platform_link = wikitext.hyperlink_external_link(
            overview_page_data["platform"]["name"],
            overview_page_data["platform"]["url"],
        )

        new_row = f"\n| {organisation_link}\n| {platform_link}\n|-"
        return new_row
Exemplo n.º 4
0
 def table_field_updated(self, update_fields: dict,
                         current_organisation_page: dict):
     if "platform" in update_fields.keys():
         return WikiTextService().hyperlink_external_link(
             current_organisation_page["platform"]["name"],
             current_organisation_page["platform"]["url"],
         )
     elif "project" in update_fields.keys():
         return WikiTextService().hyperlink_wiki_page(
             current_organisation_page["project"]["name"].capitalize(),
             current_organisation_page["project"]["name"].capitalize(),
         )
     else:
         return False
Exemplo n.º 5
0
 def test_hyperlink_external_link(self):
     hyperlynk_text = "text example"
     link = "http://example.com"
     expected_hyperlink = f"[{link} {hyperlynk_text}]"
     hyperlink = WikiTextService().hyperlink_external_link(
         hyperlynk_text, link)
     self.assertEqual(hyperlink, expected_hyperlink)
Exemplo n.º 6
0
 def table_field_updated(self, update_fields: dict,
                         overview_page_data: dict):
     if "platform" in update_fields.keys():
         return WikiTextService().hyperlink_external_link(
             overview_page_data["platform"]["name"],
             overview_page_data["platform"]["url"],
         )
     elif "organisation" in update_fields.keys():
         organisation_page_title = (
             f"{self.templates.oeg_page}/"
             f"{overview_page_data['organisation']['name'].capitalize()}")
         return WikiTextService().hyperlink_wiki_page(
             organisation_page_title,
             overview_page_data["organisation"]["name"].capitalize(),
         )
     else:
         return False
Exemplo n.º 7
0
    def create_page(self, document_data: dict) -> None:
        """
        Creates a wiki page

        Keyword arguments:
        document_data -- All required data for a project using
                         Organised Editing Guidelines
        """
        mediawiki = MediaWikiService()
        wikitext = WikiTextService()
        token = mediawiki.get_token()

        page_title = self.templates.oeg_page

        overview_page_sections = self.document_to_page_sections(document_data)

        sections_text = wikitext.generate_text_from_dict(
            self.templates.page_template,
            f"=={self.templates.page_initial_section}==",
            overview_page_sections,
        )
        updated_text = WikiTableService().add_table_row(
            page_text=sections_text,
            new_row=self.generate_activities_list_table_row(document_data),
            table_section_title=self.templates.activities_list_section_title,
            table_template=self.templates.table_template,
        )
        if mediawiki.is_existing_page(page_title):
            page_text = MediaWikiService().get_page_text(
                self.templates.oeg_page)
            overview_page_table = (WikiSectionService().get_section_table(
                page_text,
                self.templates.activities_list_section_title).string)
            updated_text = WikiTableService().add_table_row(
                page_text=page_text,
                new_row=self.generate_activities_list_table_row(document_data),
                table_section_title=self.templates.
                activities_list_section_title,
                table_template=overview_page_table,
            )
            mediawiki.edit_page(token, self.templates.oeg_page, updated_text)
        else:
            mediawiki.create_page(token, page_title, updated_text)
Exemplo n.º 8
0
    def generate_page_sections_dict(self,
                                    organisation_page_data: dict) -> dict:
        """
        Generate dict containing the document content
        parsed to wikitext for all sections present
        in the organisation page

        Keyword arguments:
        organisation_page_data -- Dictionary containing the
                                  required data for the
                                  organisation page sections

        Returns:
        organisation_page_sections -- Dictionary with the document
                                      content parsed to wikitext
                                      for the organisation page sections
        """
        wikitext = WikiTextService()

        organisation_url = wikitext.hyperlink_external_link(
            organisation_page_data["organisation"]["name"],
            organisation_page_data["organisation"]["url"],
        )

        platform_url = wikitext.hyperlink_external_link(
            organisation_page_data["platform"]["name"],
            organisation_page_data["platform"]["url"],
        )

        organisation_page_sections = {
            self.templates.organisation_section: {
                self.templates.organisation_link_section:
                f"\n{organisation_url}\n",
                self.templates.organisation_description_section:
                (f"\n{organisation_page_data['organisation']['description']}\n"
                 ),
            },
            self.templates.platform_section: {
                self.templates.platform_link_section: f"\n{platform_url}\n",
            },
        }
        return organisation_page_sections
Exemplo n.º 9
0
    def parse_page_to_serializer(self, page_dictionary: dict) -> dict:
        """
        Serialize organisation page wikitext content

        Keyword Arguments:
        page_dictionary -- Dictionary containing data from a organisation page.
                           The dictionary keys represents the section title and the value
                           represents the section text

        Returns:
        current_organisation_page -- Serialized organisation page data
        """
        current_organisation_page = {
            "organisation": {},
            "platform": {},
            "project": []
        }

        # Add description to organisation page data
        current_organisation_page["organisation"][
            "description"] = page_dictionary[
                self.templates.organisation_section][
                    self.templates.organisation_description_section].replace(
                        "\n", "")

        # Add organisation url and name to organisation page data
        (
            organisation_url,
            organisation_name,
        ) = WikiTextService().get_page_link_and_text_from_external_hyperlink(
            page_dictionary[self.templates.organisation_section][
                self.templates.organisation_link_section])
        current_organisation_page["organisation"]["url"] = organisation_url
        current_organisation_page["organisation"]["name"] = organisation_name

        # Add organisation projects to organisation page data
        projects_list_text = page_dictionary[self.templates.projects_section][
            self.templates.projects_list_section]
        current_organisation_page["project"] = self.get_organisation_projects(
            projects_list_text)

        # Add organisation projects platforms to organisation page data
        current_organisation_page[
            "platform"] = self.get_organisation_projects_platforms(
                projects_list_text)

        # Validate organisation page fields
        document_schema = OrganisationPageSchema(partial=True,
                                                 only=self.page_fields)
        document_schema.load(current_organisation_page)
        return current_organisation_page
Exemplo n.º 10
0
    def get_overview_page_platforms_and_organisations(
            self, overview_page_table_text: str):
        overview_page_table = WikiTableService().get_text_table(
            overview_page_table_text)
        overview_page_table_data = overview_page_table.data(span=False)

        organisation_list = []
        platform_list = []
        wikitext = WikiTextService()

        for table_row_number, table_row_data in enumerate(
                overview_page_table_data[1:], start=1):
            hyperlinked_organisation_url = overview_page_table.cells(
                row=table_row_number,
                column=self.templates.overview_list_organisation_name_column,
            ).value

            hyperlinked_platform_url = overview_page_table.cells(
                row=table_row_number,
                column=self.templates.overview_list_platform_name_column,
            ).value

            organisation_list.append({
                "name":
                wikitext.get_page_link_and_text_from_wiki_page_hyperlink(
                    hyperlinked_organisation_url)[1]
            })

            (
                platform_url,
                platform_name,
            ) = wikitext.get_page_link_and_text_from_external_hyperlink(
                hyperlinked_platform_url)
            platform_list.append({"name": platform_name, "url": platform_url})

        return platform_list, organisation_list
Exemplo n.º 11
0
    def generate_page_sections_dict(self, project_page_data: dict):
        """
        Generate dict containing the document content parsed to wikitext
        for all sections present in the project page

        Keyword arguments:
        project_page_data -- Dictionary containing the required data for the
                              project page sections

        Returns:
        project_page_sections -- Dictionary with the document content
                                 parsed to wikitext for the project
                                 page sections
        """
        created_date = WikiTextService().format_date_text(
            project_page_data["project"]["created"])
        timeframe = f"\n* '''Start Date:''' {created_date}\n"
        hashtag = project_page_data["project"]["changeset_comment"].replace(
            "#", "<nowiki>#</nowiki>")
        project_external_source = project_page_data["project"][
            "external_source"]

        project_page_sections = {
            self.templates.short_description_section:
            (f"\n{project_page_data['project']['short_description']}\n"),
            self.templates.timeframe_section:
            timeframe,
            self.templates.url_section:
            (f"\n{project_page_data['project']['url']}\n"),
            self.templates.external_sources_section: {
                self.templates.instructions_section:
                (f"\n{project_external_source['instructions']}\n"),
                self.templates.per_task_instructions_section:
                (f"\n{project_external_source['per_task_instructions']}\n"),
                self.templates.imagery_section:
                (f"\n{project_external_source['imagery'].strip()}\n"),
                self.templates.license_section:
                (f"\n{project_external_source['license']}\n"),
            },
            self.templates.hashtag_section:
            f"\n{hashtag}\n",
        }
        return project_page_sections
Exemplo n.º 12
0
    def create_page(self, document_data: dict):
        """
        Creates a wiki page

        Keyword arguments:
        document_data -- All required data for a project using
                         Organised Editing Guidelines
        """
        mediawiki = MediaWikiService()

        organisation_page_sections = self.document_to_page_sections(
            document_data)

        sections_text = WikiTextService().generate_text_from_dict(
            self.templates.page_template,
            self.templates.page_initial_section,
            organisation_page_sections,
        )
        updated_text = WikiTableService().add_table_row(
            page_text=sections_text,
            new_row=self.generate_projects_list_table_row(document_data),
            table_section_title=self.templates.projects_section,
            table_template=self.templates.table_template,
        )

        page_title = f"{self.templates.oeg_page}/{document_data['organisation']['name'].capitalize()}"
        token = mediawiki.get_token()
        if mediawiki.is_existing_page(page_title):
            page_text = MediaWikiService().get_page_text(page_title)
            organisation_page_table = (WikiSectionService().get_section_table(
                page_text, self.templates.projects_list_section).string)
            updated_text = WikiTableService().add_table_row(
                page_text=page_text,
                new_row=self.generate_projects_list_table_row(document_data),
                table_section_title=self.templates.projects_list_section,
                table_template=organisation_page_table,
            )
            mediawiki.edit_page(token, page_title, updated_text)
        else:
            mediawiki.create_page(token, page_title, updated_text)
Exemplo n.º 13
0
    def edit_page(self, document_data: dict, update_fields: dict,
                  project_page_data: dict):
        """
        Edits a wiki page

        Keyword arguments:
        document_data -- All required data for a project using
                         Organised Editing Guidelines
        """
        mediawiki = MediaWikiService()
        token = mediawiki.get_token()
        page_title = (f"{self.templates.oeg_page}/Projects/"
                      f'{project_page_data["project"]["name"].capitalize()}')

        project_page_sections = self.document_to_page_sections(document_data)

        sections_text = WikiTextService().generate_text_from_dict(
            self.templates.page_template,
            f"=={self.templates.page_initial_section}==",
            project_page_sections,
        )
        updated_text = WikiTableService().add_table_row(
            page_text=sections_text,
            new_row=self.get_project_users_table_rows(document_data),
            table_section_title=self.templates.team_user_section,
            table_template=self.templates.table_template,
        )

        if ("project" in update_fields.keys()
                and "name" in update_fields["project"].keys()
                and update_fields["project"]["name"].capitalize() !=
                project_page_data["project"]["name"].capitalize()):
            new_page = (f"{self.templates.oeg_page}/Projects/"
                        f'{document_data["project"]["name"].capitalize()}')
            mediawiki.move_page(token=token,
                                old_page=page_title,
                                new_page=new_page)
            mediawiki.edit_page(token, new_page, updated_text)
        else:
            mediawiki.edit_page(token, page_title, updated_text)
Exemplo n.º 14
0
    def create_page(self, document_data: dict) -> None:
        """
        Creates a wiki page

        Keyword arguments:
        document_data -- All required data for a project using
                         Organised Editing Guidelines
        """
        mediawiki = MediaWikiService()

        token = mediawiki.get_token()

        project_page_sections = self.document_to_page_sections(document_data)

        sections_text = WikiTextService().generate_text_from_dict(
            self.templates.page_template,
            f"=={self.templates.page_initial_section}==",
            project_page_sections,
        )
        updated_text = WikiTableService().add_table_row(
            page_text=sections_text,
            new_row=self.get_project_users_table_rows(document_data),
            table_section_title=self.templates.team_user_section,
            table_template=self.templates.table_template,
        )

        page_title = (f"{self.templates.oeg_page}/Projects/"
                      f'{document_data["project"]["name"].capitalize()}')
        if mediawiki.is_existing_page(page_title):
            raise ValueError(
                "Error reporting project "
                f"'{document_data['project']['name'].capitalize()}'."
                " Project already was reported.")
        else:
            mediawiki.create_page(
                token=token,
                page_title=page_title,
                page_text=updated_text,
            )
Exemplo n.º 15
0
    def get_organisation_projects_platforms(self, table_text):
        projects_list_table = WikiTableService().get_text_table(table_text)
        projects_list_data = projects_list_table.data(span=False)
        projects_platforms = []

        for table_row_number, table_row_data in enumerate(
                projects_list_data[1:], start=1):
            platform_external_hyperlink = projects_list_table.cells(
                row=table_row_number,
                column=self.templates.projects_list_platform_name_column,
            ).value
            (
                platform_url,
                platform_name,
            ) = WikiTextService(
            ).get_page_link_and_text_from_external_hyperlink(
                platform_external_hyperlink)

            projects_platforms.append({
                "name": platform_name.strip(),
                "url": platform_url.strip(),
            }  # noqa
                                      )
        return projects_platforms
Exemplo n.º 16
0
 def test_get_get_page_link_and_text_from_wiki_page_hyperlink(self):
     wiki_hyperlink = "[wiki_page_link | page name]"
     expected_data = ("wiki_page_link", "page name")
     hyperlink_data = WikiTextService(
     ).get_page_link_and_text_from_wiki_page_hyperlink(wiki_hyperlink)
     self.assertTupleEqual(expected_data, hyperlink_data)
Exemplo n.º 17
0
 def test_get_page_link_and_text_from_external_hyperlink(self):
     external_hyperlink = "[https://example.com page name]"
     expected_data = ("https://example.com", "page name")
     hyperlink_data = WikiTextService(
     ).get_page_link_and_text_from_external_hyperlink(external_hyperlink)
     self.assertTupleEqual(expected_data, hyperlink_data)
Exemplo n.º 18
0
    def test_format_date_text_fails_with_wrong_date(self):
        wrong_date = "2019-04-08T10:54:25.449637"

        with self.assertRaises(ValueError):
            WikiTextService().format_date_text(wrong_date)
Exemplo n.º 19
0
 def test_format_date_text(self):
     date = "2019-04-08T10:54:25.449637Z"
     parsed_date = datetime.strptime(date, "%Y-%m-%dT%H:%M:%S.%fZ")
     expected_formatted_date = "08 April 2019"
     formatted_date = WikiTextService().format_date_text(parsed_date)
     self.assertEqual(expected_formatted_date, formatted_date)
Exemplo n.º 20
0
 def test_hyperlink_wiki_page(self):
     wiki_page = "Wikipage"
     text = "wiki page text"
     expected_hyperlink = f"[[{wiki_page} | {text}]]"
     hyperlink = WikiTextService().hyperlink_wiki_page(wiki_page, text)
     self.assertEqual(hyperlink, expected_hyperlink)
Exemplo n.º 21
0
    def get_edit_page_text(
        self,
        update_fields: dict,
        current_organisation_page: dict,
        update_organisation_page: dict,
    ) -> str:
        """
        Get the text for a updated organisation page

        Keyword Arguments:
        update_fields -- Fields that are being updated
        current_organisation_page -- Dict with the current organisation page content that
                                     is being updated
        update_organisation_page -- Dict with the organisation page updated content

        Returns:
        updated_text -- Text for the updated organisation page
        """
        # Get text of a organisation page
        page_title = (
            f"{self.templates.oeg_page}/"
            f"{current_organisation_page['organisation']['name'].capitalize()}"
        )
        page_text = MediaWikiService().get_page_text(page_title)

        # Generate updated text for organisation page
        update_current_organisation_page = self.document_to_page_sections(
            update_organisation_page)
        sections_text = WikiTextService().generate_text_from_dict(
            page_text,
            self.templates.page_initial_section,
            update_current_organisation_page,
        )

        updated_table_fields = self.get_update_table_fields(
            update_fields, current_organisation_page)

        # Update organisation page text if none table field needs updated
        project_list_table = WikiSectionService().get_section_table(
            page_text, self.templates.projects_list_section)
        project_list_section_title = (
            f"\n=={self.templates.projects_section}==\n"
            f"==={self.templates.projects_list_section}===\n")
        updated_text = (sections_text + project_list_section_title +
                        project_list_table.string)
        if updated_table_fields:
            # Update organisation page text if any table field needs updated
            forbidden_fields = [
                self.templates.projects_list_project_author_column,
                self.templates.projects_list_project_status_column,
            ]
            project_wiki_page = WikiTextService().hyperlink_wiki_page(
                wiki_page=
                (f"{self.templates.oeg_page}/Projects/"
                 f'{current_organisation_page["project"]["name"].capitalize()}'
                 ),
                text=current_organisation_page["project"]["name"].capitalize(),
            )
            updated_project_list_table = WikiTableService().edit_table(
                project_list_table.string,
                project_list_section_title,
                updated_table_fields,
                project_wiki_page,
                forbidden_fields,
            )
            updated_text = sections_text + updated_project_list_table
        return updated_text
Exemplo n.º 22
0
    def get_update_table_fields(self, update_fields: dict,
                                organisation_page_data: dict):
        current_project_page_title = (
            "Organised_Editing/Activities/Auto_report/Projects/"
            f"{organisation_page_data['project']['name'].capitalize()}")
        current_row_data = {
            "project_name":
            WikiTextService().hyperlink_wiki_page(
                current_project_page_title,
                organisation_page_data["project"]["name"].capitalize(),
            ),
            "platform":
            WikiTextService().hyperlink_external_link(
                organisation_page_data["platform"]["name"],
                organisation_page_data["platform"]["url"],
            ),
            "project_author":
            organisation_page_data["project"]["author"],
            "project_status":
            organisation_page_data["project"]["status"],
        }

        if "platform" in update_fields.keys(
        ) and "project" in update_fields.keys():
            update_project_name = (update_fields["project"]["name"] if "name"
                                   in update_fields["project"].keys() else
                                   organisation_page_data["project"]["name"])
            update_project_page_title = (
                "Organised_Editing/Activities/Auto_report/Projects/"
                f"{update_project_name.capitalize()}")

            update_platform_name = (update_fields["platform"]["name"] if "name"
                                    in update_fields["platform"].keys() else
                                    organisation_page_data["platform"]["name"])
            update_platform_url = (update_fields["platform"]["url"] if "url"
                                   in update_fields["platform"].keys() else
                                   organisation_page_data["platform"]["url"])

            update_project_author = (
                update_fields["project"]["author"]
                if "author" in update_fields["project"].keys() else
                organisation_page_data["project"]["author"])
            update_project_status = (
                update_fields["project"]["status"]
                if "status" in update_fields["project"].keys() else
                organisation_page_data["project"]["status"])

            update_fields = {
                self.templates.projects_list_project_name_column: {
                    "current":
                    current_row_data["project_name"],
                    "update":
                    WikiTextService().hyperlink_wiki_page(
                        update_project_page_title,
                        update_project_name.capitalize()),
                },
                self.templates.projects_list_platform_name_column: {
                    "current":
                    current_row_data["platform"],
                    "update":
                    WikiTextService().hyperlink_external_link(
                        update_platform_name, update_platform_url),
                },
                self.templates.projects_list_project_author_column: {
                    "current": current_row_data["project_author"],
                    "update": update_project_author,
                },
                self.templates.projects_list_project_status_column: {
                    "current": current_row_data["project_status"],
                    "update": update_project_status,
                },
            }
            return update_fields
        elif "platform" in update_fields.keys():
            update_platform_name = (update_fields["platform"]["name"] if "name"
                                    in update_fields["platform"].keys() else
                                    organisation_page_data["platform"]["name"])
            update_platform_url = (update_fields["platform"]["url"] if "url"
                                   in update_fields["platform"].keys() else
                                   organisation_page_data["platform"]["url"])
            update_fields = {
                self.templates.projects_list_project_name_column: {
                    "current": current_row_data["project_name"],
                    "update": current_row_data["project_name"],
                },
                self.templates.projects_list_platform_name_column: {
                    "current":
                    current_row_data["platform"],
                    "update":
                    WikiTextService().hyperlink_external_link(
                        update_platform_name, update_platform_url),
                },
                self.templates.projects_list_project_author_column: {
                    "current": current_row_data["project_author"],
                    "update": current_row_data["project_author"],
                },
                self.templates.projects_list_project_status_column: {
                    "current": current_row_data["project_status"],
                    "update": current_row_data["project_status"],
                },
            }
            return update_fields
        elif "project" in update_fields.keys():
            update_project_name = (update_fields["project"]["name"] if "name"
                                   in update_fields["project"].keys() else
                                   organisation_page_data["project"]["name"])
            update_project_page_title = (
                "Organised_Editing/Activities/Auto_report/Projects/"
                f"{update_project_name.capitalize()}")

            update_project_author = (
                update_fields["project"]["author"]
                if "author" in update_fields["project"].keys() else
                organisation_page_data["project"]["author"])
            update_project_status = (
                update_fields["project"]["status"]
                if "status" in update_fields["project"].keys() else
                organisation_page_data["project"]["status"])

            update_fields = {
                self.templates.projects_list_project_name_column: {
                    "current":
                    current_row_data["project_name"],
                    "update":
                    WikiTextService().hyperlink_wiki_page(
                        update_project_page_title,
                        update_project_name.capitalize()),
                },
                self.templates.projects_list_platform_name_column: {
                    "current": current_row_data["platform"],
                    "update": current_row_data["platform"],
                },
                self.templates.projects_list_project_author_column: {
                    "current": current_row_data["project_author"],
                    "update": update_project_author,
                },
                self.templates.projects_list_project_status_column: {
                    "current": current_row_data["project_status"],
                    "update": update_project_status,
                },
            }
            return update_fields
        else:
            return False
Exemplo n.º 23
0
    def get_update_table_fields(self, update_fields, overview_page_data):
        current_organisation_page_title = (
            "Organised_Editing/Activities/Auto_report/"
            f"{overview_page_data['organisation']['name'].capitalize()}")

        current_row_data = {
            "organisation":
            WikiTextService().hyperlink_wiki_page(
                current_organisation_page_title,
                overview_page_data["organisation"]["name"].capitalize(),
            ),
            "platform":
            WikiTextService().hyperlink_external_link(
                overview_page_data["platform"]["name"],
                overview_page_data["platform"]["url"],
            ),
        }
        if ("platform" in update_fields.keys()
                and "organisation" in update_fields.keys()):
            update_platform_name = (update_fields["platform"]["name"] if "name"
                                    in update_fields["platform"].keys() else
                                    overview_page_data["platform"]["name"])
            update_platform_url = (update_fields["platform"]["url"] if "url"
                                   in update_fields["platform"].keys() else
                                   overview_page_data["platform"]["url"])

            update_organisation_name = (
                update_fields["organisation"]["name"].capitalize()
                if "name" in update_fields["organisation"].keys() else
                overview_page_data["organisation"]["name"].capitalize())
            update_organisation_page_title = (
                "Organised_Editing/Activities/Auto_report/"
                f"{update_organisation_name.capitalize()}")

            update_fields = {
                self.templates.overview_list_organisation_name_column: {
                    "current":
                    current_row_data["organisation"],
                    "update":
                    WikiTextService().hyperlink_wiki_page(
                        update_organisation_page_title,
                        update_organisation_name.capitalize(),
                    ),
                },
                self.templates.overview_list_platform_name_column: {
                    "current":
                    current_row_data["platform"],
                    "update":
                    WikiTextService().hyperlink_external_link(
                        update_platform_name, update_platform_url),
                },
            }
            return update_fields
        elif "platform" in update_fields.keys():
            update_platform_name = (update_fields["platform"]["name"] if "name"
                                    in update_fields["platform"].keys() else
                                    overview_page_data["platform"]["name"])
            update_platform_url = (update_fields["platform"]["url"] if "url"
                                   in update_fields["platform"].keys() else
                                   overview_page_data["platform"]["url"])

            update_fields = {
                self.templates.overview_list_organisation_name_column: {
                    "current": current_row_data["organisation"],
                    "update": current_row_data["organisation"],
                },
                self.templates.overview_list_platform_name_column: {
                    "current":
                    current_row_data["platform"],
                    "update":
                    WikiTextService().hyperlink_external_link(
                        update_platform_name, update_platform_url),
                },
            }
            return update_fields
        elif "organisation" in update_fields.keys():
            update_organisation_name = (
                update_fields["organisation"]["name"].capitalize()
                if "name" in update_fields["organisation"].keys() else
                overview_page_data["organisation"]["name"].capitalize())
            update_organisation_page_title = (
                "Organised_Editing/Activities/Auto_report/"
                f"{update_organisation_name.capitalize()}")

            update_fields = {
                self.templates.overview_list_organisation_name_column: {
                    "current":
                    current_row_data["organisation"],
                    "update":
                    WikiTextService().hyperlink_wiki_page(
                        update_organisation_page_title,
                        update_organisation_name.capitalize(),
                    ),
                },
                self.templates.overview_list_platform_name_column: {
                    "current": current_row_data["platform"],
                    "update": current_row_data["platform"],
                },
            }
            return update_fields
        else:
            return False