invenio-vocabularies 6.8.0__py2.py3-none-any.whl → 6.10.0__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

@@ -10,6 +10,6 @@
10
10
 
11
11
  from .ext import InvenioVocabularies
12
12
 
13
- __version__ = "6.8.0"
13
+ __version__ = "6.10.0"
14
14
 
15
15
  __all__ = ("__version__", "InvenioVocabularies")
@@ -0,0 +1,36 @@
1
+ #
2
+ # This file is part of Invenio.
3
+ # Copyright (C) 2024 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 internal name ID."""
9
+
10
+ import sqlalchemy as sa
11
+ from alembic import op
12
+ from sqlalchemy.dialects import postgresql
13
+
14
+ # revision identifiers, used by Alembic.
15
+ revision = "3ba812d80559"
16
+ down_revision = "55a700f897b6"
17
+ branch_labels = ()
18
+ depends_on = None
19
+
20
+
21
+ def upgrade():
22
+ """Upgrade database."""
23
+ op.add_column(
24
+ "name_metadata", sa.Column("internal_id", sa.String(length=255), nullable=True)
25
+ )
26
+ op.create_unique_constraint(
27
+ op.f("uq_name_metadata_internal_id"), "name_metadata", ["internal_id"]
28
+ )
29
+
30
+
31
+ def downgrade():
32
+ """Downgrade database."""
33
+ op.drop_constraint(
34
+ op.f("uq_name_metadata_internal_id"), "name_metadata", type_="unique"
35
+ )
36
+ op.drop_column("name_metadata", "internal_id")
@@ -59,3 +59,13 @@ class AffiliationRelationSchema(ContribVocabularyRelationSchema):
59
59
  ftf_name = "name"
60
60
  parent_field_name = "affiliations"
61
61
  name = SanitizedUnicode()
62
+ identifiers = IdentifierSet(
63
+ fields.Nested(
64
+ partial(
65
+ IdentifierSchema,
66
+ allowed_schemes=affiliation_schemes,
67
+ identifier_required=False,
68
+ )
69
+ ),
70
+ dump_only=True,
71
+ )
@@ -0,0 +1,24 @@
1
+ #
2
+ # This file is part of Invenio.
3
+ # Copyright (C) 2024 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
+ """Names service components."""
9
+
10
+ from invenio_records_resources.services.records.components import ServiceComponent
11
+
12
+
13
+ class InternalIDComponent(ServiceComponent):
14
+ """Service component for internal id field."""
15
+
16
+ field = "internal_id"
17
+
18
+ def create(self, identity, data=None, record=None, **kwargs):
19
+ """Create handler."""
20
+ setattr(record, self.field, data.pop(self.field, None))
21
+
22
+ def update(self, identity, data=None, record=None, **kwargs):
23
+ """Update handler."""
24
+ setattr(record, self.field, data.pop(self.field, None))
@@ -21,6 +21,7 @@ from invenio_records_resources.services.records.queryparser import (
21
21
  from werkzeug.local import LocalProxy
22
22
 
23
23
  from ...services.components import PIDComponent
24
+ from .components import InternalIDComponent
24
25
 
25
26
  names_schemes = LocalProxy(lambda: current_app.config["VOCABULARIES_NAMES_SCHEMES"])
26
27
 
@@ -67,6 +68,7 @@ class NamesSearchOptions(SearchOptions):
67
68
 
68
69
  service_components = [
69
70
  # Order of components are important!
71
+ InternalIDComponent,
70
72
  DataComponent,
71
73
  PIDComponent,
72
74
  RelationsComponent,
@@ -65,4 +65,4 @@
65
65
  "uniqueItems": true
66
66
  }
67
67
  }
68
- }
68
+ }
@@ -13,7 +13,7 @@ from invenio_db import db
13
13
  from invenio_records.dumpers import SearchDumper
14
14
  from invenio_records.dumpers.indexedat import IndexedAtDumperExt
15
15
  from invenio_records.dumpers.relations import RelationDumperExt
16
- from invenio_records.systemfields import RelationsField
16
+ from invenio_records.systemfields import ModelField, RelationsField
17
17
  from invenio_records_resources.factories.factory import RecordTypeFactory
