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
@@ -0,0 +1,186 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2022-2024 CERN.
4
+ # Copyright (C) 2024 California Institute of Technology.
5
+ #
6
+ # Invenio-Vocabularies is free software; you can redistribute it and/or
7
+ # modify it under the terms of the MIT License; see LICENSE file for more
8
+ # details.
9
+
10
+ """Affiliations datastreams, transformers, writers and readers."""
11
+
12
+ from flask import current_app
13
+
14
+ from ...datastreams.errors import TransformerError, WriterError
15
+ from ...datastreams.transformers import BaseTransformer
16
+ from ...datastreams.writers import ServiceWriter
17
+ from ..common.ror.datastreams import RORTransformer
18
+
19
+
20
+ class AffiliationsServiceWriter(ServiceWriter):
21
+ """Affiliations service writer."""
22
+
23
+ def __init__(self, *args, **kwargs):
24
+ """Constructor."""
25
+ service_or_name = kwargs.pop("service_or_name", "affiliations")
26
+ super().__init__(service_or_name=service_or_name, *args, **kwargs)
27
+
28
+ def _entry_id(self, entry):
29
+ """Get the id from an entry."""
30
+ return entry["id"]
31
+
32
+
33
+ class AffiliationsRORTransformer(RORTransformer):
34
+ """Affiliations ROR Transformer."""
35
+
36
+ def __init__(
37
+ self, *args, vocab_schemes=None, funder_fundref_doi_prefix=None, **kwargs
38
+ ):
39
+ """Constructor."""
40
+ if vocab_schemes is None:
41
+ vocab_schemes = current_app.config.get("VOCABULARIES_AFFILIATION_SCHEMES")
42
+ super().__init__(
43
+ *args,
44
+ vocab_schemes=vocab_schemes,
45
+ funder_fundref_doi_prefix=funder_fundref_doi_prefix,
46
+ **kwargs,
47
+ )
48
+
49
+
50
+ class OpenAIREOrganizationTransformer(BaseTransformer):
51
+ """OpenAIRE Organization Transformer."""
52
+
53
+ def apply(self, stream_entry, **kwargs):
54
+ """Applies the transformation to the stream entry."""
55
+ record = stream_entry.entry
56
+
57
+ if "id" not in record:
58
+ raise TransformerError([f"No id for: {record}"])
59
+
60
+ if not record["id"].startswith("openorgs____::"):
61
+ raise TransformerError([f"Not valid OpenAIRE OpenOrgs id for: {record}"])
62
+
63
+ if "pid" not in record:
64
+ raise TransformerError([f"No alternative identifiers for: {record}"])
65
+
66
+ organization = {}
67
+
68
+ for pid in record["pid"]:
69
+ if pid["scheme"] == "ROR":
70
+ organization["id"] = pid["value"].removeprefix("https://ror.org/")
71
+ elif pid["scheme"] == "PIC":
72
+ organization["identifiers"] = [
73
+ {
74
+ "scheme": "pic",
75
+ "identifier": pid["value"],
76
+ }
77
+ ]
78
+
79
+ stream_entry.entry = organization
80
+ return stream_entry
81
+
82
+
83
+ class OpenAIREAffiliationsServiceWriter(ServiceWriter):
84
+ """OpenAIRE Affiliations service writer."""
85
+
86
+ def __init__(self, *args, **kwargs):
87
+ """Constructor."""
88
+ service_or_name = kwargs.pop("service_or_name", "affiliations")
89
+ # Here we only update and we do not insert, since OpenAIRE data is used to augment existing affiliations
90
+ # (with PIC identifiers) and is not used to create new affiliations.
91
+ super().__init__(
92
+ service_or_name=service_or_name, insert=False, update=True, *args, **kwargs
93
+ )
94
+
95
+ def _entry_id(self, entry):
96
+ """Get the id from an entry."""
97
+ return entry["id"]
98
+
99
+ def write(self, stream_entry, *args, **kwargs):
100
+ """Writes the input entry using a given service."""
101
+ entry = stream_entry.entry
102
+
103
+ return super().write(stream_entry, *args, **kwargs)
104
+
105
+ def write_many(self, stream_entries, *args, **kwargs):
106
+ """Writes the input entries using a given service."""
107
+ return super().write_many(stream_entries, *args, **kwargs)
108
+
109
+
110
+ VOCABULARIES_DATASTREAM_READERS = {}
111
+ """Affiliations datastream readers."""
112
+
113
+ VOCABULARIES_DATASTREAM_WRITERS = {
114
+ "affiliations-service": AffiliationsServiceWriter,
115
+ "openaire-affiliations-service": OpenAIREAffiliationsServiceWriter,
116
+ }
117
+ """Affiliations datastream writers."""
118
+
119
+ VOCABULARIES_DATASTREAM_TRANSFORMERS = {
120
+ "ror-affiliations": AffiliationsRORTransformer,
121
+ "openaire-organization": OpenAIREOrganizationTransformer,
122
+ }
123
+ """Affiliations datastream transformers."""
124
+
125
+
126
+ DATASTREAM_CONFIG = {
127
+ "readers": [
128
+ {
129
+ "type": "zip",
130
+ "args": {
131
+ "regex": "_schema_v2\\.json$",
132
+ },
133
+ },
134
+ {"type": "json"},
135
+ ],
136
+ "transformers": [
137
+ {
138
+ "type": "ror-affiliations",
139
+ },
140
+ ],
141
+ "writers": [
142
+ {
143
+ "type": "async",
144
+ "args": {
145
+ "writer": {
146
+ "type": "affiliations-service",
147
+ }
148
+ },
149
+ }
150
+ ],
151
+ }
152
+ """Data Stream configuration.
153
+
154
+ An origin is required for the reader.
155
+ """
156
+
157
+ DATASTREAM_CONFIG_OPENAIRE = {
158
+ "readers": [
159
+ {"type": "openaire-http", "args": {"tar_href": "/organization.tar"}},
160
+ {
161
+ "type": "tar",
162
+ "args": {
163
+ "regex": "\\.json.gz$",
164
+ "mode": "r",
165
+ },
166
+ },
167
+ {"type": "gzip"},
168
+ {"type": "jsonl"},
169
+ ],
170
+ "transformers": [
171
+ {
172
+ "type": "openaire-organization",
173
+ },
174
+ ],
175
+ "writers": [
176
+ {
177
+ "type": "async",
178
+ "args": {
179
+ "writer": {
180
+ "type": "openaire-affiliations-service",
181
+ }
182
+ },
183
+ }
184
+ ],
185
+ }
186
+ """Alternative Data Stream configuration for OpenAIRE Affiliations."""
@@ -0,0 +1,36 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2022 CERN.
4
+ #
5
+ # Invenio-Vocabularies is free software; you can redistribute it and/or
6
+ # modify it under the terms of the MIT License; see LICENSE file for more
7
+ # details.
8
+
9
+ """Vocabulary affiliations facets and labels."""
10
+
11
+ from ...services.facets import VocabularyLabels, lazy_get_label
12
+
13
+
14
+ class AffiliationsLabels(VocabularyLabels):
15
+ """Fetching of vocabulary labels for facets."""
16
+
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
+ """
26
+ super().__init__(
27
+ vocabulary,
28
+ cache=cache,
29
+ cache_ttl=cache_ttl,
30
+ service_id="affiliations",
31
+ )
32
+ self.fields = ("id", "title") # not configurable
33
+
34
+ def _vocab_to_label(self, vocab):
35
+ """Returns the label string for a vocabulary entry."""
36
+ return f"{lazy_get_label(vocab['title'])}"
@@ -7,24 +7,55 @@
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
+ },
13
+ "country": {
14
+ "type": "string",
15
+ "description": "Represents a affiliation's country as a country code."
16
+ },
17
+ "country_name": {
18
+ "type": "string",
19
+ "description": "Represents a affiliation's country as a full name."
20
+ },
21
+ "location_name": {
22
+ "type": "string",
23
+ "description": "Represents a affiliation's location name (usually a city)."
24
+ },
10
25
  "acronym": {
11
26
  "type": "string"
12
27
  },
13
- "id": {
14
- "$ref": "local://definitions-v1.0.0.json#/identifier"
15
- },
16
28
  "identifiers": {
17
29
  "description": "Alternate identifiers for the record.",
18
30
  "type": "array",
19
- "items": {"$ref": "local://definitions-v1.0.0.json#/identifiers_with_scheme"},
31
+ "items": {
32
+ "$ref": "local://definitions-v1.0.0.json#/identifiers_with_scheme"
33
+ },
34
+ "uniqueItems": true
35
+ },
36
+ "status": {
37
+ "type": "string",
38
+ "description": "Status of the affiliation organization."
39
+ },
40
+ "aliases": {
41
+ "description": "Alternate names for the affiliation.",
42
+ "type": "array",
43
+ "items": {
44
+ "type": "string"
45
+ },
46
+ "uniqueItems": true
47
+ },
48
+ "types": {
49
+ "description": "Types of affiliation organization.",
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string"
53
+ },
20
54
  "uniqueItems": true
21
55
  },
22
56
  "name": {
23
57
  "type": "string"
24
58
  },
25
- "pid": {
26
- "$ref": "local://definitions-v1.0.0.json#/internal-pid"
27
- },
28
59
  "title": {
29
60
  "$ref": "local://vocabularies/definitions-v1.0.0.json#/title"
30
61
  }
@@ -84,7 +84,28 @@
84
84
  },
85
85
  "title": {
86
86
  "type": "object",
87
- "dynamic": true
87
+ "dynamic": "true"
88
+ },
89
+ "tags": {
90
+ "type": "keyword"
91
+ },
92
+ "country": {
93
+ "type": "text"
94
+ },
95
+ "country_name": {
96
+ "type": "text"
97
+ },
98
+ "location_name": {
99
+ "type": "text"
100
+ },
101
+ "status": {
102
+ "type": "keyword"
103
+ },
104
+ "aliases": {
105
+ "type": "text"
106
+ },
107
+ "types": {
108
+ "type": "keyword"
88
109
  }
89
110
  }
90
111
  }
@@ -0,0 +1,171 @@
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
+ "lowercasepreserveoriginal",
18
+ "asciifoldingpreserveoriginal",
19
+ "edgegrams"
20
+ ]
21
+ },
22
+ "accent_analyzer": {
23
+ "tokenizer": "standard",
24
+ "type": "custom",
25
+ "char_filter": ["strip_special_chars"],
26
+ "filter": [
27
+ "lowercasepreserveoriginal",
28
+ "asciifoldingpreserveoriginal"
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
+ "lowercasepreserveoriginal": {
44
+ "type": "lowercase",
45
+ "preserve_original": true
46
+ },
47
+ "asciifoldingpreserveoriginal": {
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
+ "id": {
95
+ "type": "keyword"
96
+ },
97
+ "name_sort": {
98
+ "type": "keyword"
99
+ },
100
+ "name": {
101
+ "type": "text",
102
+ "analyzer": "accent_edge_analyzer",
103
+ "search_analyzer": "accent_analyzer",
104
+ "copy_to": "name_sort"
105
+ },
106
+ "acronym": {
107
+ "type": "text",
108
+ "analyzer": "accent_edge_analyzer",
109
+ "search_analyzer": "accent_analyzer",
110
+ "fields": {
111
+ "keyword": {
112
+ "type": "keyword",
113
+ "normalizer": "accent_normalizer"
114
+ }
115
+ }
116
+ },
117
+ "identifiers": {
118
+ "properties": {
119
+ "identifier": {
120
+ "type": "keyword"
121
+ },
122
+ "scheme": {
123
+ "type": "keyword"
124
+ }
125
+ }
126
+ },
127
+ "pid": {
128
+ "type": "object",
129
+ "properties": {
130
+ "pk": {
131
+ "type": "integer"
132
+ },
133
+ "pid_type": {
134
+ "type": "keyword"
135
+ },
136
+ "obj_type": {
137
+ "type": "keyword"
138
+ },
139
+ "status": {
140
+ "type": "keyword"
141
+ }
142
+ }
143
+ },
144
+ "title": {
145
+ "type": "object",
146
+ "dynamic": "true"
147
+ },
148
+ "tags": {
149
+ "type": "keyword"
150
+ },
151
+ "country": {
152
+ "type": "text"
153
+ },
154
+ "country_name": {
155
+ "type": "text"
156
+ },
157
+ "location_name": {
158
+ "type": "text"
159
+ },
160
+ "status": {
161
+ "type": "keyword"
162
+ },
163
+ "aliases": {
164
+ "type": "text"
165
+ },
166
+ "types": {
167
+ "type": "keyword"
168
+ }
169
+ }
170
+ }
171
+ }
@@ -84,7 +84,28 @@
84
84
  },
85
85
  "title": {
86
86
  "type": "object",
87
- "dynamic": true
87
+ "dynamic": "true"
88
+ },
89
+ "tags": {
90
+ "type": "keyword"
91
+ },
92
+ "country": {
93
+ "type": "text"
94
+ },
95
+ "country_name": {
96
+ "type": "text"
97
+ },
98
+ "location_name": {
99
+ "type": "text"
100
+ },
101
+ "status": {
102
+ "type": "keyword"
103
+ },
104
+ "aliases": {
105
+ "type": "text"
106
+ },
107
+ "types": {
108
+ "type": "keyword"
88
109
  }
89
110
  }
90
111
  }
@@ -0,0 +1,171 @@
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
+ "lowercasepreserveoriginal",
18
+ "asciifoldingpreserveoriginal",
19
+ "edgegrams"
20
+ ]
21
+ },
22
+ "accent_analyzer": {
23
+ "tokenizer": "standard",
24
+ "type": "custom",
25
+ "char_filter": ["strip_special_chars"],
26
+ "filter": [
27
+ "lowercasepreserveoriginal",
28
+ "asciifoldingpreserveoriginal"
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
+ "lowercasepreserveoriginal": {
44
+ "type": "lowercase",
45
+ "preserve_original": true
46
+ },
47
+ "asciifoldingpreserveoriginal": {
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
+ "id": {
95
+ "type": "keyword"
96
+ },
97
+ "name_sort": {
98
+ "type": "keyword"
99
+ },
100
+ "name": {
101
+ "type": "text",
102
+ "analyzer": "accent_edge_analyzer",
103
+ "search_analyzer": "accent_analyzer",
104
+ "copy_to": "name_sort"
105
+ },
106
+ "acronym": {
107
+ "type": "text",
108
+ "analyzer": "accent_edge_analyzer",
109
+ "search_analyzer": "accent_analyzer",
110
+ "fields": {
111
+ "keyword": {
112
+ "type": "keyword",
113
+ "normalizer": "accent_normalizer"
114
+ }
115
+ }
116
+ },
117
+ "identifiers": {
118
+ "properties": {
119
+ "identifier": {
120
+ "type": "keyword"
121
+ },
122
+ "scheme": {
123
+ "type": "keyword"
124
+ }
125
+ }
126
+ },
127
+ "pid": {
128
+ "type": "object",
129
+ "properties": {
130
+ "pk": {
131
+ "type": "integer"
132
+ },
133
+ "pid_type": {
134
+ "type": "keyword"
135
+ },
136
+ "obj_type": {
137
+ "type": "keyword"
138
+ },
139
+ "status": {
140
+ "type": "keyword"
141
+ }
142
+ }
143
+ },
144
+ "title": {
145
+ "type": "object",
146
+ "dynamic": "true"
147
+ },
148
+ "tags": {
149
+ "type": "keyword"
150
+ },
151
+ "country": {
152
+ "type": "text"
153
+ },
154
+ "country_name": {
155
+ "type": "text"
156
+ },
157
+ "location_name": {
158
+ "type": "text"
159
+ },
160
+ "status": {
161
+ "type": "keyword"
162
+ },
163
+ "aliases": {
164
+ "type": "text"
165
+ },
166
+ "types": {
167
+ "type": "keyword"
168
+ }
169
+ }
170
+ }
171
+ }