commonmeta-py 0.89__py3-none-any.whl → 0.91__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- commonmeta/__init__.py +1 -1
- commonmeta/readers/json_feed_reader.py +29 -4
- {commonmeta_py-0.89.dist-info → commonmeta_py-0.91.dist-info}/METADATA +1 -1
- {commonmeta_py-0.89.dist-info → commonmeta_py-0.91.dist-info}/RECORD +7 -7
- {commonmeta_py-0.89.dist-info → commonmeta_py-0.91.dist-info}/WHEEL +0 -0
- {commonmeta_py-0.89.dist-info → commonmeta_py-0.91.dist-info}/entry_points.txt +0 -0
- {commonmeta_py-0.89.dist-info → commonmeta_py-0.91.dist-info}/licenses/LICENSE +0 -0
commonmeta/__init__.py
CHANGED
@@ -13,6 +13,7 @@ from ..utils import (
|
|
13
13
|
dict_to_spdx,
|
14
14
|
name_to_fos,
|
15
15
|
validate_ror,
|
16
|
+
validate_url,
|
16
17
|
issn_as_url,
|
17
18
|
)
|
18
19
|
from ..author_utils import get_authors
|
@@ -230,6 +231,7 @@ def get_funding_references(meta: Optional[dict]) -> Optional[list]:
|
|
230
231
|
elif len(urls) == 2 and validate_prefix(urls[0]) == "10.13039":
|
231
232
|
if urls[0] == "https://doi.org/10.13039/100000001":
|
232
233
|
funder_name = "National Science Foundation"
|
234
|
+
funder_identifier = "https://ror.org/021nxhr62"
|
233
235
|
else:
|
234
236
|
funder_name = None
|
235
237
|
f = furl(urls[1])
|
@@ -242,8 +244,8 @@ def get_funding_references(meta: Optional[dict]) -> Optional[list]:
|
|
242
244
|
compact(
|
243
245
|
{
|
244
246
|
"funderName": funder_name,
|
245
|
-
"funderIdentifier":
|
246
|
-
"funderIdentifierType": "
|
247
|
+
"funderIdentifier": funder_identifier,
|
248
|
+
"funderIdentifierType": "ROR",
|
247
249
|
"awardUri": urls[1],
|
248
250
|
"awardNumber": award_number,
|
249
251
|
}
|
@@ -286,12 +288,35 @@ def get_funding_references(meta: Optional[dict]) -> Optional[list]:
|
|
286
288
|
if i.get("type", None) == "HasAward"
|
287
289
|
]
|
288
290
|
)
|
291
|
+
def format_funding_reference(funding: dict) -> dict:
|
292
|
+
"""format funding reference. Make sure award URI is either a DOI or URL"""
|
293
|
+
|
294
|
+
award_uri = funding.get("awardUri", None)
|
295
|
+
if validate_url(funding.get("awardUri", None)) not in ["DOI", "URL"]:
|
296
|
+
award_uri = None
|
297
|
+
funder_identifier = funding.get("funderIdentifier", None)
|
298
|
+
funder_identifier_type = funding.get("funderIdentifierType", None)
|
299
|
+
if not funder_identifier_type and validate_ror(
|
300
|
+
funding.get("funderIdentifier", None)
|
301
|
+
):
|
302
|
+
funder_identifier_type = "ROR"
|
303
|
+
|
304
|
+
return compact(
|
305
|
+
{
|
306
|
+
"funderName": funding.get("funderName", None),
|
307
|
+
"funderIdentifier": funder_identifier,
|
308
|
+
"funderIdentifierType": funder_identifier_type,
|
309
|
+
"awardTitle": funding.get("awardTitle", None),
|
310
|
+
"awardNumber": funding.get("awardNumber", None),
|
311
|
+
"awardUri": award_uri,
|
312
|
+
}
|
313
|
+
)
|
289
314
|
funding_references = py_.get(meta, "funding_references")
|
290
315
|
if funding_references is not None:
|
291
|
-
awards += [
|
316
|
+
awards += [format_funding_reference(i) for i in funding_references if i.get("funderName", None)]
|
292
317
|
|
293
318
|
awards += wrap(py_.get(meta, "blog.funding"))
|
294
|
-
return awards
|
319
|
+
return py_.uniq(awards)
|
295
320
|
|
296
321
|
|
297
322
|
def get_relations(relations: Optional[list]) -> Optional[list]:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: commonmeta-py
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.91
|
4
4
|
Summary: Library for conversions to/from the Commonmeta scholarly metadata format
|
5
5
|
Project-URL: Homepage, https://python.commonmeta.org
|
6
6
|
Project-URL: Repository, https://github.com/front-matter/commonmeta-py
|
@@ -1,4 +1,4 @@
|
|
1
|
-
commonmeta/__init__.py,sha256=
|
1
|
+
commonmeta/__init__.py,sha256=Z2tINoXodJGwjrvj8fZzV3Wf7IVLPcAZHw6jNNE-oMo,1911
|
2
2
|
commonmeta/api_utils.py,sha256=-ZHGVZZhJqnjnsLtp4-PoeHYbDqL0cQme7W70BEjo4U,2677
|
3
3
|
commonmeta/author_utils.py,sha256=1oQQfxaq7aMQI3rLt8XMufksuBeC8Zht96aJ8vz09Ug,8459
|
4
4
|
commonmeta/base_utils.py,sha256=AsUElA5kT2fw_Osy7Uaj2F6MKeq9yB7d5f2V-h2lh7c,3750
|
@@ -22,7 +22,7 @@ commonmeta/readers/csl_reader.py,sha256=ynqJeqK9TlHFsmgMREPmKGlcj6tVycpnqDN0N0Lj
|
|
22
22
|
commonmeta/readers/datacite_reader.py,sha256=CdOtxhthrakBoQMsLTdPx6sUCmqtEWo5ICYE6ZsWDdo,12026
|
23
23
|
commonmeta/readers/datacite_xml_reader.py,sha256=nhnO92fZihr1HZlbXjyem-HJXc9_DWLgJ2zeltuPMIg,13041
|
24
24
|
commonmeta/readers/inveniordm_reader.py,sha256=F0syoLZ3amzkrEk8efb9WxwhMDY8QM8ctOH32E3fGqM,8358
|
25
|
-
commonmeta/readers/json_feed_reader.py,sha256=
|
25
|
+
commonmeta/readers/json_feed_reader.py,sha256=E1IAXjuKGK3fExl6uRmzTpoZghEytO6JKC-2D3i-aq4,14409
|
26
26
|
commonmeta/readers/kbase_reader.py,sha256=ehKXQsJyPCtaq2FmBxNb2Jb5Nktpx8pNscpmEM6N0A4,6763
|
27
27
|
commonmeta/readers/ris_reader.py,sha256=v6qOd-i2OcMTEFy5RGd3MlYthJcYSU6yzmZ5yHDzmII,3677
|
28
28
|
commonmeta/readers/schema_org_reader.py,sha256=78vYWCZqrYevZsSbx7oVVLm3mlNzi323WNW5E_PL9o0,17234
|
@@ -70,8 +70,8 @@ commonmeta/writers/datacite_writer.py,sha256=UpDp4Brg5xrmS5T3QYoNi6PPXKdRxAo254e
|
|
70
70
|
commonmeta/writers/inveniordm_writer.py,sha256=-GsTcVMPlbbB9kSTmHP00ZJ1aHIbA21K0LkcuPWBMm8,11429
|
71
71
|
commonmeta/writers/ris_writer.py,sha256=AcnCszS3WY9lF594NbFBtLylsA8ownnYp_XLQJ84Ios,2093
|
72
72
|
commonmeta/writers/schema_org_writer.py,sha256=5j002uCNLdlScZMNQmPjodcVWqaBh2z38zL1H4lo2hY,5741
|
73
|
-
commonmeta_py-0.
|
74
|
-
commonmeta_py-0.
|
75
|
-
commonmeta_py-0.
|
76
|
-
commonmeta_py-0.
|
77
|
-
commonmeta_py-0.
|
73
|
+
commonmeta_py-0.91.dist-info/METADATA,sha256=65-gfoa34ZG1A-WhWpN5-BJMeXCuJxdQigKFvJFFSI4,7429
|
74
|
+
commonmeta_py-0.91.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
75
|
+
commonmeta_py-0.91.dist-info/entry_points.txt,sha256=U4w4BoRuS3rN5t5Y-uYSyOeU5Lh_VRVMS9OIDzIgw4w,50
|
76
|
+
commonmeta_py-0.91.dist-info/licenses/LICENSE,sha256=746hEF2wZCKkcckk5-_DcBLtHewfaEMS4iXTlA1PVwk,1074
|
77
|
+
commonmeta_py-0.91.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|