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.
- invenio_vocabularies/__init__.py +2 -2
- invenio_vocabularies/administration/__init__.py +10 -0
- invenio_vocabularies/administration/views/__init__.py +10 -0
- invenio_vocabularies/administration/views/vocabularies.py +45 -0
- invenio_vocabularies/alembic/4a9a4fd235f8_create_vocabulary_schemes.py +4 -4
- invenio_vocabularies/alembic/4f365fced43f_create_vocabularies_tables.py +2 -2
- invenio_vocabularies/alembic/55a700f897b6_add_names_and_afiliations_pid_column.py +96 -0
- invenio_vocabularies/alembic/676dd587542d_create_funders_vocabulary_table.py +1 -1
- invenio_vocabularies/alembic/e1146238edd3_create_awards_table.py +1 -1
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.eslintrc.yml +11 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.prettierrc +1 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/package.json +25 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/AwardResults.js +95 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js +139 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FunderDropdown.js +87 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js +223 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.test.js +1 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingFieldItem.js +152 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingModal.js +270 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/NoAwardResults.js +37 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/index.js +8 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/i18next-scanner.config.js +63 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/i18next.js +36 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/index.js +1 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/package.json +53 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/scripts/compileCatalog.js +39 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/scripts/initCatalog.js +19 -0
- invenio_vocabularies/cli.py +31 -44
- invenio_vocabularies/config.py +74 -7
- invenio_vocabularies/contrib/affiliations/affiliations.py +22 -6
- invenio_vocabularies/contrib/affiliations/api.py +1 -2
- invenio_vocabularies/contrib/affiliations/config.py +10 -5
- invenio_vocabularies/contrib/affiliations/datastreams.py +186 -0
- invenio_vocabularies/contrib/affiliations/facets.py +36 -0
- invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json +38 -7
- invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json +22 -1
- invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v2.0.0.json +171 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json +22 -1
- invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v2.0.0.json +171 -0
- invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json +22 -1
- invenio_vocabularies/contrib/affiliations/schema.py +23 -5
- invenio_vocabularies/contrib/affiliations/services.py +1 -2
- invenio_vocabularies/contrib/awards/awards.py +18 -6
- invenio_vocabularies/contrib/awards/config.py +1 -3
- invenio_vocabularies/contrib/awards/datastreams.py +246 -3
- invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json +41 -0
- invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json +53 -1
- invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json +53 -1
- invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json +53 -1
- invenio_vocabularies/contrib/awards/schema.py +27 -35
- invenio_vocabularies/contrib/awards/serializer.py +9 -1
- invenio_vocabularies/contrib/awards/services.py +1 -2
- invenio_vocabularies/contrib/common/__init__.py +9 -0
- invenio_vocabularies/contrib/common/openaire/__init__.py +9 -0
- invenio_vocabularies/contrib/common/openaire/datastreams.py +84 -0
- invenio_vocabularies/contrib/common/ror/__init__.py +9 -0
- invenio_vocabularies/contrib/common/ror/datastreams.py +220 -0
- invenio_vocabularies/contrib/funders/config.py +12 -5
- invenio_vocabularies/contrib/funders/datastreams.py +40 -62
- invenio_vocabularies/contrib/funders/facets.py +13 -5
- invenio_vocabularies/contrib/funders/funders.py +4 -2
- invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json +36 -1
- invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json +22 -1
- invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v2.0.0.json +156 -0
- invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json +22 -1
- invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v2.0.0.json +156 -0
- invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json +22 -1
- invenio_vocabularies/contrib/funders/schema.py +8 -0
- invenio_vocabularies/contrib/funders/serializer.py +2 -1
- invenio_vocabularies/contrib/names/config.py +5 -3
- invenio_vocabularies/contrib/names/datastreams.py +177 -38
- invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json +2 -6
- invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json +3 -0
- invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v2.0.0.json +150 -0
- invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json +3 -0
- invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v2.0.0.json +150 -0
- invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json +3 -0
- invenio_vocabularies/contrib/names/names.py +29 -13
- invenio_vocabularies/contrib/names/permissions.py +20 -0
- invenio_vocabularies/contrib/names/s3client.py +44 -0
- invenio_vocabularies/contrib/names/schema.py +31 -4
- invenio_vocabularies/contrib/subjects/config.py +9 -3
- invenio_vocabularies/contrib/subjects/datastreams.py +61 -0
- invenio_vocabularies/contrib/subjects/euroscivoc/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/euroscivoc/datastreams.py +171 -0
- invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json +31 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json +35 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json +35 -0
- invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json +35 -0
- invenio_vocabularies/contrib/subjects/mesh/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mesh/datastreams.py +43 -0
- invenio_vocabularies/contrib/subjects/schema.py +47 -5
- invenio_vocabularies/contrib/subjects/subjects.py +10 -0
- invenio_vocabularies/datastreams/datastreams.py +61 -13
- invenio_vocabularies/datastreams/factories.py +1 -2
- invenio_vocabularies/datastreams/readers.py +138 -29
- invenio_vocabularies/datastreams/tasks.py +37 -0
- invenio_vocabularies/datastreams/transformers.py +17 -27
- invenio_vocabularies/datastreams/writers.py +116 -14
- invenio_vocabularies/datastreams/xml.py +34 -0
- invenio_vocabularies/ext.py +59 -5
- invenio_vocabularies/factories.py +137 -0
- invenio_vocabularies/jobs.py +133 -0
- invenio_vocabularies/proxies.py +2 -2
- invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json +7 -0
- invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json +1 -4
- invenio_vocabularies/records/mappings/os-v1/vocabularies/vocabulary-v1.0.0.json +3 -3
- invenio_vocabularies/records/mappings/os-v2/vocabularies/vocabulary-v1.0.0.json +3 -3
- invenio_vocabularies/records/mappings/v7/vocabularies/vocabulary-v1.0.0.json +3 -3
- invenio_vocabularies/records/models.py +8 -10
- invenio_vocabularies/records/pidprovider.py +1 -2
- invenio_vocabularies/records/systemfields/relations.py +2 -2
- invenio_vocabularies/resources/__init__.py +9 -1
- invenio_vocabularies/resources/config.py +105 -0
- invenio_vocabularies/resources/resource.py +31 -41
- invenio_vocabularies/resources/schema.py +2 -1
- invenio_vocabularies/services/__init__.py +5 -2
- invenio_vocabularies/services/config.py +179 -0
- invenio_vocabularies/services/custom_fields/__init__.py +6 -2
- invenio_vocabularies/services/custom_fields/subject.py +82 -0
- invenio_vocabularies/services/custom_fields/vocabulary.py +19 -9
- invenio_vocabularies/services/facets.py +67 -37
- invenio_vocabularies/services/permissions.py +3 -1
- invenio_vocabularies/services/results.py +110 -0
- invenio_vocabularies/services/schema.py +39 -2
- invenio_vocabularies/services/service.py +46 -94
- invenio_vocabularies/services/tasks.py +1 -1
- invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/subjects.html +23 -0
- invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabularies-list.html +12 -0
- invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabulary-details.html +71 -0
- invenio_vocabularies/translations/af/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/af/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/ar/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ar/LC_MESSAGES/messages.po +9 -8
- invenio_vocabularies/translations/bg/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/bg/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/ca/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ca/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/cs/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/cs/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/da/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/da/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/de/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/de/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/de_AT/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/de_AT/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/de_DE/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/de_DE/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/el/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/el/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/en/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/en_AT/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/en_AT/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/en_HU/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/en_HU/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/es/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/es/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/es_CU/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/es_CU/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/es_MX/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/es_MX/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/et/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/et/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/et_EE/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/et_EE/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/fa/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/fa/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/fa_IR/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/fa_IR/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/fr/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/fr/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/fr_CI/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/fr_CI/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/fr_FR/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/fr_FR/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/gl/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/gl/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/hi_IN/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/hi_IN/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/hr/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/hr/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/hu/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/hu/LC_MESSAGES/messages.po +4 -4
- invenio_vocabularies/translations/hu_HU/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/hu_HU/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/it/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/it/LC_MESSAGES/messages.po +4 -3
- invenio_vocabularies/translations/ja/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ja/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/ka/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ka/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/lt/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/lt/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/messages.pot +95 -48
- invenio_vocabularies/translations/ne/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ne/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/no/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/no/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/pl/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/pl/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/pt/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/pt/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/ro/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ro/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/ru/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ru/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/rw/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/rw/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/sk/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/sk/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/sv/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/sv/LC_MESSAGES/messages.po +4 -3
- invenio_vocabularies/translations/sv_SE/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/sv_SE/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/tr/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/tr/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/uk/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/uk/LC_MESSAGES/messages.po +17 -13
- invenio_vocabularies/translations/uk_UA/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/uk_UA/LC_MESSAGES/messages.po +139 -0
- invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.po +1 -1
- invenio_vocabularies/views.py +12 -26
- invenio_vocabularies/webpack.py +51 -0
- invenio_vocabularies-6.3.1.dist-info/METADATA +346 -0
- invenio_vocabularies-6.3.1.dist-info/RECORD +306 -0
- {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/WHEEL +1 -1
- {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/entry_points.txt +20 -0
- invenio_vocabularies-1.2.0.dist-info/METADATA +0 -133
- invenio_vocabularies-1.2.0.dist-info/RECORD +0 -220
- {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/AUTHORS.rst +0 -0
- {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/LICENSE +0 -0
- {invenio_vocabularies-1.2.0.dist-info → invenio_vocabularies-6.3.1.dist-info}/top_level.txt +0 -0
invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/i18next-scanner.config.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// This file is part of React-Invenio-Deposit
|
|
2
|
+
//
|
|
3
|
+
// Invenio-administration is free software; you can redistribute it and/or modify it
|
|
4
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
5
|
+
|
|
6
|
+
// list of func used to
|
|
7
|
+
// mark the strings for translation
|
|
8
|
+
const { languages } = require("./package.json").config;
|
|
9
|
+
|
|
10
|
+
const funcList = ["i18next.t"];
|
|
11
|
+
const extensions = [".js", ".jsx"];
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
options: {
|
|
15
|
+
debug: true,
|
|
16
|
+
removeUnusedKeys: true,
|
|
17
|
+
browserLanguageDetection: true,
|
|
18
|
+
func: {
|
|
19
|
+
list: funcList,
|
|
20
|
+
extensions: extensions,
|
|
21
|
+
},
|
|
22
|
+
//using Trans component
|
|
23
|
+
trans: {
|
|
24
|
+
component: "Trans",
|
|
25
|
+
extensions: extensions,
|
|
26
|
+
fallbackKey: function (ns, value) {
|
|
27
|
+
return value;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
lngs: languages,
|
|
31
|
+
ns: [
|
|
32
|
+
// file name (.json)
|
|
33
|
+
"translations",
|
|
34
|
+
],
|
|
35
|
+
defaultLng: "en",
|
|
36
|
+
defaultNs: "translations",
|
|
37
|
+
// @param {string} lng The language currently used.
|
|
38
|
+
// @param {string} ns The namespace currently used.
|
|
39
|
+
// @param {string} key The translation key.
|
|
40
|
+
// @return {string} Returns a default value for the translation key.
|
|
41
|
+
defaultValue: function (lng, ns, key) {
|
|
42
|
+
if (lng === "en") {
|
|
43
|
+
// Return key as the default value for English language
|
|
44
|
+
return key;
|
|
45
|
+
}
|
|
46
|
+
return "";
|
|
47
|
+
},
|
|
48
|
+
resource: {
|
|
49
|
+
// The path where resources get loaded from. Relative to current working directory.
|
|
50
|
+
loadPath: "messages/{{lng}}/{{ns}}.json",
|
|
51
|
+
|
|
52
|
+
// The path to store resources.
|
|
53
|
+
savePath: "messages/{{lng}}/{{ns}}.json",
|
|
54
|
+
jsonIndent: 2,
|
|
55
|
+
lineEnding: "\n",
|
|
56
|
+
},
|
|
57
|
+
nsSeparator: false, // namespace separator
|
|
58
|
+
|
|
59
|
+
//Set to false to disable key separator
|
|
60
|
+
// if you prefer having keys as the fallback for translation (e.g. gettext).
|
|
61
|
+
keySeparator: false,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// This file is part of React-Invenio-Deposit
|
|
2
|
+
//
|
|
3
|
+
// Invenio-administration is free software; you can redistribute it and/or modify it
|
|
4
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
5
|
+
|
|
6
|
+
import i18n from "i18next";
|
|
7
|
+
|
|
8
|
+
import LanguageDetector from "i18next-browser-languagedetector";
|
|
9
|
+
import { translations } from "./messages";
|
|
10
|
+
import { initReactI18next } from "react-i18next";
|
|
11
|
+
|
|
12
|
+
const options = {
|
|
13
|
+
fallbackLng: "en", // fallback keys
|
|
14
|
+
returnEmptyString: false,
|
|
15
|
+
debug: process.env.NODE_ENV === "development",
|
|
16
|
+
resources: translations,
|
|
17
|
+
keySeparator: false,
|
|
18
|
+
nsSeparator: false,
|
|
19
|
+
// specify language detection order
|
|
20
|
+
detection: {
|
|
21
|
+
order: ["htmlTag"],
|
|
22
|
+
// cache user language off
|
|
23
|
+
caches: [],
|
|
24
|
+
},
|
|
25
|
+
react: {
|
|
26
|
+
// Set empty - to allow html tags convert to trans tags
|
|
27
|
+
// HTML TAG | Trans TAG
|
|
28
|
+
// <span> | <1>
|
|
29
|
+
transKeepBasicHtmlNodesFor: [],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const i18next = i18n.createInstance();
|
|
34
|
+
i18next.use(LanguageDetector).use(initReactI18next).init(options);
|
|
35
|
+
|
|
36
|
+
export { i18next };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const translations = {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "invenio-vocabularies-ui",
|
|
3
|
+
"config": {
|
|
4
|
+
"languages": [
|
|
5
|
+
"af",
|
|
6
|
+
"ar",
|
|
7
|
+
"bg",
|
|
8
|
+
"ca",
|
|
9
|
+
"cs",
|
|
10
|
+
"da",
|
|
11
|
+
"de",
|
|
12
|
+
"el",
|
|
13
|
+
"en",
|
|
14
|
+
"es",
|
|
15
|
+
"et",
|
|
16
|
+
"et_EE",
|
|
17
|
+
"fa",
|
|
18
|
+
"fr",
|
|
19
|
+
"gl",
|
|
20
|
+
"hr",
|
|
21
|
+
"hu",
|
|
22
|
+
"it",
|
|
23
|
+
"ja",
|
|
24
|
+
"ka",
|
|
25
|
+
"lt",
|
|
26
|
+
"no",
|
|
27
|
+
"pl",
|
|
28
|
+
"pt",
|
|
29
|
+
"ro",
|
|
30
|
+
"ru",
|
|
31
|
+
"rw",
|
|
32
|
+
"sk",
|
|
33
|
+
"sv",
|
|
34
|
+
"tr",
|
|
35
|
+
"uk",
|
|
36
|
+
"zh_CN",
|
|
37
|
+
"zh_TW"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"i18next-conv": "^10.2.0",
|
|
42
|
+
"i18next-scanner": "^3.0.0",
|
|
43
|
+
"react-i18next": "^11.11.3",
|
|
44
|
+
"i18next": "^20.3.0",
|
|
45
|
+
"i18next-browser-languagedetector": "^6.1.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"extract_messages": "i18next-scanner --config i18next-scanner.config.js '../../js/**/*.{js,jsx}'",
|
|
49
|
+
"postextract_messages": "i18next-conv -l en -s ./messages/en/translations.json -t ./translations.pot",
|
|
50
|
+
"compile_catalog": "node ./scripts/compileCatalog.js",
|
|
51
|
+
"init_catalog": "node ./scripts/initCatalog"
|
|
52
|
+
}
|
|
53
|
+
}
|
invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/scripts/compileCatalog.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// This file is part of React-Invenio-Deposit
|
|
2
|
+
//
|
|
3
|
+
// Invenio-administration is free software; you can redistribute it and/or modify it
|
|
4
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
5
|
+
|
|
6
|
+
const { readFileSync, writeFileSync } = require("fs");
|
|
7
|
+
const { gettextToI18next } = require("i18next-conv");
|
|
8
|
+
|
|
9
|
+
const PACKAGE_JSON_BASE_PATH = "./";
|
|
10
|
+
const { languages } = require(`../package`).config;
|
|
11
|
+
|
|
12
|
+
// it accepts the same options as the cli.
|
|
13
|
+
// https://github.com/i18next/i18next-gettext-converter#options
|
|
14
|
+
const options = {
|
|
15
|
+
/* you options here */
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function save(target) {
|
|
19
|
+
return (result) => {
|
|
20
|
+
writeFileSync(target, result);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if ("lang" === process.argv[2]) {
|
|
25
|
+
const lang = process.argv[3];
|
|
26
|
+
gettextToI18next(
|
|
27
|
+
lang,
|
|
28
|
+
readFileSync(`${PACKAGE_JSON_BASE_PATH}messages/${lang}/messages.po`),
|
|
29
|
+
options
|
|
30
|
+
).then(save(`${PACKAGE_JSON_BASE_PATH}messages/${lang}/translations.json`));
|
|
31
|
+
} else {
|
|
32
|
+
for (const lang of languages) {
|
|
33
|
+
gettextToI18next(
|
|
34
|
+
lang,
|
|
35
|
+
readFileSync(`${PACKAGE_JSON_BASE_PATH}messages/${lang}/messages.po`),
|
|
36
|
+
options
|
|
37
|
+
).then(save(`${PACKAGE_JSON_BASE_PATH}messages/${lang}/translations.json`));
|
|
38
|
+
}
|
|
39
|
+
}
|
invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/scripts/initCatalog.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// This file is part of React-Invenio-Deposit
|
|
2
|
+
//
|
|
3
|
+
// Invenio-administration is free software; you can redistribute it and/or modify it
|
|
4
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
5
|
+
|
|
6
|
+
const { writeFileSync } = require("fs");
|
|
7
|
+
const packageJson = require("../package");
|
|
8
|
+
|
|
9
|
+
const { languages } = packageJson.config;
|
|
10
|
+
if ("lang" === process.argv[2]) {
|
|
11
|
+
const addedLang = process.argv[3];
|
|
12
|
+
languages.push(addedLang);
|
|
13
|
+
packageJson.config.languages = [...new Set(languages)];
|
|
14
|
+
writeFileSync(`package.json`, JSON.stringify(packageJson, null, 2));
|
|
15
|
+
} else {
|
|
16
|
+
console.error(
|
|
17
|
+
"Error:Please provide a language by running `npm run init_catalog lang <lang>`"
|
|
18
|
+
);
|
|
19
|
+
}
|
invenio_vocabularies/cli.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2020-
|
|
3
|
+
# Copyright (C) 2020-2024 CERN.
|
|
4
4
|
# Copyright (C) 2021 Graz University of Technology.
|
|
5
5
|
#
|
|
6
6
|
# Invenio-Vocabularies is free software; you can redistribute it and/or
|
|
@@ -9,46 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
"""Commands to create and manage vocabularies."""
|
|
11
11
|
|
|
12
|
-
from copy import deepcopy
|
|
13
|
-
|
|
14
12
|
import click
|
|
15
|
-
import yaml
|
|
16
13
|
from flask.cli import with_appcontext
|
|
17
14
|
from invenio_access.permissions import system_identity
|
|
18
15
|
from invenio_pidstore.errors import PIDDeletedError, PIDDoesNotExistError
|
|
19
|
-
from invenio_records_resources.proxies import current_service_registry
|
|
20
16
|
|
|
21
|
-
from .contrib.awards.datastreams import DATASTREAM_CONFIG as awards_ds_config
|
|
22
|
-
from .contrib.funders.datastreams import DATASTREAM_CONFIG as funders_ds_config
|
|
23
|
-
from .contrib.names.datastreams import DATASTREAM_CONFIG as names_ds_config
|
|
24
17
|
from .datastreams import DataStreamFactory
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def get_config_for_ds(vocabulary, filepath=None, origin=None):
|
|
28
|
-
"""Calculates the configuration for a Data Stream."""
|
|
29
|
-
config = None
|
|
30
|
-
if vocabulary == "names": # FIXME: turn into a proper factory
|
|
31
|
-
config = deepcopy(names_ds_config)
|
|
32
|
-
elif vocabulary == "funders":
|
|
33
|
-
config = deepcopy(funders_ds_config)
|
|
34
|
-
elif vocabulary == "awards":
|
|
35
|
-
config = deepcopy(awards_ds_config)
|
|
36
|
-
|
|
37
|
-
if config:
|
|
38
|
-
if filepath:
|
|
39
|
-
with open(filepath) as f:
|
|
40
|
-
config = yaml.safe_load(f).get(vocabulary)
|
|
41
|
-
if origin:
|
|
42
|
-
config["readers"][0].setdefault("args", {})
|
|
43
|
-
config["readers"][0]["args"]["origin"] = origin
|
|
44
|
-
|
|
45
|
-
return config
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def get_service_for_vocabulary(vocabulary):
|
|
49
|
-
"""Calculates the configuration for a Data Stream."""
|
|
50
|
-
if vocabulary == "names": # FIXME: turn into a proper factory
|
|
51
|
-
return current_service_registry.get("names")
|
|
18
|
+
from .factories import get_vocabulary_config
|
|
52
19
|
|
|
53
20
|
|
|
54
21
|
@click.group()
|
|
@@ -111,7 +78,9 @@ def import_vocab(vocabulary, filepath=None, origin=None, num_samples=None):
|
|
|
111
78
|
click.secho("One of --filepath or --origin must be present.", fg="red")
|
|
112
79
|
exit(1)
|
|
113
80
|
|
|
114
|
-
|
|
81
|
+
vc = get_vocabulary_config(vocabulary)
|
|
82
|
+
config = vc.get_config(filepath, origin)
|
|
83
|
+
|
|
115
84
|
success, errored, filtered = _process_vocab(config, num_samples)
|
|
116
85
|
|
|
117
86
|
_output_process(vocabulary, "imported", success, errored, filtered)
|
|
@@ -127,11 +96,19 @@ def update(vocabulary, filepath=None, origin=None):
|
|
|
127
96
|
if not filepath and not origin:
|
|
128
97
|
click.secho("One of --filepath or --origin must be present.", fg="red")
|
|
129
98
|
exit(1)
|
|
130
|
-
|
|
131
|
-
config =
|
|
99
|
+
vc = get_vocabulary_config(vocabulary)
|
|
100
|
+
config = vc.get_config(filepath, origin)
|
|
132
101
|
|
|
133
102
|
for w_conf in config["writers"]:
|
|
134
|
-
w_conf["
|
|
103
|
+
if w_conf["type"] == "async":
|
|
104
|
+
w_conf_update = w_conf["args"]["writer"]
|
|
105
|
+
else:
|
|
106
|
+
w_conf_update = w_conf
|
|
107
|
+
|
|
108
|
+
if "args" in w_conf_update:
|
|
109
|
+
w_conf_update["args"]["update"] = True
|
|
110
|
+
else:
|
|
111
|
+
w_conf_update["args"] = {"update": True}
|
|
135
112
|
|
|
136
113
|
success, errored, filtered = _process_vocab(config)
|
|
137
114
|
|
|
@@ -153,7 +130,8 @@ def convert(vocabulary, filepath=None, origin=None, target=None, num_samples=Non
|
|
|
153
130
|
)
|
|
154
131
|
exit(1)
|
|
155
132
|
|
|
156
|
-
|
|
133
|
+
vc = get_vocabulary_config(vocabulary)
|
|
134
|
+
config = vc.get_config(filepath, origin)
|
|
157
135
|
if not filepath:
|
|
158
136
|
config["writers"] = [{"type": "yaml", "args": {"filepath": target}}]
|
|
159
137
|
|
|
@@ -169,18 +147,27 @@ def convert(vocabulary, filepath=None, origin=None, target=None, num_samples=Non
|
|
|
169
147
|
type=click.STRING,
|
|
170
148
|
help="Identifier of the vocabulary item to delete.",
|
|
171
149
|
)
|
|
172
|
-
@click.option("--all", is_flag=True, default=False
|
|
150
|
+
@click.option("--all", is_flag=True, default=False)
|
|
173
151
|
@with_appcontext
|
|
174
152
|
def delete(vocabulary, identifier, all):
|
|
175
153
|
"""Delete all items or a specific one of the vocabulary."""
|
|
176
|
-
if not
|
|
154
|
+
if not identifier and not all:
|
|
177
155
|
click.secho("An identifier or the --all flag must be present.", fg="red")
|
|
178
156
|
exit(1)
|
|
179
157
|
|
|
180
|
-
|
|
158
|
+
vc = get_vocabulary_config(vocabulary)
|
|
159
|
+
service = vc.get_service()
|
|
181
160
|
if identifier:
|
|
182
161
|
try:
|
|
183
|
-
if service.delete(
|
|
162
|
+
if service.delete(system_identity, identifier):
|
|
184
163
|
click.secho(f"{identifier} deleted from {vocabulary}.", fg="green")
|
|
185
164
|
except (PIDDeletedError, PIDDoesNotExistError):
|
|
186
165
|
click.secho(f"PID {identifier} not found.")
|
|
166
|
+
elif all:
|
|
167
|
+
items = service.scan(system_identity)
|
|
168
|
+
for item in items.hits:
|
|
169
|
+
try:
|
|
170
|
+
if service.delete(system_identity, item["id"]):
|
|
171
|
+
click.secho(f"{item['id']} deleted from {vocabulary}.", fg="green")
|
|
172
|
+
except (PIDDeletedError, PIDDoesNotExistError):
|
|
173
|
+
click.secho(f"PID {item['id']} not found.")
|
invenio_vocabularies/config.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2020 CERN.
|
|
3
|
+
# Copyright (C) 2020-2024 CERN.
|
|
4
4
|
# Copyright (C) 2021 Northwestern University.
|
|
5
|
+
# Copyright (C) 2024 University of Münster.
|
|
5
6
|
#
|
|
6
7
|
# Invenio-Vocabularies is free software; you can redistribute it and/or
|
|
7
8
|
# modify it under the terms of the MIT License; see LICENSE file for more
|
|
@@ -17,15 +18,16 @@ from .datastreams.readers import (
|
|
|
17
18
|
GzipReader,
|
|
18
19
|
JsonLinesReader,
|
|
19
20
|
JsonReader,
|
|
21
|
+
OAIPMHReader,
|
|
20
22
|
TarReader,
|
|
21
23
|
XMLReader,
|
|
22
24
|
YamlReader,
|
|
23
25
|
ZipReader,
|
|
24
26
|
)
|
|
25
27
|
from .datastreams.transformers import XMLTransformer
|
|
26
|
-
from .datastreams.writers import ServiceWriter, YamlWriter
|
|
27
|
-
from .resources
|
|
28
|
-
from .services.
|
|
28
|
+
from .datastreams.writers import AsyncWriter, ServiceWriter, YamlWriter
|
|
29
|
+
from .resources import VocabulariesResourceConfig
|
|
30
|
+
from .services.config import VocabulariesServiceConfig
|
|
29
31
|
|
|
30
32
|
VOCABULARIES_RESOURCE_CONFIG = VocabulariesResourceConfig
|
|
31
33
|
"""Configure the resource."""
|
|
@@ -41,8 +43,17 @@ VOCABULARIES_IDENTIFIER_SCHEMES = {
|
|
|
41
43
|
}
|
|
42
44
|
""""Generic identifier schemes, usable by other vocabularies."""
|
|
43
45
|
|
|
46
|
+
|
|
47
|
+
def is_pic(val):
|
|
48
|
+
"""Test if argument is a Participant Identification Code (PIC)."""
|
|
49
|
+
if len(val) != 9:
|
|
50
|
+
return False
|
|
51
|
+
return val.isdigit()
|
|
52
|
+
|
|
53
|
+
|
|
44
54
|
VOCABULARIES_AFFILIATION_SCHEMES = {
|
|
45
55
|
**VOCABULARIES_IDENTIFIER_SCHEMES,
|
|
56
|
+
"pic": {"label": _("PIC"), "validator": is_pic},
|
|
46
57
|
}
|
|
47
58
|
"""Affiliations allowed identifier schemes."""
|
|
48
59
|
|
|
@@ -62,28 +73,33 @@ VOCABULARIES_AWARD_SCHEMES = {
|
|
|
62
73
|
"""Awards allowed identifier schemes."""
|
|
63
74
|
|
|
64
75
|
VOCABULARIES_AWARDS_OPENAIRE_FUNDERS = {
|
|
65
|
-
"anr_________": "00rbzpz17",
|
|
66
76
|
"aka_________": "05k73zm37",
|
|
77
|
+
"anr_________": "00rbzpz17",
|
|
67
78
|
"arc_________": "05mmh0f86",
|
|
79
|
+
"asap________": "03zj4c476",
|
|
68
80
|
"cihr________": "01gavpb45",
|
|
69
81
|
"corda_______": "00k4n6c32",
|
|
82
|
+
"corda_____he": "00k4n6c32",
|
|
70
83
|
"corda__h2020": "00k4n6c32",
|
|
71
84
|
"euenvagency_": "02k4b9v70",
|
|
72
85
|
"fct_________": "00snfqn58",
|
|
73
86
|
"fwf_________": "013tf3c58",
|
|
87
|
+
"inca________": "03m8vkq32",
|
|
74
88
|
"irb_hr______": "03n51vw80",
|
|
89
|
+
"lcs_________": "02ar66p97",
|
|
75
90
|
"mestd_______": "01znas443",
|
|
76
91
|
"nhmrc_______": "011kf5r70",
|
|
77
92
|
"nih_________": "01cwqze88",
|
|
78
93
|
"nserc_______": "01h531d29",
|
|
79
94
|
"nsf_________": "021nxhr62",
|
|
80
95
|
"nwo_________": "04jsz6e67",
|
|
81
|
-
"rcuk________": "
|
|
82
|
-
"ukri________": "001aqnf71",
|
|
96
|
+
"rcuk________": "00dq2kk65", # deprecated funder org
|
|
83
97
|
"sfi_________": "0271asj38",
|
|
84
98
|
"snsf________": "00yjd3n13",
|
|
85
99
|
"sshrc_______": "006cvnv84",
|
|
86
100
|
"tubitakf____": "04w9kkr77",
|
|
101
|
+
"twcf________": "00x0z1472",
|
|
102
|
+
"ukri________": "001aqnf71",
|
|
87
103
|
"wt__________": "029chgv08",
|
|
88
104
|
}
|
|
89
105
|
"""Mapping of OpenAIRE and ROR funder codes."""
|
|
@@ -98,6 +114,21 @@ VOCABULARIES_NAMES_SCHEMES = {
|
|
|
98
114
|
}
|
|
99
115
|
"""Names allowed identifier schemes."""
|
|
100
116
|
|
|
117
|
+
VOCABULARIES_SUBJECTS_SCHEMES = {
|
|
118
|
+
"gnd": {"label": _("GND"), "validator": idutils.is_gnd, "datacite": "GND"},
|
|
119
|
+
"url": {"label": _("URL"), "validator": idutils.is_url},
|
|
120
|
+
}
|
|
121
|
+
"""Subjects allowed identifier schemes."""
|
|
122
|
+
|
|
123
|
+
VOCABULARIES_CUSTOM_VOCABULARY_TYPES = [
|
|
124
|
+
"names",
|
|
125
|
+
"affiliations",
|
|
126
|
+
"awards",
|
|
127
|
+
"funders",
|
|
128
|
+
"subjects",
|
|
129
|
+
]
|
|
130
|
+
"""List of custom vocabulary types."""
|
|
131
|
+
|
|
101
132
|
VOCABULARIES_DATASTREAM_READERS = {
|
|
102
133
|
"csv": CSVReader,
|
|
103
134
|
"json": JsonReader,
|
|
@@ -107,6 +138,7 @@ VOCABULARIES_DATASTREAM_READERS = {
|
|
|
107
138
|
"yaml": YamlReader,
|
|
108
139
|
"zip": ZipReader,
|
|
109
140
|
"xml": XMLReader,
|
|
141
|
+
"oai-pmh": OAIPMHReader,
|
|
110
142
|
}
|
|
111
143
|
"""Data Streams readers."""
|
|
112
144
|
|
|
@@ -118,5 +150,40 @@ VOCABULARIES_DATASTREAM_TRANSFORMERS = {
|
|
|
118
150
|
VOCABULARIES_DATASTREAM_WRITERS = {
|
|
119
151
|
"service": ServiceWriter,
|
|
120
152
|
"yaml": YamlWriter,
|
|
153
|
+
"async": AsyncWriter,
|
|
121
154
|
}
|
|
122
155
|
"""Data Streams writers."""
|
|
156
|
+
|
|
157
|
+
VOCABULARIES_TYPES_SORT_OPTIONS = {
|
|
158
|
+
"name": dict(
|
|
159
|
+
title=_("Name"),
|
|
160
|
+
fields=["id"],
|
|
161
|
+
),
|
|
162
|
+
"count": dict(
|
|
163
|
+
title=_("Number of entries"),
|
|
164
|
+
fields=["count"],
|
|
165
|
+
),
|
|
166
|
+
}
|
|
167
|
+
"""Definitions of available Vocabulary types sort options. """
|
|
168
|
+
|
|
169
|
+
VOCABULARIES_TYPES_SEARCH = {
|
|
170
|
+
"facets": [],
|
|
171
|
+
"sort": ["name", "count"],
|
|
172
|
+
}
|
|
173
|
+
"""Vocabulary type search configuration."""
|
|
174
|
+
|
|
175
|
+
SUBJECTS_EUROSCIVOC_FILE_URL = "https://op.europa.eu/o/opportal-service/euvoc-download-handler?cellarURI=http%3A%2F%2Fpublications.europa.eu%2Fresource%2Fdistribution%2Feuroscivoc%2F20231115-0%2Frdf%2Fskos_ap_eu%2FEuroSciVoc-skos-ap-eu.rdf&fileName=EuroSciVoc-skos-ap-eu.rdf"
|
|
176
|
+
"""Subject EuroSciVoc file download link."""
|
|
177
|
+
|
|
178
|
+
VOCABULARIES_ORCID_ACCESS_KEY = "TODO"
|
|
179
|
+
"""ORCID access key to access the s3 bucket."""
|
|
180
|
+
VOCABULARIES_ORCID_SECRET_KEY = "TODO"
|
|
181
|
+
"""ORCID secret key to access the s3 bucket."""
|
|
182
|
+
VOCABULARIES_ORCID_SUMMARIES_BUCKET = "v3.0-summaries"
|
|
183
|
+
"""ORCID summaries bucket name."""
|
|
184
|
+
VOCABULARIES_ORCID_SYNC_MAX_WORKERS = 32
|
|
185
|
+
"""ORCID max number of simultaneous workers/connections."""
|
|
186
|
+
VOCABULARIES_ORCID_SYNC_SINCE = {
|
|
187
|
+
"days": 1,
|
|
188
|
+
}
|
|
189
|
+
"""ORCID time shift to sync. Parameters accepted are the ones passed to 'datetime.timedelta'."""
|
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
"""Vocabulary affiliations."""
|
|
10
10
|
|
|
11
|
+
from flask_resources import JSONSerializer, ResponseHandler
|
|
12
|
+
from invenio_db import db
|
|
11
13
|
from invenio_records.dumpers import SearchDumper
|
|
12
14
|
from invenio_records.dumpers.indexedat import IndexedAtDumperExt
|
|
13
15
|
from invenio_records_resources.factories.factory import RecordTypeFactory
|
|
16
|
+
from invenio_records_resources.records.systemfields import ModelPIDField
|
|
17
|
+
from invenio_records_resources.resources.records.headers import etag_headers
|
|
14
18
|
|
|
15
|
-
from ...records.pidprovider import PIDProviderFactory
|
|
16
|
-
from ...records.systemfields import BaseVocabularyPIDFieldContext
|
|
17
19
|
from ...services.permissions import PermissionPolicy
|
|
18
20
|
from .config import AffiliationsSearchOptions, service_components
|
|
19
21
|
from .schema import AffiliationSchema
|
|
@@ -21,17 +23,23 @@ from .schema import AffiliationSchema
|
|
|
21
23
|
record_type = RecordTypeFactory(
|
|
22
24
|
"Affiliation",
|
|
23
25
|
# Data layer
|
|
26
|
+
pid_field_cls=ModelPIDField,
|
|
24
27
|
pid_field_kwargs={
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
"model_field_name": "pid",
|
|
29
|
+
},
|
|
30
|
+
model_cls_attrs={
|
|
31
|
+
# cannot set to nullable=False because it would fail at
|
|
32
|
+
# service level when create({}), see records-resources.
|
|
33
|
+
"pid": db.Column(db.String(255), unique=True),
|
|
28
34
|
},
|
|
29
35
|
schema_version="1.0.0",
|
|
30
36
|
schema_path="local://affiliations/affiliation-v1.0.0.json",
|
|
37
|
+
index_name="affiliations-affiliation-v2.0.0",
|
|
31
38
|
record_dumper=SearchDumper(
|
|
39
|
+
model_fields={"pid": ("id", str)},
|
|
32
40
|
extensions=[
|
|
33
41
|
IndexedAtDumperExt(),
|
|
34
|
-
]
|
|
42
|
+
],
|
|
35
43
|
),
|
|
36
44
|
# Service layer
|
|
37
45
|
service_id="affiliations",
|
|
@@ -41,4 +49,12 @@ record_type = RecordTypeFactory(
|
|
|
41
49
|
permission_policy_cls=PermissionPolicy,
|
|
42
50
|
# Resource layer
|
|
43
51
|
endpoint_route="/affiliations",
|
|
52
|
+
resource_cls_attrs={
|
|
53
|
+
"response_handlers": {
|
|
54
|
+
"application/json": ResponseHandler(JSONSerializer(), headers=etag_headers),
|
|
55
|
+
"application/vnd.inveniordm.v1+json": ResponseHandler(
|
|
56
|
+
JSONSerializer(), headers=etag_headers
|
|
57
|
+
),
|
|
58
|
+
}
|
|
59
|
+
},
|
|
44
60
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2021 CERN.
|
|
3
|
+
# Copyright (C) 2021-2024 CERN.
|
|
4
4
|
#
|
|
5
5
|
# Invenio-Vocabularies is free software; you can redistribute it and/or
|
|
6
6
|
# modify it under the terms of the MIT License; see LICENSE file for more
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
"""Vocabulary affiliations."""
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
from .affiliations import record_type
|
|
13
12
|
|
|
14
13
|
Affiliation = record_type.record_cls
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2021 CERN.
|
|
3
|
+
# Copyright (C) 2021-2024 CERN.
|
|
4
4
|
#
|
|
5
5
|
# Invenio-Vocabularies is free software; you can redistribute it and/or
|
|
6
6
|
# modify it under the terms of the MIT License; see LICENSE file for more
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"""Vocabulary affiliations configuration."""
|
|
10
10
|
|
|
11
11
|
from flask import current_app
|
|
12
|
+
from invenio_i18n import get_locale
|
|
12
13
|
from invenio_i18n import lazy_gettext as _
|
|
13
14
|
from invenio_records_resources.services import SearchOptions
|
|
14
15
|
from invenio_records_resources.services.records.components import DataComponent
|
|
@@ -20,6 +21,7 @@ from ...services.components import PIDComponent
|
|
|
20
21
|
affiliation_schemes = LocalProxy(
|
|
21
22
|
lambda: current_app.config["VOCABULARIES_AFFILIATION_SCHEMES"]
|
|
22
23
|
)
|
|
24
|
+
localized_title = LocalProxy(lambda: f"title.{get_locale()}^20")
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
class AffiliationsSearchOptions(SearchOptions):
|
|
@@ -28,11 +30,14 @@ class AffiliationsSearchOptions(SearchOptions):
|
|
|
28
30
|
suggest_parser_cls = SuggestQueryParser.factory(
|
|
29
31
|
fields=[
|
|
30
32
|
"name^100",
|
|
31
|
-
"acronym^
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
"
|
|
33
|
+
"acronym.keyword^100",
|
|
34
|
+
"acronym^40",
|
|
35
|
+
localized_title,
|
|
36
|
+
"id^20",
|
|
37
|
+
"aliases^20",
|
|
35
38
|
],
|
|
39
|
+
type="most_fields", # https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#multi-match-types
|
|
40
|
+
fuzziness="AUTO", # https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#fuzziness
|
|
36
41
|
)
|
|
37
42
|
|
|
38
43
|
sort_default = "bestmatch"
|