Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elsevier Parser: remove date_published simulation #214

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 0 additions & 5 deletions dags/elsevier/metadata_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def __init__(self, file_path):
CustomExtractor(
destination="date_published",
extraction_function=self._get_published_date,
required=True,
),
CustomExtractor(
destination="journal_year",
Expand Down Expand Up @@ -88,10 +87,6 @@ def _get_published_date(self, article):
field_name="published_date",
dois=self.dois,
)
if not date:
self.published_date = datetime.now().strftime("%Y-%m-%d")
self.year = datetime.now().strftime("%Y")
return self.published_date
date = datetime.fromisoformat(date[:-1])
self.published_date = date.strftime("%Y-%m-%d")
self.year = date.strftime("%Y")
Expand Down
4 changes: 2 additions & 2 deletions tests/units/elsevier/test_metadata_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def parsed_articles(parser, article):
id="test_publication_info",
),
param(
["2023-11-02", "2023-11-02", "2023-02-04", "2023-11-02"],
["", "", "2023-02-04", ""],
"date_published",
id="test_published_date",
),
Expand Down Expand Up @@ -150,7 +150,7 @@ def parsed_articles(parser, article):
@freeze_time("2023-11-02")
def test_elsevier_dataset_parsing(parsed_articles, expected, key):
for (parsed_article, expected_article) in zip(parsed_articles, expected):
assert expected_article == parsed_article[key]
assert expected_article == parsed_article.get(key, "")


@fixture
Expand Down
Loading