sdmxlib 0.78.0__tar.gz → 0.80.0__tar.gz
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.
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/PKG-INFO +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/pyproject.toml +2 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/pyproject.toml.orig +5 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/EGM.md +20 -12
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/__init__.py +14 -4
- sdmxlib-0.80.0/src/sdmxlib/_facet_types.xsd +126 -0
- sdmxlib-0.80.0/src/sdmxlib/_facets.py +198 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/api/registry.py +37 -20
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/builders/EGM.md +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/builders/contentconstraint.py +14 -14
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/builders/metadata_annotation.py +5 -5
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/EGM.md +58 -45
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/__init__.py +53 -39
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_availability.py +7 -7
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_build.py +57 -57
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_canonical.py +1 -1
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_check.py +105 -84
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_copy.py +38 -36
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_fetch.py +19 -19
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_finding.py +2 -2
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_fingerprint.py +7 -7
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_overlay.py +59 -41
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_remote.py +9 -9
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/_write.py +211 -105
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/manifest.schema.json +20 -20
- {sdmxlib-0.78.0/src/sdmxlib/bundle → sdmxlib-0.80.0/src/sdmxlib/edition}/overlay.schema.json +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/EGM.md +10 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/__init__.py +52 -9
- sdmxlib-0.80.0/src/sdmxlib/formats/_tags.py +136 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/render.py +4 -4
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_csv/EGM.md +2 -3
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -13
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_csv/writer.py +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/EGM.md +11 -6
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/_data_common.py +45 -28
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/_dto.py +39 -24
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/_header.py +8 -7
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +8 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +83 -82
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/data_v1.py +2 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/data_v2.py +2 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/metadata.py +19 -18
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/reader.py +8 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +3 -3
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml/_common.py +13 -32
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml/_header.py +4 -5
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml21/writer.py +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml30/metadata.py +10 -17
- sdmxlib-0.80.0/src/sdmxlib/inventory/EGM.md +73 -0
- sdmxlib-0.80.0/src/sdmxlib/inventory/__init__.py +129 -0
- sdmxlib-0.80.0/src/sdmxlib/inventory/_format.py +375 -0
- sdmxlib-0.80.0/src/sdmxlib/inventory/_reader.py +278 -0
- sdmxlib-0.80.0/src/sdmxlib/inventory/_rules.py +538 -0
- sdmxlib-0.80.0/src/sdmxlib/inventory/conformance.py +341 -0
- sdmxlib-0.80.0/src/sdmxlib/inventory/schemas/catalog.schema.json +26 -0
- sdmxlib-0.80.0/src/sdmxlib/inventory/schemas/current.schema.json +26 -0
- sdmxlib-0.80.0/src/sdmxlib/inventory/schemas/leaf.schema.json +176 -0
- sdmxlib-0.80.0/src/sdmxlib/inventory/schemas/root.schema.json +162 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/local/EGM.md +48 -39
- sdmxlib-0.80.0/src/sdmxlib/local/__init__.py +8 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/local/_scan.py +8 -5
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/local/data_store.py +89 -25
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/local/engine.py +38 -38
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/local/object_store.py +11 -11
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/local/registry.py +269 -167
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/local/sql.py +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/EGM.md +42 -10
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/__init__.py +13 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_rules.py +4 -4
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/annotations.py +6 -3
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/binding.py +3 -3
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/codelist.py +6 -2
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/constraint.py +5 -2
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/convert.py +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/datastructure.py +12 -3
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/in_memory_registry.py +28 -8
- sdmxlib-0.80.0/src/sdmxlib/model/istring.py +582 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/link.py +9 -5
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/validation.py +208 -22
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/valuelist.py +8 -3
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/polars.py +18 -11
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_compile.py +3 -3
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_expr.py +8 -4
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/observations.py +3 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/query.py +3 -3
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/session.py +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/sql.py +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/EGM.md +16 -9
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/_checked.py +1 -1
- sdmxlib-0.80.0/src/sdmxlib/storage/_layout.py +185 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/_manifest.py +89 -78
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/_parsed.py +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/_projections.py +5 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/_references.py +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/_synthetic.py +1 -1
- sdmxlib-0.80.0/src/sdmxlib/storage/_tags.py +84 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/_trim.py +6 -6
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/lazy.py +7 -2
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/readers.py +7 -3
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/resolve.py +11 -12
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/schema.py +15 -11
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/writers.py +9 -9
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/testing.py +52 -34
- sdmxlib-0.78.0/src/sdmxlib/local/__init__.py +0 -8
- sdmxlib-0.78.0/src/sdmxlib/model/istring.py +0 -157
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/LICENSE +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/README.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/_duckdb.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/_read_errors.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/_singleflight.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/_time.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/api/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/api/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/api/_freshness.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/api/client.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/api/federated.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/api/policy.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/api/providers.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/api/session.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/builders/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/data_store.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/_arrow.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/_attachment.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/_coerce.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/_index.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/_positions.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/_refuse.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/data_format.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/gaps.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/_periods.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json/writer.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json_1_0/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml21/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml30/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml31/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_binding.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_container.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_invariants.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_items.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_label_match.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_rebind.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_referenceable.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_refshape.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_resolvers.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/_tree.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/base.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/category.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/collections.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/concept.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/dataflow.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/errors.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/expr.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/header.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/hierarchy.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/mapping.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/message.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/metadata_provision.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/metadataflow.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/metadataset.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/metadatastructure.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/organisation.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/provision.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/ref.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/registry.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/representation.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/rest_api.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/rollup.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/urn.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/version.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/model/version_rewrite.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/py.typed +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_closure.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_common.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_edges.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_execute.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_joins.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_plan.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_pushdown.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_rebase.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/_rest.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/accessors.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/raw.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/query/schema.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/rest.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/_columns.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/storage/_kinds.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.80.0}/src/sdmxlib/versions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sdmxlib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.80.0
|
|
4
4
|
Summary: SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store.
|
|
5
5
|
Keywords: sdmx,statistics,metadata,datastructure
|
|
6
6
|
Author: gabrielgellner
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sdmxlib"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.80.0"
|
|
4
4
|
description = "SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -121,6 +121,7 @@ dev = [
|
|
|
121
121
|
"polars>=2.0.0",
|
|
122
122
|
"pytest>=9.0.2",
|
|
123
123
|
"jsonschema[format-nongpl]>=4.21.0",
|
|
124
|
+
"deltalake>=1.6.6,<1.7",
|
|
124
125
|
"pytest-benchmark>=4.0.0",
|
|
125
126
|
"pytest-cov>=7.1.0",
|
|
126
127
|
"pytest-xdist>=3.8.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sdmxlib"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.80.0"
|
|
4
4
|
description = "SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -143,6 +143,10 @@ dev = [
|
|
|
143
143
|
"polars>=2.0.0",
|
|
144
144
|
"pytest>=9.0.2",
|
|
145
145
|
"jsonschema[format-nongpl]>=4.21.0",
|
|
146
|
+
# The Delta-backed Inventory prototype the conformance suite also runs
|
|
147
|
+
# against (GH-252): a test fixture proving the spec's escape route, not a
|
|
148
|
+
# supported backend. Capped below the next minor, as delta-rs breaks on one.
|
|
149
|
+
"deltalake>=1.6.6,<1.7",
|
|
146
150
|
"pytest-benchmark>=4.0.0",
|
|
147
151
|
"pytest-cov>=7.1.0",
|
|
148
152
|
"pytest-xdist>=3.8.0",
|
|
@@ -47,6 +47,12 @@ the subpackages share.
|
|
|
47
47
|
`SingleFlight` (`docs/design/caching.md`).
|
|
48
48
|
- `to_storage`, `from_storage` and `as_utc` (`_time.py`): store every
|
|
49
49
|
TIMESTAMP as naive UTC.
|
|
50
|
+
- `FacetChecker` (`_facets.py`): whether a value meets a text format. libxml2
|
|
51
|
+
checks the type and the pattern as XML Schema defines them; SDMX's own text
|
|
52
|
+
types come from `_facet_types.xsd`, a copy of SDMXCommon.xsd's definitions
|
|
53
|
+
that `tests/unit/test_facets.py` holds to the vendored schemas. Lengths,
|
|
54
|
+
bounds and `decimals` are checked in Python; the sequence facets are not
|
|
55
|
+
checked. One checker serves one validation run.
|
|
50
56
|
- `reading_csv`, `csv_errors`, `converting`, `reads_scan`, `type_mismatch`
|
|
51
57
|
and `SCANS` (`_read_errors.py`): what reading observations raises. Data
|
|
52
58
|
that cannot be read is `SdmxParseError`; a value that does not fit its
|
|
@@ -56,9 +62,9 @@ the subpackages share.
|
|
|
56
62
|
in a drained stream, and only errors DuckDB's CSV reader raised.
|
|
57
63
|
- `first` and `count` (`_duckdb.py`): a cursor's first row with its result
|
|
58
64
|
finished, and the row count from a cursor.
|
|
59
|
-
- `
|
|
60
|
-
(`testing.py`): build a seeded synthetic
|
|
61
|
-
or take a `Shape` from an existing
|
|
65
|
+
- `synthetic_edition`, `profile_edition`, `Shape`, `Dim` and `HierarchyShape`
|
|
66
|
+
(`testing.py`): build a seeded synthetic edition that passes `check_edition`,
|
|
67
|
+
or take a `Shape` from an existing edition.
|
|
62
68
|
- `RewrittenVersion`, `VersionRewrite` and `strip_leading_zeros`
|
|
63
69
|
(`versions.py`): re-exported from `model.version_rewrite` for
|
|
64
70
|
`add_all(rewrite_version=...)`.
|
|
@@ -68,18 +74,20 @@ the subpackages share.
|
|
|
68
74
|
- [`formats/`](./formats/EGM.md): SDMX-ML 2.1/3.0/3.1, SDMX-JSON and
|
|
69
75
|
SDMX-CSV readers and writers, and the format gap table.
|
|
70
76
|
- [`storage/`](./storage/EGM.md): the DuckDB schema, writers, readers, lazy
|
|
71
|
-
facades and
|
|
72
|
-
- [`local/`](./local/EGM.md): `
|
|
73
|
-
`
|
|
77
|
+
facades and edition trimming.
|
|
78
|
+
- [`local/`](./local/EGM.md): `EditionRegistry`, `LocalRegistry`,
|
|
79
|
+
`EditionEngine` and `DuckDBDataStore` over DuckDB and DuckLake.
|
|
74
80
|
- [`query/`](./query/EGM.md): the `sl.q` path language, compiled to
|
|
75
81
|
parameterised DuckDB SQL; `ObsQuery`; and raw SQL.
|
|
76
82
|
- [`api/`](./api/EGM.md): `RestRegistry`, `FmrRegistry`,
|
|
77
83
|
`FederatedRegistry`, `Provider` and the httpx2 client.
|
|
78
|
-
- [`
|
|
79
|
-
|
|
84
|
+
- [`inventory/`](./inventory/EGM.md): the Inventory's documents, transition
|
|
85
|
+
rules and reader: which edition of each product is live.
|
|
86
|
+
- [`edition/`](./edition/EGM.md): `seal`, `check_edition`,
|
|
87
|
+
`copy_edition`, `build_edition`, `fetch_edition`, overlays and
|
|
80
88
|
fingerprints.
|
|
81
89
|
- [`builders/`](./builders/EGM.md): availability constraints and DSD
|
|
82
|
-
metadata annotations, computed from
|
|
90
|
+
metadata annotations, computed from an edition.
|
|
83
91
|
|
|
84
92
|
## Invariants
|
|
85
93
|
|
|
@@ -106,8 +114,8 @@ the subpackages share.
|
|
|
106
114
|
to be UTC already.
|
|
107
115
|
- `SqlRelation.to_sql()` returns `(sql, params)`, and values are bound as
|
|
108
116
|
parameters.
|
|
109
|
-
- `
|
|
110
|
-
seed and shape, and writes its manifest through `
|
|
117
|
+
- `synthetic_edition` gives the same artefacts and observation rows for a given
|
|
118
|
+
seed and shape, and writes its manifest through `seal`. The edition id
|
|
111
119
|
and the DuckDB file bytes differ on each build.
|
|
112
120
|
|
|
113
121
|
## Side Effects
|
|
@@ -120,7 +128,7 @@ the subpackages share.
|
|
|
120
128
|
the handle.
|
|
121
129
|
- `SingleFlight` uses `threading.Lock` and `threading.Event`. Waiters block
|
|
122
130
|
until the leader finishes.
|
|
123
|
-
- `testing.
|
|
131
|
+
- `testing.synthetic_edition` creates directories, writes observations and
|
|
124
132
|
writes a manifest.
|
|
125
133
|
- `_read_errors` converts the exceptions raised by CSV reads and by
|
|
126
134
|
`RecordBatchReader` iteration.
|
|
@@ -47,8 +47,8 @@ from sdmxlib.query._pushdown import PushdownError
|
|
|
47
47
|
from sdmxlib.sql import SqlRelation
|
|
48
48
|
from sdmxlib.formats import parse, read, serialize, to_json, to_xml
|
|
49
49
|
from sdmxlib.local import (
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
EditionEngine,
|
|
51
|
+
EditionRegistry,
|
|
52
52
|
LazyCodelist,
|
|
53
53
|
LazyHierarchy,
|
|
54
54
|
QueryPlan,
|
|
@@ -159,6 +159,7 @@ from sdmxlib.model import (
|
|
|
159
159
|
InclusionMode,
|
|
160
160
|
InMemoryRegistry,
|
|
161
161
|
InternationalString,
|
|
162
|
+
InvalidTagError,
|
|
162
163
|
ItemExpr,
|
|
163
164
|
ItemList,
|
|
164
165
|
ItemMap,
|
|
@@ -169,9 +170,13 @@ from sdmxlib.model import (
|
|
|
169
170
|
TimeRange,
|
|
170
171
|
Level,
|
|
171
172
|
Link,
|
|
173
|
+
LocalisedString,
|
|
174
|
+
MissingTagError,
|
|
172
175
|
RepresentationMapping,
|
|
173
176
|
SourceValue,
|
|
174
177
|
item,
|
|
178
|
+
normalize_tag,
|
|
179
|
+
tag_alias,
|
|
175
180
|
Maintainable,
|
|
176
181
|
MaintainableArtefact,
|
|
177
182
|
MapDataType,
|
|
@@ -251,8 +256,6 @@ __all__ = [
|
|
|
251
256
|
"AttributeUsage",
|
|
252
257
|
"AvailabilityConstraint",
|
|
253
258
|
"BearerToken",
|
|
254
|
-
"BundleEngine",
|
|
255
|
-
"BundleRegistry",
|
|
256
259
|
"CascadeSelection",
|
|
257
260
|
"Categorisation",
|
|
258
261
|
"Category",
|
|
@@ -304,6 +307,8 @@ __all__ = [
|
|
|
304
307
|
"DroppedArtefact",
|
|
305
308
|
"DuckDBDataStore",
|
|
306
309
|
"DuckLakeVersionError",
|
|
310
|
+
"EditionEngine",
|
|
311
|
+
"EditionRegistry",
|
|
307
312
|
"EnumerationLike",
|
|
308
313
|
"EpochMap",
|
|
309
314
|
"EpochPeriod",
|
|
@@ -330,6 +335,7 @@ __all__ = [
|
|
|
330
335
|
"InMemoryRegistry",
|
|
331
336
|
"InclusionMode",
|
|
332
337
|
"InternationalString",
|
|
338
|
+
"InvalidTagError",
|
|
333
339
|
"ItemExpr",
|
|
334
340
|
"ItemList",
|
|
335
341
|
"ItemMap",
|
|
@@ -340,6 +346,7 @@ __all__ = [
|
|
|
340
346
|
"Level",
|
|
341
347
|
"Link",
|
|
342
348
|
"LocalRegistry",
|
|
349
|
+
"LocalisedString",
|
|
343
350
|
"LossyReadError",
|
|
344
351
|
"Maintainable",
|
|
345
352
|
"MaintainableArtefact",
|
|
@@ -358,6 +365,7 @@ __all__ = [
|
|
|
358
365
|
"MetadataSet",
|
|
359
366
|
"MetadataStructure",
|
|
360
367
|
"Metadataflow",
|
|
368
|
+
"MissingTagError",
|
|
361
369
|
"Num",
|
|
362
370
|
"ObsQuery",
|
|
363
371
|
"ObsRow",
|
|
@@ -445,12 +453,14 @@ __all__ = [
|
|
|
445
453
|
"from_dict",
|
|
446
454
|
"item",
|
|
447
455
|
"len",
|
|
456
|
+
"normalize_tag",
|
|
448
457
|
"parse",
|
|
449
458
|
"parse_components",
|
|
450
459
|
"q",
|
|
451
460
|
"read",
|
|
452
461
|
"schema",
|
|
453
462
|
"serialize",
|
|
463
|
+
"tag_alias",
|
|
454
464
|
"to_dict",
|
|
455
465
|
"to_json",
|
|
456
466
|
"to_xml",
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- SDMX's own text-format types, as SDMXCommon.xsd (SDMX-ML 3.0 and 3.1) defines them, without its
|
|
3
|
+
documentation. sdmxlib._facets checks a value of an SDMX time type or Alpha, AlphaNumeric or Numeric
|
|
4
|
+
against these; tests/unit/test_facets.py checks each definition against the vendored schemas. -->
|
|
5
|
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
|
|
6
|
+
<xs:simpleType name="AlphaNumericType">
|
|
7
|
+
<xs:restriction base="xs:string">
|
|
8
|
+
<xs:pattern value="[A-Za-z0-9]+"/>
|
|
9
|
+
</xs:restriction>
|
|
10
|
+
</xs:simpleType>
|
|
11
|
+
<xs:simpleType name="AlphaType">
|
|
12
|
+
<xs:restriction base="AlphaNumericType">
|
|
13
|
+
<xs:pattern value="[A-Za-z]+"/>
|
|
14
|
+
</xs:restriction>
|
|
15
|
+
</xs:simpleType>
|
|
16
|
+
<xs:simpleType name="NumericType">
|
|
17
|
+
<xs:restriction base="AlphaNumericType">
|
|
18
|
+
<xs:pattern value="[0-9]+"/>
|
|
19
|
+
</xs:restriction>
|
|
20
|
+
</xs:simpleType>
|
|
21
|
+
<xs:simpleType name="ObservationalTimePeriodType">
|
|
22
|
+
<xs:union memberTypes="StandardTimePeriodType TimeRangeType"/>
|
|
23
|
+
</xs:simpleType>
|
|
24
|
+
<xs:simpleType name="StandardTimePeriodType">
|
|
25
|
+
<xs:union memberTypes="BasicTimePeriodType ReportingTimePeriodType"/>
|
|
26
|
+
</xs:simpleType>
|
|
27
|
+
<xs:simpleType name="BasicTimePeriodType">
|
|
28
|
+
<xs:union memberTypes="GregorianTimePeriodType xs:dateTime"/>
|
|
29
|
+
</xs:simpleType>
|
|
30
|
+
<xs:simpleType name="GregorianTimePeriodType">
|
|
31
|
+
<xs:union memberTypes="xs:gYear xs:gYearMonth xs:date"/>
|
|
32
|
+
</xs:simpleType>
|
|
33
|
+
<xs:simpleType name="ReportingTimePeriodType">
|
|
34
|
+
<xs:union memberTypes="ReportingYearType ReportingSemesterType ReportingTrimesterType ReportingQuarterType ReportingMonthType ReportingWeekType ReportingDayType"/>
|
|
35
|
+
</xs:simpleType>
|
|
36
|
+
<xs:simpleType name="BaseReportPeriodType">
|
|
37
|
+
<xs:restriction base="xs:string">
|
|
38
|
+
<xs:pattern value="\d{4}\-([ASTQ]\d{1}|[MW]\d{2}|[D]\d{3})(Z|((\+|\-)\d{2}:\d{2}))?"/>
|
|
39
|
+
</xs:restriction>
|
|
40
|
+
</xs:simpleType>
|
|
41
|
+
<xs:simpleType name="ReportPeriodValidTimeZoneType">
|
|
42
|
+
<xs:restriction base="BaseReportPeriodType">
|
|
43
|
+
<xs:pattern value=".+Z"/>
|
|
44
|
+
<xs:pattern value=".{5}.*(\+|\-)(14:00|((0[0-9]|1[0-3]):[0-5][0-9]))"/>
|
|
45
|
+
<xs:pattern value=".{5}[^\+\-Z]+"/>
|
|
46
|
+
</xs:restriction>
|
|
47
|
+
</xs:simpleType>
|
|
48
|
+
<xs:simpleType name="ReportingYearType">
|
|
49
|
+
<xs:restriction base="ReportPeriodValidTimeZoneType">
|
|
50
|
+
<xs:pattern value=".{5}A1.*"/>
|
|
51
|
+
</xs:restriction>
|
|
52
|
+
</xs:simpleType>
|
|
53
|
+
<xs:simpleType name="ReportingSemesterType">
|
|
54
|
+
<xs:restriction base="ReportPeriodValidTimeZoneType">
|
|
55
|
+
<xs:pattern value=".{5}S[1-2].*"/>
|
|
56
|
+
</xs:restriction>
|
|
57
|
+
</xs:simpleType>
|
|
58
|
+
<xs:simpleType name="ReportingTrimesterType">
|
|
59
|
+
<xs:restriction base="ReportPeriodValidTimeZoneType">
|
|
60
|
+
<xs:pattern value=".{5}T[1-3].*"/>
|
|
61
|
+
</xs:restriction>
|
|
62
|
+
</xs:simpleType>
|
|
63
|
+
<xs:simpleType name="ReportingQuarterType">
|
|
64
|
+
<xs:restriction base="ReportPeriodValidTimeZoneType">
|
|
65
|
+
<xs:pattern value=".{5}Q[1-4].*"/>
|
|
66
|
+
</xs:restriction>
|
|
67
|
+
</xs:simpleType>
|
|
68
|
+
<xs:simpleType name="ReportingMonthType">
|
|
69
|
+
<xs:restriction base="ReportPeriodValidTimeZoneType">
|
|
70
|
+
<xs:pattern value=".{5}M(0[1-9]|1[0-2]).*"/>
|
|
71
|
+
</xs:restriction>
|
|
72
|
+
</xs:simpleType>
|
|
73
|
+
<xs:simpleType name="ReportingWeekType">
|
|
74
|
+
<xs:restriction base="ReportPeriodValidTimeZoneType">
|
|
75
|
+
<xs:pattern value=".{5}W(0[1-9]|[1-4][0-9]|5[0-3]).*"/>
|
|
76
|
+
</xs:restriction>
|
|
77
|
+
</xs:simpleType>
|
|
78
|
+
<xs:simpleType name="ReportingDayType">
|
|
79
|
+
<xs:restriction base="ReportPeriodValidTimeZoneType">
|
|
80
|
+
<xs:pattern value=".{5}D(0[0-9][1-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-6]).*"/>
|
|
81
|
+
</xs:restriction>
|
|
82
|
+
</xs:simpleType>
|
|
83
|
+
<xs:simpleType name="BaseTimeRangeType">
|
|
84
|
+
<xs:restriction base="xs:string">
|
|
85
|
+
<xs:pattern value="\d{4}\-\d{2}\-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?)?(Z|((\+|\-)\d{2}:\d{2}))?/P.+"/>
|
|
86
|
+
</xs:restriction>
|
|
87
|
+
</xs:simpleType>
|
|
88
|
+
<xs:simpleType name="RangeValidMonthDayType">
|
|
89
|
+
<xs:restriction base="BaseTimeRangeType">
|
|
90
|
+
<xs:pattern value=".{5}02\-(0[1-9]|[1-2][0-9]).+"/>
|
|
91
|
+
<xs:pattern value=".{5}(04|06|09|11)\-(0[1-9]|[1-2][0-9]|30).+"/>
|
|
92
|
+
<xs:pattern value=".{5}(01|03|05|07|08|10|12)\-(0[1-9]|[1-2][0-9]|3[0-1]).+"/>
|
|
93
|
+
</xs:restriction>
|
|
94
|
+
</xs:simpleType>
|
|
95
|
+
<xs:simpleType name="RangeValidLeapYearType">
|
|
96
|
+
<xs:restriction base="RangeValidMonthDayType">
|
|
97
|
+
<xs:pattern value="((\d{2}(04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))|((00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)00))\-02\-29.+"/>
|
|
98
|
+
<xs:pattern value=".{5}02\-(([0-1][0-9])|(2[^9])).+"/>
|
|
99
|
+
<xs:pattern value=".{5}((0[1,3-9])|1[0-2]).+"/>
|
|
100
|
+
</xs:restriction>
|
|
101
|
+
</xs:simpleType>
|
|
102
|
+
<xs:simpleType name="RangeValidTimeType">
|
|
103
|
+
<xs:restriction base="RangeValidLeapYearType">
|
|
104
|
+
<xs:pattern value=".{10}T(24:00:00(\.[0]+)?|((([0-1][0-9])|(2[0-3])):[0-5][0-9]:[0-5][0-9](\.\d+)?))(/|Z|\+|\-).+"/>
|
|
105
|
+
<xs:pattern value="[^T]+/.+"/>
|
|
106
|
+
</xs:restriction>
|
|
107
|
+
</xs:simpleType>
|
|
108
|
+
<xs:simpleType name="RangeValidTimeZoneType">
|
|
109
|
+
<xs:restriction base="RangeValidTimeType">
|
|
110
|
+
<xs:pattern value=".+Z/.+"/>
|
|
111
|
+
<xs:pattern value=".{10}.*(\+|\-)(14:00|((0[0-9]|1[0-3]):[0-5][0-9]))/.+"/>
|
|
112
|
+
<xs:pattern value=".{10}[^\+\-Z]+"/>
|
|
113
|
+
</xs:restriction>
|
|
114
|
+
</xs:simpleType>
|
|
115
|
+
<xs:simpleType name="TimeRangeValidDateDurationType">
|
|
116
|
+
<xs:restriction base="RangeValidTimeZoneType">
|
|
117
|
+
<xs:pattern value=".+/P(\d+Y)?(\d+M)?(\d+D)?(T.+)?"/>
|
|
118
|
+
</xs:restriction>
|
|
119
|
+
</xs:simpleType>
|
|
120
|
+
<xs:simpleType name="TimeRangeType">
|
|
121
|
+
<xs:restriction base="TimeRangeValidDateDurationType">
|
|
122
|
+
<xs:pattern value=".+/P.*T(\d+H)?(\d+M)?(\d+(.\d+)?S)?"/>
|
|
123
|
+
<xs:pattern value=".+/P[^T]+"/>
|
|
124
|
+
</xs:restriction>
|
|
125
|
+
</xs:simpleType>
|
|
126
|
+
</xs:schema>
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
r"""Whether a value meets a text format: a `Facet`'s type, lengths, bounds, decimals and pattern (GH-297).
|
|
2
|
+
|
|
3
|
+
libxml2, through lxml, checks the type and the pattern as XML Schema defines
|
|
4
|
+
them. The type is the XSD type the information model maps a `DataType` to
|
|
5
|
+
(IM §3.6.3.3), or one of SDMX's own text types, which ``_facet_types.xsd``
|
|
6
|
+
holds as SDMXCommon.xsd defines them. A pattern is read in the XSD regex
|
|
7
|
+
dialect it is written in: anchored, with class subtraction and the ``\i`` and
|
|
8
|
+
``\c`` escapes. Python checks the rest: the lengths count characters, the
|
|
9
|
+
bounds compare numbers, inclusive unless the type is `ExclusiveValueRange`,
|
|
10
|
+
and ``decimals`` counts the digits after the decimal separator.
|
|
11
|
+
|
|
12
|
+
The sequence facets (`is_sequence`, `interval`, `start_value`, `end_value`,
|
|
13
|
+
`time_interval`, `start_time`, `end_time`) describe how a series of values
|
|
14
|
+
is generated and are not checked. A value equal to one of the facet's
|
|
15
|
+
sentinel values is checked against the type alone: a sentinel has its special
|
|
16
|
+
meaning "within their data type" (IM §5.3.2.2).
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import re
|
|
20
|
+
from decimal import Decimal, InvalidOperation
|
|
21
|
+
from importlib import resources
|
|
22
|
+
|
|
23
|
+
from lxml import etree
|
|
24
|
+
|
|
25
|
+
from sdmxlib.model.representation import Facet
|
|
26
|
+
|
|
27
|
+
_XS = "http://www.w3.org/2001/XMLSchema"
|
|
28
|
+
|
|
29
|
+
#: The XSD type of each SDMX text type, by the type's name (IM §3.6.3.3, and
|
|
30
|
+
#: SDMXCommon.xsd for SDMX's own). A type missing here, such as XHTML or
|
|
31
|
+
#: KeyValues, is checked as ``xs:string``.
|
|
32
|
+
_XSD_TYPES: dict[str, str] = {
|
|
33
|
+
"String": "xs:string",
|
|
34
|
+
"Alpha": "AlphaType",
|
|
35
|
+
"AlphaNumeric": "AlphaNumericType",
|
|
36
|
+
"Numeric": "NumericType",
|
|
37
|
+
"BigInteger": "xs:integer",
|
|
38
|
+
"Integer": "xs:int",
|
|
39
|
+
"Long": "xs:long",
|
|
40
|
+
"Short": "xs:short",
|
|
41
|
+
"Decimal": "xs:decimal",
|
|
42
|
+
"Float": "xs:float",
|
|
43
|
+
"Double": "xs:double",
|
|
44
|
+
"Boolean": "xs:boolean",
|
|
45
|
+
"URI": "xs:anyURI",
|
|
46
|
+
"Count": "xs:integer",
|
|
47
|
+
"InclusiveValueRange": "xs:decimal",
|
|
48
|
+
"ExclusiveValueRange": "xs:decimal",
|
|
49
|
+
"Incremental": "xs:decimal",
|
|
50
|
+
"ObservationalTimePeriod": "ObservationalTimePeriodType",
|
|
51
|
+
"StandardTimePeriod": "StandardTimePeriodType",
|
|
52
|
+
"BasicTimePeriod": "BasicTimePeriodType",
|
|
53
|
+
"GregorianTimePeriod": "GregorianTimePeriodType",
|
|
54
|
+
"GregorianYear": "xs:gYear",
|
|
55
|
+
"GregorianYearMonth": "xs:gYearMonth",
|
|
56
|
+
"GregorianDay": "xs:date",
|
|
57
|
+
"ReportingTimePeriod": "ReportingTimePeriodType",
|
|
58
|
+
"ReportingYear": "ReportingYearType",
|
|
59
|
+
"ReportingSemester": "ReportingSemesterType",
|
|
60
|
+
"ReportingTrimester": "ReportingTrimesterType",
|
|
61
|
+
"ReportingQuarter": "ReportingQuarterType",
|
|
62
|
+
"ReportingMonth": "ReportingMonthType",
|
|
63
|
+
"ReportingWeek": "ReportingWeekType",
|
|
64
|
+
"ReportingDay": "ReportingDayType",
|
|
65
|
+
"DateTime": "xs:dateTime",
|
|
66
|
+
"TimeRange": "TimeRangeType",
|
|
67
|
+
"Month": "xs:gMonth",
|
|
68
|
+
"MonthDay": "xs:gMonthDay",
|
|
69
|
+
"Day": "xs:gDay",
|
|
70
|
+
"Time": "xs:time",
|
|
71
|
+
"Duration": "xs:duration",
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#: The types a value is a number of, so `min_value`, `max_value` and `decimals` apply.
|
|
75
|
+
_NUMERIC = frozenset(
|
|
76
|
+
{
|
|
77
|
+
"Numeric",
|
|
78
|
+
"BigInteger",
|
|
79
|
+
"Integer",
|
|
80
|
+
"Long",
|
|
81
|
+
"Short",
|
|
82
|
+
"Decimal",
|
|
83
|
+
"Float",
|
|
84
|
+
"Double",
|
|
85
|
+
"Count",
|
|
86
|
+
"InclusiveValueRange",
|
|
87
|
+
"ExclusiveValueRange",
|
|
88
|
+
"Incremental",
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
#: A number's digits after the decimal separator, before any exponent.
|
|
93
|
+
_FRACTION = re.compile(r"\s*[+-]?\d*(?:\.(\d*))?(?:[eE][+-]?\d+)?\s*")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _type_name(facet: Facet) -> str:
|
|
97
|
+
return "String" if facet.type is None else str(facet.type)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class FacetChecker:
|
|
101
|
+
"""Checks values against facets, compiling each type and pattern once per checker.
|
|
102
|
+
|
|
103
|
+
One checker serves one validation run; it holds the compiled schemas and
|
|
104
|
+
nothing else, so it is dropped with the run.
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
def __init__(self) -> None:
|
|
108
|
+
"""A checker with nothing compiled."""
|
|
109
|
+
self._types = etree.fromstring(resources.files("sdmxlib").joinpath("_facet_types.xsd").read_bytes())
|
|
110
|
+
self._compiled: dict[tuple[str, str | None], etree.XMLSchema | str] = {}
|
|
111
|
+
|
|
112
|
+
def _schema(self, base: str, pattern: str | None) -> etree.XMLSchema | str:
|
|
113
|
+
"""The schema of one element of `base` restricted by `pattern`, or why `pattern` does not compile."""
|
|
114
|
+
key = (base, pattern)
|
|
115
|
+
found = self._compiled.get(key)
|
|
116
|
+
if found is None:
|
|
117
|
+
document = etree.fromstring(etree.tostring(self._types))
|
|
118
|
+
element = etree.SubElement(document, f"{{{_XS}}}element", name="v")
|
|
119
|
+
simple = etree.SubElement(element, f"{{{_XS}}}simpleType")
|
|
120
|
+
restriction = etree.SubElement(simple, f"{{{_XS}}}restriction", base=base)
|
|
121
|
+
if pattern is not None:
|
|
122
|
+
etree.SubElement(restriction, f"{{{_XS}}}pattern", value=pattern)
|
|
123
|
+
try:
|
|
124
|
+
found = etree.XMLSchema(document)
|
|
125
|
+
except etree.XMLSchemaParseError as exc:
|
|
126
|
+
found = f"its pattern {pattern!r} is not an XML Schema regular expression ({exc})"
|
|
127
|
+
self._compiled[key] = found
|
|
128
|
+
return found
|
|
129
|
+
|
|
130
|
+
def _meets(self, base: str, pattern: str | None, value: str) -> bool | str:
|
|
131
|
+
"""Whether `value` is a `base` matching `pattern`; why not, when the pattern does not compile."""
|
|
132
|
+
schema = self._schema(base, pattern)
|
|
133
|
+
if isinstance(schema, str):
|
|
134
|
+
return schema
|
|
135
|
+
element = etree.Element("v")
|
|
136
|
+
try:
|
|
137
|
+
element.text = value
|
|
138
|
+
except ValueError:
|
|
139
|
+
return False
|
|
140
|
+
return schema.validate(etree.ElementTree(element))
|
|
141
|
+
|
|
142
|
+
def type_breaks(self, facet: Facet, value: str) -> str | None:
|
|
143
|
+
"""Why `value` is not a value of `facet`'s type, or None when it is."""
|
|
144
|
+
name = _type_name(facet)
|
|
145
|
+
met = self._meets(_XSD_TYPES.get(name, "xs:string"), None, value)
|
|
146
|
+
return None if met is True else f"is not of type {name}"
|
|
147
|
+
|
|
148
|
+
def breaks(self, facet: Facet, value: str) -> str | None:
|
|
149
|
+
"""Why `value` does not meet `facet`, or None when it does.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
facet: The text format.
|
|
153
|
+
value: The value as written.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
The first facet `value` breaks, as a clause: ``is not of type ReportingQuarter``.
|
|
157
|
+
"""
|
|
158
|
+
broken = self.type_breaks(facet, value)
|
|
159
|
+
if broken is not None or value in {sentinel.value for sentinel in facet.sentinel_values}:
|
|
160
|
+
return broken
|
|
161
|
+
if facet.min_length is not None and len(value) < facet.min_length:
|
|
162
|
+
return f"is {len(value)} characters long, shorter than minLength {facet.min_length}"
|
|
163
|
+
if facet.max_length is not None and len(value) > facet.max_length:
|
|
164
|
+
return f"is {len(value)} characters long, longer than maxLength {facet.max_length}"
|
|
165
|
+
name = _type_name(facet)
|
|
166
|
+
if name in _NUMERIC:
|
|
167
|
+
broken = _bounds_broken(facet, value, exclusive=name == "ExclusiveValueRange")
|
|
168
|
+
if broken is not None:
|
|
169
|
+
return broken
|
|
170
|
+
if facet.pattern is not None:
|
|
171
|
+
met = self._meets(_XSD_TYPES.get(name, "xs:string"), facet.pattern, value)
|
|
172
|
+
if met is not True:
|
|
173
|
+
return met if isinstance(met, str) else f"does not match the pattern {facet.pattern!r}"
|
|
174
|
+
return None
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _bounds_broken(facet: Facet, value: str, *, exclusive: bool) -> str | None:
|
|
178
|
+
"""The numeric facets `value`, a number of the facet's type, breaks: its bounds and ``decimals``."""
|
|
179
|
+
try:
|
|
180
|
+
number = Decimal(value.strip())
|
|
181
|
+
except InvalidOperation:
|
|
182
|
+
return None
|
|
183
|
+
if number.is_nan() and (facet.min_value is not None or facet.max_value is not None):
|
|
184
|
+
return "is NaN, which no bound holds"
|
|
185
|
+
if facet.min_value is not None:
|
|
186
|
+
low = Decimal(repr(facet.min_value))
|
|
187
|
+
if number < low or (exclusive and number == low):
|
|
188
|
+
return f"is below minValue {facet.min_value}" if number < low else f"equals the exclusive minValue {low}"
|
|
189
|
+
if facet.max_value is not None:
|
|
190
|
+
high = Decimal(repr(facet.max_value))
|
|
191
|
+
if number > high or (exclusive and number == high):
|
|
192
|
+
return f"is above maxValue {facet.max_value}" if number > high else f"equals the exclusive maxValue {high}"
|
|
193
|
+
if facet.decimals is not None:
|
|
194
|
+
fraction = _FRACTION.fullmatch(value)
|
|
195
|
+
digits = len(fraction.group(1) or "") if fraction is not None else 0
|
|
196
|
+
if digits > facet.decimals:
|
|
197
|
+
return f"has {digits} digits after the decimal separator, more than decimals {facet.decimals}"
|
|
198
|
+
return None
|
|
@@ -28,6 +28,7 @@ from sdmxlib.model.datastructure import DataStructure
|
|
|
28
28
|
from sdmxlib.model.errors import Refusal
|
|
29
29
|
from sdmxlib.model.in_memory_registry import InMemoryRegistry
|
|
30
30
|
from sdmxlib.model.message import StructureMessage
|
|
31
|
+
from sdmxlib.model.provision import ProvisionAgreement
|
|
31
32
|
from sdmxlib.model.ref import Ref, SupportsUrn, artefact_urn, target_urn
|
|
32
33
|
from sdmxlib.model.urn import SdmxUrn
|
|
33
34
|
from sdmxlib.model.validation import SdmxConformanceError
|
|
@@ -1181,8 +1182,9 @@ class RestRegistry:
|
|
|
1181
1182
|
def scan_csv(self, source: str | Path | bytes) -> ObsQuery:
|
|
1182
1183
|
"""An SDMX-CSV file's observations, as a query — the structure fetched from this registry.
|
|
1183
1184
|
|
|
1184
|
-
Reads the file's ``
|
|
1185
|
-
|
|
1185
|
+
Reads the file's ``STRUCTURE`` / ``STRUCTURE_ID`` columns, or 1.0's
|
|
1186
|
+
``DATAFLOW``, to name the dataflow or the provision agreement for it,
|
|
1187
|
+
fetches it with its structure, and reads the file with it:
|
|
1186
1188
|
the same `ObsQuery` `obs(flow)` returns, over the file's rows
|
|
1187
1189
|
instead of a fetch. A path is read in place on every query, and once
|
|
1188
1190
|
as it is scanned, to refuse a delete row; bytes are loaded once. See
|
|
@@ -1192,11 +1194,13 @@ class RestRegistry:
|
|
|
1192
1194
|
source: File path or raw SDMX-CSV bytes.
|
|
1193
1195
|
|
|
1194
1196
|
Raises:
|
|
1195
|
-
ValueError: If the
|
|
1197
|
+
ValueError: If the file names no structure, names it unparseably,
|
|
1198
|
+
or names a data structure rather than a dataflow or provision
|
|
1199
|
+
agreement.
|
|
1196
1200
|
SdmxParseError: If the data is not readable SDMX-CSV, lacks a
|
|
1197
|
-
column the structure declares,
|
|
1198
|
-
|
|
1199
|
-
|
|
1201
|
+
column the structure declares, names more than one structure,
|
|
1202
|
+
or holds a ``D`` (delete) row or an action SDMX-CSV does not
|
|
1203
|
+
define in its ``ACTION`` column.
|
|
1200
1204
|
ValueError: If a value does not fit its component's type, when the
|
|
1201
1205
|
file is read; for a path, when a query reads the value.
|
|
1202
1206
|
|
|
@@ -1206,27 +1210,40 @@ class RestRegistry:
|
|
|
1206
1210
|
obs.frame(labels="en")
|
|
1207
1211
|
"""
|
|
1208
1212
|
from sdmxlib.formats.sdmx_csv.reader import ( # noqa: PLC0415 # lazy: defer CSV import
|
|
1209
|
-
|
|
1213
|
+
STRUCTURE_KINDS,
|
|
1214
|
+
_peek_structure,
|
|
1210
1215
|
parse_dataflow_id,
|
|
1211
1216
|
)
|
|
1212
1217
|
|
|
1213
|
-
|
|
1214
|
-
if
|
|
1218
|
+
kind, identifier = _peek_structure(source)
|
|
1219
|
+
if identifier is None:
|
|
1215
1220
|
msg = (
|
|
1216
|
-
"
|
|
1217
|
-
"
|
|
1221
|
+
"this file names no structure: no STRUCTURE_ID column (SDMX-CSV 2.0) and no DATAFLOW column "
|
|
1222
|
+
"(1.0), so there is nothing to fetch"
|
|
1223
|
+
)
|
|
1224
|
+
raise ValueError(msg)
|
|
1225
|
+
if kind is not None and kind not in STRUCTURE_KINDS:
|
|
1226
|
+
msg = f"unknown STRUCTURE value {kind!r} — SDMX-CSV allows {', '.join(STRUCTURE_KINDS)}"
|
|
1227
|
+
raise ValueError(msg)
|
|
1228
|
+
if kind == "datastructure":
|
|
1229
|
+
msg = (
|
|
1230
|
+
f"this file names the data structure {identifier}, not a dataflow — an observation query is "
|
|
1231
|
+
"over a dataflow, and a structure alone does not say which. Name the dataflow in the file "
|
|
1232
|
+
"(STRUCTURE=dataflow), or a provision agreement for it."
|
|
1218
1233
|
)
|
|
1219
1234
|
raise ValueError(msg)
|
|
1220
1235
|
|
|
1221
|
-
agency, id_, version = parse_dataflow_id(
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1236
|
+
agency, id_, version = parse_dataflow_id(identifier)
|
|
1237
|
+
if kind == "dataprovision":
|
|
1238
|
+
agreement = self._fetch_one(
|
|
1239
|
+
ProvisionAgreement, agency, id_, version, detail="referencepartial", references="descendants"
|
|
1240
|
+
)
|
|
1241
|
+
if agreement.dataflow is None:
|
|
1242
|
+
msg = f"provision agreement {identifier} has no dataflow, so its structure cannot be reached"
|
|
1243
|
+
raise ValueError(msg)
|
|
1244
|
+
flow = agreement.dataflow()
|
|
1245
|
+
else:
|
|
1246
|
+
flow = self._fetch_one(Dataflow, agency, id_, version, detail="referencepartial", references="descendants")
|
|
1230
1247
|
|
|
1231
1248
|
if flow.structure is None:
|
|
1232
1249
|
msg = f"Dataflow {flow.id!r} has no structure reference"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
5
|
`sdmxlib.builders` holds pure, synchronous functions that build SDMX artefacts
|
|
6
|
-
from a registry (a published `
|
|
6
|
+
from a registry (a published `EditionRegistry` or a `LocalRegistry`) and a
|
|
7
7
|
DuckDB connection. A producer can build an artefact ahead of time and store
|
|
8
8
|
it, and a consumer can compute the same artefact live with byte-identical
|
|
9
9
|
output.
|
|
@@ -46,7 +46,7 @@ output.
|
|
|
46
46
|
`DataflowBinding`. The column is quoted with `_quote_identifier`; the table
|
|
47
47
|
name `<database_role>.<table_location>` is interpolated from the binding
|
|
48
48
|
unquoted.
|
|
49
|
-
- `build_component_availability` over a published `
|
|
49
|
+
- `build_component_availability` over a published `EditionRegistry` reads its
|
|
50
50
|
stored availability: it drops a key constraint that covers every held value
|
|
51
51
|
of its dimension, and takes an unconstrained dimension's held values without
|
|
52
52
|
a scan. Over a `LocalRegistry` it always scans.
|