Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,12 @@ def get_keywords(json_data):
unique_keywords = []
for kw in all_keywords:
name = kw["name"]
if name == "XX":
self.migration_logger.add_information(
json_data["recid"],
{"message": "Keyword XX found and ignored!", "value": name},
)
continue
if name not in seen:
seen.add(name)
unique_keywords.append(kw)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,25 @@ def validate_copyright(self, key, holder, year):
@model.over("related_id", "^962__", override=True)
@for_each_value
def related_id(self, key, value):
"""Translates tag 962."""
"""
Overridden version of the `presented_at` rule.

This rule uses the new `related_id` key so that only tag 962 handling is customized,
without overriding all rules for related identifiers.
"""
pagination = value.get("k", "").strip()
# Only 2 records has this field: 300427, 317239
if pagination and pagination != "no pagination":
raise UnexpectedValue(field=key, subfield="k", value=pagination)
new_related_id = presented_at(self, key, value)
if new_related_id:
rel_id = new_related_id[0]
rel_id.pop("resource_type", None)
rel_ids = self.get("related_identifiers", [])
if rel_id not in rel_ids:
rel_ids.append(rel_id)
self["related_identifiers"] = rel_ids
# Related identifier is already added, ignore this key
raise IgnoreKey("related_id")


Expand Down Expand Up @@ -418,6 +425,7 @@ def creation_date(self, key, value):
@for_each_value
def action_note(self, key, value):
"""Translates action note (digitized information)."""

def format_field(value, subfield):
val = value.get(subfield)
if isinstance(val, (list, tuple)):
Expand Down
Loading