Skip to content

Commit 4780c6d

Browse files
committed
Add id saving option
1 parent e8d44f9 commit 4780c6d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

caltechdata_api/decustomize_schema.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,18 @@ def decustomize_schema(json_record,pass_emails=False,pass_media=False):
217217
if 'descriptionValue' in d:
218218
d["description"] = d.pop("descriptionValue")
219219

220+
#Save CaltechDATA ID in all records
221+
idv = {'alternateIdentifier': json_record['pid_value'],
222+
'alternateIdentifierType': "CaltechDATA_Identifier"}
223+
if 'alternateIdentifiers' in json_record:
224+
json_record['alternateIdentifiers'].append(idv)
225+
else:
226+
json_record['alternateIdentifiers'] = [idv]
227+
220228
#Handle file info
221229
if pass_media == False:
222230
if 'electronic_location_and_access' in json_record:
223-
del json_record['electonic_location_and_access']
231+
del json_record['electronic_location_and_access']
224232

225233

226234
others = ['files', 'id', 'owners', 'pid_value', 'control_number', '_oai',

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from setuptools import setup, find_packages
22
setup(
33
name = 'caltechdata_api',
4-
version ='0.0.5',
4+
version ='0.1.0',
55
packages = find_packages(),
66
install_requires=[
77
'requests',

0 commit comments

Comments
 (0)