commonmeta-py 0.30__py3-none-any.whl → 0.31__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/writers/inveniordm_writer.py +22 -10
- {commonmeta_py-0.30.dist-info → commonmeta_py-0.31.dist-info}/METADATA +1 -1
- {commonmeta_py-0.30.dist-info → commonmeta_py-0.31.dist-info}/RECORD +7 -7
- {commonmeta_py-0.30.dist-info → commonmeta_py-0.31.dist-info}/LICENSE +0 -0
- {commonmeta_py-0.30.dist-info → commonmeta_py-0.31.dist-info}/WHEEL +0 -0
- {commonmeta_py-0.30.dist-info → commonmeta_py-0.31.dist-info}/entry_points.txt +0 -0
commonmeta/__init__.py
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
"""InvenioRDM writer for commonmeta-py"""
|
2
2
|
|
3
3
|
import orjson as json
|
4
|
-
import pydash as py_
|
5
4
|
|
6
|
-
from ..
|
7
|
-
from ..
|
8
|
-
from ..doi_utils import doi_from_url
|
5
|
+
from ..base_utils import compact, wrap, parse_attributes
|
6
|
+
from ..date_utils import get_iso8601_date
|
7
|
+
from ..doi_utils import doi_from_url
|
9
8
|
from ..constants import CM_TO_INVENIORDM_TRANSLATIONS
|
10
|
-
from ..utils import
|
9
|
+
from ..utils import get_language, validate_orcid
|
11
10
|
|
12
11
|
|
13
12
|
def write_inveniordm(metadata):
|
@@ -40,6 +39,8 @@ def write_inveniordm(metadata):
|
|
40
39
|
if container.get("identifierType", None) == "ISSN"
|
41
40
|
else None
|
42
41
|
)
|
42
|
+
|
43
|
+
subjects = [to_inveniordm_subject(i) for i in wrap(metadata.subjects)]
|
43
44
|
data = compact(
|
44
45
|
{
|
45
46
|
"pids": {
|
@@ -60,15 +61,16 @@ def write_inveniordm(metadata):
|
|
60
61
|
"publisher": metadata.publisher.get("name", None)
|
61
62
|
if metadata.publisher
|
62
63
|
else None,
|
63
|
-
"publication_date": metadata.date.get("published")
|
64
|
+
"publication_date": get_iso8601_date(metadata.date.get("published"))
|
64
65
|
if metadata.date.get("published", None)
|
65
66
|
else None,
|
66
67
|
"dates": [
|
67
|
-
{
|
68
|
+
{
|
69
|
+
"date": metadata.date.get("updated"),
|
70
|
+
"type": {"id": "updated"},
|
71
|
+
}
|
68
72
|
],
|
69
|
-
"subjects":
|
70
|
-
wrap(metadata.subjects), content="subject", first=False
|
71
|
-
),
|
73
|
+
"subjects": subjects,
|
72
74
|
"description": parse_attributes(
|
73
75
|
metadata.descriptions, content="description", first=True
|
74
76
|
),
|
@@ -124,3 +126,13 @@ def to_inveniordm_creator(creator: dict) -> dict:
|
|
124
126
|
}
|
125
127
|
)
|
126
128
|
}
|
129
|
+
|
130
|
+
|
131
|
+
def to_inveniordm_subject(subject: dict) -> dict:
|
132
|
+
"""Convert subjects to inveniordm subjects"""
|
133
|
+
return compact(
|
134
|
+
{
|
135
|
+
"id": subject.get("id", None),
|
136
|
+
"subject": subject.get("subject", None),
|
137
|
+
}
|
138
|
+
)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
commonmeta/__init__.py,sha256=
|
1
|
+
commonmeta/__init__.py,sha256=FFfOmC3JZbNBVQtBjbddrKFTgL3cPfQIpScMhdA3qZk,1779
|
2
2
|
commonmeta/api_utils.py,sha256=-ZHGVZZhJqnjnsLtp4-PoeHYbDqL0cQme7W70BEjo4U,2677
|
3
3
|
commonmeta/author_utils.py,sha256=zBIPTgP5n7Zx57xomJ2h7x0dvC0AV8gJ2gPoYeDy5Lo,8348
|
4
4
|
commonmeta/base_utils.py,sha256=0t6fr9XGeeTBoMlKSAMI7p_EmKsA6wYRW0roEBXVcc8,3722
|
@@ -65,11 +65,11 @@ commonmeta/writers/commonmeta_writer.py,sha256=2qlttCfYpGhfVjrYkjzbIra7AywssRLT3
|
|
65
65
|
commonmeta/writers/crossref_xml_writer.py,sha256=0Ds494RnXfdfjWw5CLX1kwV2zP7gqffdVqO-X74Uc6c,492
|
66
66
|
commonmeta/writers/csl_writer.py,sha256=rlCeShkvC6ui9By0yVfNCMay_JfaZ4AooUPOPg-g-2M,2819
|
67
67
|
commonmeta/writers/datacite_writer.py,sha256=G7Lr0aZ4sAEdbfXe3dG4Y6AyGUKA9UWr_iiaQRDnV24,6233
|
68
|
-
commonmeta/writers/inveniordm_writer.py,sha256=
|
68
|
+
commonmeta/writers/inveniordm_writer.py,sha256=rreqnyZOq-XE51SkmAWGYrQ6OaNvIYblcQVVUivcYyc,4725
|
69
69
|
commonmeta/writers/ris_writer.py,sha256=AcnCszS3WY9lF594NbFBtLylsA8ownnYp_XLQJ84Ios,2093
|
70
70
|
commonmeta/writers/schema_org_writer.py,sha256=5j002uCNLdlScZMNQmPjodcVWqaBh2z38zL1H4lo2hY,5741
|
71
|
-
commonmeta_py-0.
|
72
|
-
commonmeta_py-0.
|
73
|
-
commonmeta_py-0.
|
74
|
-
commonmeta_py-0.
|
75
|
-
commonmeta_py-0.
|
71
|
+
commonmeta_py-0.31.dist-info/LICENSE,sha256=746hEF2wZCKkcckk5-_DcBLtHewfaEMS4iXTlA1PVwk,1074
|
72
|
+
commonmeta_py-0.31.dist-info/METADATA,sha256=zJ8DGELyt5duoMd6t7UebZE83w6clxAAXZEJt9sKQic,8331
|
73
|
+
commonmeta_py-0.31.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
74
|
+
commonmeta_py-0.31.dist-info/entry_points.txt,sha256=vbcDw3_2lMTKdcAL2VUF4DRYRpKuzXVYLMCdgKVf88U,49
|
75
|
+
commonmeta_py-0.31.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|