Relocate the unprefixed_value assignement so that it actually holds t… - #6
Relocate the unprefixed_value assignement so that it actually holds t…#6bdgregg wants to merge 1 commit into
Conversation
…he unprefixed_value instead a duplicate of value.
| @@ -1350,7 +1352,6 @@ def add_value( | |||
| values.append(value) | |||
| else: | |||
| # Prevent duplicates with and without prefix | |||
There was a problem hiding this comment.
associated comment should be moved as well. imo having the variables be value and prefixed_value is more readable than trying to decode which cases have value as prefixed (prefixed_value probably should be set to either None or the original value if prefix does not exist)
There was a problem hiding this comment.
This is plausible, but Tyrica's comment is ambiguous, and based on face-to-face discussion, I think the approach is wrong.
There are three fields which are mapped with prefixes here:
https://github.com/ulsdevteam/islandora_metadata/blob/f27a6843d206bf3a9644abc414a9081ed60a3a32/Ingest_Scripts/Utility_Files/manifest_to_i2_field_mapping.csv
field_modelfield_resource_typefield_depositor
Your debugging with Carolyn suggests that the expected merge operation is to have the output value unprefixed for fields other than field_linked_agent. This suggests that "Prevent duplicates with and without prefix" means "do not add a prefixed value if the same value exists unprefixed". Thus "image" + "resource_types:image" = "image". The proposed code does not cover that deduplication.
Actually, it does cover "image" + "resource_types:image" = "image"; what it doesn't cover is "resource_types:image" + "image" = "image". So, it might work, depending on the input. But it would be brittle, depending on the input.
|
@ctgraham, This is the suggested code replacement to handle duplicates with or without a prefix follows resulting with the without prefix being the preferred result. This seems to be a bit of a lift for the function and those functions calling it (which is probably why it wasn't suggested earlier). Does this feel like what you were trying to indicate? Existing code: Replacement code: The function parameters would change as well... As well as those functions that need updated (add_value, add_title, process_title, process_model, process_record, process_model).
|
…he unprefixed_value instead a duplicate of value. See Issue #3.