Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documents: fill out custom fields for ROAR during RERO DOC import #656

Merged
merged 1 commit into from
Nov 2, 2021
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
2 changes: 1 addition & 1 deletion sonar/dedicated/templates/dedicated/hepvs/home.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p>FREDI est l'acronyme de "Forschung – Recherche – Entwicklung – Développement – Innova(z)tion" la nouvelle
<p>FREDI est l'acronyme de "Forschung – Recherche – Entwicklung – Développement – Innovation" la nouvelle
plateforme de dépôt des productions scientifiques et professionnelles en Open Access ainsi que des projets de
recherche de la Haute école pédagogique du Valais. De plus, selon la logique d'amélioration continue, la plateforme
FREDI permet de centraliser l'intégralité des données des projets de recherche à des fins d'optimisation du système
Expand Down
18 changes: 18 additions & 0 deletions sonar/modules/documents/dojson/rerodoc/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ def marc21_to_type_and_organisation(self, key, value):
if organisation == 'unisi':
organisation = 'usi'

# Specific transformation for `hep bejune`, in order to fill out
# custom fields `Filière` (`customField1`) and `Titre obtenu`
# (`customField2`)
if organisation == 'hepbejune' and value.get('f'):
document_subtype = value.get('f').lower()
customField1 = ''
customField2 = ''
if document_subtype == 'diss_bachelor':
customField1 = 'Enseignement primaire'
customField2 = 'Bachelor of Arts in Pre-Primary and Primary Education'
elif document_subtype == 'diss_master':
customField1 = 'Enseignement secondaire'
customField2 = 'Master of Arts or of Science in Secondary Education'
if customField1:
self['customField1'] = [customField1]
if customField2:
self['customField2'] = [customField2]

# Specific transformation for `bpuge` and `mhnge`, because the real
# acronym is `vge`.
subdivision_name = None
Expand Down
3 changes: 3 additions & 0 deletions sonar/modules/documents/loaders/schemas/rerodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class RerodocSchema(Marc21Schema):
usageAndAccessPolicy = fields.Dict()
files = fields.List(fields.Dict())
subdivisions = fields.List(fields.Dict())
customField1 = fields.List(fields.String())
customField2 = fields.List(fields.String())
customField3 = fields.List(fields.String())

@pre_dump
def process(self, obj, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion sonar/modules/documents/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def aggregations():
aggregations_list[aggregations_list.index(
f'customField{i}')] = {
'key':
f'customField{1}',
f'customField{i}',
'name':
get_language_value(
organisation[f'documentsCustomField{i}']['label'])
Expand Down