invenio-vocabularies 1.2.0__py2.py3-none-any.whl → 6.3.1__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.

Files changed (239) hide show
  1. invenio_vocabularies/__init__.py +2 -2
  2. invenio_vocabularies/administration/__init__.py +10 -0
  3. invenio_vocabularies/administration/views/__init__.py +10 -0
  4. invenio_vocabularies/administration/views/vocabularies.py +45 -0
  5. invenio_vocabularies/alembic/4a9a4fd235f8_create_vocabulary_schemes.py +4 -4
  6. invenio_vocabularies/alembic/4f365fced43f_create_vocabularies_tables.py +2 -2
  7. invenio_vocabularies/alembic/55a700f897b6_add_names_and_afiliations_pid_column.py +96 -0
  8. invenio_vocabularies/alembic/676dd587542d_create_funders_vocabulary_table.py +1 -1
  9. invenio_vocabularies/alembic/e1146238edd3_create_awards_table.py +1 -1
  10. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.eslintrc.yml +11 -0
  11. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.prettierrc +1 -0
  12. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/index.js +7 -0
  13. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/package.json +25 -0
  14. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/AwardResults.js +95 -0
  15. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js +139 -0
  16. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FunderDropdown.js +87 -0
  17. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js +223 -0
  18. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.test.js +1 -0
  19. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingFieldItem.js +152 -0
  20. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingModal.js +270 -0
  21. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/NoAwardResults.js +37 -0
  22. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/index.js +8 -0
  23. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/index.js +7 -0
  24. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/index.js +7 -0
  25. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/index.js +7 -0
  26. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/i18next-scanner.config.js +63 -0
  27. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/i18next.js +36 -0
  28. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/index.js +1 -0
  29. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/package.json +53 -0
  30. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/scripts/compileCatalog.js +39 -0
  31. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/scripts/initCatalog.js +19 -0
  32. invenio_vocabularies/cli.py +31 -44
  33. invenio_vocabularies/config.py +74 -7
  34. invenio_vocabularies/contrib/affiliations/affiliations.py +22 -6
  35. invenio_vocabularies/contrib/affiliations/api.py +1 -2
  36. invenio_vocabularies/contrib/affiliations/config.py +10 -5
  37. invenio_vocabularies/contrib/affiliations/datastreams.py +186 -0
  38. invenio_vocabularies/contrib/affiliations/facets.py +36 -0
  39. invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json +38 -7
  40. invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json +22 -1
  41. invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v2.0.0.json +171 -0
  42. invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json +22 -1
  43. invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v2.0.0.json +171 -0
  44. invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json +22 -1
  45. invenio_vocabularies/contrib/affiliations/schema.py +23 -5
  46. invenio_vocabularies/contrib/affiliations/services.py +1 -2
  47. invenio_vocabularies/contrib/awards/awards.py +18 -6
  48. invenio_vocabularies/contrib/awards/config.py +1 -3
  49. invenio_vocabularies/contrib/awards/datastreams.py +246 -3
  50. invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json +41 -0
  51. invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json +53 -1
  52. invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json +53 -1
  53. invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json +53 -1
  54. invenio_vocabularies/contrib/awards/schema.py +27 -35
  55. invenio_vocabularies/contrib/awards/serializer.py +9 -1
  56. invenio_vocabularies/contrib/awards/services.py +1 -2
  57. invenio_vocabularies/contrib/common/__init__.py +9 -0
  58. invenio_vocabularies/contrib/common/openaire/__init__.py +9 -0
  59. invenio_vocabularies/contrib/common/openaire/datastreams.py +84 -0
  60. invenio_vocabularies/contrib/common/ror/__init__.py +9 -0
  61. invenio_vocabularies/contrib/common/ror/datastreams.py +220 -0
  62. invenio_vocabularies/contrib/funders/config.py +12 -5
  63. invenio_vocabularies/contrib/funders/datastreams.py +40 -62
  64. invenio_vocabularies/contrib/funders/facets.py +13 -5
  65. invenio_vocabularies/contrib/funders/funders.py +4 -2
  66. invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json +36 -1
  67. invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json +22 -1
  68. invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v2.0.0.json +156 -0
  69. invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json +22 -1
  70. invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v2.0.0.json +156 -0
  71. invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json +22 -1
  72. invenio_vocabularies/contrib/funders/schema.py +8 -0
  73. invenio_vocabularies/contrib/funders/serializer.py +2 -1
  74. invenio_vocabularies/contrib/names/config.py +5 -3
  75. invenio_vocabularies/contrib/names/datastreams.py +177 -38
  76. invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json +2 -6
  77. invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json +3 -0
  78. invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v2.0.0.json +150 -0
  79. invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json +3 -0
  80. invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v2.0.0.json +150 -0
  81. invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json +3 -0
  82. invenio_vocabularies/contrib/names/names.py +29 -13
  83. invenio_vocabularies/contrib/names/permissions.py +20 -0
  84. invenio_vocabularies/contrib/names/s3client.py +44 -0
  85. invenio_vocabularies/contrib/names/schema.py +31 -4
  86. invenio_vocabularies/contrib/subjects/config.py +9 -3
  87. invenio_vocabularies/contrib/subjects/datastreams.py +61 -0
  88. invenio_vocabularies/contrib/subjects/euroscivoc/__init__.py +9 -0
  89. invenio_vocabularies/contrib/subjects/euroscivoc/datastreams.py +171 -0
  90. invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json +31 -0
  91. invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json +35 -0
  92. invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json +35 -0
  93. invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json +35 -0
  94. invenio_vocabularies/contrib/subjects/mesh/__init__.py +9 -0
  95. invenio_vocabularies/contrib/subjects/mesh/datastreams.py +43 -0
  96. invenio_vocabularies/contrib/subjects/schema.py +47 -5
  97. invenio_vocabularies/contrib/subjects/subjects.py +10 -0
  98. invenio_vocabularies/datastreams/datastreams.py +61 -13
  99. invenio_vocabularies/datastreams/factories.py +1 -2
  100. invenio_vocabularies/datastreams/readers.py +138 -29
  101. invenio_vocabularies/datastreams/tasks.py +37 -0
  102. invenio_vocabularies/datastreams/transformers.py +17 -27
  103. invenio_vocabularies/datastreams/writers.py +116 -14
  104. invenio_vocabularies/datastreams/xml.py +34 -0
  105. invenio_vocabularies/ext.py +59 -5
  106. invenio_vocabularies/factories.py +137 -0
  107. invenio_vocabularies/jobs.py +133 -0
  108. invenio_vocabularies/proxies.py +2 -2
  109. invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json +7 -0
  110. invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json +1 -4
  111. invenio_vocabularies/records/mappings/os-v1/vocabularies/vocabulary-v1.0.0.json +3 -3
  112. invenio_vocabularies/records/mappings/os-v2/vocabularies/vocabulary-v1.0.0.json +3 -3
  113. invenio_vocabularies/records/mappings/v7/vocabularies/vocabulary-v1.0.0.json +3 -3
  114. invenio_vocabularies/records/models.py +8 -10
  115. invenio_vocabularies/records/pidprovider.py +1 -2
  116. invenio_vocabularies/records/systemfields/relations.py +2 -2
  117. invenio_vocabularies/resources/__init__.py +9 -1
  118. invenio_vocabularies/resources/config.py +105 -0
  119. invenio_vocabularies/resources/resource.py +31 -41
  120. invenio_vocabularies/resources/schema.py +2 -1
  121. invenio_vocabularies/services/__init__.py +5 -2
  122. invenio_vocabularies/services/config.py +179 -0
  123. invenio_vocabularies/services/custom_fields/__init__.py +6 -2
  124. invenio_vocabularies/services/custom_fields/subject.py +82 -0
  125. invenio_vocabularies/services/custom_fields/vocabulary.py +19 -9
  126. invenio_vocabularies/services/facets.py +67 -37
  127. invenio_vocabularies/services/permissions.py +3 -1
  128. invenio_vocabularies/services/results.py +110 -0
  129. invenio_vocabularies/services/schema.py +39 -2
  130. invenio_vocabularies/services/service.py +46 -94
  131. invenio_vocabularies/services/tasks.py +1 -1
  132. invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/subjects.html +23 -0
  133. invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabularies-list.html +12 -0
  134. invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabulary-details.html +71 -0
  135. invenio_vocabularies/translations/af/LC_MESSAGES/messages.mo +0 -0
  136. invenio_vocabularies/translations/af/LC_MESSAGES/messages.po +1 -1
  137. invenio_vocabularies/translations/ar/LC_MESSAGES/messages.mo +0 -0
  138. invenio_vocabularies/translations/ar/LC_MESSAGES/messages.po +9 -8
  139. invenio_vocabularies/translations/bg/LC_MESSAGES/messages.mo +0 -0
  140. invenio_vocabularies/translations/bg/LC_MESSAGES/messages.po +1 -1
  141. invenio_vocabularies/translations/ca/LC_MESSAGES/messages.mo +0 -0
  142. invenio_vocabularies/translations/ca/LC_MESSAGES/messages.po +1 -1
  143. invenio_vocabularies/translations/cs/LC_MESSAGES/messages.mo +0 -0
  144. invenio_vocabularies/translations/cs/LC_MESSAGES/messages.po +1 -1
  145. invenio_vocabularies/translations/da/LC_MESSAGES/messages.mo +0 -0
  146. invenio_vocabularies/translations/da/LC_MESSAGES/messages.po +1 -1
  147. invenio_vocabularies/translations/de/LC_MESSAGES/messages.mo +0 -0
  148. invenio_vocabularies/translations/de/LC_MESSAGES/messages.po +1 -1
  149. invenio_vocabularies/translations/de_AT/LC_MESSAGES/messages.mo +0 -0
  150. invenio_vocabularies/translations/de_AT/LC_MESSAGES/messages.po +139 -0
  151. invenio_vocabularies/translations/de_DE/LC_MESSAGES/messages.mo +0 -0
  152. invenio_vocabularies/translations/de_DE/LC_MESSAGES/messages.po +139 -0
  153. invenio_vocabularies/translations/el/LC_MESSAGES/messages.mo +0 -0
  154. invenio_vocabularies/translations/el/LC_MESSAGES/messages.po +1 -1
  155. invenio_vocabularies/translations/en/LC_MESSAGES/messages.mo +0 -0
  156. invenio_vocabularies/translations/en_AT/LC_MESSAGES/messages.mo +0 -0
  157. invenio_vocabularies/translations/en_AT/LC_MESSAGES/messages.po +139 -0
  158. invenio_vocabularies/translations/en_HU/LC_MESSAGES/messages.mo +0 -0
  159. invenio_vocabularies/translations/en_HU/LC_MESSAGES/messages.po +139 -0
  160. invenio_vocabularies/translations/es/LC_MESSAGES/messages.mo +0 -0
  161. invenio_vocabularies/translations/es/LC_MESSAGES/messages.po +1 -1
  162. invenio_vocabularies/translations/es_CU/LC_MESSAGES/messages.mo +0 -0
  163. invenio_vocabularies/translations/es_CU/LC_MESSAGES/messages.po +139 -0
  164. invenio_vocabularies/translations/es_MX/LC_MESSAGES/messages.mo +0 -0
  165. invenio_vocabularies/translations/es_MX/LC_MESSAGES/messages.po +139 -0
  166. invenio_vocabularies/translations/et/LC_MESSAGES/messages.mo +0 -0
  167. invenio_vocabularies/translations/et/LC_MESSAGES/messages.po +1 -1
  168. invenio_vocabularies/translations/et_EE/LC_MESSAGES/messages.mo +0 -0
  169. invenio_vocabularies/translations/et_EE/LC_MESSAGES/messages.po +1 -1
  170. invenio_vocabularies/translations/fa/LC_MESSAGES/messages.mo +0 -0
  171. invenio_vocabularies/translations/fa/LC_MESSAGES/messages.po +1 -1
  172. invenio_vocabularies/translations/fa_IR/LC_MESSAGES/messages.mo +0 -0
  173. invenio_vocabularies/translations/fa_IR/LC_MESSAGES/messages.po +139 -0
  174. invenio_vocabularies/translations/fr/LC_MESSAGES/messages.mo +0 -0
  175. invenio_vocabularies/translations/fr/LC_MESSAGES/messages.po +1 -1
  176. invenio_vocabularies/translations/fr_CI/LC_MESSAGES/messages.mo +0 -0
  177. invenio_vocabularies/translations/fr_CI/LC_MESSAGES/messages.po +139 -0
  178. invenio_vocabularies/translations/fr_FR/LC_MESSAGES/messages.mo +0 -0
  179. invenio_vocabularies/translations/fr_FR/LC_MESSAGES/messages.po +139 -0
  180. invenio_vocabularies/translations/gl/LC_MESSAGES/messages.mo +0 -0
  181. invenio_vocabularies/translations/gl/LC_MESSAGES/messages.po +1 -1
  182. invenio_vocabularies/translations/hi_IN/LC_MESSAGES/messages.mo +0 -0
  183. invenio_vocabularies/translations/hi_IN/LC_MESSAGES/messages.po +139 -0
  184. invenio_vocabularies/translations/hr/LC_MESSAGES/messages.mo +0 -0
  185. invenio_vocabularies/translations/hr/LC_MESSAGES/messages.po +1 -1
  186. invenio_vocabularies/translations/hu/LC_MESSAGES/messages.mo +0 -0
  187. invenio_vocabularies/translations/hu/LC_MESSAGES/messages.po +4 -4
  188. invenio_vocabularies/translations/hu_HU/LC_MESSAGES/messages.mo +0 -0
  189. invenio_vocabularies/translations/hu_HU/LC_MESSAGES/messages.po +139 -0
  190. invenio_vocabularies/translations/it/LC_MESSAGES/messages.mo +0 -0
  191. invenio_vocabularies/translations/it/LC_MESSAGES/messages.po +4 -3
  192. invenio_vocabularies/translations/ja/LC_MESSAGES/messages.mo +0 -0
  193. invenio_vocabularies/translations/ja/LC_MESSAGES/messages.po +1 -1
  194. invenio_vocabularies/translations/ka/LC_MESSAGES/messages.mo +0 -0
  195. invenio_vocabularies/translations/ka/LC_MESSAGES/messages.po +1 -1
  196. invenio_vocabularies/translations/lt/LC_MESSAGES/messages.mo +0 -0
  197. invenio_vocabularies/translations/lt/LC_MESSAGES/messages.po +1 -1
  198. invenio_vocabularies/translations/messages.pot +95 -48
  199. invenio_vocabularies/translations/ne/LC_MESSAGES/messages.mo +0 -0
  200. invenio_vocabularies/translations/ne/LC_MESSAGES/messages.po +139 -0
  201. invenio_vocabularies/translations/no/LC_MESSAGES/messages.mo +0 -0
  202. invenio_vocabularies/translations/no/LC_MESSAGES/messages.po +1 -1
  203. invenio_vocabularies/translations/pl/LC_MESSAGES/messages.mo +0 -0
  204. invenio_vocabularies/translations/pl/LC_MESSAGES/messages.po +1 -1
  205. invenio_vocabularies/translations/pt/LC_MESSAGES/messages.mo +0 -0
  206. invenio_vocabularies/translations/pt/LC_MESSAGES/messages.po +1 -1
  207. invenio_vocabularies/translations/ro/LC_MESSAGES/messages.mo +0 -0
  208. invenio_vocabularies/translations/ro/LC_MESSAGES/messages.po +1 -1
  209. invenio_vocabularies/translations/ru/LC_MESSAGES/messages.mo +0 -0
  210. invenio_vocabularies/translations/ru/LC_MESSAGES/messages.po +1 -1
  211. invenio_vocabularies/translations/rw/LC_MESSAGES/messages.mo +0 -0
  212. invenio_vocabularies/translations/rw/LC_MESSAGES/messages.po +1 -1
  213. invenio_vocabularies/translations/sk/LC_MESSAGES/messages.mo +0 -0
  214. invenio_vocabularies/translations/sk/LC_MESSAGES/messages.po +1 -1
  215. invenio_vocabularies/translations/sv/LC_MESSAGES/messages.mo +0 -0
  216. invenio_vocabularies/translations/sv/LC_MESSAGES/messages.po +4 -3
  217. invenio_vocabularies/translations/sv_SE/LC_MESSAGES/messages.mo +0 -0
  218. invenio_vocabularies/translations/sv_SE/LC_MESSAGES/messages.po +139 -0
  219. invenio_vocabularies/translations/tr/LC_MESSAGES/messages.mo +0 -0
  220. invenio_vocabularies/translations/tr/LC_MESSAGES/messages.po +1 -1
  221. invenio_vocabularies/translations/uk/LC_MESSAGES/messages.mo +0 -0
  222. invenio_vocabularies/translations/uk/LC_MESSAGES/messages.po +17 -13
  223. invenio_vocabularies/translations/uk_UA/LC_MESSAGES/messages.mo +0 -0
  224. invenio_vocabularies/translations/uk_UA/LC_MESSAGES/messages.po +139 -0
  225. invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo +0 -0
  226. invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.po +1 -1
  227. invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo +0 -0
  228. invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.po +1 -1
  229. invenio_vocabularies/views.py +12 -26
  230. invenio_vocabularies/webpack.py +51 -0
  231. invenio_vocabularies-6.3.1.dist-info/METADATA +346 -0
  232. invenio_vocabularies-6.3.1.dist-info/RECORD +306 -0
  233. {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/WHEEL +1 -1
  234. {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/entry_points.txt +20 -0
  235. invenio_vocabularies-1.2.0.dist-info/METADATA +0 -133
  236. invenio_vocabularies-1.2.0.dist-info/RECORD +0 -220
  237. {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/AUTHORS.rst +0 -0
  238. {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/LICENSE +0 -0
  239. {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2022 CERN.
3
+ # Copyright (C) 2022-2024 CERN.
4
+ # Copyright (C) 2024 California Institute of Technology.
4
5
  #
5
6
  # Invenio-Vocabularies is free software; you can redistribute it and/or
6
7
  # modify it under the terms of the MIT License; see LICENSE file for more
@@ -8,14 +9,11 @@
8
9
 
9
10
  """Funders datastreams, transformers, writers and readers."""
10
11
 
11
- from idutils import normalize_ror
12
- from invenio_access.permissions import system_identity
12
+ from flask import current_app
13
13
  from invenio_i18n import lazy_gettext as _
14
14
 
15
- from ...datastreams.errors import TransformerError
16
- from ...datastreams.transformers import BaseTransformer
17
15
  from ...datastreams.writers import ServiceWriter
18
- from .config import funder_fundref_doi_prefix, funder_schemes
16
+ from ..common.ror.datastreams import RORTransformer
19
17
 
20
18
 
21
19
  class FundersServiceWriter(ServiceWriter):
@@ -31,64 +29,40 @@ class FundersServiceWriter(ServiceWriter):
31
29
  return entry["id"]
32
30
 
33
31
 
34
- class RORTransformer(BaseTransformer):
35
- """Transforms a JSON ROR record into a funders record."""
36
-
37
- def apply(self, stream_entry, **kwargs):
38
- """Applies the transformation to the stream entry."""
39
- record = stream_entry.entry
40
- funder = {}
41
-
42
- funder["id"] = normalize_ror(record.get("id"))
43
- if not funder["id"]:
44
- raise TransformerError(_(f"Id not found in ROR entry."))
45
-
46
- funder["name"] = record.get("name")
47
- if not funder["name"]:
48
- raise TransformerError(_(f"Name not found in ROR entry."))
49
-
50
- country_code = record.get("country", {}).get("country_code")
51
- if country_code:
52
- funder["country"] = country_code
53
-
54
- funder["title"] = {"en": funder["name"]}
55
- for label in record.get("labels", []):
56
- funder["title"][label["iso639"]] = label["label"]
57
-
58
- # The ROR is always listed in identifiers, expected by serialization
59
- funder["identifiers"] = [{"identifier": funder["id"], "scheme": "ror"}]
60
- valid_schemes = set(funder_schemes.keys())
61
- fund_ref = "fundref"
62
- valid_schemes.add(fund_ref)
63
- for scheme, identifier in record.get("external_ids", {}).items():
64
- scheme = scheme.lower()
65
- if scheme in valid_schemes:
66
- value = identifier.get("preferred") or identifier.get("all")[0]
67
- if scheme == fund_ref:
68
- value = f"{funder_fundref_doi_prefix}/{value}"
69
- scheme = "doi"
70
-
71
- funder["identifiers"].append(
72
- {
73
- "identifier": value,
74
- "scheme": scheme,
75
- }
76
- )
77
-
78
- stream_entry.entry = funder
79
- return stream_entry
32
+ class FundersRORTransformer(RORTransformer):
33
+ """Funders ROR Transformer."""
80
34
 
35
+ def __init__(
36
+ self, *args, vocab_schemes=None, funder_fundref_doi_prefix=None, **kwargs
37
+ ):
38
+ """Constructor."""
39
+ if vocab_schemes is None:
40
+ vocab_schemes = current_app.config.get("VOCABULARIES_FUNDER_SCHEMES")
41
+ if funder_fundref_doi_prefix is None:
42
+ funder_fundref_doi_prefix = current_app.config.get(
43
+ "VOCABULARIES_FUNDER_DOI_PREFIX"
44
+ )
45
+ super().__init__(
46
+ *args,
47
+ vocab_schemes=vocab_schemes,
48
+ funder_fundref_doi_prefix=funder_fundref_doi_prefix,
49
+ **kwargs,
50
+ )
51
+
52
+
53
+ VOCABULARIES_DATASTREAM_READERS = {}
54
+ """Funders datastreams writers."""
81
55
 
82
- VOCABULARIES_DATASTREAM_TRANSFORMERS = {
83
- "ror-funder": RORTransformer,
56
+ VOCABULARIES_DATASTREAM_WRITERS = {
57
+ "funders-service": FundersServiceWriter,
84
58
  }
85
- """ROR Data Streams transformers."""
59
+ """Funders datastreams writers."""
86
60
 
87
61
 
88
- VOCABULARIES_DATASTREAM_WRITERS = {
89
- "funders-service": FundersServiceWriter,
62
+ VOCABULARIES_DATASTREAM_TRANSFORMERS = {
63
+ "ror-funders": FundersRORTransformer,
90
64
  }
91
- """Funders Data Streams transformers."""
65
+ """Funders datastreams transformers."""
92
66
 
93
67
 
94
68
  DATASTREAM_CONFIG = {
@@ -96,19 +70,23 @@ DATASTREAM_CONFIG = {
96
70
  {
97
71
  "type": "zip",
98
72
  "args": {
99
- "regex": ".json$",
73
+ "regex": "_schema_v2\\.json$",
100
74
  },
101
75
  },
102
76
  {"type": "json"},
103
77
  ],
104
78
  "transformers": [
105
- {"type": "ror-funder"},
79
+ {
80
+ "type": "ror-funders",
81
+ },
106
82
  ],
107
83
  "writers": [
108
84
  {
109
- "type": "funders-service",
85
+ "type": "async",
110
86
  "args": {
111
- "identity": system_identity,
87
+ "writer": {
88
+ "type": "funders-service",
89
+ }
112
90
  },
113
91
  }
114
92
  ],
@@ -14,14 +14,22 @@ from ...services.facets import VocabularyLabels, lazy_get_label
14
14
  class FundersLabels(VocabularyLabels):
15
15
  """Fetching of vocabulary labels for facets."""
16
16
 
17
- def __init__(self, vocabulary, cache=False, service_name=None):
18
- """Initialize the labels."""
17
+ def __init__(self, vocabulary, cache=True, cache_ttl=3600, service_id=None):
18
+ """Initialize the labels.
19
+
20
+ :param vocabulary: the name of the vocabulary type.
21
+ :param cache: use simple process in-memory cache when True.
22
+ :param cache_ttl: cache expiration in seconds.
23
+ :param service_id: the id of the registered service to be used
24
+ when fetching values for the vocabulary.
25
+ """
19
26
  super().__init__(
20
27
  vocabulary,
21
- cache,
22
- service_name="funders",
28
+ cache=cache,
29
+ cache_ttl=cache_ttl,
30
+ service_id="funders",
23
31
  )
24
- self.fields = ["id", "title", "country"] # not configurable
32
+ self.fields = ("id", "title", "country") # not configurable
25
33
 
26
34
  def _vocab_to_label(self, vocab):
27
35
  """Returns the label string for a vocabulary entry."""
@@ -1,12 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2022 CERN.
3
+ # Copyright (C) 2022-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
7
7
  # details.
8
8
 
9
9
  """Vocabulary funders."""
10
+
10
11
  from flask_resources import (
11
12
  BaseListSchema,
12
13
  JSONSerializer,
@@ -35,7 +36,7 @@ record_type = RecordTypeFactory(
35
36
  model_cls_attrs={
36
37
  # cannot set to nullable=False because it would fail at
37
38
  # service level when create({}), see records-resources.
38
- "pid": db.Column(db.String, unique=True),
39
+ "pid": db.Column(db.String(255), unique=True),
39
40
  },
40
41
  record_dumper=SearchDumper(
41
42
  model_fields={"pid": ("id", str)},
@@ -45,6 +46,7 @@ record_type = RecordTypeFactory(
45
46
  ),
46
47
  schema_version="1.0.0",
47
48
  schema_path="local://funders/funder-v1.0.0.json",
49
+ index_name="funders-funder-v2.0.0",
48
50
  # Service layer
49
51
  service_id="funders",
50
52
  service_schema=FunderSchema,
@@ -7,9 +7,20 @@
7
7
  "$schema": {
8
8
  "$ref": "local://definitions-v1.0.0.json#/$schema"
9
9
  },
10
+ "tags": {
11
+ "$ref": "local://vocabularies/definitions-v1.0.0.json#/tags"
12
+ },
10
13
  "country": {
11
14
  "type": "string",
12
- "description": "Represents a funder's origin country."
15
+ "description": "Represents a funder's origin country as a country code."
16
+ },
17
+ "country_name": {
18
+ "type": "string",
19
+ "description": "Represents a funder's origin country as a full name."
20
+ },
21
+ "location_name": {
22
+ "type": "string",
23
+ "description": "Represents a funder's location name (usually a city)."
13
24
  },
14
25
  "identifiers": {
15
26
  "description": "Alternate identifiers for the record.",
@@ -23,6 +34,30 @@
23
34
  "type": "string",
24
35
  "description": "Funders name."
25
36
  },
37
+ "acronym": {
38
+ "type": "string",
39
+ "description": "Acronym for funders name."
40
+ },
41
+ "status": {
42
+ "type": "string",
43
+ "description": "Status of the funder."
44
+ },
45
+ "aliases": {
46
+ "description": "Alternate names for the funder.",
47
+ "type": "array",
48
+ "items": {
49
+ "type": "string"
50
+ },
51
+ "uniqueItems": true
52
+ },
53
+ "types": {
54
+ "description": "Types of funders.",
55
+ "type": "array",
56
+ "items": {
57
+ "type": "string"
58
+ },
59
+ "uniqueItems": true
60
+ },
26
61
  "title": {
27
62
  "$ref": "local://vocabularies/definitions-v1.0.0.json#/title"
28
63
  }
@@ -57,12 +57,33 @@
57
57
  "country": {
58
58
  "type": "text"
59
59
  },
60
+ "country_name": {
61
+ "type": "text"
62
+ },
63
+ "location_name": {
64
+ "type": "text"
65
+ },
66
+ "acronym": {
67
+ "type": "text"
68
+ },
69
+ "status": {
70
+ "type": "keyword"
71
+ },
72
+ "aliases": {
73
+ "type": "text"
74
+ },
75
+ "types": {
76
+ "type": "keyword"
77
+ },
60
78
  "id": {
61
79
  "type": "keyword"
62
80
  },
63
81
  "title": {
64
82
  "type": "object",
65
- "dynamic": true
83
+ "dynamic": "true"
84
+ },
85
+ "tags": {
86
+ "type": "keyword"
66
87
  }
67
88
  }
68
89
  }
@@ -0,0 +1,156 @@
1
+ {
2
+ "settings": {
3
+ "analysis": {
4
+ "char_filter": {
5
+ "strip_special_chars": {
6
+ "type": "pattern_replace",
7
+ "pattern": "[\\p{Punct}\\p{S}]",
8
+ "replacement": ""
9
+ }
10
+ },
11
+ "analyzer": {
12
+ "accent_edge_analyzer": {
13
+ "tokenizer": "standard",
14
+ "type": "custom",
15
+ "char_filter": ["strip_special_chars"],
16
+ "filter": [
17
+ "lowercase",
18
+ "asciifolding",
19
+ "edgegrams"
20
+ ]
21
+ },
22
+ "accent_analyzer": {
23
+ "tokenizer": "standard",
24
+ "type": "custom",
25
+ "char_filter": ["strip_special_chars"],
26
+ "filter": [
27
+ "lowercase",
28
+ "asciifolding"
29
+ ]
30
+ }
31
+ },
32
+ "normalizer": {
33
+ "accent_normalizer": {
34
+ "type": "custom",
35
+ "char_filter": ["strip_special_chars"],
36
+ "filter": [
37
+ "lowercase",
38
+ "asciifolding"
39
+ ]
40
+ }
41
+ },
42
+ "filter": {
43
+ "lowercase": {
44
+ "type": "lowercase",
45
+ "preserve_original": true
46
+ },
47
+ "asciifolding": {
48
+ "type": "asciifolding",
49
+ "preserve_original": true
50
+ },
51
+ "edgegrams": {
52
+ "type": "edge_ngram",
53
+ "min_gram": 2,
54
+ "max_gram": 20
55
+ }
56
+ }
57
+ }
58
+ },
59
+ "mappings": {
60
+ "dynamic_templates": [
61
+ {
62
+ "i18n_title": {
63
+ "path_match": "title.*",
64
+ "match_mapping_type": "string",
65
+ "mapping": {
66
+ "type": "text",
67
+ "analyzer": "accent_edge_analyzer",
68
+ "search_analyzer": "accent_analyzer"
69
+ }
70
+ }
71
+ }
72
+ ],
73
+ "dynamic": "strict",
74
+ "properties": {
75
+ "$schema": {
76
+ "type": "keyword",
77
+ "index": "false"
78
+ },
79
+ "created": {
80
+ "type": "date"
81
+ },
82
+ "updated": {
83
+ "type": "date"
84
+ },
85
+ "indexed_at": {
86
+ "type": "date"
87
+ },
88
+ "uuid": {
89
+ "type": "keyword"
90
+ },
91
+ "version_id": {
92
+ "type": "integer"
93
+ },
94
+ "identifiers": {
95
+ "properties": {
96
+ "identifier": {
97
+ "type": "keyword"
98
+ },
99
+ "scheme": {
100
+ "type": "keyword"
101
+ }
102
+ }
103
+ },
104
+ "name_sort": {
105
+ "type": "keyword"
106
+ },
107
+ "name": {
108
+ "type": "text",
109
+ "analyzer": "accent_edge_analyzer",
110
+ "search_analyzer": "accent_analyzer",
111
+ "copy_to": "name_sort"
112
+ },
113
+ "country": {
114
+ "type": "text"
115
+ },
116
+ "country_name": {
117
+ "type": "text"
118
+ },
119
+ "location_name": {
120
+ "type": "text"
121
+ },
122
+ "acronym": {
123
+ "type": "text",
124
+ "analyzer": "accent_edge_analyzer",
125
+ "search_analyzer": "accent_analyzer",
126
+ "fields": {
127
+ "keyword": {
128
+ "type": "keyword",
129
+ "normalizer": "accent_normalizer"
130
+ }
131
+ }
132
+ },
133
+ "status": {
134
+ "type": "keyword"
135
+ },
136
+ "aliases": {
137
+ "type": "text",
138
+ "analyzer": "accent_edge_analyzer",
139
+ "search_analyzer": "accent_analyzer"
140
+ },
141
+ "types": {
142
+ "type": "keyword"
143
+ },
144
+ "id": {
145
+ "type": "keyword"
146
+ },
147
+ "title": {
148
+ "type": "object",
149
+ "dynamic": "true"
150
+ },
151
+ "tags": {
152
+ "type": "keyword"
153
+ }
154
+ }
155
+ }
156
+ }
@@ -57,12 +57,33 @@
57
57
  "country": {
58
58
  "type": "text"
59
59
  },
60
+ "country_name": {
61
+ "type": "text"
62
+ },
63
+ "location_name": {
64
+ "type": "text"
65
+ },
66
+ "acronym": {
67
+ "type": "text"
68
+ },
69
+ "status": {
70
+ "type": "keyword"
71
+ },
72
+ "aliases": {
73
+ "type": "text"
74
+ },
75
+ "types": {
76
+ "type": "keyword"
77
+ },
60
78
  "id": {
61
79
  "type": "keyword"
62
80
  },
63
81
  "title": {
64
82
  "type": "object",
65
- "dynamic": true
83
+ "dynamic": "true"
84
+ },
85
+ "tags": {
86
+ "type": "keyword"
66
87
  }
67
88
  }
68
89
  }
@@ -0,0 +1,156 @@
1
+ {
2
+ "settings": {
3
+ "analysis": {
4
+ "char_filter": {
5
+ "strip_special_chars": {
6
+ "type": "pattern_replace",
7
+ "pattern": "[\\p{Punct}\\p{S}]",
8
+ "replacement": ""
9
+ }
10
+ },
11
+ "analyzer": {
12
+ "accent_edge_analyzer": {
13
+ "tokenizer": "standard",
14
+ "type": "custom",
15
+ "char_filter": ["strip_special_chars"],
16
+ "filter": [
17
+ "lowercase",
18
+ "asciifolding",
19
+ "edgegrams"
20
+ ]
21
+ },
22
+ "accent_analyzer": {
23
+ "tokenizer": "standard",
24
+ "type": "custom",
25
+ "char_filter": ["strip_special_chars"],
26
+ "filter": [
27
+ "lowercase",
28
+ "asciifolding"
29
+ ]
30
+ }
31
+ },
32
+ "normalizer": {
33
+ "accent_normalizer": {
34
+ "type": "custom",
35
+ "char_filter": ["strip_special_chars"],
36
+ "filter": [
37
+ "lowercase",
38
+ "asciifolding"
39
+ ]
40
+ }
41
+ },
42
+ "filter": {
43
+ "lowercase": {
44
+ "type": "lowercase",
45
+ "preserve_original": true
46
+ },
47
+ "asciifolding": {
48
+ "type": "asciifolding",
49
+ "preserve_original": true
50
+ },
51
+ "edgegrams": {
52
+ "type": "edge_ngram",
53
+ "min_gram": 2,
54
+ "max_gram": 20
55
+ }
56
+ }
57
+ }
58
+ },
59
+ "mappings": {
60
+ "dynamic_templates": [
61
+ {
62
+ "i18n_title": {
63
+ "path_match": "title.*",
64
+ "match_mapping_type": "string",
65
+ "mapping": {
66
+ "type": "text",
67
+ "analyzer": "accent_edge_analyzer",
68
+ "search_analyzer": "accent_analyzer"
69
+ }
70
+ }
71
+ }
72
+ ],
73
+ "dynamic": "strict",
74
+ "properties": {
75
+ "$schema": {
76
+ "type": "keyword",
77
+ "index": "false"
78
+ },
79
+ "created": {
80
+ "type": "date"
81
+ },
82
+ "updated": {
83
+ "type": "date"
84
+ },
85
+ "indexed_at": {
86
+ "type": "date"
87
+ },
88
+ "uuid": {
89
+ "type": "keyword"
90
+ },
91
+ "version_id": {
92
+ "type": "integer"
93
+ },
94
+ "identifiers": {
95
+ "properties": {
96
+ "identifier": {
97
+ "type": "keyword"
98
+ },
99
+ "scheme": {
100
+ "type": "keyword"
101
+ }
102
+ }
103
+ },
104
+ "name_sort": {
105
+ "type": "keyword"
106
+ },
107
+ "name": {
108
+ "type": "text",
109
+ "analyzer": "accent_edge_analyzer",
110
+ "search_analyzer": "accent_analyzer",
111
+ "copy_to": "name_sort"
112
+ },
113
+ "country": {
114
+ "type": "text"
115
+ },
116
+ "country_name": {
117
+ "type": "text"
118
+ },
119
+ "location_name": {
120
+ "type": "text"
121
+ },
122
+ "acronym": {
123
+ "type": "text",
124
+ "analyzer": "accent_edge_analyzer",
125
+ "search_analyzer": "accent_analyzer",
126
+ "fields": {
127
+ "keyword": {
128
+ "type": "keyword",
129
+ "normalizer": "accent_normalizer"
130
+ }
131
+ }
132
+ },
133
+ "status": {
134
+ "type": "keyword"
135
+ },
136
+ "aliases": {
137
+ "type": "text",
138
+ "analyzer": "accent_edge_analyzer",
139
+ "search_analyzer": "accent_analyzer"
140
+ },
141
+ "types": {
142
+ "type": "keyword"
143
+ },
144
+ "id": {
145
+ "type": "keyword"
146
+ },
147
+ "title": {
148
+ "type": "object",
149
+ "dynamic": "true"
150
+ },
151
+ "tags": {
152
+ "type": "keyword"
153
+ }
154
+ }
155
+ }
156
+ }
@@ -57,12 +57,33 @@
57
57
  "country": {
58
58
  "type": "text"
59
59
  },
60
+ "country_name": {
61
+ "type": "text"
62
+ },
63
+ "location_name": {
64
+ "type": "text"
65
+ },
66
+ "acronym": {
67
+ "type": "text"
68
+ },
69
+ "status": {
70
+ "type": "keyword"
71
+ },
72
+ "aliases": {
73
+ "type": "text"
74
+ },
75
+ "types": {
76
+ "type": "keyword"
77
+ },
60
78
  "id": {
61
79
  "type": "keyword"
62
80
  },
63
81
  "title": {
64
82
  "type": "object",
65
- "dynamic": true
83
+ "dynamic": "true"
84
+ },
85
+ "tags": {
86
+ "type": "keyword"
66
87
  }
67
88
  }
68
89
  }