src/pds_doi_service/core/outputs/doi_validator.py
def _check_field_title_content(self, doi: Doi):
        """
        Check that the title of the provided Doi object contains the type of
        PDS product (bundle, collection, document, etc...).

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

        Raises
        ------
        TitleDoesNotMatchProductTypeException
            If the title for the provided Doi object does not contain the
            type of PDS product.

        """
        product_type_specific_split = doi.product_type_specific.split(" ")

        # The suffix should be the last field in product_type_specific so
        # if it has many tokens, check the last one.
        product_type_specific_suffix = product_type_specific_split[-1]

        logger.debug("product_type_specific_suffix: %s", product_type_specific_suffix)
        logger.debug("doi.title: %s", doi.title)

        if not product_type_specific_suffix.lower() in doi.title.lower():
            msg = (
                f"DOI with identifier '{doi.pds_identifier}' and title "
                f"'{doi.title}' does not contains the product-specific type "
                f"suffix '{product_type_specific_suffix.lower()}'. "
                "Product-specific type suffix should be in the title.\n"
                "If you want to bypass this check, rerun the command with the "
                "--force flag provided."
            )

            raise TitleDoesNotMatchProductTypeException(msg)

        Check that the title of the provided Doi object contains the type of
        PDS product (bundle, collection, document, etc...).

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

        Raises
        ------
        TitleDoesNotMatchProductTypeException
            If the title for the provided Doi object does not contain the
            type of PDS product.

        
Check that the title of the provided Doi object contains the type of
PDS product (bundle, collection, document, etc...).

Parameters

doi : Doi
The Doi object to check.

Raises

TitleDoesNotMatchProductTypeException
If the title for the provided Doi object does not contain the
type of PDS product.
Check that the title of the provided Doi object contains the type of PDS product ( bundle collection document etc ... ) . Parameters doi : Doi The Doi object to check . Raises TitleDoesNotMatchProductTypeException If the title for the provided Doi object does not contain the type of PDS product .
def _check_field_title_content(self, doi: Doi):
        product_type_specific_split = doi.product_type_specific.split(" ")
        product_type_specific_suffix = product_type_specific_split[-1]
        logger.debug("product_type_specific_suffix: %s", product_type_specific_suffix)
        logger.debug("doi.title: %s", doi.title)
        if not product_type_specific_suffix.lower() in doi.title.lower():
            msg = (
                f"DOI with identifier '{doi.pds_identifier}' and title "
                f"'{doi.title}' does not contains the product-specific type "
                f"suffix '{product_type_specific_suffix.lower()}'. "
                "Product-specific type suffix should be in the title.\n"
                "If you want to bypass this check, rerun the command with the "
                "--force flag provided."
            )
            raise TitleDoesNotMatchProductTypeException(msg)
def _check_field_title_content ( self , doi : Doi ) : product_type_specific_split = doi . product_type_specific . split ( " " ) product_type_specific_suffix = product_type_specific_split [ - 1 ] logger . debug ( "product_type_specific_suffix: %s" , product_type_specific_suffix ) logger . debug ( "doi.title: %s" , doi . title ) if not product_type_specific_suffix . lower ( ) in doi . title . lower ( ) : msg = ( f"DOI with identifier '{doi.pds_identifier}' and title " f"'{doi.title}' does not contains the product-specific type " f"suffix '{product_type_specific_suffix.lower()}'. " "Product-specific type suffix should be in the title.\n" "If you want to bypass this check, rerun the command with the " "--force flag provided." ) raise TitleDoesNotMatchProductTypeException ( msg )
Check that the title of the provided Doi object contains the type of
PDS product (bundle, collection, document, etc...).
Check that the title of the provided Doi object contains the type of PDS product ( bundle collection document etc ... ) .
"""
        Check that the title of the provided Doi object contains the type of
        PDS product (bundle, collection, document, etc...).

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

        Raises
        ------
        TitleDoesNotMatchProductTypeException
            If the title for the provided Doi object does not contain the
            type of PDS product.

        """ # The suffix should be the last field in product_type_specific so # if it has many tokens, check the last one.
self
doi
Doi