You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/example.rst
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,11 +24,11 @@ These include *structural metadata* that together completely describe the data a
24
24
sm
25
25
26
26
:py:`sm` is a Python object of class :class:`.StructureMessage`.
27
-
We can explore some of the specific artifacts—for example, two **code lists**—using :meth:`.StructureMessage.get` to retrieve them and :func:`.to_pandas` to convert to :class:`.pandas.Series`:
27
+
We can explore some of the specific artifacts—for example, three **code lists**—using :meth:`.StructureMessage.get` to retrieve them and :func:`.to_pandas` to convert to :class:`.pandas.Series`:
28
28
29
29
.. ipython:: python
30
30
31
-
for cl in"AGE", "SEX":
31
+
for cl in"AGE(10.3)", "SEX(1.13)", "UNIT(55.0)":
32
32
print(sdmx.to_pandas(sm.get(cl)))
33
33
34
34
Next, we download a **data set** containing a portion of the data in this data flow, structured by this DSD.
Copy file name to clipboardExpand all lines: doc/implementation.rst
+54-30Lines changed: 54 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,37 +4,61 @@ Implementation notes
4
4
:mod:`sdmx` aims for a **precise, Pythonic, and useful implementation of the SDMX standards**.
5
5
This means:
6
6
7
-
- Classes and their attributes have the same names, types, cardinality that appear in the standard.
7
+
- Classes and their attributes have the names, types, cardinality, and directionality given in the standard.
8
8
9
-
- Where the standard uses non-Pythonic naming conventions (for instance, "dimensionAtObservation"), :mod:`sdmx` follows the `PEP-8 naming conventions <https://peps.python.org/pep-0008/#naming-conventions>`_ (for instance, "dimension_at_observation" for an attribute).
9
+
- Where the standard has non-Pythonic names (for instance, "dimensionAtObservation"), :mod:`sdmx` follows the `PEP-8 naming conventions <https://peps.python.org/pep-0008/#naming-conventions>`_ (for instance, "dimension_at_observation" for a class attribute).
10
10
- Where the standard is ambiguous or imprecise itself, implementation (for instance, naming) choices in :mod:`sdmx` are clearly labelled.
11
11
12
12
- Extensions, additional features, and conveniences in :mod:`sdmx` that do not appear in the standards are clearly labeled.
13
-
- All behaviour visible “in the wild”—that is, from publicly available data sources and files—is supported, so long as it is verifiably standards compliant.
13
+
- All behaviour visible “in the wild”—that is, from publicly available data sources and files—is either:
14
+
15
+
- supported, if it is verifiably standards-compliant, or
16
+
- tolerated if otherwise, so long as this does not complicate the implementation of standards.
17
+
Non-standard content is flagged using log messages and by other means.
14
18
15
19
This page gives brief explanations of **how** this implementation is achieved.
16
20
Although this page is organized (see the contents in the sidebar) to correspond to the standards, it (:ref:`again <not-the-standard>`) **does not restate them** or set out to explain all their details.
17
21
For those purposes, see :doc:`resources`; or the :doc:`walkthrough`, which includes some incidental explanations.
18
22
19
23
.. _sdmx-version-policy:
20
24
21
-
SDMX standard versions 2.0, 2.1, and 3.0
22
-
========================================
25
+
Standards versions
26
+
==================
23
27
28
+
SDMX standards documents are available `on the SDMX website <https://sdmx.org/?page_id=5008>`__ and via links to other locations.
24
29
Multiple versions of the SDMX standards have been adopted:
25
30
26
31
- 2.0 in November 2005.
27
32
- 2.1 in August 2011; published at the International Standards Organization (ISO) in January 2013; and revised multiple times since.
28
-
- 3.0 in October 2021.
29
-
30
-
The standards are available on the SDMX website: https://sdmx.org/?page_id=5008
31
-
32
-
- In SDMX 2.1, sections of the standards were numbered from 1 to 7.
33
-
For instance, the :ref:`im` is Section 2.
34
-
- From SDMX 3.0, some of these section numbers have been removed.
35
-
For instance, SDMX-ML was described in SDMX 2.1 sections 3A and 3B; in SDMX 3.0, these section numbers are no longer used, replaced with a reference to the SDMX Technical Working Group (TWG) Git repository at https://github.com/sdmx-twg/sdmx-ml .
36
-
- Some of these sections or sub-standards are versioned differently from the overall standard.
37
-
See in particular :ref:`sdmx-csv`, :ref:`sdmx-json`, and :ref:`sdmx-rest` below.
33
+
- 3.0.0 in October 2021.
34
+
- 3.1 planned for some time in 2025.
35
+
36
+
Some notes about the organization of the standards:
37
+
38
+
- In SDMX 2.1, **‘sections’** of the standards were numbered from 1 to 7.
39
+
For instance, the :ref:`im` is referred to as “Section 2”.
40
+
41
+
- This is distinct from numbered sections or headings *within* the particular standards documents.
42
+
For instance, SDMX 2.1 Section 2 “Information Model/UML Conceptual Design” is a document that contains numbered sections/headings such as “2. Actors and Use Cases” and “2.1. Introduction.”
43
+
Documentation and code comments for the :mod:`sdmx` package attempts to be unambiguous about such references, and uses the “§” character to refer to these (sub-)headings.
44
+
- From SDMX 3.0.0, some of these section numbers have been removed or disused.
45
+
For instance, the SDMX-ML file format was described in SDMX 2.1 sections 3A and 3B; in SDMX 3.0.0, these section numbers are no longer used, replaced with a reference to the SDMX Technical Working Group (TWG) Git repository at https://github.com/sdmx-twg/sdmx-ml.
46
+
- Some of the sections or component standards are versioned differently from SDMX as a whole.
47
+
The following table lists the *apparent* correspondences between versions of the component standards (The SDMX TWG does not publish such a table, so this should not be taken as official):
See further details under the :ref:`sdmx-csv`, :ref:`sdmx-json`, and :ref:`sdmx-rest` sections, below.
60
+
- The version numbers `do not <https://github.com/sdmx-twg/sdmx-3_1_0/issues/1#issuecomment-2519837607>`_ follow the `semantic versioning <https://semver.org>`_ system.
61
+
This means that increments to the second (3.0 → 3.1) or first (3.1 → 4.0) version part do not necessarily indicate the presence/absence of 'breaking' or backwards-incompatible changes.
38
62
39
63
For the current Python package, :mod:`sdmx`:
40
64
@@ -45,20 +69,20 @@ For the current Python package, :mod:`sdmx`:
45
69
This makes it more difficult and costly to support them.
46
70
- While no SDMX 2.0 implementation is planned, contributions from new developers are possible and welcome.
47
71
48
-
- **SDMX 2.1 and 3.0** are implemented as described on this page, with exhaustive implementation as the design goal for :mod:`sdmx`.
49
-
- For **SDMX 3.0** specifically, as of v2.14.0 :mod:`sdmx` implements:
72
+
- **SDMX 2.1 and 3.0.0** are implemented as described on this page, with exhaustive implementation as the design goal for :mod:`sdmx`.
73
+
- For **SDMX 3.0.0** specifically, as of v2.14.0 :mod:`sdmx` implements:
50
74
51
-
- The SDMX 3.0 information model (:mod:`.model.v30`), to the same extent as SDMX 2.1.
52
-
- Reading of SDMX-ML 3.0 (:mod:`.reader.xml.v30`).
75
+
- The SDMX 3.0.0 information model (:mod:`.model.v30`), to the same extent as SDMX 2.1.
76
+
- Reading of SDMX-ML 3.0.0 (:mod:`.reader.xml.v30`).
53
77
- Construction of URLs and querying SDMX-REST API v2.1.0 data sources (:mod:`.rest.v30`).
54
78
55
79
This implies the following are not yet supported:
56
80
57
-
- Writing SDMX-ML 3.0.
81
+
- Writing SDMX-ML 3.0.0.
58
82
- Reading and writing SDMX-JSON 2.0 (see :ref:`sdmx-json`).
59
83
60
-
Follow the :doc:`whatsnew`; :issue:`87`; and other GitHub issues and pull requests for details.
61
-
Please `open an issue <https://github.com/khaeru/sdmx/issues>`_ on GitHub to report examples of real-world SDMX 3.0 web services examples and specimens of data that can be added.
84
+
Follow the :doc:`whatsnew`and GitHub issues and pull requests with the `'sdmx-3' label <https://github.com/khaeru/sdmx/labels/sdmx-3>`__ for details.
85
+
Please `open an issue <https://github.com/khaeru/sdmx/issues>`_ on GitHub to report examples of real-world SDMX 3.0.0 web services examples and specimens of data that can be added.
62
86
63
87
.. _im:
64
88
@@ -68,14 +92,14 @@ Information model (SDMX-IM)
68
92
Reference:
69
93
70
94
- `SDMX 2.1 Section 2 — Information Model <https://sdmx.org/wp-content/uploads/SDMX_2-1-1_SECTION_2_InformationModel_201108.pdf>`_ (PDF).
71
-
- `SDMX 3.0 Section 2 — Information Model <https://sdmx.org/wp-content/uploads/SDMX_3-0-0_SECTION_2_FINAL-1_0.pdf>`_ (PDF).
95
+
- `SDMX 3.0.0 Section 2 — Information Model <https://sdmx.org/wp-content/uploads/SDMX_3-0-0_SECTION_2_FINAL-1_0.pdf>`_ (PDF).
72
96
73
97
In general:
74
98
75
99
- :mod:`sdmx.model.common` implements:
76
100
77
-
1. Classes that are fully identical in the SDMX 2.1 and 3.0 information models.
78
-
2. Base classes like :class:`.BaseDataStructureDefinition` that contain **common attributes and features** shared by SDMX 2.1 and 3.0 classes that differ in some ways.
101
+
1. Classes that are fully identical in the SDMX 2.1 and 3.0.0 information models.
102
+
2. Base classes like :class:`.BaseDataStructureDefinition` that contain **common attributes and features** shared by SDMX 2.1 and 3.0.0 classes that differ in some ways.
79
103
These classes should not be instantiated or used directly, except for type checking and hinting.
80
104
81
105
- :mod:`sdmx.model.v21` and :mod:`sdmx.model.v30` contain:
@@ -254,7 +278,7 @@ The IM provides terms and concepts for data and metadata, but does not specify h
254
278
The SDMX standards include multiple formats for storing data, metadata, and structures.
255
279
In general, :mod:`sdmx`:
256
280
257
-
- Reads most SDMX-ML 2.1 and 3.0 and SDMX-JSON 1.0 messages.
281
+
- Reads most SDMX-ML 2.1 and 3.0.0 and SDMX-JSON 1.0 messages.
258
282
- Uses collected specimens of messages in various formats, stored in the `khaeru/sdmx-test-data <https://github.com/khaeru/sdmx-test-data/>`_ Git repository.
259
283
These are used by the test suite to check that the code functions as intended, but can also be viewed to understand the data formats.
260
284
@@ -272,7 +296,7 @@ SDMX-ML can represent every class and property in the IM.
272
296
273
297
.. versionadded:: 2.11.0
274
298
275
-
Support for reading SDMX-ML 3.0.
299
+
Support for reading SDMX-ML 3.0.0.
276
300
277
301
.. _sdmx-json:
278
302
@@ -345,17 +369,17 @@ These generally elaborate the SDMX standards, but in some cases also document so
345
369
The SDMX-REST *web service API* is versioned differently from the overall SDMX *standard*:
346
370
347
371
- SDMX-REST API v1.5.0 and earlier corresponding to SDMX 2.1 and earlier.
348
-
- SDMX-REST API v2.0.0 and later corresponding to SDMX 3.0 and later.
372
+
- SDMX-REST API v2.0.0 and later corresponding to SDMX 3.0.0 and later.
349
373
350
374
:mod:`sdmx` aims to support:
351
375
352
376
- SDMX-REST API versions in the 1.x series from v1.5.0 and later
353
377
- SDMX-REST API versions in the 2.x series from v2.1.0 and later.
354
-
- Data retrieved in SDMX 2.1 and 3.0 :ref:`formats <formats>`.
378
+
- Data retrieved in SDMX 2.1 and 3.0.0:ref:`formats <formats>`.
355
379
Some existing services offer a parameter to select SDMX 2.1 *or* 2.0 format; :mod:`sdmx` does not support the latter.
356
380
Other services *only* provide SDMX 2.0-formatted data; these cannot be used with :mod:`sdmx` (:ref:`see above <sdmx-version-policy>`).
357
381
358
-
:class:`.Client` constructs valid URLs (using :class:`~.rest.URL` subclasses :class:`.v21.URL` and :class:`.v30.URL`).
382
+
:class:`.Client` constructs valid URLs using the :class:`~.rest.URL` subclasses :class:`.v21.URL` and :class:`.v30.URL`.
359
383
360
384
- For example, :meth:`.Client.get` automatically adds the HTTP header ``Accept: application/vnd.sdmx.structurespecificdata+xml;`` when a :py:`structure=...` argument is provided and the data source supports this content type.
361
385
- :class:`.v21.URL` supplies some default parameters in certain cases.
Copy file name to clipboardExpand all lines: doc/whatsnew.rst
+63-3Lines changed: 63 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,70 @@
3
3
What's new?
4
4
***********
5
5
6
-
.. _2.21.1:
6
+
.. _2.22.0:
7
+
8
+
Next release
9
+
============
10
+
11
+
Migration notes
12
+
---------------
13
+
14
+
- Modify code that imports :class:`~.v21.Annotation` from :mod:`sdmx.model.common` to import from either :mod:`sdmx.model.v21` or :mod:`sdmx.model.v30`, as appropriate.
15
+
For example, instead of:
16
+
17
+
.. code-block:: python
18
+
19
+
from sdmx.model.common import Annotation
20
+
21
+
a = Annotation(id="FOO", ...)
22
+
23
+
…do:
7
24
8
-
.. Next release
9
-
.. ============
25
+
.. code-block:: python
26
+
27
+
from sdmx.model.v21 import Annotation
28
+
29
+
a = Annotation(id="FOO", ...)
30
+
- Adjust code that accesses :class:`.ReportStructure` via the :attr:`v21.MetadataSet.described_by` attribute:
31
+
32
+
1. To access ReportStructure, use the new :attr:`~.v21.MetadataSet.report_structure` attribute.
33
+
2. To access :class:`.MetadataStructureDefinition`, use :attr:`~v21.MetadataSet.described_by`.
34
+
35
+
All changes
36
+
-----------
37
+
38
+
- :meth:`StructureMessage.get` handles full and partial :class:`URNs <URN>` (:pull:`227`).
39
+
- :class:`.v21.Annotation` and :class:`.v30.Annotation` are derived from :class:`.common.BaseAnnotation` (:pull:`227`).
40
+
This allows to reflect that the latter has an attribute, :attr:`.v30.Annotation.value`, that the former does not.
41
+
This is a change in the SDMX 3.0.0 Information Model that is not mentioned in the “Summary of major changes and new functionality” or IM document.
42
+
43
+
Code like :py:`from sdmx.model.common import Annotation` now emits :class:`DeprecationWarning`, and in the future will raise :class:`ImportError`.
44
+
- :func:`.validate_xml` now supports :xml:`<com:StructuredText>` elements representing, for instance, :class:`.XHTMLAttributeValue` (:pull:`227`).
45
+
A new function :func:`.construct_schema` modifies the official SDMX-ML schemas to insert an import of the `XML Schema for XHTML 1.0 <https://www.w3.org/TR/xhtml1-schema/>`_, allowing to validate the XHTML content within these elements.
46
+
- Improve :mod:`.model` (:pull:`227`):
47
+
48
+
- :class:`.IdentifiableArtefact` is comparable with :class:`str` via its :attr:`~.IdentifiableArtefact.id`.
49
+
This means that :func:`sorted` can be used with mixed collections of these two types.
50
+
- :attr:`.Structure.grouping` now returns a list of :class:`.ComponentList`.
51
+
In :mod:`sdmx` v2.21.1 and earlier, this list would include a :class:`dict` of 0 or more :class:`.GroupDimensionDescriptor`, keyed by the ID of each.
52
+
Now, each group dimension descriptor is directly an item in the list.
53
+
- :attr:`.v21.MetadataSet.report_structure` is added and distinguished from :attr:`~.v21.MetadataSet.described_by`.
54
+
This works around an issue in the SDMX 2.1 IM; see the class docstring for details.
55
+
- New convenience methods :meth:`.MetadataReport.get`, :meth:`.MetadataReport.get_value`, and :meth:`.ReportedAttribute.get_child`.
56
+
57
+
- Improve reading and writing of SDMX-ML (:pull:`227`):
58
+
59
+
- Read :xml:`<str:AnnotationValue>` in SDMX-ML 3.0.0 (:issue:`226`).
60
+
- Read :xml:`<str:Hierarchy>` where the optional :xml:`<... leveled="...">` attribute is not present (:issue:`226`).
61
+
- Read and write XSD-valid :class:`.v21.MetadataSet` and :class:`.v21.HierarchicalCodelist`.
62
+
- Write :attr:`.Dimension.concept_role`.
63
+
- Write annotations associated with :class:`DataSet <.BaseDataSet>`, :class:`MetadataSet <.BaseMetadataSet>`, and :class:`.MetadataReport`.
64
+
- Pending resolution of :issue:`228`, ignore :xml:`<com:Link>` in SDMX-ML 3.0.0 .
65
+
66
+
- Update and expand :ref:`sdmx-version-policy` in the documentation (:pull:`227`).
67
+
A table is now included showing the correspondence of versions of component SDMX standards.
0 commit comments