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,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2020-2022 CERN.
3
+ # Copyright (C) 2020-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
@@ -10,6 +10,6 @@
10
10
 
11
11
  from .ext import InvenioVocabularies
12
12
 
13
- __version__ = "1.2.0"
13
+ __version__ = "6.3.1"
14
14
 
15
15
  __all__ = ("__version__", "InvenioVocabularies")
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2024 CERN.
4
+ # Copyright (C) 2024 Uni Münster.
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
+ """Invenio administration views module for vocabularies."""
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2020-2024 CERN.
4
+ # Copyright (C) 2024 Uni Münster.
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
+ """Invenio administration views module for Vocabularies."""
@@ -0,0 +1,45 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2020-2024 CERN.
4
+ # Copyright (C) 2024 Uni Münster.
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
+ """Vocabularies admin interface."""
11
+
12
+ from invenio_administration.views.base import (
13
+ AdminResourceEditView,
14
+ AdminResourceListView,
15
+ )
16
+
17
+
18
+ class VocabulariesListView(AdminResourceListView):
19
+ """Configuration for vocabularies list view."""
20
+
21
+ api_endpoint = "/vocabularies/"
22
+ name = "vocabulary-types"
23
+ menu_label = "Vocabulary Types"
24
+ resource_config = "vocabulary_admin_resource"
25
+ search_request_headers = {"Accept": "application/json"}
26
+ title = "Vocabulary Types"
27
+ category = "Site management"
28
+
29
+ pid_path = "id"
30
+ icon = "exchange"
31
+ template = "invenio_administration/search.html"
32
+
33
+ display_search = True
34
+ display_delete = False
35
+ display_edit = False
36
+ display_create = False
37
+
38
+ item_field_list = {
39
+ "id": {"text": "Name", "order": 1},
40
+ "count": {"text": "Number of entries", "order": 2},
41
+ }
42
+
43
+ search_config_name = "VOCABULARIES_TYPES_SEARCH"
44
+ search_facets_config_name = "VOCABULARIES_TYPES_FACETS"
45
+ search_sort_config_name = "VOCABULARIES_TYPES_SORT_OPTIONS"
@@ -20,10 +20,10 @@ def upgrade():
20
20
  """Upgrade database."""
21
21
  op.create_table(
22
22
  "vocabularies_schemes",
23
- sa.Column("id", sa.String(), nullable=False),
24
- sa.Column("parent_id", sa.String(), nullable=False),
25
- sa.Column("name", sa.String(), nullable=True),
26
- sa.Column("uri", sa.String(), nullable=True),
23
+ sa.Column("id", sa.String(255), nullable=False),
24
+ sa.Column("parent_id", sa.String(255), nullable=False),
25
+ sa.Column("name", sa.String(255), nullable=True),
26
+ sa.Column("uri", sa.String(255), nullable=True),
27
27
  sa.PrimaryKeyConstraint(
28
28
  "id", "parent_id", name=op.f("pk_vocabularies_schemes")
29
29
  ),
@@ -78,8 +78,8 @@ def upgrade():
78
78
  )
79
79
  op.create_table(
80
80
  "vocabularies_types",
81
- sa.Column("id", sa.String(), nullable=False),
82
- sa.Column("pid_type", sa.String(), nullable=True),
81
+ sa.Column("id", sa.String(255), nullable=False),
82
+ sa.Column("pid_type", sa.String(255), nullable=True),
83
83
  sa.PrimaryKeyConstraint("id", name=op.f("pk_vocabularies_types")),
84
84
  sa.UniqueConstraint("pid_type", name=op.f("uq_vocabularies_types_pid_type")),
85
85
  )
