Skip to content

Commit

Permalink
documents: import faculty and department from RERO DOC for UNIFR
Browse files Browse the repository at this point in the history
* Imports the "faculty" and "department" fields from RERO DOC
  to "customField1" and "customField2", resp. Applies only to FOLIA.
* Closes #691.

Co-Authored-by: Miguel Moreira <miguel.moreira@rero.ch>
  • Loading branch information
mmo committed Nov 4, 2021
1 parent dcd9574 commit c18b11a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sonar/modules/documents/dojson/rerodoc/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,22 @@ def marc21_to_contribution_field_711(self, key, value):
return None


@overdo.over('customField1', '^918..')
@utils.ignore_value
def marc21_to_faculty_and_department(self, key, value):
"""Extract faculty and department for UNIFR."""
record = overdo.blob_record
org = record.get('980__', {}).get('b')
if org and org == 'UNIFR':
faculty = value.get('a')
if faculty:
self['customField1'] = [faculty]
dep = value.get('c')
if dep:
self['customField2'] = [dep]
return None


@overdo.over('partOf', '^773..')
@utils.for_each_value
@utils.ignore_value
Expand Down

0 comments on commit c18b11a

Please sign in to comment.