src/pds_doi_service/core/outputs/osti/osti_web_parser.py
def _get_identifier(record):
        """
        Depending on versions, a PDS identifier (lidvid or otherwise) can be
        stored in different locations. This function searches each location,
        and returns the first valid result.
        """
        identifier = None

        if record.xpath("accession_number"):
            identifier = record.xpath("accession_number")[0].text
        elif record.xpath("related_identifiers/related_identifier[./identifier_type='URL']"):
            identifier = record.xpath(
                "related_identifiers/related_identifier[./identifier_type='URL']/identifier_value"
            )[0].text
        elif record.xpath("related_identifiers/related_identifier[./identifier_type='URN']"):
            identifier = record.xpath(
                "related_identifiers/related_identifier[./identifier_type='URN']/identifier_value"
            )[0].text
        elif record.xpath("report_numbers"):
            identifier = record.xpath("report_numbers")[0].text
        elif record.xpath("site_url"):
            # For some records, the identifier can be parsed from the 'site_url'
            # field as last resort.
            identifier = parse_identifier_from_site_url(record.xpath("site_url")[0].text)
        else:
            # For now, do not consider it an error if cannot get an identifier.
            logger.warning(
                "Could not parse a PDS identifier from the provided XML record. "
                "Expecting one of ['accession_number','identifier_type',"
                "'report_numbers','site_url'] tags"
            )

        if identifier:
            # Some identifier fields have been observed with leading and
            # trailing whitespace, so remove it here
            identifier = identifier.strip()

        return identifier

        Depending on versions, a PDS identifier (lidvid or otherwise) can be
        stored in different locations. This function searches each location,
        and returns the first valid result.
        
Depending on versions, a PDS identifier (lidvid or otherwise) can be
stored in different locations. This function searches each location,
and returns the first valid result.
Depending on versions a PDS identifier ( lidvid or otherwise ) can be stored in different locations . This function searches each location and returns the first valid result .
def _get_identifier(record):
        identifier = None
        if record.xpath("accession_number"):
            identifier = record.xpath("accession_number")[0].text
        elif record.xpath("related_identifiers/related_identifier[./identifier_type='URL']"):
            identifier = record.xpath(
                "related_identifiers/related_identifier[./identifier_type='URL']/identifier_value"
            )[0].text
        elif record.xpath("related_identifiers/related_identifier[./identifier_type='URN']"):
            identifier = record.xpath(
                "related_identifiers/related_identifier[./identifier_type='URN']/identifier_value"
            )[0].text
        elif record.xpath("report_numbers"):
            identifier = record.xpath("report_numbers")[0].text
        elif record.xpath("site_url"):
            identifier = parse_identifier_from_site_url(record.xpath("site_url")[0].text)
        else:
            logger.warning(
                "Could not parse a PDS identifier from the provided XML record. "
                "Expecting one of ['accession_number','identifier_type',"
                "'report_numbers','site_url'] tags"
            )
        if identifier:
            identifier = identifier.strip()
        return identifier
def _get_identifier ( record ) : identifier = None if record . xpath ( "accession_number" ) : identifier = record . xpath ( "accession_number" ) [ 0 ] . text elif record . xpath ( "related_identifiers/related_identifier[./identifier_type='URL']" ) : identifier = record . xpath ( "related_identifiers/related_identifier[./identifier_type='URL']/identifier_value" ) [ 0 ] . text elif record . xpath ( "related_identifiers/related_identifier[./identifier_type='URN']" ) : identifier = record . xpath ( "related_identifiers/related_identifier[./identifier_type='URN']/identifier_value" ) [ 0 ] . text elif record . xpath ( "report_numbers" ) : identifier = record . xpath ( "report_numbers" ) [ 0 ] . text elif record . xpath ( "site_url" ) : identifier = parse_identifier_from_site_url ( record . xpath ( "site_url" ) [ 0 ] . text ) else : logger . warning ( "Could not parse a PDS identifier from the provided XML record. " "Expecting one of ['accession_number','identifier_type'," "'report_numbers','site_url'] tags" ) if identifier : identifier = identifier . strip ( ) return identifier
Depending on versions, a PDS identifier (lidvid or otherwise) can be
stored in different locations.
Depending on versions a PDS identifier ( lidvid or otherwise ) can be stored in different locations .
"""
        Depending on versions, a PDS identifier (lidvid or otherwise) can be
        stored in different locations. This function searches each location,
        and returns the first valid result.
        """ # For some records, the identifier can be parsed from the 'site_url' # field as last resort. # For now, do not consider it an error if cannot get an identifier. # Some identifier fields have been observed with leading and # trailing whitespace, so remove it here
record