@@ -0,0 +1,96 @@
1
+ #
2
+ # This file is part of Invenio.
3
+ # Copyright (C) 2023 CERN.
4
+ #
5
+ # Invenio is free software; you can redistribute it and/or modify it
6
+ # under the terms of the MIT License; see LICENSE file for more details.
7
+
8
+ """Add "pid" column to names and affiliations tables."""
9
+
10
+ import sqlalchemy as sa
11
+ from alembic import op
12
+
13
+ # revision identifiers, used by Alembic.
14
+ revision = "55a700f897b6"
15
+ down_revision = "e1146238edd3"
16
+ branch_labels = ()
17
+ depends_on = "999c62899c20"
18
+
19
+
20
+ pids_table = sa.sql.table(
21
+ "pidstore_pid",
22
+ sa.sql.column("pid_type"),
23
+ sa.sql.column("pid_value"),
24
+ sa.sql.column("object_uuid"),
25
+ sa.sql.column("object_type"),
26
+ )
27
+ names_table = sa.sql.table(
28
+ "name_metadata",
29
+ sa.sql.column("id"),
30
+ sa.sql.column("pid"),
31
+ )
32
+ affiliations_table = sa.sql.table(
33
+ "affiliation_metadata",
34
+ sa.sql.column("id"),
35
+ sa.sql.column("pid"),
36
+ )
37
+
38
+
39
+ def upgrade():
40
+ """Upgrade database."""
41
+ op.add_column(
42
+ "name_metadata",
43
+ sa.Column("pid", sa.String(255), nullable=True),
44
+ )
45
+ # populate from PIDStore
46
+ op.execute(
47
+ names_table.update()
48
+ .where(
49
+ names_table.c.id == pids_table.c.object_uuid,
50
+ pids_table.c.object_type == "rec",
51
+ pids_table.c.pid_type == "names",
52
+ )
53
+ .values(pid=pids_table.c.pid_value)
54
+ )
55
+ op.create_unique_constraint(
56
+ op.f("uq_name_metadata_pid"),
57
+ "name_metadata",
58
+ ["pid"],
59
+ )
60
+
61
+ op.add_column(
62
+ "affiliation_metadata",
63
+ sa.Column("pid", sa.String(255), nullable=True),
64
+ )
65
+ # populate from PIDStore
66
+ op.execute(
67
+ affiliations_table.update()
68
+ .where(
69
+ affiliations_table.c.id == pids_table.c.object_uuid,
70
+ pids_table.c.object_type == "rec",
71
+ pids_table.c.pid_type == "aff",
72
+ )
73
+ .values(pid=pids_table.c.pid_value)
74
+ )
75
+
76
+ op.create_unique_constraint(
77
+ op.f("uq_affiliation_metadata_pid"),
78
+ "affiliation_metadata",
79
+ ["pid"],
80
+ )
81
+
82
+
83
+ def downgrade():
84
+ """Downgrade database."""
85
+ op.drop_constraint(
86
+ op.f("uq_name_metadata_pid"),
87
+ "name_metadata",
88
+ type_="unique",
89
+ )
90
+ op.drop_constraint(
91
+ op.f("uq_affiliation_metadata_pid"),
92
+ "affiliation_metadata",
93
+ type_="unique",
94
+ )
95
+ op.drop_column("name_metadata", "pid")
96
+ op.drop_column("affiliation_metadata", "pid")
@@ -45,7 +45,7 @@ def upgrade():
45
45
  nullable=True,
46
46
  ),
47
47
  sa.Column("version_id", sa.Integer(), nullable=False),
48
- sa.Column("pid", sa.String(), nullable=True),
48
+ sa.Column("pid", sa.String(255), nullable=True),
49
49
  sa.PrimaryKeyConstraint("id", name=op.f("pk_funder_metadata")),
50
50
  sa.UniqueConstraint("pid", name=op.f("uq_funder_metadata_pid")),
51
51
  )
@@ -45,7 +45,7 @@ def upgrade():
45
45
  nullable=True,
46
46
  ),
47
47
  sa.Column("version_id", sa.Integer(), nullable=False),
48
- sa.Column("pid", sa.String(), nullable=True),
48
+ sa.Column("pid", sa.String(255), nullable=True),
49
49
  sa.PrimaryKeyConstraint("id", name=op.f("pk_award_metadata")),
50
50
  sa.UniqueConstraint("pid", name=op.f("uq_award_metadata_pid")),
51
51
  )
