src/pds_doi_service/core/outputs/doi_validator.py
def _check_for_preexisting_identifier(self, doi: Doi):
        """
        For the identifier assigned to the provided Doi object, check that
        the latest transaction for the same identifier has a matching DOI value.

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

        Raises
        ------
        IllegalDOIActionException
            If the check fails.

        """
        # The database expects each field to be a list.
        query_criterias = {"ids": [doi.pds_identifier]}

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

        for row in rows:
            existing_record = dict(zip(columns, row))

            if doi.doi != existing_record["doi"]:
                raise IllegalDOIActionException(
                    f"There is already a DOI {existing_record['doi']} associated "
                    f"with PDS identifier {doi.pds_identifier} "
                    f"(status={existing_record['status']}).\n"
                    f"You cannot modify a DOI for an existing PDS identifier."
                )

        For the identifier assigned to the provided Doi object, check that
        the latest transaction for the same identifier has a matching DOI value.

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

        Raises
        ------
        IllegalDOIActionException
            If the check fails.

        
For the identifier assigned to the provided Doi object, check that
the latest transaction for the same identifier has a matching DOI value.

Parameters

doi : Doi
The Doi object to validate.

Raises

IllegalDOIActionException
If the check fails.
For the identifier assigned to the provided Doi object check that the latest transaction for the same identifier has a matching DOI value . Parameters doi : Doi The Doi object to validate . Raises IllegalDOIActionException If the check fails .
def _check_for_preexisting_identifier(self, doi: Doi):
        query_criterias = {"ids": [doi.pds_identifier]}
        columns, rows = self._database_obj.select_latest_rows(query_criterias)
        for row in rows:
            existing_record = dict(zip(columns, row))
            if doi.doi != existing_record["doi"]:
                raise IllegalDOIActionException(
                    f"There is already a DOI {existing_record['doi']} associated "
                    f"with PDS identifier {doi.pds_identifier} "
                    f"(status={existing_record['status']}).\n"
                    f"You cannot modify a DOI for an existing PDS identifier."
                )
def _check_for_preexisting_identifier ( self , doi : Doi ) : query_criterias = { "ids" : [ doi . pds_identifier ] } columns , rows = self . _database_obj . select_latest_rows ( query_criterias ) for row in rows : existing_record = dict ( zip ( columns , row ) ) if doi . doi != existing_record [ "doi" ] : raise IllegalDOIActionException ( f"There is already a DOI {existing_record['doi']} associated " f"with PDS identifier {doi.pds_identifier} " f"(status={existing_record['status']}).\n" f"You cannot modify a DOI for an existing PDS identifier." )
For the identifier assigned to the provided Doi object, check that
the latest transaction for the same identifier has a matching DOI value.
For the identifier assigned to the provided Doi object check that the latest transaction for the same identifier has a matching DOI value .
"""
        For the identifier assigned to the provided Doi object, check that
        the latest transaction for the same identifier has a matching DOI value.

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

        Raises
        ------
        IllegalDOIActionException
            If the check fails.

        """ # The database expects each field to be a list. # Query database for rows with given id value.
self
doi
Doi