invenio-vocabularies 6.2.0__py2.py3-none-any.whl → 6.3.0__py2.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.

Potentially problematic release.


This version of invenio-vocabularies might be problematic. Click here for more details.

@@ -10,6 +10,6 @@
10
10
 
11
11
  from .ext import InvenioVocabularies
12
12
 
13
- __version__ = "6.2.0"
13
+ __version__ = "6.3.0"
14
14
 
15
15
  __all__ = ("__version__", "InvenioVocabularies")
@@ -211,6 +211,56 @@ class CORDISProjectTransformer(BaseTransformer):
211
211
 
212
212
  award["organizations"].append(organization_data)
213
213
 
214
+ programmes = (
215
+ record.get("relations", {}).get("associations", {}).get("programme", {})
216
+ )
217
+ if programmes:
218
+ # Projects with a single programme (this is the case of some projects in FP7) are not wrapped in a list,
219
+ # so we do this here to be able to iterate over it.
220
+ programmes = programmes if isinstance(programmes, list) else [programmes]
221
+
222
+ programmes_related_legal_basis = [
223
+ {
224
+ "code": programme["code"],
225
+ "uniqueprogrammepart": programme.get("@uniqueprogrammepart"),
226
+ }
227
+ for programme in programmes
228
+ if programme.get("@type") == "relatedLegalBasis"
229
+ ]
230
+
231
+ if len(programmes_related_legal_basis) == 0:
232
+ raise TransformerError(
233
+ _(
234
+ "No related legal basis programme found for project {project_id}".format(
235
+ project_id=record["id"]
236
+ )
237
+ )
238
+ )
239
+ elif len(programmes_related_legal_basis) == 1:
240
+ # FP7 projects have only one related legal basis programme and do not have a 'uniqueprogrammepart' field.
241
+ unique_programme_related_legal_basis = programmes_related_legal_basis[0]
242
+ elif len(programmes_related_legal_basis) >= 1:
243
+ # The entry with the field 'uniqueprogrammepart' == 'true' is the high level programme code,
244
+ # while the other entry is a more specific sub-programme.
245
+ unique_programme_related_legal_basis = [
246
+ programme_related_legal_basis
247
+ # A few H2020 projects have more than one 'uniqueprogrammepart' == 'true',
248
+ # for instance https://cordis.europa.eu/project/id/825673 (showing as "main programme" in the page)
249
+ # which has one entry with the code 'H2020-EU.1.2.',
250
+ # and one with the code 'H2020-EU.1.2.3.'.
251
+ # We sort them from the shortest code to the longest code, and take the first item,
252
+ # so that it conforms more with other projects which all have the shortest code as the main one.
253
+ for programme_related_legal_basis in sorted(
254
+ programmes_related_legal_basis, key=lambda d: len(d["code"])
255
+ )
256
+ if programme_related_legal_basis["uniqueprogrammepart"] == "true"
257
+ ][0]
258
+
259
+ # Store the code of the programme.
260
+ # For instance the code "HORIZON.1.2" which means "Marie Skłodowska-Curie Actions (MSCA)"
261
+ # See https://cordis.europa.eu/programme/id/HORIZON.1.2
262
+ award["program"] = unique_programme_related_legal_basis["code"]
263
+
214
264
  stream_entry.entry = award
215
265
  return stream_entry
216
266
 
@@ -222,7 +272,7 @@ class CORDISAwardsServiceWriter(ServiceWriter):
222
272
  """Constructor."""
223
273
  service_or_name = kwargs.pop("service_or_name", "awards")
224
274
  # Here we only update and we do not insert, since CORDIS data is used to augment existing awards
225
- # (with subjects and organizations information) and is not used to create new awards.
275
+ # (with subjects, organizations, and program information) and is not used to create new awards.
226
276
  super().__init__(
227
277
  service_or_name=service_or_name, insert=False, update=True, *args, **kwargs
228
278
  )
@@ -160,6 +160,8 @@ class RORTransformer(BaseTransformer):
160
160
  acronym = name["value"]
161
161
  else:
162
162
  aliases.add(name["value"])
163
+ if "en" not in ror["title"]:
164
+ ror["title"]["en"] = ror["name"]
163
165
  if acronym:
164
166
  ror["acronym"] = acronym
165
167
  if aliases:
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2021-2022 CERN.
3
+ # Copyright (C) 2021-2024 CERN.
4
4
  #
5
5
  # Invenio-Vocabularies is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the MIT License; see LICENSE file for more
