src/pds_doi_service/core/outputs/doi_validator.py
def _check_field_title_duplicate(self, doi: Doi):
        """
        Check the provided Doi object's title to see if the same title has
        already been used with a different DOI record.

        Parameters
        ----------
        doi : Doi
            The Doi object to check.

        Raises
        ------
        DuplicatedTitleDOIException
            If the title for the provided Doi object is in use for another record.

        """
        query_criterias = {"title": [doi.title]}

        # Query database for rows with given title value.
        columns, rows = self._database_obj.select_latest_rows(query_criterias)

        # keep rows with same title BUT different identifier
        rows_with_different_identifier = [row for row in rows if row[columns.index("identifier")] != doi.pds_identifier]

        if rows_with_different_identifier:
            identifiers = ",".join([row[columns.index("identifier")] for row in rows_with_different_identifier])
            status = ",".join([row[columns.index("status")] for row in rows_with_different_identifier])
            dois = ",".join([row[columns.index("doi")] for row in rows_with_different_identifier])

            msg = (
                f"The title '{doi.title}' has already been used for records "
                f"{identifiers}, status: {status}, doi: {dois}. "
                "A different title should be used.\nIf you want to bypass this "
                "check, rerun the command with the --force flag provided."
            )

            raise DuplicatedTitleDOIException(msg)

        Check the provided Doi object's title to see if the same title has
        already been used with a different DOI record.

        Parameters
        ----------
        doi : Doi
            The Doi object to check.

        Raises
        ------
        DuplicatedTitleDOIException
            If the title for the provided Doi object is in use for another record.

        
Check the provided Doi object's title to see if the same title has
already been used with a different DOI record.

Parameters

doi : Doi
The Doi object to check.

Raises

DuplicatedTitleDOIException
If the title for the provided Doi object is in use for another record.
Check the provided Doi object ' s title to see if the same title has already been used with a different DOI record . Parameters doi : Doi The Doi object to check . Raises DuplicatedTitleDOIException If the title for the provided Doi object is in use for another record .
def _check_field_title_duplicate(self, doi: Doi):
        query_criterias = {"title": [doi.title]}
        columns, rows = self._database_obj.select_latest_rows(query_criterias)
        rows_with_different_identifier = [row for row in rows if row[columns.index("identifier")] != doi.pds_identifier]
        if rows_with_different_identifier:
            identifiers = ",".join([row[columns.index("identifier")] for row in rows_with_different_identifier])
            status = ",".join([row[columns.index("status")] for row in rows_with_different_identifier])
            dois = ",".join([row[columns.index("doi")] for row in rows_with_different_identifier])
            msg = (
                f"The title '{doi.title}' has already been used for records "
                f"{identifiers}, status: {status}, doi: {dois}. "
                "A different title should be used.\nIf you want to bypass this "
                "check, rerun the command with the --force flag provided."
            )
            raise DuplicatedTitleDOIException(msg)
def _check_field_title_duplicate ( self , doi : Doi ) : query_criterias = { "title" : [ doi . title ] } columns , rows = self . _database_obj . select_latest_rows ( query_criterias ) rows_with_different_identifier = [ row for row in rows if row [ columns . index ( "identifier" ) ] != doi . pds_identifier ] if rows_with_different_identifier : identifiers = "," . join ( [ row [ columns . index ( "identifier" ) ] for row in rows_with_different_identifier ] ) status = "," . join ( [ row [ columns . index ( "status" ) ] for row in rows_with_different_identifier ] ) dois = "," . join ( [ row [ columns . index ( "doi" ) ] for row in rows_with_different_identifier ] ) msg = ( f"The title '{doi.title}' has already been used for records " f"{identifiers}, status: {status}, doi: {dois}. " "A different title should be used.\nIf you want to bypass this " "check, rerun the command with the --force flag provided." ) raise DuplicatedTitleDOIException ( msg )
Check the provided Doi object's title to see if the same title has
already been used with a different DOI record.
Check the provided Doi object ' s title to see if the same title has already been used with a different DOI record .
"""
        Check the provided Doi object's title to see if the same title has
        already been used with a different DOI record.

        Parameters
        ----------
        doi : Doi
            The Doi object to check.

        Raises
        ------
        DuplicatedTitleDOIException
            If the title for the provided Doi object is in use for another record.

        """ # Query database for rows with given title value. # keep rows with same title BUT different identifier
self
doi
Doi