inspire: get exact match for accelerators and experiments#747
inspire: get exact match for accelerators and experiments#747jrcastro2 wants to merge 1 commit intoCERNDocumentServer:masterfrom
Conversation
| "LHCb": "LHCB", | ||
| "AMS": "AMS-RE1", | ||
| "NA-62": "NA62", | ||
| "NA-062": "NA62", |
There was a problem hiding this comment.
I just added a few, this should be expanded as new values are found (unless there is an easy way to get all of them?)
| } | ||
| """INSPIRE to CDS accelerator vocabulary mappings.""" | ||
|
|
||
| CDS_INSPIRE_EXPERIMENT_MAPPINGS = { |
There was a problem hiding this comment.
could we instead just normalise the term on the fly? what I see here is that we are uppercasing and removing hyphens... I find it troublesome to have to maintain this list when we can normalise the name before performing a search (same comment for the config above)
There was a problem hiding this comment.
Hmmm, I understand that we want to do exact matches, and just added the list for the cases where we do not make the exact matches. To remove the mapping I guess we could first search the term as it is, or if it fails we search with the value normalized (so that it covers the more generic values), does this work?
There was a problem hiding this comment.
Looking at the list, I don't think we can normalize AMS to AMS-RE1 or NA-062 to NA62
I was going to suggest to use the props field but it only supports 1 string value :(
There was a problem hiding this comment.
Discussed IRL, agreed to keep it simple, search for the value and if not found normalize it, search again, if not found simply log the error message with the failed value, and remove the mapping. If the value is not found it means is wrong, it should be updated in the source.
kpsherva
left a comment
There was a problem hiding this comment.
I have suggested a simplification, please check. In addition, multiple tests are failing
794a631 to
5f60844
Compare
| f"Failed vocabulary search for '{original_term}' in '{vocab_type}'. Error: {e}." | ||
| ) | ||
| return None | ||
| except Exception as e: |
There was a problem hiding this comment.
minor nit: do we really need to catch separately? 😅
Test from 15 May 2025