pysdmx 1.3.0__py3-none-any.whl → 1.4.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/__extras_check.py +3 -2
- pysdmx/__init__.py +1 -1
- pysdmx/api/fmr/__init__.py +4 -4
- pysdmx/api/gds/__init__.py +328 -0
- pysdmx/api/qb/gds.py +153 -0
- pysdmx/api/qb/service.py +91 -3
- pysdmx/api/qb/structure.py +1 -0
- pysdmx/api/qb/util.py +1 -0
- pysdmx/io/__init__.py +2 -1
- pysdmx/io/csv/sdmx10/reader/__init__.py +4 -2
- pysdmx/io/csv/sdmx10/writer/__init__.py +15 -2
- pysdmx/io/csv/sdmx20/reader/__init__.py +5 -2
- pysdmx/io/csv/sdmx20/writer/__init__.py +13 -2
- pysdmx/io/format.py +4 -0
- pysdmx/io/input_processor.py +12 -3
- pysdmx/io/json/fusion/messages/core.py +2 -0
- pysdmx/io/json/fusion/messages/report.py +13 -7
- pysdmx/io/json/gds/messages/__init__.py +35 -0
- pysdmx/io/json/gds/messages/agencies.py +41 -0
- pysdmx/io/json/gds/messages/catalog.py +79 -0
- pysdmx/io/json/gds/messages/sdmx_api.py +23 -0
- pysdmx/io/json/gds/messages/services.py +49 -0
- pysdmx/io/json/gds/messages/urn_resolver.py +43 -0
- pysdmx/io/json/gds/reader/__init__.py +12 -0
- pysdmx/io/json/sdmxjson2/messages/__init__.py +12 -4
- pysdmx/io/json/sdmxjson2/messages/agency.py +72 -0
- pysdmx/io/json/sdmxjson2/messages/category.py +22 -29
- pysdmx/io/json/sdmxjson2/messages/code.py +68 -64
- pysdmx/io/json/sdmxjson2/messages/concept.py +9 -18
- pysdmx/io/json/sdmxjson2/messages/constraint.py +2 -13
- pysdmx/io/json/sdmxjson2/messages/core.py +113 -21
- pysdmx/io/json/sdmxjson2/messages/dataflow.py +51 -21
- pysdmx/io/json/sdmxjson2/messages/dsd.py +110 -36
- pysdmx/io/json/sdmxjson2/messages/map.py +61 -49
- pysdmx/io/json/sdmxjson2/messages/pa.py +9 -17
- pysdmx/io/json/sdmxjson2/messages/provider.py +88 -0
- pysdmx/io/json/sdmxjson2/messages/report.py +84 -14
- pysdmx/io/json/sdmxjson2/messages/schema.py +14 -5
- pysdmx/io/json/sdmxjson2/messages/structure.py +105 -36
- pysdmx/io/json/sdmxjson2/messages/vtl.py +42 -96
- pysdmx/io/pd.py +2 -9
- pysdmx/io/reader.py +72 -27
- pysdmx/io/serde.py +11 -0
- pysdmx/io/writer.py +134 -0
- pysdmx/io/xml/{sdmx21/reader/__data_aux.py → __data_aux.py} +9 -2
- pysdmx/io/xml/{sdmx21/reader/__parse_xml.py → __parse_xml.py} +30 -6
- pysdmx/io/xml/__ss_aux_reader.py +96 -0
- pysdmx/io/xml/__structure_aux_reader.py +1174 -0
- pysdmx/io/xml/__structure_aux_writer.py +1233 -0
- pysdmx/io/xml/{sdmx21/__tokens.py → __tokens.py} +33 -1
- pysdmx/io/xml/{sdmx21/writer/__write_aux.py → __write_aux.py} +129 -37
- pysdmx/io/xml/{sdmx21/writer/__write_data_aux.py → __write_data_aux.py} +1 -1
- pysdmx/io/xml/__write_structure_specific_aux.py +254 -0
- pysdmx/io/xml/{sdmx21/reader/doc_validation.py → doc_validation.py} +10 -2
- pysdmx/io/xml/{sdmx21/reader/header.py → header.py} +11 -3
- pysdmx/io/xml/sdmx21/reader/error.py +2 -2
- pysdmx/io/xml/sdmx21/reader/generic.py +12 -8
- pysdmx/io/xml/sdmx21/reader/structure.py +5 -840
- pysdmx/io/xml/sdmx21/reader/structure_specific.py +13 -97
- pysdmx/io/xml/sdmx21/reader/submission.py +2 -2
- pysdmx/io/xml/sdmx21/writer/error.py +1 -1
- pysdmx/io/xml/sdmx21/writer/generic.py +13 -7
- pysdmx/io/xml/sdmx21/writer/structure.py +16 -828
- pysdmx/io/xml/sdmx21/writer/structure_specific.py +13 -238
- pysdmx/io/xml/sdmx30/__init__.py +1 -0
- pysdmx/io/xml/sdmx30/reader/__init__.py +1 -0
- pysdmx/io/xml/sdmx30/reader/structure.py +39 -0
- pysdmx/io/xml/sdmx30/reader/structure_specific.py +39 -0
- pysdmx/io/xml/sdmx30/writer/__init__.py +1 -0
- pysdmx/io/xml/sdmx30/writer/structure.py +67 -0
- pysdmx/io/xml/sdmx30/writer/structure_specific.py +108 -0
- pysdmx/model/__base.py +99 -34
- pysdmx/model/__init__.py +4 -0
- pysdmx/model/category.py +20 -0
- pysdmx/model/code.py +29 -8
- pysdmx/model/concept.py +52 -11
- pysdmx/model/dataflow.py +117 -33
- pysdmx/model/dataset.py +66 -14
- pysdmx/model/gds.py +161 -0
- pysdmx/model/map.py +51 -8
- pysdmx/model/message.py +235 -55
- pysdmx/model/metadata.py +79 -16
- pysdmx/model/submission.py +12 -7
- pysdmx/model/vtl.py +30 -13
- pysdmx/toolkit/__init__.py +1 -1
- pysdmx/toolkit/pd/__init__.py +85 -0
- pysdmx/toolkit/vtl/__init__.py +2 -1
- pysdmx/toolkit/vtl/_validations.py +1 -1
- pysdmx/toolkit/vtl/{generate_vtl_script.py → script_generation.py} +30 -4
- pysdmx/toolkit/vtl/validation.py +119 -0
- pysdmx/util/_model_utils.py +1 -1
- pysdmx-1.4.0rc1.dist-info/METADATA +119 -0
- pysdmx-1.4.0rc1.dist-info/RECORD +140 -0
- pysdmx/io/json/sdmxjson2/messages/org.py +0 -140
- pysdmx/toolkit/vtl/model_validations.py +0 -50
- pysdmx-1.3.0.dist-info/METADATA +0 -76
- pysdmx-1.3.0.dist-info/RECORD +0 -116
- /pysdmx/io/xml/{sdmx21/writer/config.py → config.py} +0 -0
- {pysdmx-1.3.0.dist-info → pysdmx-1.4.0rc1.dist-info}/LICENSE +0 -0
- {pysdmx-1.3.0.dist-info → pysdmx-1.4.0rc1.dist-info}/WHEEL +0 -0
|
@@ -4,7 +4,8 @@ import warnings
|
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
from typing import Any, Dict, Optional, Union
|
|
6
6
|
|
|
7
|
-
from pysdmx.io.xml.
|
|
7
|
+
from pysdmx.io.xml.__parse_xml import parse_xml
|
|
8
|
+
from pysdmx.io.xml.__tokens import (
|
|
8
9
|
AGENCY_ID,
|
|
9
10
|
DATASET_ACTION,
|
|
10
11
|
DATASET_ID,
|
|
@@ -17,6 +18,7 @@ from pysdmx.io.xml.sdmx21.__tokens import (
|
|
|
17
18
|
ID,
|
|
18
19
|
NAME,
|
|
19
20
|
PREPARED,
|
|
21
|
+
PROV_AGREEMENT,
|
|
20
22
|
PROV_AGREMENT,
|
|
21
23
|
RECEIVER,
|
|
22
24
|
REF,
|
|
@@ -29,7 +31,6 @@ from pysdmx.io.xml.sdmx21.__tokens import (
|
|
|
29
31
|
URN,
|
|
30
32
|
VERSION,
|
|
31
33
|
)
|
|
32
|
-
from pysdmx.io.xml.sdmx21.reader.__parse_xml import parse_xml
|
|
33
34
|
from pysdmx.model import Organisation, Reference
|
|
34
35
|
from pysdmx.model.dataset import ActionType
|
|
35
36
|
from pysdmx.model.message import Header
|
|
@@ -98,7 +99,12 @@ def __parse_structure(
|
|
|
98
99
|
elif STR_USAGE in structure:
|
|
99
100
|
structure_info = structure[STR_USAGE]
|
|
100
101
|
sdmx_type = DFW
|
|
102
|
+
elif PROV_AGREEMENT in structure:
|
|
103
|
+
structure_info = structure[PROV_AGREEMENT]
|
|
104
|
+
sdmx_type = PROV_AGREEMENT
|
|
101
105
|
else:
|
|
106
|
+
# Provision Agrement is a typo in the SDMX 2.1 schema,
|
|
107
|
+
# and it is later solved in SDMX 3.0
|
|
102
108
|
structure_info = structure[PROV_AGREMENT]
|
|
103
109
|
sdmx_type = PROV_AGREMENT
|
|
104
110
|
|
|
@@ -113,8 +119,10 @@ def __parse_structure(
|
|
|
113
119
|
id=structure_id,
|
|
114
120
|
version=version,
|
|
115
121
|
)
|
|
116
|
-
|
|
122
|
+
elif URN in structure_info:
|
|
117
123
|
ref_obj = parse_maintainable_urn(structure_info[URN])
|
|
124
|
+
else:
|
|
125
|
+
ref_obj = parse_maintainable_urn(structure_info)
|
|
118
126
|
return {str(ref_obj): dim_at_obs}
|
|
119
127
|
|
|
120
128
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"""SDMX 2.1 XML error reader."""
|
|
2
2
|
|
|
3
3
|
from pysdmx.errors import Invalid
|
|
4
|
-
from pysdmx.io.xml.
|
|
4
|
+
from pysdmx.io.xml.__parse_xml import parse_xml
|
|
5
|
+
from pysdmx.io.xml.__tokens import (
|
|
5
6
|
ERROR,
|
|
6
7
|
ERROR_CODE,
|
|
7
8
|
ERROR_MESSAGE,
|
|
8
9
|
ERROR_TEXT,
|
|
9
10
|
)
|
|
10
|
-
from pysdmx.io.xml.sdmx21.reader.__parse_xml import parse_xml
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def read(input_str: str, validate: bool = True) -> None:
|
|
@@ -6,7 +6,12 @@ import pandas as pd
|
|
|
6
6
|
|
|
7
7
|
from pysdmx.errors import Invalid
|
|
8
8
|
from pysdmx.io.pd import PandasDataset
|
|
9
|
-
from pysdmx.io.xml.
|
|
9
|
+
from pysdmx.io.xml.__data_aux import (
|
|
10
|
+
__process_df,
|
|
11
|
+
get_data_objects,
|
|
12
|
+
)
|
|
13
|
+
from pysdmx.io.xml.__parse_xml import parse_xml
|
|
14
|
+
from pysdmx.io.xml.__tokens import (
|
|
10
15
|
ATTRIBUTES,
|
|
11
16
|
GENERIC,
|
|
12
17
|
ID,
|
|
@@ -20,11 +25,6 @@ from pysdmx.io.xml.sdmx21.__tokens import (
|
|
|
20
25
|
STR_REF,
|
|
21
26
|
VALUE,
|
|
22
27
|
)
|
|
23
|
-
from pysdmx.io.xml.sdmx21.reader.__data_aux import (
|
|
24
|
-
__process_df,
|
|
25
|
-
get_data_objects,
|
|
26
|
-
)
|
|
27
|
-
from pysdmx.io.xml.sdmx21.reader.__parse_xml import parse_xml
|
|
28
28
|
from pysdmx.io.xml.utils import add_list
|
|
29
29
|
from pysdmx.model.dataset import ActionType
|
|
30
30
|
|
|
@@ -58,7 +58,9 @@ def __reading_generic_series(dataset: Dict[str, Any]) -> pd.DataFrame:
|
|
|
58
58
|
for data in series[OBS]:
|
|
59
59
|
obs = {
|
|
60
60
|
OBS_DIM: data[OBS_DIM][VALUE.lower()],
|
|
61
|
-
OBS_VALUE_ID: data[OBS_VALUE_XML_TAG][VALUE.lower()]
|
|
61
|
+
OBS_VALUE_ID: data[OBS_VALUE_XML_TAG][VALUE.lower()]
|
|
62
|
+
if OBS_VALUE_XML_TAG in data
|
|
63
|
+
else "",
|
|
62
64
|
}
|
|
63
65
|
if ATTRIBUTES in data:
|
|
64
66
|
obs = {
|
|
@@ -87,7 +89,9 @@ def __reading_generic_all(dataset: Dict[str, Any]) -> pd.DataFrame:
|
|
|
87
89
|
obs = {
|
|
88
90
|
**obs,
|
|
89
91
|
**__get_element_to_list(data, mode=OBS_KEY),
|
|
90
|
-
OBS_VALUE_ID: data[OBS_VALUE_XML_TAG][VALUE.lower()]
|
|
92
|
+
OBS_VALUE_ID: data[OBS_VALUE_XML_TAG][VALUE.lower()]
|
|
93
|
+
if OBS_VALUE_XML_TAG in data
|
|
94
|
+
else "",
|
|
91
95
|
}
|
|
92
96
|
if ATTRIBUTES in data:
|
|
93
97
|
obs = {**obs, **__get_element_to_list(data, mode=ATTRIBUTES)}
|