@@ -0,0 +1,11 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # This file is part of Invenio.
4
+ # Copyright (C) 2023 CERN.
5
+ #
6
+ # Invenio is free software; you can redistribute it and/or modify
7
+ # it under the terms of the MIT License; see LICENSE file for more details.
8
+
9
+ extends:
10
+ - '@inveniosoftware/eslint-config-invenio'
11
+ - '@inveniosoftware/eslint-config-invenio/prettier'
@@ -0,0 +1 @@
1
+ "@inveniosoftware/eslint-config-invenio/prettier-config.js"
@@ -0,0 +1,7 @@
1
+ // This file is part of InvenioVocabularies
2
+ // Copyright (C) 2023 CERN.
3
+ //
4
+ // Invenio is free software; you can redistribute it and/or modify it
5
+ // under the terms of the MIT License; see LICENSE file for more details.
6
+
7
+ export * from "./src";
@@ -0,0 +1,25 @@
1
+ {
2
+ "@comment": [
3
+ "This package.json is needed to run the JS tests, locally and CI."
4
+ ],
5
+ "scripts": {
6
+ "test": "react-scripts test"
7
+ },
8
+ "devDependencies": {
9
+ "@testing-library/jest-dom": "^4.2.0",
10
+ "@testing-library/react": "^9.5.0",
11
+ "@testing-library/user-event": "^7.2.0",
12
+ "axios": "^1.7.7",
13
+ "coveralls": "^3.0.0",
14
+ "enzyme": "^3.10.0",
15
+ "enzyme-adapter-react-16": "^1.15.0",
16
+ "expect": "^26.0.0",
17
+ "lodash": "^4.17.0",
18
+ "luxon": "^1.23.0",
19
+ "react": "^16.13.0",
20
+ "react-dom": "^16.13.0",
21
+ "react-scripts": "^5.0.1",
22
+ "semantic-ui-react": "^2.1.0",
23
+ "react-overridable": "^0.0.3"
24
+ }
25
+ }
@@ -0,0 +1,95 @@
1
+ // This file is part of InvenioVocabularies
2
+ // Copyright (C) 2021-2023 CERN.
3
+ // Copyright (C) 2021 Northwestern University.
4
+ //
5
+ // Invenio is free software; you can redistribute it and/or modify it
6
+ // under the terms of the MIT License; see LICENSE file for more details.
7
+
8
+ import React from "react";
9
+ import PropTypes from "prop-types";
10
+ import _get from "lodash/get";
11
+ import { Item, Header, Radio, Label, Icon } from "semantic-ui-react";
12
+ import { withState } from "react-searchkit";
13
+ import { FastField } from "formik";
14
+
15
+ export const AwardResults = withState(
16
+ ({
17
+ currentResultsState: results,
18
+ deserializeAward,
19
+ deserializeFunder,
20
+ computeFundingContents,
21
+ }) => {
22
+ return (
23
+ <FastField name="selectedFunding">
24
+ {({ form: { values, setFieldValue } }) => {
25
+ return (
26
+ <Item.Group>
27
+ {results.data.hits.map((award) => {
28
+ let funder = award?.funder;
29
+ const deserializedAward = deserializeAward(award);
30
+ const deserializedFunder = deserializeFunder(funder);
31
+ const funding = {
32
+ award: deserializedAward,
33
+ funder: deserializedFunder,
34
+ };
35
+ let { headerContent, descriptionContent, awardOrFunder } =
36
+ computeFundingContents(funding);
37
+
38
+ return (
39
+ <Item
40
+ key={deserializedAward.id}
41
+ onClick={() => setFieldValue("selectedFunding", funding)}
42
+ className="license-item"
43
+ >
44
+ <Radio
45
+ checked={
46
+ _get(values, "selectedFunding.award.id") === funding.award.id
47
+ }
48
+ onChange={() => setFieldValue("selectedFunding", funding)}
49
+ />
50
+ <Item.Content className="license-item-content">
51
+ <Header size="small">
52
+ {headerContent}
53
+ {awardOrFunder === "award"
54
+ ? award.number && (
55
+ <Label basic size="mini">
56
+ {award.number}
57
+ </Label>
58
+ )
59
+ : ""}
60
+ {awardOrFunder === "award"
61
+ ? award.url && (
62
+ <a
63
+ href={`${award.url}`}
64
+ target="_blank"
65
+ rel="noopener noreferrer"
66
+ >
67
+ <Icon
68
+ link
69
+ name="external alternate"
70
+ className="spaced-left"
71
+ />
72
+ </a>
73
+ )
74
+ : ""}
75
+ </Header>
76
+ <Item.Description className="license-item-description">
77
+ {descriptionContent}
78
+ </Item.Description>
79
+ </Item.Content>
80
+ </Item>
81
+ );
82
+ })}
83
+ </Item.Group>
84
+ );
85
+ }}
86
+ </FastField>
87
+ );
88
+ }
89
+ );
90
+
91
+ AwardResults.propTypes = {
92
+ deserializeAward: PropTypes.func.isRequired,
93
+ deserializeFunder: PropTypes.func.isRequired,
94
+ computeFundingContents: PropTypes.func.isRequired,
95
+ };
@@ -0,0 +1,139 @@
1
+ // This file is part of InvenioVocabularies
2
+ // Copyright (C) 2021-2024 CERN.
3
+ // Copyright (C) 2021 Northwestern University.
4
+ //
5
+ // Invenio is free software; you can redistribute it and/or modify it
6
+ // under the terms of the MIT License; see LICENSE file for more details.
7
+
8
+ import PropTypes from "prop-types";
9
+ import React from "react";
10
+ import { Form, Header } from "semantic-ui-react";
11
+ import { TextField, RemoteSelectField } from "react-invenio-forms";
12
+ import { i18next } from "@translations/invenio_rdm_records/i18next";
13
+ import _isEmpty from "lodash/isEmpty";
14
+
15
+ import Overridable from "react-overridable";
16
+
17
+ function CustomAwardForm({ deserializeFunder, selectedFunding }) {
18
+ function deserializeFunderToDropdown(funderItem) {
19
+ const funderName = funderItem?.name;
20
+ const funderPID = funderItem?.id;
21
+ const funderCountry = funderItem?.country_name ?? funderItem?.country;
22
+
23
+ if (!funderName && !funderPID) {
24
+ return {};
25
+ }
26
+
27
+ return {
28
+ text: [funderName, funderCountry, funderPID].filter((val) => val).join(", "),
29
+ value: funderItem.id,
30
+ key: funderItem.id,
31
+ ...(funderName && { name: funderName }),
32
+ ...(funderPID && { pid: funderPID }),
33
+ };
34
+ }
35
+
36
+ function serializeFunderFromDropdown(funderDropObject) {
37
+ return {
38
+ id: funderDropObject.key,
39
+ ...(funderDropObject.name && { name: funderDropObject.name }),
40
+ ...(funderDropObject.pid && { pid: funderDropObject.pid }),
41
+ };
42
+ }
43
+
44
+ return (
45
+ <Form>
46
+ <Overridable
47
+ id="InvenioVocabularies.CustomAwardForm.RemoteSelectField.Container"
48
+ fieldPath="selectedFunding.funder.id"
49
+ >
50
+ <RemoteSelectField
51
+ fieldPath="selectedFunding.funder.id"
52
+ suggestionAPIUrl="/api/funders"
53
+ suggestionAPIHeaders={{
54
+ Accept: "application/vnd.inveniordm.v1+json",
55
+ }}
56
+ placeholder={i18next.t("Search for a funder by name")}
57
+ serializeSuggestions={(funders) => {
58
+ return funders.map((funder) =>
59
+ deserializeFunderToDropdown(deserializeFunder(funder))
60
+ );
61
+ }}
62
+ searchInput={{
63
+ autoFocus: _isEmpty(selectedFunding),
64
+ }}
65
+ label={i18next.t("Funder")}
66
+ noQueryMessage={i18next.t("Search for funder...")}
67
+ clearable
68
+ allowAdditions={false}
69
+ multiple={false}
70
+ selectOnBlur={false}
71
+ selectOnNavigation={false}
72
+ required
73
+ search={(options) => options}
74
+ isFocused
75
+ onValueChange={({ formikProps }, selectedFundersArray) => {
76
+ if (selectedFundersArray.length === 1) {
77
+ const selectedFunder = selectedFundersArray[0];
78
+ if (selectedFunder) {
79
+ const deserializedFunder = serializeFunderFromDropdown(selectedFunder);
80
+ formikProps.form.setFieldValue(
81
+ "selectedFunding.funder",
82
+ deserializedFunder
83
+ );
84
+ }
85
+ }
86
+ }}
87
+ />
88
+ </Overridable>
89
+ <Overridable id="InvenioVocabularies.CustomAwardForm.AwardInformationHeader.Container">
90
+ <Header as="h3" size="small">
91
+ {i18next.t("Additional information")} ({i18next.t("optional")})
92
+ </Header>
93
+ </Overridable>
94
+ <Form.Group widths="equal">
95
+ <Overridable
96
+ id="InvenioVocabularies.CustomAwardForm.AwardNumberTextField.Container"
97
+ fieldPath="selectedFunding.award.number"
98
+ >
99
+ <TextField
100
+ label={i18next.t("Number")}
101
+ placeholder={i18next.t("Award/Grant number")}
102
+ fieldPath="selectedFunding.award.number"
103
+ />
104
+ </Overridable>
105
+ <Overridable
106
+ id="InvenioVocabularies.CustomAwardForm.AwardTitleTextField.Container"
107
+ fieldPath="selectedFunding.award.title"
108
+ >
109
+ <TextField
110
+ label={i18next.t("Title")}
111
+ placeholder={i18next.t("Award/Grant Title")}
112
+ fieldPath="selectedFunding.award.title"
113
+ />
114
+ </Overridable>
115
+ <Overridable
116
+ id="InvenioVocabularies.CustomAwardForm.AwardUrlTextField.Container"
117
+ fieldPath="selectedFunding.award.url"
118
+ >
119
+ <TextField
120
+ label={i18next.t("URL")}
121
+ placeholder={i18next.t("Award/Grant URL")}
122
+ fieldPath="selectedFunding.award.url"
123
+ />
124
+ </Overridable>
125
+ </Form.Group>
126
+ </Form>
127
+ );
128
+ }
129
+
130
+ CustomAwardForm.propTypes = {
131
+ deserializeFunder: PropTypes.func.isRequired,
132
+ selectedFunding: PropTypes.object,
133
+ };
134
+
135
+ CustomAwardForm.defaultProps = {
136
+ selectedFunding: undefined,
137
+ };
138
+
139
+ export default CustomAwardForm;
@@ -0,0 +1,87 @@
1
+ // This file is part of InvenioVocabularies
2
+ // Copyright (C) 2021-2023 CERN.
3
+ // Copyright (C) 2021 Northwestern University.
4
+ //
5
+ // Invenio is free software; you can redistribute it and/or modify it
6
+ // under the terms of the MIT License; see LICENSE file for more details.
7
+
8
+ import React from "react";
9
+
10
+ import { Dropdown } from "semantic-ui-react";
11
+ import { withState } from "react-searchkit";
12
+ import { i18next } from "@translations/invenio_rdm_records/i18next";
13
+
14
+ export const FunderDropdown = withState(
15
+ ({ currentResultsState: awardsList, updateQueryState, currentQueryState }) => {
16
+ const [fundersFromFacets] = useFundersFromFacets(awardsList);
17
+
18
+ /**
19
+ * Trigger on funder selection.
20
+ * Updated the query state to filter by the selected funder.
21
+ *
22
+ * @param {*} event
23
+ * @param {*} data
24
+ */
25
+ function onFunderSelect(event, data) {
26
+ let newFilter = [];
27
+
28
+ if (data && data.value !== "") {
29
+ newFilter = ["funders", data.value];
30
+ }
31
+ updateQueryState({ ...currentQueryState, filters: newFilter, page: 1 });
32
+ }
33
+
34
+ /**
35
+ * Custom hook, triggered when the awards list changes.
36
+ * It retrieves funders from new award's facets.
37
+ *
38
+ * @param {object} awards
39
+ *
40
+ * @returns {object[]} an array of objects, each representing a facetted funder.
41
+ */
42
+ function useFundersFromFacets(awards) {
43
+ const [result, setResult] = React.useState([]);
44
+ React.useEffect(() => {
45
+ /**
46
+ * Retrieves funders from awards facets and sets the result in state 'result'.
47
+ */
48
+ function getFundersFromAwardsFacet() {
49
+ if (awards.loading) {
50
+ setResult([]);
51
+ return;
52
+ }
53
+
54
+ const funders = awards.data.aggregations?.funders?.buckets.map((agg) => {
55
+ return {
56
+ key: agg.key,
57
+ value: agg.key,
58
+ text: agg.label,
59
+ };
60
+ });
61
+ setResult(funders);
62
+ }
63
+
64
+ getFundersFromAwardsFacet();
65
+ }, [awards]);
66
+
67
+ return [result];
68
+ }
69
+
70
+ return (
71
+ <Dropdown
72
+ placeholder={i18next.t("Funder")}
73
+ search
74
+ selection
75
+ clearable
76
+ scrolling
77
+ multiple={false}
78
+ options={fundersFromFacets || []}
79
+ allowAdditions={false}
80
+ onChange={onFunderSelect}
81
+ fluid
82
+ selectOnBlur={false}
83
+ selectOnNavigation={false}
84
+ />
85
+ );
86
+ }
87
+ );