Skip to content

Commit 7edd34a

Browse files
committed
Fix 43 customization and add example
1 parent 0809e37 commit 7edd34a

File tree

3 files changed

+149
-4
lines changed

3 files changed

+149
-4
lines changed

caltechdata_api/customize_schema.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ def customize_schema_43(json_record):
9090
alt = []
9191
for identifier in json_record["identifiers"]:
9292
if identifier["identifierType"] == "DOI":
93-
json_record["doi"] = identifier
93+
json_record["doi"] = identifier['identifier']
9494
else:
9595
alt.append(identifier)
9696
if alt != []:
9797
json_record["alternativeIdentifiers"] = alt
98-
del json_record["identifier"]
98+
del json_record["identifiers"]
9999

100100
# change author formatting
101101
# We're dropping URIs
@@ -159,6 +159,10 @@ def customize_schema_43(json_record):
159159
for funding in json_record["fundingReferences"]:
160160
if "awardNumber" in funding:
161161
funding["awardNumber"] = {"awardNumber": funding["awardNumber"]}
162+
if 'funderIdentifier' in funding:
163+
funding['funderIdentifier'] = {'funderIdentifier':
164+
funding['funderIdentifier']}
165+
162166

163167
# resourceTypeGeneral
164168
typeg = json_record["types"]["resourceTypeGeneral"]

codemeta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"codeRepository": "https://github.com/caltechlibrary/caltechdata_api",
77
"issueTracker": "https://github.com/caltechlibrary/caltechdata_api/issues",
88
"license": "https://data.caltech.edu/license",
9-
"version": "0.1.8",
9+
"version": "0.1.10",
1010
"author": [
1111
{
1212
"@type": "Person",
@@ -18,7 +18,7 @@
1818
}],
1919
"developmentStatus": "active",
2020
"downloadUrl":
21-
"https://github.com/caltechlibrary/caltechdata_api/archive/0.1.5.zip",
21+
"https://github.com/caltechlibrary/caltechdata_api/archive/0.1.10.zip",
2222
"keywords": [
2323
"GitHub",
2424
"metadata",

example43.json

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
"identifiers": [
3+
{
4+
"identifier": "10.14291/1",
5+
"identifierType": "DOI"
6+
}],
7+
"alternateIdentifiers": [
8+
{
9+
"alternateIdentifier": "Alt_Identifier",
10+
"alternateIdentifierType": "Alt_Identifier_Type"
11+
}
12+
],
13+
"contributors": [
14+
{
15+
"nameType": "Personal",
16+
"affiliation": [
17+
{
18+
"name": "DataCite",
19+
"affiliationIdentifier": "https://ror.org/04wxnsj81",
20+
"affiliationIdentifierScheme": "ROR"
21+
}
22+
],
23+
"name": "Contributor Name",
24+
"contributorType": "ContactPerson",
25+
"nameIdentifiers": [
26+
{
27+
"nameIdentifier": "Contributor Identifier",
28+
"nameIdentifierScheme": "GRID",
29+
"schemeUri": "https://www.grid.ac/institutes/"
30+
}
31+
]
32+
}
33+
],
34+
"creators": [
35+
{
36+
"nameType": "Personal",
37+
"affiliation": [
38+
{
39+
"name": "DataCite",
40+
"affiliationIdentifier": "https://ror.org/04wxnsj81",
41+
"affiliationIdentifierScheme": "ROR"
42+
}
43+
],
44+
"name": "Name",
45+
"familyName": "Family Name",
46+
"givenName": "Given Name",
47+
"nameIdentifiers": [
48+
{
49+
"nameIdentifier": "Name Identifier",
50+
"nameIdentifierScheme": "ORCID",
51+
"schemeUri": "http://orcid.org/"
52+
}
53+
]
54+
}
55+
],
56+
"dates": [
57+
{
58+
"date": "2014-10-01",
59+
"dateType": "Created"
60+
},
61+
{
62+
"date": "2017-03-01",
63+
"dateType": "Updated"
64+
},
65+
{
66+
"date": "2012-05-22/2016-12-21",
67+
"dateType": "Collected"
68+
}
69+
],
70+
"descriptions": [
71+
{
72+
"description": "Description",
73+
"descriptionType": "Abstract"
74+
}
75+
],
76+
"formats": [
77+
"format"
78+
],
79+
"fundingReferences": [
80+
{
81+
"awardTitle": "Measurement of Column-Averaged CO2",
82+
"funderName": "National Aeronautics and Space Administration",
83+
"funderIdentifierType": "GRID",
84+
"funderIdentifier": "grid.238252.c",
85+
"awardNumber": "NAG5-12247"
86+
}
87+
],
88+
"geoLocations": [
89+
{
90+
"geoLocationPlace": "Place Name",
91+
"geoLocationPoint": {
92+
"pointLatitude": "0.000",
93+
"pointLongitude": "0.000"
94+
}
95+
}
96+
],
97+
"language": "en",
98+
"publicationYear": "2017",
99+
"publisher": "Publisher",
100+
"relatedIdentifiers": [
101+
{
102+
"relatedIdentifier": "http://www.url.org/",
103+
"relatedIdentifierType": "URL",
104+
"relationType": "IsPartOf"
105+
},
106+
{
107+
"relatedIdentifier": "10.5072/FK2",
108+
"relatedIdentifierType": "DOI",
109+
"relationType": "IsDocumentedBy"
110+
}
111+
],
112+
"types": {
113+
"resourceTypeGeneral": "Dataset",
114+
"resourceType": "Dataset"
115+
},
116+
"rightsList": [
117+
{
118+
"rights": "Rights Name",
119+
"rightsURI": "Rights List"
120+
}
121+
],
122+
"subjects": [
123+
{
124+
"subject": "subject1"
125+
},
126+
{
127+
"subject": "subject2"
128+
}
129+
],
130+
"titles": [
131+
{
132+
"title": "Title"
133+
},
134+
{
135+
"title": "Alternative Title",
136+
"titleType": "AlternativeTitle"
137+
}
138+
],
139+
"version": "0",
140+
"schemaVersion": "http://datacite.org/schema/kernel-4"
141+
}

0 commit comments

Comments
 (0)