Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion export/kbart.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,24 @@
import argparse
import logging
import codecs
import re

import utils

logger = logging.getLogger(__name__)

# ISSN redirects for journals that changed their ISSN in URLs
# Maps old ISSN to new ISSN
ISSN_URL_REDIRECTS = {
'1575-0620': '2013-6463', # Revista española de sanidad penitenciaria (SciELO Spain)
}

# Pre-compile regex patterns for ISSN redirects for better performance
_ISSN_REDIRECT_PATTERNS = {
old_issn: re.compile(r'([?&]pid=)' + re.escape(old_issn) + r'(&|$)')
for old_issn in ISSN_URL_REDIRECTS.keys()
}


def _config_logging(logging_level='INFO', logging_file=None):

Expand Down Expand Up @@ -164,7 +177,17 @@ def fmt_csv(self, data):
last_document.issue.number or '' if last_document and last_document.issue else '')
else:
line += ['', '', '']
line.append(data.url().replace('sci_serial', 'sci_issues'))
# Generate the URL
url = data.url().replace('sci_serial', 'sci_issues')

Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be trailing whitespace on the blank line after the url = ... assignment. Please remove the extra spaces to keep the diff clean and avoid whitespace-only changes.

Suggested change

Copilot uses AI. Check for mistakes.
# Apply ISSN redirects for journals that changed their ISSN in URLs
# This is necessary for journals that no longer use their print ISSN
for old_issn, new_issn in ISSN_URL_REDIRECTS.items():
# Use pre-compiled regex pattern for better performance
pattern = _ISSN_REDIRECT_PATTERNS[old_issn]
url = pattern.sub(r'\g<1>' + new_issn + r'\2', url)

Comment on lines +182 to +189
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be trailing whitespace on the blank line after the ISSN-redirect substitution loop. Please remove the extra spaces (or drop the blank line) to avoid whitespace-only diffs.

Suggested change
# Apply ISSN redirects for journals that changed their ISSN in URLs
# This is necessary for journals that no longer use their print ISSN
for old_issn, new_issn in ISSN_URL_REDIRECTS.items():
# Use pre-compiled regex pattern for better performance
pattern = _ISSN_REDIRECT_PATTERNS[old_issn]
url = pattern.sub(r'\g<1>' + new_issn + r'\2', url)
# Apply ISSN redirects for journals that changed their ISSN in URLs
# This is necessary for journals that no longer use their print ISSN
for old_issn, new_issn in ISSN_URL_REDIRECTS.items():
# Use pre-compiled regex pattern for better performance
pattern = _ISSN_REDIRECT_PATTERNS[old_issn]
url = pattern.sub(r'\g<1>' + new_issn + r'\2', url)

Copilot uses AI. Check for mistakes.
line.append(url)
line.append('') # first_author
line.append(data.scielo_issn or '')
line.append('') # embargo_info
Expand Down
Loading