@@ -60,8 +60,10 @@ class ProcessRORAffiliationsJob(ProcessDataStreamJob):
60
60
  if since is None and job_obj.last_runs["success"]:
61
61
  since = job_obj.last_runs["success"].started_at
62
62
  else:
63
- since = datetime.datetime.now()
63
+ since = since or datetime.datetime.now()
64
64
 
65
+ # NOTE: Update is set to False for now given we don't have the logic to re-index dependent records yet.
66
+ # Since jobs support custom args, update true can be passed via that.
65
67
  return {
66
68
  "config": {
67
69
  "readers": [
@@ -77,7 +79,7 @@ class ProcessRORAffiliationsJob(ProcessDataStreamJob):
77
79
  "args": {
78
80
  "writer": {
79
81
  "type": "affiliations-service",
80
- "args": {"update": True},
82
+ "args": {"update": False},
81
83
  }
82
84
  },
83
85
  "type": "async",
@@ -86,3 +88,46 @@ class ProcessRORAffiliationsJob(ProcessDataStreamJob):
86
88
  "transformers": [{"type": "ror-affiliations"}],
87
89
  }
88
90
  }
91
+
92
+
93
+ class ProcessRORFundersJob(ProcessDataStreamJob):
94
+ """Process ROR funders datastream registered task."""
95
+
96
+ description = "Process ROR funders"
97
+ title = "Load ROR funders"
98
+ id = "process_ror_funders"
99
+
100
+ @classmethod
101
+ def default_args(cls, job_obj, since=None, **kwargs):
102
+ """Generate default job arguments here."""
103
+ if since is None and job_obj.last_runs["success"]:
104
+ since = job_obj.last_runs["success"].started_at
105
+ else:
106
+ since = since or datetime.datetime.now()
107
+
108
+ # NOTE: Update is set to False for now given we don't have the logic to re-index dependent records yet.
109
+ # Since jobs support custom args, update true can be passed via that.
110
+ return {
111
+ "config": {
112
+ "readers": [
113
+ {
114
+ "args": {"since": since},
115
+ "type": "ror-http",
116
+ },
117
+ {"args": {"regex": "_schema_v2\\.json$"}, "type": "zip"},
118
+ {"type": "json"},
119
+ ],
120
+ "writers": [
121
+ {
122
+ "args": {
123
+ "writer": {
124
+ "type": "funders-service",
125
+ "args": {"update": False},
126
+ }
127
+ },
128
+ "type": "async",
129
+ }
130
+ ],
131
+ "transformers": [{"type": "ror-funders"}],
132
+ }
133
+ }
@@ -35,7 +35,7 @@ theme = WebpackThemeBundle(
35
35
  "react-dropzone": "^11.0.0",
36
36
  "react-i18next": "^11.11.0",
37
37
  "react-invenio-forms": "^4.0.0",
38
- "react-searchkit": "^2.0.0",
38
+ "react-searchkit": "^3.0.0",
39
39
  "yup": "^0.32.0",
40
40
  },
41
41
  aliases={
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: invenio-vocabularies
3
- Version: 6.2.0
3
+ Version: 6.3.0
4
4
  Summary: Invenio module for managing vocabularies.
5
5
  Home-page: https://github.com/inveniosoftware/invenio-vocabularies
6
6
  Author: CERN
@@ -83,6 +83,17 @@ https://invenio-vocabularies.readthedocs.io/
83
83
  Changes
84
84
  =======
85
85
 
86
+ Version v6.3.0 (released 2024-10-11)
87
+
88
+ - awards: get program from CORDIS
89
+ - fix: add 'en' title if missing ROR
90
+ - fix: since not passed to args
91
+ - jobs: add process funders job
92
+
93
+ Version v6.2.1 (released 2024-10-10)
94
+
95
+ - webpack: bump react-searchkit due to axios upgrade
96
+
86
97
  Version v6.2.0 (released 2024-10-10)
87
98
 
88
99
  - tests: update axios version (needed only for local js tests)
@@ -1,13 +1,13 @@
1
- invenio_vocabularies/__init__.py,sha256=3owW-TfH2DDgOkGa0ObjwTskfWvOzTJH9ZqJap3QH2A,377
1
+ invenio_vocabularies/__init__.py,sha256=uT7gvYe4pp5fuXqR4Kh8SNLYVi0ZRPcdav187WrWiyk,377
2
2
  invenio_vocabularies/cli.py,sha256=S3lBsLxsSYa83sCDaGZr5mP7TwPvmmwxzzbB13h8VBI,5856
3
3
  invenio_vocabularies/config.py,sha256=bpNKVgwfb7bgkP5zbmoawnAMD6bHWXIJV-6CpEhi-M8,5752
4
4
  invenio_vocabularies/ext.py,sha256=GujJ4UARd4Fxf4z7zznRk9JAgHamZuYCOdrKU5czg00,5987
5
5
  invenio_vocabularies/factories.py,sha256=mVg4yGKe58e4uS8rYe0DmIO6oMpmtNTcK3wH9eM5jVU,4380
6
6
  invenio_vocabularies/fixtures.py,sha256=nNWwH04HFASjfj1oy5kMdcQGKmVjzUuA5wSw-ER1QAg,1585
7
- invenio_vocabularies/jobs.py,sha256=QBWgScrUlKJagpOvwXN12G1OsvW6NM-IFKRgkbW_edg,2549
7
+ invenio_vocabularies/jobs.py,sha256=yPK4HDnJI9vP7rAnRUXhZPRKfiznOUaO-FJU7RMjGQ0,4275
8
8
  invenio_vocabularies/proxies.py,sha256=k7cTUgWfnCoYIuNqAj_VFi1zBN33KNNclRSVnBkObEM,711
9
9
  invenio_vocabularies/views.py,sha256=PNJ5nvc3O7ASwNe56xmqy5YaU9n3UYF3W2JwvtE_kYs,1561
10
- invenio_vocabularies/webpack.py,sha256=bp2vz3O8QdZwrznsV-SjAmS0g1nV9WGWqc-7ZJQY5PQ,1891
10
+ invenio_vocabularies/webpack.py,sha256=hzTM0qx6iiRHkmjti53yuZ5ebfPMR5mpO9uNewBat74,1891
11
11
  invenio_vocabularies/administration/__init__.py,sha256=0bDp2Aw8aZth7C-q9Xn9rxeCUQQRoIUxoWWWwPvKbXA,308
12
12
  invenio_vocabularies/administration/views/__init__.py,sha256=31DP4jLG6q4HQlzSRiGLPxUjHPUCCl4N34y4XMuPP6g,313
13
13
  invenio_vocabularies/administration/views/vocabularies.py,sha256=JyKr1OYF9DO89zvWCNOtNfClO_QptdHdjvgY1kkImnw,1290
@@ -68,7 +68,7 @@ invenio_vocabularies/contrib/awards/__init__.py,sha256=KwCmwFalz-3pDs9iTa5TKUidB
68
68
  invenio_vocabularies/contrib/awards/api.py,sha256=OXukE7PLXs45BTtqVrhvGBNqLmQaI-CgXmHTCi36LZk,303
69
69
  invenio_vocabularies/contrib/awards/awards.py,sha256=tOLvcvTPiN1gn1QAl-hSh1bwcclg8Kx2ZMmJMEhI7vk,2959
70
70
  invenio_vocabularies/contrib/awards/config.py,sha256=PlDHabkWDUzwa1Fvk_U2hG83kQYBqM1IyChg8Yg_VlY,1630
71
- invenio_vocabularies/contrib/awards/datastreams.py,sha256=j6dtimniWg9faHzV1J49QpAgUJDDW3rjQR0_Mhcfqm4,11147
71
+ invenio_vocabularies/contrib/awards/datastreams.py,sha256=k7GtQ0pmY9EehYUtus45G6opJb8v2Kc63YIn5zO4SU8,14004
72
72
  invenio_vocabularies/contrib/awards/models.py,sha256=mM-kSNf7kDH3oIbV8epxxbUi7muYqi4JreXxgWXlVzw,318
73
73
  invenio_vocabularies/contrib/awards/resources.py,sha256=_9YTqbhz8axFXGhG5y4WyjE27p9n-7e3c6HoBRditPA,411
74
74
  invenio_vocabularies/contrib/awards/schema.py,sha256=P_k9EONMMx0eWpALVuhGBzZlDeh4599elLlmMis-Vko,3302
@@ -87,7 +87,7 @@ invenio_vocabularies/contrib/common/__init__.py,sha256=DdbGYRthEpQtObhY_YK4vOT9Z
87
87
  invenio_vocabularies/contrib/common/openaire/__init__.py,sha256=L7UtSimFJ3NI6j53bHzYKsWpFti1uo4fPb9OaTl7leI,244
88
88
  invenio_vocabularies/contrib/common/openaire/datastreams.py,sha256=BV6NtBCPFuii6KbTHGkgNQO5tt_3Hn9T_219bz8AINg,3514
89
89
  invenio_vocabularies/contrib/common/ror/__init__.py,sha256=3u2-fre1SQ-4nz3Ay0nxj3ntmMZ8Ujh_4eV-fyxfmtc,239
90
- invenio_vocabularies/contrib/common/ror/datastreams.py,sha256=arhB2OKu3Hl0Sn6urTxBQh_kim4oc9TTMRAwzi4pbXE,8057
90
+ invenio_vocabularies/contrib/common/ror/datastreams.py,sha256=wHpJy5mRKgJ4nQ7IniLyjxoxjTCZKHaEKKKr_OKrqFM,8139
91
91
  invenio_vocabularies/contrib/funders/__init__.py,sha256=YxFXBDnT7NM8rFwxT_Ge3xXR2n17EM0alknQq7r_Bt8,478
92
92
  invenio_vocabularies/contrib/funders/api.py,sha256=QKGGeSnPHSoBfucvpaVruXT_txYidofZ080G3IxFkIo,306
93
93
  invenio_vocabularies/contrib/funders/config.py,sha256=EU7UrwLOkr2Bem9Skz_HJIxyBQRkXEdPT8zIuV8vbzI,2217
@@ -297,10 +297,10 @@ invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo,sha256=g1I5aNO8r
297
297
  invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.po,sha256=vg8qC8ofpAdJ3mQz7mWM1ylKDpiNWXFs7rlMdSPkgKk,4629
298
298
  invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo,sha256=cqSm8NtMAwrP9O6qbmtkDtRT1e9D93qpsJN5X9_PPVw,600
299
299
  invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.po,sha256=9ACePz_EpB-LfcIJajZ2kp8Q04tcdrQLOtug162ZUss,4115
300
- invenio_vocabularies-6.2.0.dist-info/AUTHORS.rst,sha256=8d0p_WWE1r9DavvzMDi2D4YIGBHiMYcN3LYxqQOj8sY,291
301
- invenio_vocabularies-6.2.0.dist-info/LICENSE,sha256=UvI8pR8jGWqe0sTkb_hRG6eIrozzWwWzyCGEpuXX4KE,1062
302
- invenio_vocabularies-6.2.0.dist-info/METADATA,sha256=nmPiV7XQY2p8bV7PHfPV6oIWo5IHEKhrHKIijWiWfMk,9761
303
- invenio_vocabularies-6.2.0.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
304
- invenio_vocabularies-6.2.0.dist-info/entry_points.txt,sha256=qm4ydo2p2KWN3937X8argeeSHw-BX_IJ7gS11pkADEU,2903
305
- invenio_vocabularies-6.2.0.dist-info/top_level.txt,sha256=x1gRNbaODF_bCD0SBLM3nVOFPGi06cmGX5X94WKrFKk,21
306
- invenio_vocabularies-6.2.0.dist-info/RECORD,,
300
+ invenio_vocabularies-6.3.0.dist-info/AUTHORS.rst,sha256=8d0p_WWE1r9DavvzMDi2D4YIGBHiMYcN3LYxqQOj8sY,291
301
+ invenio_vocabularies-6.3.0.dist-info/LICENSE,sha256=UvI8pR8jGWqe0sTkb_hRG6eIrozzWwWzyCGEpuXX4KE,1062
302
+ invenio_vocabularies-6.3.0.dist-info/METADATA,sha256=9NYJRAerai4L9KSUjbnUV1O4CBk9ewHXpShhXi-PMTM,10027
303
+ invenio_vocabularies-6.3.0.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
304
+ invenio_vocabularies-6.3.0.dist-info/entry_points.txt,sha256=P9wLzJDDXGd4BEzRX4ylmnWge8wg_Q9jI0NBxNRVA2Q,2972
305
+ invenio_vocabularies-6.3.0.dist-info/top_level.txt,sha256=x1gRNbaODF_bCD0SBLM3nVOFPGi06cmGX5X94WKrFKk,21
306
+ invenio_vocabularies-6.3.0.dist-info/RECORD,,
@@ -51,6 +51,7 @@ invenio_vocabularies = invenio_vocabularies
51
51
 
52
52
  [invenio_jobs.jobs]
53
53
  process_ror_affiliations = invenio_vocabularies.jobs:ProcessRORAffiliationsJob
54
+ process_ror_funders = invenio_vocabularies.jobs:ProcessRORFundersJob
54
55
 
55
56
  [invenio_jsonschemas.schemas]
56
57
  affiliations = invenio_vocabularies.contrib.affiliations.jsonschemas