fix(harvester): skip harvest when metadata did not change - #968
Open
TahaKhan998 wants to merge 1 commit into
Open
fix(harvester): skip harvest when metadata did not change#968TahaKhan998 wants to merge 1 commit into
TahaKhan998 wants to merge 1 commit into
Conversation
| return left == right | ||
|
|
||
|
|
||
| def _present_keys(value): |
Contributor
There was a problem hiding this comment.
I would rename this to be more readable, wdyt?
| return False | ||
| return all(compare_metadata(x, y) for x, y in zip(a, b)) | ||
|
|
||
| if isinstance(a, str) and isinstance(b, str): |
Contributor
There was a problem hiding this comment.
Could you please add some comments for context
| for pids in (left, right): | ||
| doi = pids.get("doi") | ||
| if doi: | ||
| pids["doi"] = {k: doi[k] for k in ("identifier", "provider") if k in doi} |
Contributor
There was a problem hiding this comment.
The loop seems like an overkill decreasing readability just for 2 keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #941
inspire 2970770 / cds mat8t-f6991, skip compared these custom fields and thought they changed:
stored:
{
"cern:programmes": {"id": "None"},
"thesis:thesis": {"university": "KIT", "type": "PhD"}
}
merged:
{
"cern:programmes": {"id": "None"},
"thesis:thesis": {"university": "KIT", "type": "phd"},
"cern:accelerators": [],
"cern:experiments": []
}
empty lists vs missing keys, and phd vs PhD. we published, dump dropped the empty lists and put PhD back, view changes only showed revision_id and updated.
same thing for cds dois:
stored: {"doi": {"identifier": "10.17181/CERN.ABCD", "provider": "datacite", "client": "datacite"}}
merged: {"doi": {"identifier": "10.17181/CERN.ABCD", "provider": "datacite"}}
now we ignore empty list vs missing, treat phd/PhD as the same, and for dois only compare identifier + provider.