Add ability to store alternative values in the meta-metadata#154
Add ability to store alternative values in the meta-metadata#154
Conversation
|
Thanks you for PR. There is one thing that looks like a bug to me: |
src/hermes/model/merge.py
Outdated
| case list() as item: item[:] = value | ||
| case _: target[key] = value | ||
| case _: | ||
| if key in target and target[key] != value: |
There was a problem hiding this comment.
if not key in target, the access in line 134 should already throw, so, this check is superfluous.
src/hermes/model/merge.py
Outdated
| case list() as item: item[:] = value | ||
| case _: target[key] = value | ||
| case _: | ||
| if key in target: |
There was a problem hiding this comment.
if not key in target, the access in line 100 should already throw, so, this check is superfluous.
|
@led02 : I think the problem with the missing I think I do not understand the intention behind the |
|
Thanks for the reviews and comments. In fact, the Indeed, the idea is to have common handling for different data types availble while still being flexible for configuration. Hence, there is always a fall-back strategy availble (that is bascially As I can recapitulate the general idea behind this code, I also have my problems (re-)understanding the implementation. What I understand that it needs serious refactoring. ;) My discussions with different team members brought made me think that it might be a good idea to split up the |
|
PS: I'm pretty confident the problem with the |
Hmm, interesting. I did not expect the |
`merge.py` and `path.py` are seriously broken and really, really need refactoring.
Yeah, just another indicator that the code has it's shortcomings... I thought it would be Well, for now the version alternatives are collected. I think we agree there needs to be done some proper refactoring here. Again, I'm sorry... it was about 4:20 AM when I wrote this ... code with shortcomings 😊 |
sdruskat
left a comment
There was a problem hiding this comment.
Thanks @led02!
A bit of DRYing up work left to do, see inline comments.
Other than that, works fine for some values (e.g., changing the affiliation for an author), witness:
"alternatives": [
[
"German Aerospace Center (DLR)",
{
"local_path": "CITATION.cff",
"timestamp": "2023-04-24T15:49:17",
"harvester": "cff"
}
]
],CodeMeta overrides CFF in this case, which has issues with intuition (agree with @jkelling in this case). I don't think this is wrong, but needs to be clarified to users that the last added value will/seems to override any previous values.
One thing I noticed is that this makes obvious what seems to be an issue with git harvesting, where the same harvester adds a null alternative:
- Run
hermesfrom within the project dir without configuring codemeta harvester, and you'll get:
"hermes:gitBranch": {
"alternatives": [
[
null,
{
"timestamp": "2023-04-24T15:52:46",
"harvester": "git"
}
]
]
}Providing this review as a comment to clarify if that's an issue with the git harvester, or with the implementation of alternative values.
How to use?
.hermes/process/codemeta.jsonto your project dir (and slightly modify it ... to trigger new behaviour)codemetaas harvester (inhermes.toml)alternativesinhermes/process/tags.json