Skip to content

Commit d1735bd

Browse files
committed
Reconcile move_date_values with dict-wrapped subjects youtube
The subject list must be filled with dicts in the format: {"name": "this is the subject"} to be transformed into a list of strings in the solr doc. The move_date_values encrichment wasn't processing dicts, so the two were out of step with each other."
1 parent a307a76 commit d1735bd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

metadata_mapper/mappers/mapper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def to_UCLDC(self) -> dict[str, Any]:
134134
# Mapped value may be a function or lambda
135135
self.mapped_data = {k: v() if isinstance(v, Callable) else v for (k, v)
136136
in mapped_data.items()}
137-
138137
return self.mapped_data
139138

140139
def UCLDC_map(self) -> dict:
@@ -494,10 +493,15 @@ def move_date_values(self, prop, dest="temporal"):
494493

495494
remove = []
496495
for value in src_values:
497-
if not isinstance(value, str):
496+
if isinstance(value, dict):
497+
if "name" not in value:
498+
continue
499+
value = value.get("name")
500+
elif not isinstance(value, str):
498501
continue
499502
cleaned_value = re.sub(r"[\(\)\.\?]", "", value)
500503
cleaned_value = cleaned_value.strip()
504+
501505
for pattern in constants.move_date_value_reg_search:
502506
matches = re.compile(pattern, re.I).findall(cleaned_value)
503507
if (len(matches) == 1 and

0 commit comments

Comments
 (0)