pysdmx 1.10.0__py3-none-any.whl → 1.10.0rc1__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.
- pysdmx/__init__.py +1 -1
- pysdmx/api/fmr/__init__.py +2 -3
- pysdmx/io/json/sdmxjson2/messages/__init__.py +0 -4
- pysdmx/io/json/sdmxjson2/messages/code.py +6 -16
- pysdmx/io/json/sdmxjson2/messages/constraint.py +16 -235
- pysdmx/io/json/sdmxjson2/messages/dsd.py +7 -35
- pysdmx/io/json/sdmxjson2/messages/map.py +4 -5
- pysdmx/io/json/sdmxjson2/messages/metadataflow.py +0 -1
- pysdmx/io/json/sdmxjson2/messages/msd.py +10 -18
- pysdmx/io/json/sdmxjson2/messages/schema.py +2 -2
- pysdmx/io/json/sdmxjson2/messages/structure.py +44 -81
- pysdmx/io/json/sdmxjson2/messages/vtl.py +9 -13
- pysdmx/io/json/sdmxjson2/reader/doc_validation.py +0 -4
- pysdmx/model/__base.py +1 -46
- pysdmx/model/__init__.py +0 -18
- pysdmx/model/category.py +0 -17
- pysdmx/model/message.py +71 -80
- {pysdmx-1.10.0.dist-info → pysdmx-1.10.0rc1.dist-info}/METADATA +1 -1
- {pysdmx-1.10.0.dist-info → pysdmx-1.10.0rc1.dist-info}/RECORD +21 -22
- pysdmx/model/constraint.py +0 -69
- {pysdmx-1.10.0.dist-info → pysdmx-1.10.0rc1.dist-info}/WHEEL +0 -0
- {pysdmx-1.10.0.dist-info → pysdmx-1.10.0rc1.dist-info}/licenses/LICENSE +0 -0
|
@@ -17,7 +17,6 @@ from pysdmx.io.json.sdmxjson2.messages.code import (
|
|
|
17
17
|
JsonValuelist,
|
|
18
18
|
)
|
|
19
19
|
from pysdmx.io.json.sdmxjson2.messages.concept import JsonConceptScheme
|
|
20
|
-
from pysdmx.io.json.sdmxjson2.messages.constraint import JsonDataConstraint
|
|
21
20
|
from pysdmx.io.json.sdmxjson2.messages.core import JsonHeader
|
|
22
21
|
from pysdmx.io.json.sdmxjson2.messages.dataflow import JsonDataflow
|
|
23
22
|
from pysdmx.io.json.sdmxjson2.messages.dsd import JsonDataStructure
|
|
@@ -50,95 +49,90 @@ from pysdmx.model.message import StructureMessage
|
|
|
50
49
|
class JsonStructures(Struct, frozen=True, omit_defaults=True):
|
|
51
50
|
"""The allowed strutures."""
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
categorisations: Sequence[JsonCategorisation] = ()
|
|
52
|
+
dataStructures: Sequence[JsonDataStructure] = ()
|
|
55
53
|
categorySchemes: Sequence[JsonCategoryScheme] = ()
|
|
56
|
-
codelists: Sequence[JsonCodelist] = ()
|
|
57
54
|
conceptSchemes: Sequence[JsonConceptScheme] = ()
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
dataflows: Sequence[JsonDataflow] = ()
|
|
61
|
-
dataProviderSchemes: Sequence[JsonDataProviderScheme] = ()
|
|
62
|
-
dataStructures: Sequence[JsonDataStructure] = ()
|
|
55
|
+
codelists: Sequence[JsonCodelist] = ()
|
|
56
|
+
valueLists: Sequence[JsonValuelist] = ()
|
|
63
57
|
hierarchies: Sequence[JsonHierarchy] = ()
|
|
64
58
|
hierarchyAssociations: Sequence[JsonHierarchyAssociation] = ()
|
|
65
|
-
|
|
59
|
+
agencySchemes: Sequence[JsonAgencyScheme] = ()
|
|
60
|
+
dataProviderSchemes: Sequence[JsonDataProviderScheme] = ()
|
|
66
61
|
metadataProviderSchemes: Sequence[JsonMetadataProviderScheme] = ()
|
|
62
|
+
dataflows: Sequence[JsonDataflow] = ()
|
|
63
|
+
provisionAgreements: Sequence[JsonProvisionAgreement] = ()
|
|
64
|
+
metadataflows: Sequence[JsonMetadataflow] = ()
|
|
67
65
|
metadataProvisionAgreements: Sequence[JsonMetadataProvisionAgreement] = ()
|
|
68
66
|
metadataStructures: Sequence[JsonMetadataStructure] = ()
|
|
69
|
-
|
|
70
|
-
provisionAgreements: Sequence[JsonProvisionAgreement] = ()
|
|
67
|
+
structureMaps: Sequence[JsonStructureMap] = ()
|
|
71
68
|
representationMaps: Sequence[JsonRepresentationMap] = ()
|
|
69
|
+
categorisations: Sequence[JsonCategorisation] = ()
|
|
70
|
+
customTypeSchemes: Sequence[JsonCustomTypeScheme] = ()
|
|
71
|
+
vtlMappingSchemes: Sequence[JsonVtlMappingScheme] = ()
|
|
72
|
+
namePersonalisationSchemes: Sequence[JsonNamePersonalisationScheme] = ()
|
|
72
73
|
rulesetSchemes: Sequence[JsonRulesetScheme] = ()
|
|
73
|
-
structureMaps: Sequence[JsonStructureMap] = ()
|
|
74
74
|
transformationSchemes: Sequence[JsonTransformationScheme] = ()
|
|
75
75
|
userDefinedOperatorSchemes: Sequence[JsonUserDefinedOperatorScheme] = ()
|
|
76
|
-
valueLists: Sequence[JsonValuelist] = ()
|
|
77
|
-
vtlMappingSchemes: Sequence[JsonVtlMappingScheme] = ()
|
|
78
76
|
|
|
79
77
|
def to_model(self) -> Sequence[MaintainableArtefact]:
|
|
80
78
|
"""Map to pysdmx artefacts."""
|
|
81
79
|
structures = [] # type: ignore[var-annotated]
|
|
82
80
|
structures.extend(
|
|
83
|
-
i.to_model(
|
|
81
|
+
i.to_model(
|
|
82
|
+
self.conceptSchemes, self.codelists, self.valueLists, ()
|
|
83
|
+
)
|
|
84
|
+
for i in self.dataStructures
|
|
84
85
|
)
|
|
85
|
-
structures.extend(i.to_model() for i in self.categorisations)
|
|
86
86
|
structures.extend(i.to_model() for i in self.categorySchemes)
|
|
87
|
-
structures.extend(i.to_model() for i in self.codelists)
|
|
88
87
|
structures.extend(
|
|
89
88
|
i.to_model(self.codelists) for i in self.conceptSchemes
|
|
90
89
|
)
|
|
91
|
-
structures.extend(i.to_model() for i in self.
|
|
92
|
-
structures.extend(i.to_model() for i in self.
|
|
93
|
-
structures.extend(
|
|
94
|
-
i.to_model(
|
|
95
|
-
self.dataStructures,
|
|
96
|
-
self.conceptSchemes,
|
|
97
|
-
self.valueLists,
|
|
98
|
-
self.codelists,
|
|
99
|
-
)
|
|
100
|
-
for i in self.dataflows
|
|
101
|
-
)
|
|
90
|
+
structures.extend(i.to_model() for i in self.codelists)
|
|
91
|
+
structures.extend(i.to_model() for i in self.valueLists)
|
|
92
|
+
structures.extend(i.to_model(self.codelists) for i in self.hierarchies)
|
|
102
93
|
structures.extend(
|
|
103
|
-
i.to_model(self.
|
|
104
|
-
for i in self.
|
|
94
|
+
i.to_model(self.hierarchies, self.codelists)
|
|
95
|
+
for i in self.hierarchyAssociations
|
|
105
96
|
)
|
|
106
97
|
structures.extend(
|
|
107
|
-
i.to_model(
|
|
108
|
-
self.conceptSchemes, self.codelists, self.valueLists, ()
|
|
109
|
-
)
|
|
110
|
-
for i in self.dataStructures
|
|
98
|
+
i.to_model(self.dataflows) for i in self.agencySchemes
|
|
111
99
|
)
|
|
112
|
-
structures.extend(i.to_model(self.codelists) for i in self.hierarchies)
|
|
113
100
|
structures.extend(
|
|
114
|
-
i.to_model(self.
|
|
115
|
-
for i in self.
|
|
101
|
+
i.to_model(self.provisionAgreements)
|
|
102
|
+
for i in self.dataProviderSchemes
|
|
116
103
|
)
|
|
117
|
-
|
|
118
|
-
structures.extend(i.to_model() for i in self.metadataflows)
|
|
119
104
|
structures.extend(
|
|
120
105
|
i.to_model(self.metadataProvisionAgreements)
|
|
121
106
|
for i in self.metadataProviderSchemes
|
|
122
107
|
)
|
|
123
|
-
structures.extend(
|
|
124
|
-
i.to_model() for i in self.metadataProvisionAgreements
|
|
125
|
-
)
|
|
126
108
|
structures.extend(
|
|
127
109
|
i.to_model(self.conceptSchemes, self.codelists, self.valueLists)
|
|
128
110
|
for i in self.metadataStructures
|
|
129
111
|
)
|
|
130
112
|
structures.extend(
|
|
131
|
-
i.to_model(
|
|
113
|
+
i.to_model(
|
|
114
|
+
self.dataStructures,
|
|
115
|
+
self.conceptSchemes,
|
|
116
|
+
self.valueLists,
|
|
117
|
+
self.codelists,
|
|
118
|
+
)
|
|
119
|
+
for i in self.dataflows
|
|
132
120
|
)
|
|
133
121
|
structures.extend(i.to_model() for i in self.provisionAgreements)
|
|
122
|
+
structures.extend(i.to_model() for i in self.metadataflows)
|
|
134
123
|
structures.extend(
|
|
135
|
-
i.to_model(
|
|
136
|
-
for i in self.representationMaps
|
|
124
|
+
i.to_model() for i in self.metadataProvisionAgreements
|
|
137
125
|
)
|
|
138
|
-
structures.extend(i.to_model() for i in self.rulesetSchemes)
|
|
139
126
|
structures.extend(
|
|
140
127
|
i.to_model(self.representationMaps) for i in self.structureMaps
|
|
141
128
|
)
|
|
129
|
+
structures.extend(i.to_model() for i in self.categorisations)
|
|
130
|
+
structures.extend(i.to_model() for i in self.customTypeSchemes)
|
|
131
|
+
structures.extend(i.to_model() for i in self.vtlMappingSchemes)
|
|
132
|
+
structures.extend(
|
|
133
|
+
i.to_model() for i in self.namePersonalisationSchemes
|
|
134
|
+
)
|
|
135
|
+
structures.extend(i.to_model() for i in self.rulesetSchemes)
|
|
142
136
|
structures.extend(
|
|
143
137
|
i.to_model(
|
|
144
138
|
self.customTypeSchemes,
|
|
@@ -152,8 +146,9 @@ class JsonStructures(Struct, frozen=True, omit_defaults=True):
|
|
|
152
146
|
structures.extend(
|
|
153
147
|
i.to_model() for i in self.userDefinedOperatorSchemes
|
|
154
148
|
)
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
for rm in self.representationMaps:
|
|
150
|
+
multi = bool(len(rm.source) > 1 or len(rm.target) > 1)
|
|
151
|
+
structures.append(rm.to_model(multi))
|
|
157
152
|
return structures
|
|
158
153
|
|
|
159
154
|
@classmethod
|
|
@@ -269,33 +264,6 @@ class JsonStructures(Struct, frozen=True, omit_defaults=True):
|
|
|
269
264
|
hierarchies = tuple(
|
|
270
265
|
[JsonHierarchy.from_model(h) for h in msg.get_hierarchies()]
|
|
271
266
|
)
|
|
272
|
-
constraints = tuple(
|
|
273
|
-
[
|
|
274
|
-
JsonDataConstraint.from_model(c)
|
|
275
|
-
for c in msg.get_data_constraints()
|
|
276
|
-
]
|
|
277
|
-
)
|
|
278
|
-
mpas = tuple(
|
|
279
|
-
[
|
|
280
|
-
JsonMetadataProvisionAgreement.from_model(c)
|
|
281
|
-
for c in msg.get_metadata_provision_agreements()
|
|
282
|
-
]
|
|
283
|
-
)
|
|
284
|
-
mprvs = tuple(
|
|
285
|
-
[
|
|
286
|
-
JsonMetadataProviderScheme.from_model(c)
|
|
287
|
-
for c in msg.get_metadata_provider_schemes()
|
|
288
|
-
]
|
|
289
|
-
)
|
|
290
|
-
mdfs = tuple(
|
|
291
|
-
[JsonMetadataflow.from_model(c) for c in msg.get_metadataflows()]
|
|
292
|
-
)
|
|
293
|
-
msds = tuple(
|
|
294
|
-
[
|
|
295
|
-
JsonMetadataStructure.from_model(c)
|
|
296
|
-
for c in msg.get_metadata_structures()
|
|
297
|
-
]
|
|
298
|
-
)
|
|
299
267
|
return JsonStructures(
|
|
300
268
|
agencySchemes=agencies,
|
|
301
269
|
categorisations=categorisations,
|
|
@@ -303,16 +271,11 @@ class JsonStructures(Struct, frozen=True, omit_defaults=True):
|
|
|
303
271
|
codelists=codelists,
|
|
304
272
|
conceptSchemes=concept_schemes,
|
|
305
273
|
customTypeSchemes=custom_types,
|
|
306
|
-
dataConstraints=constraints,
|
|
307
274
|
dataflows=dataflows,
|
|
308
275
|
dataProviderSchemes=data_providers,
|
|
309
276
|
dataStructures=data_structures,
|
|
310
277
|
hierarchies=hierarchies,
|
|
311
278
|
hierarchyAssociations=hier_associations,
|
|
312
|
-
metadataflows=mdfs,
|
|
313
|
-
metadataProviderSchemes=mprvs,
|
|
314
|
-
metadataProvisionAgreements=mpas,
|
|
315
|
-
metadataStructures=msds,
|
|
316
279
|
namePersonalisationSchemes=name_personalisations,
|
|
317
280
|
provisionAgreements=agreements,
|
|
318
281
|
representationMaps=representations_maps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Collection of SDMX-JSON schemas for VTL artefacts."""
|
|
2
2
|
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Literal, Optional, Sequence
|
|
4
4
|
|
|
5
5
|
from msgspec import Struct
|
|
6
6
|
|
|
@@ -506,37 +506,33 @@ class JsonRulesetScheme(ItemSchemeType, frozen=True, omit_defaults=True):
|
|
|
506
506
|
class JsonToVtlMapping(Struct, frozen=True, omit_defaults=True):
|
|
507
507
|
"""SDMX-JSON payload for To VTL mappings."""
|
|
508
508
|
|
|
509
|
-
toVtlSubSpace:
|
|
510
|
-
|
|
509
|
+
toVtlSubSpace: Sequence[str]
|
|
510
|
+
type: Optional[str] = None
|
|
511
511
|
|
|
512
512
|
def to_model(self) -> ToVtlMapping:
|
|
513
513
|
"""Converts deserialized class to pysdmx model class."""
|
|
514
|
-
return ToVtlMapping(self.toVtlSubSpace
|
|
514
|
+
return ToVtlMapping(self.toVtlSubSpace, self.type)
|
|
515
515
|
|
|
516
516
|
@classmethod
|
|
517
517
|
def from_model(cls, mapping: ToVtlMapping) -> "JsonToVtlMapping":
|
|
518
518
|
"""Converts a pysdmx "to VTL" mapping to an SDMX-JSON one."""
|
|
519
|
-
return JsonToVtlMapping(
|
|
520
|
-
{"keys": mapping.to_vtl_sub_space}, mapping.method
|
|
521
|
-
)
|
|
519
|
+
return JsonToVtlMapping(mapping.to_vtl_sub_space, mapping.method)
|
|
522
520
|
|
|
523
521
|
|
|
524
522
|
class JsonFromVtlMapping(Struct, frozen=True, omit_defaults=True):
|
|
525
523
|
"""SDMX-JSON payload for from VTL mappings."""
|
|
526
524
|
|
|
527
|
-
fromVtlSuperSpace:
|
|
528
|
-
|
|
525
|
+
fromVtlSuperSpace: Sequence[str]
|
|
526
|
+
type: Optional[str] = None
|
|
529
527
|
|
|
530
528
|
def to_model(self) -> FromVtlMapping:
|
|
531
529
|
"""Converts deserialized class to pysdmx model class."""
|
|
532
|
-
return FromVtlMapping(self.fromVtlSuperSpace
|
|
530
|
+
return FromVtlMapping(self.fromVtlSuperSpace, self.type)
|
|
533
531
|
|
|
534
532
|
@classmethod
|
|
535
533
|
def from_model(cls, mapping: FromVtlMapping) -> "JsonFromVtlMapping":
|
|
536
534
|
"""Converts a pysdmx "from VTL" mapping to an SDMX-JSON one."""
|
|
537
|
-
return JsonFromVtlMapping(
|
|
538
|
-
{"keys": mapping.from_vtl_sub_space}, mapping.method
|
|
539
|
-
)
|
|
535
|
+
return JsonFromVtlMapping(mapping.from_vtl_sub_space, mapping.method)
|
|
540
536
|
|
|
541
537
|
|
|
542
538
|
class JsonVtlMapping(NameableType, frozen=True, omit_defaults=True):
|
pysdmx/model/__base.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import re
|
|
2
1
|
from datetime import datetime
|
|
3
|
-
from typing import Any,
|
|
2
|
+
from typing import Any, Optional, Sequence, Union
|
|
4
3
|
|
|
5
4
|
from msgspec import Struct
|
|
6
5
|
|
|
@@ -328,50 +327,6 @@ class ItemScheme(MaintainableArtefact, frozen=True, omit_defaults=True):
|
|
|
328
327
|
items: Sequence[Item] = ()
|
|
329
328
|
is_partial: bool = False
|
|
330
329
|
|
|
331
|
-
def search(
|
|
332
|
-
self,
|
|
333
|
-
query: str,
|
|
334
|
-
use_regex: bool = False,
|
|
335
|
-
fields: Literal["name", "description", "all"] = "all",
|
|
336
|
-
) -> Sequence[Item]:
|
|
337
|
-
"""Search for items matching the query.
|
|
338
|
-
|
|
339
|
-
Args:
|
|
340
|
-
query: The substring or regex pattern to search for.
|
|
341
|
-
use_regex: Whether to treat the query as a regex (default: False).
|
|
342
|
-
fields: The fields to search in (default: all textual fields).
|
|
343
|
-
|
|
344
|
-
Returns:
|
|
345
|
-
Items that match the query.
|
|
346
|
-
"""
|
|
347
|
-
if not query:
|
|
348
|
-
raise Invalid(
|
|
349
|
-
"Invalid search", "The query string cannot be empty."
|
|
350
|
-
)
|
|
351
|
-
|
|
352
|
-
# Determine which fields to search in
|
|
353
|
-
search_fields = (
|
|
354
|
-
["name", "description"] if fields == "all" else [fields]
|
|
355
|
-
)
|
|
356
|
-
|
|
357
|
-
# Transform plain text queries into a regex
|
|
358
|
-
if not use_regex:
|
|
359
|
-
query = re.escape(query)
|
|
360
|
-
|
|
361
|
-
pattern = re.compile(query, re.IGNORECASE if not use_regex else 0)
|
|
362
|
-
|
|
363
|
-
all_items = getattr(self, "all_items", "")
|
|
364
|
-
items = all_items if all_items else self.items
|
|
365
|
-
|
|
366
|
-
return [
|
|
367
|
-
item # type: ignore[misc]
|
|
368
|
-
for item in items
|
|
369
|
-
if any(
|
|
370
|
-
pattern.search(str(getattr(item, field, "")))
|
|
371
|
-
for field in search_fields
|
|
372
|
-
)
|
|
373
|
-
]
|
|
374
|
-
|
|
375
330
|
|
|
376
331
|
class DataflowRef(
|
|
377
332
|
Struct, frozen=True, omit_defaults=True, repr_omit_defaults=True, tag=True
|
pysdmx/model/__init__.py
CHANGED
|
@@ -29,16 +29,6 @@ from pysdmx.model.code import (
|
|
|
29
29
|
HierarchyAssociation,
|
|
30
30
|
)
|
|
31
31
|
from pysdmx.model.concept import Concept, ConceptScheme, DataType, Facets
|
|
32
|
-
from pysdmx.model.constraint import (
|
|
33
|
-
ConstraintAttachment,
|
|
34
|
-
CubeKeyValue,
|
|
35
|
-
CubeRegion,
|
|
36
|
-
CubeValue,
|
|
37
|
-
DataConstraint,
|
|
38
|
-
DataKey,
|
|
39
|
-
DataKeyValue,
|
|
40
|
-
KeySet,
|
|
41
|
-
)
|
|
42
32
|
from pysdmx.model.dataflow import (
|
|
43
33
|
ArrayBoundaries,
|
|
44
34
|
Component,
|
|
@@ -171,16 +161,9 @@ __all__ = [
|
|
|
171
161
|
"ComponentMap",
|
|
172
162
|
"Concept",
|
|
173
163
|
"ConceptScheme",
|
|
174
|
-
"ConstraintAttachment",
|
|
175
164
|
"Contact",
|
|
176
|
-
"CubeKeyValue",
|
|
177
|
-
"CubeRegion",
|
|
178
|
-
"CubeValue",
|
|
179
165
|
"DataConsumer",
|
|
180
166
|
"DataConsumerScheme",
|
|
181
|
-
"DataConstraint",
|
|
182
|
-
"DataKey",
|
|
183
|
-
"DataKeyValue",
|
|
184
167
|
"Dataflow",
|
|
185
168
|
"DataflowInfo",
|
|
186
169
|
"DataflowRef",
|
|
@@ -197,7 +180,6 @@ __all__ = [
|
|
|
197
180
|
"HierarchyAssociation",
|
|
198
181
|
"ImplicitComponentMap",
|
|
199
182
|
"ItemReference",
|
|
200
|
-
"KeySet",
|
|
201
183
|
"MetadataAttribute",
|
|
202
184
|
"MetadataComponent",
|
|
203
185
|
"Metadataflow",
|
pysdmx/model/category.py
CHANGED
|
@@ -91,15 +91,6 @@ class CategoryScheme(ItemScheme, frozen=True, omit_defaults=True):
|
|
|
91
91
|
flows.update(self.__extract_flows(cat))
|
|
92
92
|
return list(flows)
|
|
93
93
|
|
|
94
|
-
@property
|
|
95
|
-
def all_items(self) -> Sequence[Category]:
|
|
96
|
-
"""Get all the categories in the category scheme as a flat list.
|
|
97
|
-
|
|
98
|
-
Returns:
|
|
99
|
-
A flat list of all the categories present in the category scheme.
|
|
100
|
-
"""
|
|
101
|
-
return self.__get_categories(self.categories)
|
|
102
|
-
|
|
103
94
|
def __iter__(self) -> Iterator[Category]:
|
|
104
95
|
"""Return an iterator over the list of categories."""
|
|
105
96
|
yield from self.categories
|
|
@@ -169,14 +160,6 @@ class CategoryScheme(ItemScheme, frozen=True, omit_defaults=True):
|
|
|
169
160
|
processed_output.append(f"{attr}: {value}")
|
|
170
161
|
return f"{', '.join(processed_output)}"
|
|
171
162
|
|
|
172
|
-
def __get_categories(self, cats: Sequence[Category]) -> Sequence[Category]:
|
|
173
|
-
out = []
|
|
174
|
-
for cat in cats:
|
|
175
|
-
out.append(cat)
|
|
176
|
-
if cat.categories:
|
|
177
|
-
out.extend(self.__get_categories(cat.categories))
|
|
178
|
-
return out
|
|
179
|
-
|
|
180
163
|
|
|
181
164
|
class Categorisation(
|
|
182
165
|
MaintainableArtefact, frozen=True, omit_defaults=True, kw_only=True
|
pysdmx/model/message.py
CHANGED
|
@@ -23,7 +23,6 @@ from pysdmx.model.__base import MaintainableArtefact, Organisation
|
|
|
23
23
|
from pysdmx.model.category import Categorisation, CategoryScheme
|
|
24
24
|
from pysdmx.model.code import Codelist, Hierarchy, HierarchyAssociation
|
|
25
25
|
from pysdmx.model.concept import ConceptScheme
|
|
26
|
-
from pysdmx.model.constraint import DataConstraint
|
|
27
26
|
from pysdmx.model.dataflow import (
|
|
28
27
|
Dataflow,
|
|
29
28
|
DataStructureDefinition,
|
|
@@ -221,20 +220,10 @@ class StructureMessage(Struct, repr_omit_defaults=True, frozen=True):
|
|
|
221
220
|
"Could not find the requested element.",
|
|
222
221
|
)
|
|
223
222
|
|
|
224
|
-
# Return collection of a certain type
|
|
225
|
-
|
|
226
223
|
def get_agency_schemes(self) -> List[AgencyScheme]:
|
|
227
224
|
"""Returns the AgencySchemes."""
|
|
228
225
|
return self.__get_elements(AgencyScheme)
|
|
229
226
|
|
|
230
|
-
def get_categorisations(self) -> List[Categorisation]:
|
|
231
|
-
"""Returns the Categorisations."""
|
|
232
|
-
return self.__get_elements(Categorisation)
|
|
233
|
-
|
|
234
|
-
def get_category_schemes(self) -> List[CategoryScheme]:
|
|
235
|
-
"""Returns the CategorySchemes."""
|
|
236
|
-
return self.__get_elements(CategoryScheme)
|
|
237
|
-
|
|
238
227
|
def get_codelists(self) -> List[Codelist]:
|
|
239
228
|
"""Returns the Codelists."""
|
|
240
229
|
return self.__get_enumerations(Codelist, False)
|
|
@@ -243,10 +232,6 @@ class StructureMessage(Struct, repr_omit_defaults=True, frozen=True):
|
|
|
243
232
|
"""Returns the Concept Schemes."""
|
|
244
233
|
return self.__get_elements(ConceptScheme)
|
|
245
234
|
|
|
246
|
-
def get_custom_type_schemes(self) -> List[CustomTypeScheme]:
|
|
247
|
-
"""Returns the CustomType Schemes."""
|
|
248
|
-
return self.__get_elements(CustomTypeScheme)
|
|
249
|
-
|
|
250
235
|
def get_data_structure_definitions(
|
|
251
236
|
self,
|
|
252
237
|
) -> List[DataStructureDefinition]:
|
|
@@ -257,13 +242,57 @@ class StructureMessage(Struct, repr_omit_defaults=True, frozen=True):
|
|
|
257
242
|
"""Returns the Dataflows."""
|
|
258
243
|
return self.__get_elements(Dataflow)
|
|
259
244
|
|
|
260
|
-
def
|
|
261
|
-
"""Returns the
|
|
262
|
-
return self.__get_elements(
|
|
245
|
+
def get_metadataflows(self) -> List[Metadataflow]:
|
|
246
|
+
"""Returns the MetadataProvisionAgreements."""
|
|
247
|
+
return self.__get_elements(Metadataflow)
|
|
263
248
|
|
|
264
|
-
def
|
|
265
|
-
"""Returns
|
|
266
|
-
return self.
|
|
249
|
+
def get_organisation_scheme(self, short_urn: str) -> AgencyScheme:
|
|
250
|
+
"""Returns a specific AgencyScheme."""
|
|
251
|
+
return self.__get_single_structure(AgencyScheme, short_urn)
|
|
252
|
+
|
|
253
|
+
def get_codelist(self, short_urn: str) -> Codelist:
|
|
254
|
+
"""Returns a specific Codelist."""
|
|
255
|
+
return self.__get_single_structure(Codelist, short_urn)
|
|
256
|
+
|
|
257
|
+
def get_concept_scheme(self, short_urn: str) -> ConceptScheme:
|
|
258
|
+
"""Returns a specific Concept Scheme."""
|
|
259
|
+
return self.__get_single_structure(ConceptScheme, short_urn)
|
|
260
|
+
|
|
261
|
+
def get_data_structure_definition(
|
|
262
|
+
self, short_urn: str
|
|
263
|
+
) -> DataStructureDefinition:
|
|
264
|
+
"""Returns a specific DataStructureDefinition."""
|
|
265
|
+
return self.__get_single_structure(DataStructureDefinition, short_urn)
|
|
266
|
+
|
|
267
|
+
def get_dataflow(self, short_urn: str) -> Dataflow:
|
|
268
|
+
"""Returns a specific Dataflow."""
|
|
269
|
+
return self.__get_single_structure(Dataflow, short_urn)
|
|
270
|
+
|
|
271
|
+
def get_provision_agreement(self, short_urn: str) -> ProvisionAgreement:
|
|
272
|
+
"""Returns a specific Provision Agreement."""
|
|
273
|
+
return self.__get_single_structure(ProvisionAgreement, short_urn)
|
|
274
|
+
|
|
275
|
+
def get_transformation_schemes(self) -> List[TransformationScheme]:
|
|
276
|
+
"""Returns the TransformationSchemes."""
|
|
277
|
+
return self.__get_elements(TransformationScheme)
|
|
278
|
+
|
|
279
|
+
def get_user_defined_operator_schemes(
|
|
280
|
+
self,
|
|
281
|
+
) -> List[UserDefinedOperatorScheme]:
|
|
282
|
+
"""Returns the UserDefinedOperatorSchemes."""
|
|
283
|
+
return self.__get_elements(UserDefinedOperatorScheme)
|
|
284
|
+
|
|
285
|
+
def get_ruleset_schemes(self) -> List[RulesetScheme]:
|
|
286
|
+
"""Returns the RulesetSchemes."""
|
|
287
|
+
return self.__get_elements(RulesetScheme)
|
|
288
|
+
|
|
289
|
+
def get_category_schemes(self) -> List[CategoryScheme]:
|
|
290
|
+
"""Returns the CategorySchemes."""
|
|
291
|
+
return self.__get_elements(CategoryScheme)
|
|
292
|
+
|
|
293
|
+
def get_value_lists(self) -> List[Codelist]:
|
|
294
|
+
"""Returns the Codelists."""
|
|
295
|
+
return self.__get_enumerations(Codelist, True)
|
|
267
296
|
|
|
268
297
|
def get_hierarchies(self) -> List[Hierarchy]:
|
|
269
298
|
"""Returns the HierarchyCodelists."""
|
|
@@ -273,9 +302,13 @@ class StructureMessage(Struct, repr_omit_defaults=True, frozen=True):
|
|
|
273
302
|
"""Returns the HierarchyAssociations."""
|
|
274
303
|
return self.__get_elements(HierarchyAssociation)
|
|
275
304
|
|
|
276
|
-
def
|
|
277
|
-
"""Returns the
|
|
278
|
-
return self.__get_elements(
|
|
305
|
+
def get_data_provider_schemes(self) -> List[DataProviderScheme]:
|
|
306
|
+
"""Returns the DataProviderSchemes."""
|
|
307
|
+
return self.__get_elements(DataProviderScheme)
|
|
308
|
+
|
|
309
|
+
def get_provision_agreements(self) -> List[ProvisionAgreement]:
|
|
310
|
+
"""Returns the ProvisionAgreements."""
|
|
311
|
+
return self.__get_elements(ProvisionAgreement)
|
|
279
312
|
|
|
280
313
|
def get_metadata_provider_schemes(self) -> List[MetadataProviderScheme]:
|
|
281
314
|
"""Returns the MetadataProviderSchemes."""
|
|
@@ -291,15 +324,9 @@ class StructureMessage(Struct, repr_omit_defaults=True, frozen=True):
|
|
|
291
324
|
"""Returns the MetadataStructures."""
|
|
292
325
|
return self.__get_elements(MetadataStructure)
|
|
293
326
|
|
|
294
|
-
def
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
"""Returns the NamePersonalisationSchemes."""
|
|
298
|
-
return self.__get_elements(NamePersonalisationScheme)
|
|
299
|
-
|
|
300
|
-
def get_provision_agreements(self) -> List[ProvisionAgreement]:
|
|
301
|
-
"""Returns the ProvisionAgreements."""
|
|
302
|
-
return self.__get_elements(ProvisionAgreement)
|
|
327
|
+
def get_structure_maps(self) -> List[StructureMap]:
|
|
328
|
+
"""Returns the StructureMaps."""
|
|
329
|
+
return self.__get_elements(StructureMap)
|
|
303
330
|
|
|
304
331
|
def get_representation_maps(
|
|
305
332
|
self,
|
|
@@ -310,59 +337,23 @@ class StructureMessage(Struct, repr_omit_defaults=True, frozen=True):
|
|
|
310
337
|
out.extend(self.__get_elements(MultiRepresentationMap))
|
|
311
338
|
return out
|
|
312
339
|
|
|
313
|
-
def
|
|
314
|
-
"""Returns the
|
|
315
|
-
return self.__get_elements(
|
|
316
|
-
|
|
317
|
-
def get_structure_maps(self) -> List[StructureMap]:
|
|
318
|
-
"""Returns the StructureMaps."""
|
|
319
|
-
return self.__get_elements(StructureMap)
|
|
320
|
-
|
|
321
|
-
def get_transformation_schemes(self) -> List[TransformationScheme]:
|
|
322
|
-
"""Returns the TransformationSchemes."""
|
|
323
|
-
return self.__get_elements(TransformationScheme)
|
|
324
|
-
|
|
325
|
-
def get_user_defined_operator_schemes(
|
|
326
|
-
self,
|
|
327
|
-
) -> List[UserDefinedOperatorScheme]:
|
|
328
|
-
"""Returns the UserDefinedOperatorSchemes."""
|
|
329
|
-
return self.__get_elements(UserDefinedOperatorScheme)
|
|
340
|
+
def get_categorisations(self) -> List[Categorisation]:
|
|
341
|
+
"""Returns the Categorisations."""
|
|
342
|
+
return self.__get_elements(Categorisation)
|
|
330
343
|
|
|
331
|
-
def
|
|
332
|
-
"""Returns the
|
|
333
|
-
return self.
|
|
344
|
+
def get_custom_type_schemes(self) -> List[CustomTypeScheme]:
|
|
345
|
+
"""Returns the CustomType Schemes."""
|
|
346
|
+
return self.__get_elements(CustomTypeScheme)
|
|
334
347
|
|
|
335
348
|
def get_vtl_mapping_schemes(self) -> List[VtlMappingScheme]:
|
|
336
349
|
"""Returns the VTL Mapping Schemes."""
|
|
337
350
|
return self.__get_elements(VtlMappingScheme)
|
|
338
351
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
"""Returns
|
|
343
|
-
return self.
|
|
344
|
-
|
|
345
|
-
def get_concept_scheme(self, short_urn: str) -> ConceptScheme:
|
|
346
|
-
"""Returns a specific Concept Scheme."""
|
|
347
|
-
return self.__get_single_structure(ConceptScheme, short_urn)
|
|
348
|
-
|
|
349
|
-
def get_dataflow(self, short_urn: str) -> Dataflow:
|
|
350
|
-
"""Returns a specific Dataflow."""
|
|
351
|
-
return self.__get_single_structure(Dataflow, short_urn)
|
|
352
|
-
|
|
353
|
-
def get_data_structure_definition(
|
|
354
|
-
self, short_urn: str
|
|
355
|
-
) -> DataStructureDefinition:
|
|
356
|
-
"""Returns a specific DataStructureDefinition."""
|
|
357
|
-
return self.__get_single_structure(DataStructureDefinition, short_urn)
|
|
358
|
-
|
|
359
|
-
def get_organisation_scheme(self, short_urn: str) -> AgencyScheme:
|
|
360
|
-
"""Returns a specific AgencyScheme."""
|
|
361
|
-
return self.__get_single_structure(AgencyScheme, short_urn)
|
|
362
|
-
|
|
363
|
-
def get_provision_agreement(self, short_urn: str) -> ProvisionAgreement:
|
|
364
|
-
"""Returns a specific Provision Agreement."""
|
|
365
|
-
return self.__get_single_structure(ProvisionAgreement, short_urn)
|
|
352
|
+
def get_name_personalisation_schemes(
|
|
353
|
+
self,
|
|
354
|
+
) -> List[NamePersonalisationScheme]:
|
|
355
|
+
"""Returns the NamePersonalisationSchemes."""
|
|
356
|
+
return self.__get_elements(NamePersonalisationScheme)
|
|
366
357
|
|
|
367
358
|
|
|
368
359
|
class MetadataMessage(Struct, frozen=True):
|