Skip to content

Commit

Permalink
documents: adapt import from HEP BEJUNE
Browse files Browse the repository at this point in the history
  • Loading branch information
mmo committed Sep 20, 2021
1 parent 6227a04 commit 4843fcb
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions sonar/modules/cli/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ def hepbejune(data_file, pdf_directory):
if row[1] == 'SKIP':
continue

degree = row[14]
if degree == 'bachelor thesis':
degree = 'Mémoire de bachelor'
elif degree == 'master thesis':
degree = 'Mémoire de master'
else:
degree = 'Mémoire'

data = {
'title': [{
'type': 'bf:Title',
Expand All @@ -86,16 +94,22 @@ def hepbejune(data_file, pdf_directory):
'role': ['cre']
}],
'dissertation': {
'degree': row[12],
'grantingInstitution': row[10],
'degree': degree,
'grantingInstitution': 'Haute école pédagogique BEJUNE',
'date': date.strftime('%Y-%m-%d')
},
'provisionActivity': [{
'type': 'bf:Publication',
'startDate': row[11]
'startDate': date.strftime('%Y')
}],
'customField1': [
row[12]
],
'customField2': [
row[13]
],
'documentType':
DOCUMENT_TYPE_MAPPING.get(row[13], 'coar:c_1843'),
DOCUMENT_TYPE_MAPPING.get(row[14], 'coar:c_1843'),
'usageAndAccessPolicy': {
'license': 'CC BY-NC-ND'
},
Expand All @@ -106,10 +120,10 @@ def hepbejune(data_file, pdf_directory):
'harvested':
True,
'masked':
True
'masked_for_external_ips'
}

file_path = os.path.join(pdf_directory, row[15])
file_path = os.path.join(pdf_directory, row[16])
if os.path.isfile(file_path):
data['files'] = [{
'key': 'fulltext.pdf',
Expand Down

0 comments on commit 4843fcb

Please sign in to comment.