Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions article/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def bulk_export_articles_to_articlemeta(
"article_id": article.id,
"article_pid": getattr(article, "pid", None),
"journal_acron": getattr(article, "journal_acron", None),
"pub_year": getattr(article, "pub_year", None),
"pub_date_year": getattr(article, "pub_date_year", None),
"force_update": force_update,
},
)
Expand Down Expand Up @@ -524,9 +524,9 @@ def _iter_from_article(self):
if journal_id_list:
filters["journal__in"] = journal_id_list
if self.from_pub_year:
filters["pub_year__gte"] = self.from_pub_year
filters["pub_date_year__gte"] = self.from_pub_year
if self.until_pub_year:
filters["pub_year__lte"] = self.until_pub_year
filters["pub_date_year__lte"] = self.until_pub_year
if self.from_date:
filters["updated__gte"] = self.from_date
if self.until_date:
Expand Down Expand Up @@ -596,6 +596,7 @@ def _build_harvester(self, collection_acron):
timeout=self.timeout,
)
if collection_acron == "scl":
return OPACHarvester(self.opac_url or "www.scielo.br", collection_acron, **kwargs)
domain = self.opac_url or Collection.get(collection_acron).base_url
return OPACHarvester(domain, collection_acron, **kwargs)
return AMHarvester("article", collection_acron, **kwargs)

1 change: 1 addition & 0 deletions article/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,7 @@ def create(cls, user, url=None, source_date=None, am_article=None, force_update=
obj.source_date = source_date
obj.am_article = am_article
obj.status = cls.StatusChoices.PENDING
obj.save()
obj.add_pid_provider(user, force_update, auto_solve_pid_conflict=auto_solve_pid_conflict)
return obj
except IntegrityError:
Expand Down
7 changes: 5 additions & 2 deletions core/utils/harvesters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from typing import Any, Dict, Generator, Optional
from urllib.parse import urlencode

from article.utils.url_builder import ArticleURLBuilder

from core.utils.utils import fetch_data


Expand Down Expand Up @@ -224,7 +226,9 @@ def harvest_documents(self) -> Generator[Dict[str, Any], None, None]:

# Constrói URL do XML
journal_acron = item["journal_acronym"]
xml_url = f"{self.domain}/j/{journal_acron}/a/{pid_v3}/?format=xml"
xml_url = ArticleURLBuilder(
self.domain, journal_acron, pid_v3=pid_v3
).get_xml_url()

# Extrai data de origem
origin_date = self._parse_gmt_date(
Expand Down Expand Up @@ -288,4 +292,3 @@ def _parse_gmt_date(self, date_str: Optional[str]) -> Optional[str]:
except (ValueError, TypeError) as e:
logging.warning(f"Failed to parse GMT date '{date_str}': {e}")
return None

Loading