Skip to content

feat(mapper): Set publication date based on resource type - #595

Open
sakshamarora1 wants to merge 1 commit into
CERNDocumentServer:masterfrom
sakshamarora1:fix/dates_mapping
Open

feat(mapper): Set publication date based on resource type#595
sakshamarora1 wants to merge 1 commit into
CERNDocumentServer:masterfrom
sakshamarora1:fix/dates_mapping

Conversation

@sakshamarora1

Copy link
Copy Markdown
Contributor

fixes: #581

publication_date = normalize(publication_date_str)

return publication_date
store_priority_date(self, "article", publication_date)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would prefer if this is done a bit cleaner, because this additional nested key is making things more complex.
let's map 260__c as publication_date (as is) and 269__c as preprint_date, then please check my comment in the mapper as next

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah makes sense, I have updated the PR accordingly

Comment on lines +79 to +82
priority_dates = dojson_entry.pop("_publication_date_candidates", {})
article_date = priority_dates.get("article")
preprint_date = priority_dates.get("preprint")
resource_type = (dojson_entry.get("resource_type") or {}).get("id")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

instead of nested _publication_date_candidates, could you use publication_date and preprint date here? it will be very similar in logic but you will not need the check in line 113
so basically

pub_date = dojson_entry["publication_date"]
if (restype != "article" and is_more_accurate(dojson_entry["preprint_date"])) or restype=="preprint": 
    pub_date = dojson_entry["preprint_date"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dates mappings - preprint vs article

2 participants