18
18
  from invenio_records_resources.records.systemfields import (
19
19
  ModelPIDField,
@@ -47,10 +47,12 @@ record_type = RecordTypeFactory(
47
47
  # cannot set to nullable=False because it would fail at
48
48
  # service level when create({}), see records-resources.
49
49
  "pid": db.Column(db.String(255), unique=True),
50
+ "internal_id": db.Column(db.String(255), unique=True, nullable=True),
50
51
  },
51
52
  schema_version="1.0.0",
52
53
  schema_path="local://names/name-v1.0.0.json",
53
54
  index_name="names-name-v2.0.0",
55
+ record_cls_attrs={"internal_id": ModelField("internal_id", dump=False)},
54
56
  record_relations=name_relations,
55
57
  record_dumper=SearchDumper(
56
58
  model_fields={"pid": ("id", str)},
@@ -35,6 +35,7 @@ class NameSchema(BaseVocabularySchema, ModePIDFieldVocabularyMixin):
35
35
  so it does not inherit from it.
36
36
  """
37
37
 
38
+ internal_id = fields.Str(allow_none=True)
38
39
  name = SanitizedUnicode()
39
40
  given_name = SanitizedUnicode()
40
41
  family_name = SanitizedUnicode()
@@ -66,7 +67,7 @@ class NameSchema(BaseVocabularySchema, ModePIDFieldVocabularyMixin):
66
67
  raise ValidationError({"family_name": messages})
67
68
 
68
69
  @validates_schema
69
- def validate_affiliatons(self, data, **kwargs):
70
+ def validate_affiliations(self, data, **kwargs):
70
71
  """Validate names."""
71
72
  affiliations = data.get("affiliations", [])
72
73
  seen_names = set()
@@ -42,10 +42,10 @@ class NamesService(record_type.service_cls):
42
42
  else:
43
43
  results = self._read_many(identity, search_query, max_records=1)
44
44
 
45
- # cant use the results_item because it returns dicts intead of records
45
+ # cant use the results_item because it returns dicts instead of records
46
46
  total = results.hits.total["value"]
47
47
  if total == 0:
48
- # Not a PID but trated as such
48
+ # Not a PID but treated as such
49
49
  raise PIDDoesNotExistError(pid_type=id_type, pid_value=id_)
50
50
  if many:
51
51
  for result in results:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: invenio-vocabularies
3
- Version: 6.8.0
3
+ Version: 6.10.0
4
4
  Summary: Invenio module for managing vocabularies.
5
5
  Home-page: https://github.com/inveniosoftware/invenio-vocabularies
6
6
  Author: CERN
@@ -88,6 +88,14 @@ https://invenio-vocabularies.readthedocs.io/
88
88
  Changes
89
89
  =======
90
90
 
91
+ Version v6.10.0 (released 2024-12-09)
92
+
93
+ names: add internal id column to the name_metadata db
94
+
95
+ Version v6.9.0 (released 2024-12-09)
96
+
97
+ - schema: added identifiers in affiliations relation
98
+
91
99
  Version v6.8.0 (released 2024-12-09)
92
100
 
93
101
  - names: extract affiliation identifiers from employments
@@ -1,4 +1,4 @@
1
- invenio_vocabularies/__init__.py,sha256=pBiqJjlbk7PPRcqwNa2BknQDAQRkYYKzQkADgnr1gh4,377
1
+ invenio_vocabularies/__init__.py,sha256=yHb21kAVhVXau2roNUmpHTfj5zK9Wwe96Y6cGwAf8vA,378
2
2
  invenio_vocabularies/cli.py,sha256=CpXTTIn2GTpUqNfLEMlRAp3JWst8ZjHVxoGYdhuuv_4,5959
3
3
  invenio_vocabularies/config.py,sha256=h9Iied753mmZwZZHe5COMqUYvV-zSQtx763EIkUVb1Q,6973
4
4
  invenio_vocabularies/ext.py,sha256=GujJ4UARd4Fxf4z7zznRk9JAgHamZuYCOdrKU5czg00,5987
@@ -12,6 +12,7 @@ invenio_vocabularies/administration/__init__.py,sha256=0bDp2Aw8aZth7C-q9Xn9rxeCU
12
12
  invenio_vocabularies/administration/views/__init__.py,sha256=31DP4jLG6q4HQlzSRiGLPxUjHPUCCl4N34y4XMuPP6g,313
13
13
  invenio_vocabularies/administration/views/vocabularies.py,sha256=JyKr1OYF9DO89zvWCNOtNfClO_QptdHdjvgY1kkImnw,1290
14
14
  invenio_vocabularies/alembic/17c703ce1eb7_create_names_table.py,sha256=2QGs0Ofi6yd93VzIBqghNi47hrZtuLf0DylKyvVzskI,1572
15
+ invenio_vocabularies/alembic/3ba812d80559_add_internal_name_id.py,sha256=dwurTL2HN2GQK3c62o6xGugJqgn30DZlhq_njyUBa7s,945
15
16
  invenio_vocabularies/alembic/4a9a4fd235f8_create_vocabulary_schemes.py,sha256=Ywtp8qOFcI3PxUXemHdvy_VwdcUVtMFV1sFgNAmYrms,1054
16
17
  invenio_vocabularies/alembic/4f365fced43f_create_vocabularies_tables.py,sha256=jSrr0CLRchYADjkFeod0L-oophq2woXtRwbUU5Vytiw,3039
17
18
  invenio_vocabularies/alembic/55a700f897b6_add_names_and_afiliations_pid_column.py,sha256=w1mmkT7fpTeQJ--YmkIqkwtx7DmaP5cXpKPCJr_0Jko,2381
@@ -51,7 +52,7 @@ invenio_vocabularies/contrib/affiliations/datastreams.py,sha256=sMvkt9XOBTV7Q0we
51
52
  invenio_vocabularies/contrib/affiliations/facets.py,sha256=w316MGvtdyTpRCPOpCEmMxxLraRkbFFb1VvLkFlEc9o,1229
52
53
  invenio_vocabularies/contrib/affiliations/models.py,sha256=JUcj-1ydc2Cw2Rsc24JwXE3TFBJ_6fivhUYhGq4rT8A,329
53
54
  invenio_vocabularies/contrib/affiliations/resources.py,sha256=DBEbRxQmp-o-PeZlgFG588Q4sGcruuwIL8L9O-SzCes,435
54
- invenio_vocabularies/contrib/affiliations/schema.py,sha256=O4s6aHcO1w4_aAfGuYLx_eLS6nctd6ktyIuHB6dMKqw,1842
55
+ invenio_vocabularies/contrib/affiliations/schema.py,sha256=geORDYdBIWnv81Txl07qdHhB3U_fo9ObVp7UrSlCLRI,2104
55
56
  invenio_vocabularies/contrib/affiliations/services.py,sha256=KJbv46c2LuQOW3xz7KVLtfZjWR8vhMRPHninlUEhrss,395
56
57
  invenio_vocabularies/contrib/affiliations/jsonschemas/__init__.py,sha256=ILyZ5kejTr0p50macMBPALQCTJSe4KEE3_cgf2p3zV4,252
57
58
  invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json,sha256=be-glRNIBtIO87Tcyw8d68OdG4J8-ojjiCj8UJBnckg,1649
@@ -112,17 +113,18 @@ invenio_vocabularies/contrib/funders/mappings/v7/__init__.py,sha256=yFHmi3QYD65Y
112
113
  invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json,sha256=E7Zp4IHsQGdaxVrksr-SaQtieV7tV0W6-LgGe231G1w,1646
113
114
  invenio_vocabularies/contrib/names/__init__.py,sha256=DBfsM7JMETZGaV5QmXEwE7zhCaAXvc2SZN6uXnW_V-c,451
114
115
  invenio_vocabularies/contrib/names/api.py,sha256=sEPn_jFX3gyoxgbdEUSIvOoPCUI8pocI6qCZO6mzCgQ,300
115
- invenio_vocabularies/contrib/names/config.py,sha256=9sb5novWuQYXg_5Egexn52mjgGd1D_D9UKyQ1fmIuh4,1977
116
+ invenio_vocabularies/contrib/names/components.py,sha256=PyYD1lOhmsuNoyDwM_huxkeo7kWd44vkEbJk9gqbDrM,769
117
+ invenio_vocabularies/contrib/names/config.py,sha256=62jh4MP-CygnBpnRBVaCoGySHDEwhBSG1MnlUBumthw,2046
116
118
  invenio_vocabularies/contrib/names/datastreams.py,sha256=mmhtdrda6b4c83dRjxVF5JTqtkt92GSEMHTU6TzQtHw,14570
117
119
  invenio_vocabularies/contrib/names/models.py,sha256=SYdtDDG-y5Wq_d06YhiVO5n8gfxPW_mx-tECsIcv5H8,308
118
- invenio_vocabularies/contrib/names/names.py,sha256=_kBJBcPuANgUHlZ8RoVkpfJwzR5qaOQCBIyZusjKoCE,2509
120
+ invenio_vocabularies/contrib/names/names.py,sha256=CSGO5Q7AtFRNfyRMPf9PWMiRZiWY8fts-9yZ3XpDPuE,2676
119
121
  invenio_vocabularies/contrib/names/permissions.py,sha256=5xrpYsA3oQUJ5lJpF7wjRAFiW-pM6_yP1k9zllbRwnQ,844
120
122
  invenio_vocabularies/contrib/names/resources.py,sha256=Z8XqLKfFKE69zdTTvcTDmpEZ6wqiqjIH5tp0LzXTSwQ,1588
121
123
  invenio_vocabularies/contrib/names/s3client.py,sha256=c7B9_NbnXCfE4pE_yMTsT6uQ2hgbcRU-KY6nbWFuFzU,1063
122
- invenio_vocabularies/contrib/names/schema.py,sha256=0Uyh5l_Pdq54osow1Qs7-JUKLx9MxA5a95O5K7rM8M8,3618
123
- invenio_vocabularies/contrib/names/services.py,sha256=IyZzZ9fovSQa_tqorWciRaPTrY5yv1clD9PHotdzYOQ,2125
124
+ invenio_vocabularies/contrib/names/schema.py,sha256=TmMel-JswqArUpwmGKFahNFJTx5yqVy_osAxWEgAThY,3665
125
+ invenio_vocabularies/contrib/names/services.py,sha256=ntcGUTM0ZsKnRTxIKvZhKrRuup6Tjv965PATCaJR6Cc,2127
124
126
  invenio_vocabularies/contrib/names/jsonschemas/__init__.py,sha256=pdDZdyoxqWbAQ6ngiclhYoDUsGKgRDRPXlIDy0U5Jzg,241
125
- invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json,sha256=SmnQtet_AWZE1uZR8UY01IiO5QVLHRNAQ2cNubfP8-o,1573
127
+ invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json,sha256=WlIroNhE9o6oh1Cd13ymBPXuXDOs0NYfjLGtAH417YI,1574
126
128
  invenio_vocabularies/contrib/names/mappings/__init__.py,sha256=l5hYJmrj83lds5GupnwCcwQn7cdJo6_4H4YYzrnBa54,242
127
129
  invenio_vocabularies/contrib/names/mappings/os-v1/__init__.py,sha256=CKtF-xflE4QGF5P82Lj1ifEP1c7ekR24fc3SiTAkhsY,249
128
130
  invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json,sha256=5Ybcq3fUMYx3u1MNKmHh-CWBtATS9MYpdEcwAM8EQ80,1943
@@ -302,10 +304,10 @@ invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo,sha256=g1I5aNO8r
302
304
  invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.po,sha256=vg8qC8ofpAdJ3mQz7mWM1ylKDpiNWXFs7rlMdSPkgKk,4629
303
305
  invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo,sha256=cqSm8NtMAwrP9O6qbmtkDtRT1e9D93qpsJN5X9_PPVw,600
304
306
  invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.po,sha256=9ACePz_EpB-LfcIJajZ2kp8Q04tcdrQLOtug162ZUss,4115
305
- invenio_vocabularies-6.8.0.dist-info/AUTHORS.rst,sha256=8d0p_WWE1r9DavvzMDi2D4YIGBHiMYcN3LYxqQOj8sY,291
306
- invenio_vocabularies-6.8.0.dist-info/LICENSE,sha256=UvI8pR8jGWqe0sTkb_hRG6eIrozzWwWzyCGEpuXX4KE,1062
307
- invenio_vocabularies-6.8.0.dist-info/METADATA,sha256=dfweT9yd1E3DnY0KnIpL4vbg-5KtXzrhEsw0hExRVl8,12211
308
- invenio_vocabularies-6.8.0.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
309
- invenio_vocabularies-6.8.0.dist-info/entry_points.txt,sha256=ud9nfdMlhO_mu3okwmy5vQD48r3-rCU_pSR-lUtLeYE,3180
310
- invenio_vocabularies-6.8.0.dist-info/top_level.txt,sha256=x1gRNbaODF_bCD0SBLM3nVOFPGi06cmGX5X94WKrFKk,21
311
- invenio_vocabularies-6.8.0.dist-info/RECORD,,
307
+ invenio_vocabularies-6.10.0.dist-info/AUTHORS.rst,sha256=8d0p_WWE1r9DavvzMDi2D4YIGBHiMYcN3LYxqQOj8sY,291
308
+ invenio_vocabularies-6.10.0.dist-info/LICENSE,sha256=UvI8pR8jGWqe0sTkb_hRG6eIrozzWwWzyCGEpuXX4KE,1062
309
+ invenio_vocabularies-6.10.0.dist-info/METADATA,sha256=dNT3BBpMtD-S5lP911V21Bxs5HuVRKw1MFHucTTbUg4,12398
310
+ invenio_vocabularies-6.10.0.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
311
+ invenio_vocabularies-6.10.0.dist-info/entry_points.txt,sha256=ud9nfdMlhO_mu3okwmy5vQD48r3-rCU_pSR-lUtLeYE,3180
312
+ invenio_vocabularies-6.10.0.dist-info/top_level.txt,sha256=x1gRNbaODF_bCD0SBLM3nVOFPGi06cmGX5X94WKrFKk,21
313
+ invenio_vocabularies-6.10.0.dist-info/RECORD,,