sdmxlib 0.90.0__tar.gz → 0.91.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.
Files changed (240) hide show
  1. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/PKG-INFO +1 -1
  2. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/pyproject.toml +1 -1
  3. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/pyproject.toml.orig +1 -1
  4. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/migration/EGM.md +47 -20
  5. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/migration/__init__.py +8 -2
  6. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/migration/_agencies.py +88 -1
  7. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/migration/_fmr.py +60 -0
  8. sdmxlib-0.91.0/src/sdmxlib/migration/_hierarchies.py +152 -0
  9. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/migration/_plan.py +87 -10
  10. sdmxlib-0.91.0/src/sdmxlib/migration/_structure.py +378 -0
  11. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/migration/_types.py +90 -40
  12. sdmxlib-0.90.0/src/sdmxlib/migration/_structure.py +0 -176
  13. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/LICENSE +0 -0
  14. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/README.md +0 -0
  15. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/EGM.md +0 -0
  16. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/__init__.py +0 -0
  17. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/_duckdb.py +0 -0
  18. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/_facet_types.xsd +0 -0
  19. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/_facets.py +0 -0
  20. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/_read_errors.py +0 -0
  21. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/_singleflight.py +0 -0
  22. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/_time.py +0 -0
  23. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/EGM.md +0 -0
  24. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/__init__.py +0 -0
  25. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/_freshness.py +0 -0
  26. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/client.py +0 -0
  27. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/federated.py +0 -0
  28. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/policy.py +0 -0
  29. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/providers.py +0 -0
  30. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/registry.py +0 -0
  31. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/resources.py +0 -0
  32. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/session.py +0 -0
  33. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/structure_download.py +0 -0
  34. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/api/submit.py +0 -0
  35. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/builders/EGM.md +0 -0
  36. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/builders/__init__.py +0 -0
  37. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/builders/contentconstraint.py +0 -0
  38. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/builders/metadata_annotation.py +0 -0
  39. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/data_store.py +0 -0
  40. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/EGM.md +0 -0
  41. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/__init__.py +0 -0
  42. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_availability.py +0 -0
  43. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_build.py +0 -0
  44. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_canonical.py +0 -0
  45. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_check.py +0 -0
  46. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_copy.py +0 -0
  47. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_fetch.py +0 -0
  48. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_finding.py +0 -0
  49. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_fingerprint.py +0 -0
  50. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_overlay.py +0 -0
  51. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_remote.py +0 -0
  52. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/_write.py +0 -0
  53. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/manifest.schema.json +0 -0
  54. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/edition/overlay.schema.json +0 -0
  55. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/EGM.md +0 -0
  56. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/__init__.py +0 -0
  57. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/_arrow.py +0 -0
  58. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/_attachment.py +0 -0
  59. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/_coerce.py +0 -0
  60. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/_index.py +0 -0
  61. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/_positions.py +0 -0
  62. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/_refuse.py +0 -0
  63. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/_tags.py +0 -0
  64. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/data_format.py +0 -0
  65. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/gaps.py +0 -0
  66. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/render.py +0 -0
  67. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_csv/EGM.md +0 -0
  68. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
  69. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -0
  70. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_csv/writer.py +0 -0
  71. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/EGM.md +0 -0
  72. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
  73. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/_data_common.py +0 -0
  74. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/_dto.py +0 -0
  75. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/_header.py +0 -0
  76. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
  77. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/_periods.py +0 -0
  78. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
  79. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +0 -0
  80. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +0 -0
  81. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
  82. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/data_v1.py +0 -0
  83. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/data_v2.py +0 -0
  84. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/metadata.py +0 -0
  85. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/reader.py +0 -0
  86. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
  87. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json/writer.py +0 -0
  88. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json_1_0/EGM.md +0 -0
  89. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
  90. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +0 -0
  91. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml/EGM.md +0 -0
  92. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
  93. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
  94. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
  95. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml/_common.py +0 -0
  96. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml/_header.py +0 -0
  97. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
  98. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
  99. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +0 -0
  100. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml21/EGM.md +0 -0
  101. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
  102. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
  103. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
  104. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
  105. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
  106. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml21/writer.py +0 -0
  107. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml30/EGM.md +0 -0
  108. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
  109. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml30/metadata.py +0 -0
  110. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
  111. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
  112. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
  113. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml31/EGM.md +0 -0
  114. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
  115. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
  116. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
  117. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
  118. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/formats/structure_format.py +0 -0
  119. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/EGM.md +0 -0
  120. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/__init__.py +0 -0
  121. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/_format.py +0 -0
  122. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/_reader.py +0 -0
  123. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/_routing.py +0 -0
  124. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/_rules.py +0 -0
  125. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/conformance.py +0 -0
  126. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/schemas/catalog-2.0.schema.json +0 -0
  127. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/schemas/catalog.schema.json +0 -0
  128. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/schemas/current.schema.json +0 -0
  129. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/schemas/history.schema.json +0 -0
  130. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/schemas/leaf.schema.json +0 -0
  131. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/schemas/root-1.2.schema.json +0 -0
  132. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/schemas/root.schema.json +0 -0
  133. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/schemas/segment-header.schema.json +0 -0
  134. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/inventory/schemas/segment-line.schema.json +0 -0
  135. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/local/EGM.md +0 -0
  136. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/local/__init__.py +0 -0
  137. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/local/_scan.py +0 -0
  138. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/local/data_store.py +0 -0
  139. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/local/engine.py +0 -0
  140. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/local/object_store.py +0 -0
  141. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/local/registry.py +0 -0
  142. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/local/sql.py +0 -0
  143. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/migration/_conflicts.py +0 -0
  144. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/migration/_fmr_refusals.py +0 -0
  145. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/migration/_versions.py +0 -0
  146. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/EGM.md +0 -0
  147. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/__init__.py +0 -0
  148. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_binding.py +0 -0
  149. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_container.py +0 -0
  150. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_invariants.py +0 -0
  151. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_items.py +0 -0
  152. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_label_match.py +0 -0
  153. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_rebind.py +0 -0
  154. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_referenceable.py +0 -0
  155. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_refshape.py +0 -0
  156. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_resolvers.py +0 -0
  157. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_rules.py +0 -0
  158. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/_tree.py +0 -0
  159. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/annotations.py +0 -0
  160. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/base.py +0 -0
  161. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/binding.py +0 -0
  162. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/category.py +0 -0
  163. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/codelist.py +0 -0
  164. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/collections.py +0 -0
  165. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/concept.py +0 -0
  166. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/constraint.py +0 -0
  167. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/convert.py +0 -0
  168. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/dataflow.py +0 -0
  169. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/datastructure.py +0 -0
  170. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/diff.py +0 -0
  171. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/errors.py +0 -0
  172. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/expr.py +0 -0
  173. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/header.py +0 -0
  174. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/hierarchy.py +0 -0
  175. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/in_memory_registry.py +0 -0
  176. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/istring.py +0 -0
  177. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/link.py +0 -0
  178. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/mapping.py +0 -0
  179. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/message.py +0 -0
  180. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/metadata_provision.py +0 -0
  181. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/metadataflow.py +0 -0
  182. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/metadataset.py +0 -0
  183. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/metadatastructure.py +0 -0
  184. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/organisation.py +0 -0
  185. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/period.py +0 -0
  186. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/provision.py +0 -0
  187. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/ref.py +0 -0
  188. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/registry.py +0 -0
  189. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/representation.py +0 -0
  190. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/rest_api.py +0 -0
  191. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/rewrite.py +0 -0
  192. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/rollup.py +0 -0
  193. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/urn.py +0 -0
  194. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/validation.py +0 -0
  195. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/valuelist.py +0 -0
  196. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/model/version.py +0 -0
  197. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/polars.py +0 -0
  198. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/py.typed +0 -0
  199. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/EGM.md +0 -0
  200. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/__init__.py +0 -0
  201. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_closure.py +0 -0
  202. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_common.py +0 -0
  203. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_compile.py +0 -0
  204. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_edges.py +0 -0
  205. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_execute.py +0 -0
  206. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_expr.py +0 -0
  207. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_joins.py +0 -0
  208. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_plan.py +0 -0
  209. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_pushdown.py +0 -0
  210. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_rebase.py +0 -0
  211. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/_rest.py +0 -0
  212. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/accessors.py +0 -0
  213. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/observations.py +0 -0
  214. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/query.py +0 -0
  215. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/raw.py +0 -0
  216. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/query/schema.py +0 -0
  217. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/rest.py +0 -0
  218. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/session.py +0 -0
  219. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/sql.py +0 -0
  220. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/EGM.md +0 -0
  221. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/__init__.py +0 -0
  222. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_checked.py +0 -0
  223. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_columns.py +0 -0
  224. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_files.py +0 -0
  225. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_kinds.py +0 -0
  226. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_layout.py +0 -0
  227. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_manifest.py +0 -0
  228. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_parsed.py +0 -0
  229. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_projections.py +0 -0
  230. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_references.py +0 -0
  231. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_synthetic.py +0 -0
  232. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_tags.py +0 -0
  233. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/_trim.py +0 -0
  234. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/lazy.py +0 -0
  235. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/readers.py +0 -0
  236. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/resolve.py +0 -0
  237. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/schema.py +0 -0
  238. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/storage/writers.py +0 -0
  239. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/testing.py +0 -0
  240. {sdmxlib-0.90.0 → sdmxlib-0.91.0}/src/sdmxlib/versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdmxlib
3
- Version: 0.90.0
3
+ Version: 0.91.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.90.0"
3
+ version = "0.91.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"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sdmxlib"
3
- version = "0.90.0"
3
+ version = "0.91.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"
@@ -5,9 +5,10 @@
5
5
  `sdmxlib.migration` moves a `StructureMessage` read from an SDMX 2.1 registry
6
6
  to SDMX 3.x (GH-399). `plan` finds what the move takes and changes nothing.
7
7
  `Plan.apply` makes the changes and the options a person chose, and returns
8
- the migrated message. The rules are the version rules (`_versions.py`) and
9
- the structure rules (`_structure.py`), which read what the target format
10
- cannot carry from `formats.gaps`, and, for an FMR target, the FMR rules
8
+ the migrated message. The rules are the version rules (`_versions.py`), the
9
+ structure rules (`_structure.py`), which read what the target format
10
+ cannot carry from `formats.gaps`, the hierarchy rule (`_hierarchies.py`),
11
+ and, for an FMR target, the FMR rules
11
12
  (`_fmr.py`), which state what FMR 12.5.0 was recorded doing beyond the XSD.
12
13
 
13
14
  ## Interface
@@ -22,11 +23,20 @@ cannot carry from `formats.gaps`, and, for an FMR target, the FMR rules
22
23
  answered. `Plan.apply(answers=None, *, partial=False)` returns the migrated
23
24
  message; `answers` maps a question key to an option id and overrides the
24
25
  policy.
25
- - `Target(version, allow=frozenset(), registry=None)` (`_types.py`):
26
- `version` is `"3.0"`, `"3.1"` or `"json"`; `allow` holds the `Deviation`s
27
- the result may carry; `registry` names the registry whose rules the plan
28
- adds. `Target.fmr(release)` is SDMX-ML 3.0 with `non-ncname-parent` and
29
- FMR's rules, for a release in `FMR_RELEASES` (`"12.5.0"`).
26
+ - `Target(version, allow=frozenset(), registry=None, rules=())`
27
+ (`_types.py`): `version` is `"3.0"`, `"3.1"` or `"json"`; `allow` holds
28
+ the `Deviation`s the result may carry; `registry` names the registry whose
29
+ rules the plan adds; `rules` are the caller's own, run after the built-in
30
+ ones. `Target.fmr(release, *, rules=())` is SDMX-ML 3.0 with
31
+ `non-ncname-parent` and FMR's rules, for a release in `FMR_RELEASES`
32
+ (`"12.5.0"`).
33
+ - `Rule(find, questions={})` (`_types.py`): a caller's rule. `find(msg)`
34
+ yields findings; `questions` maps each rule id its questions carry to the
35
+ option ids they take.
36
+ - `omit_agencies(*agencies)` (`_agencies.py`): a `Rule` whose
37
+ `agency.omitted` changes leave out what the agencies maintain and,
38
+ repeatedly, what references an artefact left out; a late-bound reference
39
+ names every version it may resolve to.
30
40
  - `Change`, `Question`, `Option` and `Blocked` (`_types.py`): the findings.
31
41
  A `Question.key` is `"<rule>@<urn>"`.
32
42
  - `Move`, `SetField`, `Omit` and their union `Edit` (`_types.py`): what a
@@ -38,11 +48,19 @@ cannot carry from `formats.gaps`, and, for an FMR target, the FMR rules
38
48
  states each.
39
49
  - The structure rules (`_structure.py`): `format.dropped`,
40
50
  `format.converted`, `metadataflow.targets`, `msd.target-layer` (changes);
41
- `format.loss` (question); `metadataflow.targets` when no target can be
42
- derived, and `structure.measure-dimension` (blocked).
43
- - The FMR rules (`_fmr.py`), for an FMR target: `fmr.actual-constraint` and
44
- `fmr.next-major` (questions; the next major blocked when the message holds
45
- it), `fmr.related-dimensions` and `fmr.monolingual` (changes, no edit).
51
+ `format.loss` and `structure.measure-dimension` (questions; the latter's
52
+ options `dimension` and `measures` carry the remodelled DSD, codelist and
53
+ constraints as `Add` edits); `metadataflow.targets` when no target can be
54
+ derived, and `structure.measure-dimension` when its concept scheme is not
55
+ in the message or the codelist id is taken (blocked).
56
+ - The hierarchy rule (`_hierarchies.py`): `hierarchy.association` adds a
57
+ `HierarchyAssociation` for each hierarchy an HCL carried, to the one
58
+ dimension its codelist enumerates (change), or to each of several
59
+ (question); unbound when there is none (change, no edit).
60
+ - The FMR rules (`_fmr.py`), for an FMR target: `fmr.actual-constraint`,
61
+ `fmr.next-major` and `fmr.id-case` (questions; the next major blocked when
62
+ the message holds it), `fmr.id-case-clash` (blocked),
63
+ `fmr.related-dimensions` and `fmr.monolingual` (changes, no edit).
46
64
  - The FMR refusals (`_fmr_refusals.py`), for an FMR target: one question per
47
65
  artefact and SDMX-ML 3.0 construct FMR 12.5.0 refuses (concept roles,
48
66
  sentinel values, links in components, partial codelists, empty
@@ -50,8 +68,9 @@ cannot carry from `formats.gaps`, and, for an FMR target, the FMR rules
50
68
  artefact survives), `omit` or `keep`. A construct is found and stripped by
51
69
  the XPath the FMR oracle's ledger recorded its refusal under.
52
70
  - `Transform(urn, name)` (`_types.py`): an edit that rebuilds an artefact with
53
- a rule's transform (`_plan.TRANSFORMS`). `Add(artefact)`: an edit that puts
54
- an artefact in the result, replacing one with its URN.
71
+ a rule's transform (`_plan.TRANSFORMS`). `Add(artefact, versioned_as=None)`: an
72
+ edit that puts an artefact in the result, replacing one with its URN; with
73
+ `versioned_as`, its version moves as that artefact's does.
55
74
  - The agency rule (`_agencies.py`): `agency.scheme` (change) adds or extends
56
75
  the agency scheme a sub-agency maintainer (`CA1.QOL`) needs, named from
57
76
  `plan(..., agency_names=)`; `agency.unnamed` (blocked) when a name is
@@ -70,15 +89,19 @@ cannot carry from `formats.gaps`, and, for an FMR target, the FMR rules
70
89
  - A question key is the rule id and the artefact's URN, so the same message
71
90
  planned twice asks the same keys, and an answer recorded once applies again.
72
91
  - `apply` makes its edits in one order: omit, add, set fields, run transforms, then move
73
- identities with `sl.rewrite`. A chosen option's move overrides a change's
74
- for the same artefact, so `fmr.next-major`'s `2.0.0` wins over the version
75
- rule's `1.1.0`. Through `sl.rewrite`, every reference, item reference and
92
+ identities with `sl.rewrite`. An `Add` of an artefact an `Omit` leaves out
93
+ is not made. Moves of one artefact compose part by part, so
94
+ `fmr.id-case`'s rename and the version rule's `1.0.0` make one move;
95
+ where two change the same part, a chosen option's overrides a change's,
96
+ so `fmr.next-major`'s `2.0.0` wins over the version rule's `1.1.0`. Through `sl.rewrite`, every reference, item reference and
76
97
  `Link.urn` follows a move. It ends with `check_serialisable` for
77
98
  `target.version` and `target.allow`.
78
99
  - `apply` refuses an answer to a question the plan does not hold, an option a
79
100
  question does not take, and an open question unless `partial=True`; `plan`
80
- refuses a policy for a rule no rule asks (`QUESTIONS`), and an option the
81
- rule does not take. A rule that asks nothing of one message is not refused,
101
+ refuses a policy for a rule no rule asks (`QUESTIONS` and the caller's
102
+ rules' `questions`), and an option the rule does not take. It refuses a
103
+ caller's rule that claims a built-in rule id, or asks a question it did
104
+ not declare with the options it declared. A rule that asks nothing of one message is not refused,
82
105
  so one policy serves a whole registry.
83
106
  - A finding about an artefact a `Change` leaves out is dropped from the plan:
84
107
  a `StructureSet` asks no version question.
@@ -105,6 +128,10 @@ cannot carry from `formats.gaps`, and, for an FMR target, the FMR rules
105
128
  - `tests/integration/test_fmr_target.py`: the FMR rules' predictions held
106
129
  against FMR 12.5.0's recorded answers to the same messages
107
130
  (`tests/integration/fmr/12.5.0/registry-rules/`).
131
+ - `tests/unit/test_migration_rules.py`, `test_migration_hierarchies.py` and
132
+ `test_migration_measure_dimension.py`: caller rules and `omit_agencies`,
133
+ the hierarchy associations, and both MeasureDimension remodels written
134
+ and XSD-valid.
108
135
  - `tests/unit/test_migration_versions.py` and
109
136
  `tests/unit/test_migration_structure.py`: the plan of `sdmx_ml21` fixtures,
110
137
  apply's refusals, and for each rule module one message that fires every
@@ -13,11 +13,14 @@ result is writable in the target format.
13
13
  migrated = plan.apply({"version.external@urn:...": "final"})
14
14
 
15
15
  The rules are listed in `migration._versions` (versions),
16
- `migration._structure` (what the target format cannot carry) and
16
+ `migration._structure` (what the target format cannot carry),
17
+ `migration._hierarchies` (the associations a 2.1 hierarchy needs) and
17
18
  `migration._fmr` and `migration._fmr_refusals` (what FMR does beyond the XSD,
18
- and the 3.0 constructs it refuses, for `Target.fmr("12.5.0")`).
19
+ and the 3.0 constructs it refuses, for `Target.fmr("12.5.0")`). A caller adds
20
+ rules of their own with `Target(rules=...)`, such as `omit_agencies`.
19
21
  """
20
22
 
23
+ from sdmxlib.migration._agencies import omit_agencies
21
24
  from sdmxlib.migration._conflicts import Conflict, conflicts
22
25
  from sdmxlib.migration._plan import Plan, plan
23
26
  from sdmxlib.migration._types import (
@@ -29,6 +32,7 @@ from sdmxlib.migration._types import (
29
32
  Omit,
30
33
  Option,
31
34
  Question,
35
+ Rule,
32
36
  SetField,
33
37
  Target,
34
38
  Transform,
@@ -45,9 +49,11 @@ __all__ = [
45
49
  "Option",
46
50
  "Plan",
47
51
  "Question",
52
+ "Rule",
48
53
  "SetField",
49
54
  "Target",
50
55
  "Transform",
51
56
  "conflicts",
57
+ "omit_agencies",
52
58
  "plan",
53
59
  ]
@@ -15,15 +15,23 @@ resolve. .Stat NSI serves sub-agencies whose scheme it does not serve.
15
15
 
16
16
  A top-level agency is the target registry's to declare in ``SDMX:AGENCIES``,
17
17
  which a message rarely holds, so it is not checked here.
18
+
19
+ `omit_agencies` is a rule a caller adds (`Target(rules=...)`):
20
+
21
+ - **agency.omitted** (change): an artefact a named agency maintains, or one
22
+ that references an artefact left out, is left out.
18
23
  """
19
24
 
20
25
  from collections.abc import Iterator, Mapping
21
26
 
22
- from sdmxlib.migration._types import Add, Blocked, Change
27
+ from sdmxlib.migration._types import Add, Blocked, Change, Omit, Rule
23
28
  from sdmxlib.model.istring import InternationalString
24
29
  from sdmxlib.model.message import StructureMessage
25
30
  from sdmxlib.model.organisation import Agency, AgencyScheme
26
31
  from sdmxlib.model.ref import artefact_urn
32
+ from sdmxlib.model.urn import SdmxUrn
33
+ from sdmxlib.model.validation import _collect_refs
34
+ from sdmxlib.model.version import late_binds
27
35
 
28
36
  type Finding = Change | Blocked
29
37
 
@@ -84,3 +92,82 @@ def findings(msg: StructureMessage, agency_names: Mapping[str, InternationalStri
84
92
  reason=f"{', '.join(maintainers)} maintain artefacts, which needs {parent}:{_SCHEME_ID} to declare them",
85
93
  edits=(Add(artefact=scheme),),
86
94
  )
95
+
96
+
97
+ #: The rule id of `omit_agencies`'s changes.
98
+ OMIT_RULE = "agency.omitted"
99
+
100
+
101
+ def omit_agencies(*agencies: str) -> Rule:
102
+ """A rule that leaves out what *agencies* maintain, and what references it.
103
+
104
+ For test and training agencies a registry should not receive. Each
105
+ artefact one of *agencies* maintains is left out and, repeatedly until
106
+ nothing changes, so is each artefact that references one left out, so the
107
+ result never names an artefact it does not hold. Each is a `Change` of
108
+ rule ``agency.omitted`` with an `Omit` edit.
109
+
110
+ Args:
111
+ agencies: The maintainers to leave out, such as ``"TEST"``. A
112
+ sub-agency is named in full (``"CA1.TEST"``); naming a parent does
113
+ not leave out its sub-agencies.
114
+
115
+ Returns:
116
+ The rule, for `Target(rules=...)`.
117
+ """
118
+ left_out = frozenset(agencies)
119
+
120
+ def find(msg: StructureMessage) -> Iterator[Change]:
121
+ artefacts = {str(artefact_urn(artefact)): artefact for artefact in msg.all_artefacts()}
122
+ names = {urn: _references(artefact) for urn, artefact in artefacts.items()}
123
+ why: dict[str, str] = {
124
+ urn: f"maintained by {artefact.agency_id}, which the caller leaves out"
125
+ for urn, artefact in artefacts.items()
126
+ if artefact.agency_id in left_out
127
+ }
128
+ changed = True
129
+ while changed:
130
+ changed = False
131
+ for urn, named in names.items():
132
+ if urn in why:
133
+ continue
134
+ hit = next((gone for ref in named for gone in why if _binds(ref, SdmxUrn.parse(gone))), None)
135
+ if hit is not None:
136
+ why[urn] = f"it references {hit}, which is left out"
137
+ changed = True
138
+ for urn in artefacts:
139
+ if urn in why:
140
+ yield Change(
141
+ rule=OMIT_RULE,
142
+ urn=urn,
143
+ path="",
144
+ before=None,
145
+ after=None,
146
+ reason=why[urn],
147
+ edits=(Omit(urn=SdmxUrn.parse(urn)),),
148
+ )
149
+
150
+ return Rule(find=find)
151
+
152
+
153
+ def _binds(reference: SdmxUrn[object], urn: SdmxUrn[object]) -> bool:
154
+ """Whether a reference to the maintainable *reference* names the artefact at *urn*.
155
+
156
+ A late-bound version (``1.0+.0``, ``latest``) names every version it
157
+ may resolve to.
158
+ """
159
+ if (reference.artefact_class, reference.agency, reference.id) != (urn.artefact_class, urn.agency, urn.id):
160
+ return False
161
+ return reference.version == urn.version or reference.is_latest or late_binds(reference.version, urn.version)
162
+
163
+
164
+ def _references(artefact: object) -> list[SdmxUrn[object]]:
165
+ """The maintainables *artefact* references, each as its own URN."""
166
+ named: dict[str, SdmxUrn[object]] = {}
167
+ for _path, ref in _collect_refs(artefact, ""):
168
+ try:
169
+ owner = ref.urn.owner()
170
+ except ValueError:
171
+ owner = ref.urn
172
+ named[str(owner)] = owner
173
+ return [named[key] for key in sorted(named)]
@@ -19,6 +19,16 @@ will do before anything is sent:
19
19
  - **fmr.monolingual** (change, no edit): FMR drops a metadata attribute's
20
20
  ``isMultiLingual="false"`` TextFormat, and 3.0 reads one with none as
21
21
  multilingual.
22
+ - **fmr.id-case** (question): FMR upper-cases a maintainable id with
23
+ lower-case letters (``CL_low`` is stored as ``CL_LOW``), and SDMX ids are
24
+ case-sensitive, so a reference to the original stops resolving. Renamed to
25
+ the upper-cased id with every reference following (recommended), or sent
26
+ as it is for FMR to rename.
27
+ - **fmr.id-case-clash** (blocked): two artefacts of one class, agency and
28
+ version whose ids differ only by case become one URN in FMR. At a legacy
29
+ version the second submission replaces the first, losing it silently; at a
30
+ final semantic version FMR refuses the second ("Semantically versioned
31
+ structure can not be modified").
22
32
 
23
33
  `Target.fmr` also allows the deviation FMR shares with .Stat NSI: a code whose
24
34
  parent is not an NCName (``non-ncname-parent``), which FMR accepts and serves
@@ -45,6 +55,7 @@ type Finding = Change | Question | Blocked
45
55
  QUESTIONS: dict[str, tuple[str, ...]] = {
46
56
  "fmr.actual-constraint": ("omit", "keep"),
47
57
  "fmr.next-major": ("major", "omit-earlier", "keep"),
58
+ "fmr.id-case": ("rename", "accept"),
48
59
  }
49
60
 
50
61
  _LEGACY = re.compile(r"^(0|[1-9]\d*)(\.(0|[1-9]\d*))?$")
@@ -58,6 +69,7 @@ def findings(msg: StructureMessage, plan_target: Target) -> Iterator[Finding]:
58
69
  yield from _next_major(msg)
59
70
  yield from _related_dimensions(msg)
60
71
  yield from _monolingual(msg)
72
+ yield from _id_case(msg)
61
73
 
62
74
 
63
75
  def _urn(artefact: SupportsUrn) -> SdmxUrn[object]:
@@ -191,3 +203,51 @@ def _every_attribute(attributes: Iterable[MetadataAttribute]) -> Iterator[Metada
191
203
  for attribute in attributes:
192
204
  yield attribute
193
205
  yield from _every_attribute(attribute.children)
206
+
207
+
208
+ def _id_case(msg: StructureMessage) -> Iterator[Finding]:
209
+ by_folded: dict[tuple[str, str, str, str], list[SdmxUrn[object]]] = {}
210
+ for artefact in msg.all_artefacts():
211
+ urn = _urn(artefact)
212
+ by_folded.setdefault((urn.artefact_class, urn.agency, urn.id.upper(), urn.version), []).append(urn)
213
+ for (_cls, _agency, upper, _version), urns in by_folded.items():
214
+ if len(urns) > 1:
215
+ shown = " and ".join(f"{urn.agency}:{urn.id}({urn.version})" for urn in urns)
216
+ yield Blocked(
217
+ rule="fmr.id-case-clash",
218
+ urn=str(urns[0]),
219
+ reason=(
220
+ f"FMR upper-cases ids, so {shown} are one artefact there, {upper}: at a legacy version the "
221
+ "second submission replaces the first, and at a final semantic one FMR refuses it; give one "
222
+ "of them another id with sl.rewrite"
223
+ ),
224
+ )
225
+ continue
226
+ (urn,) = urns
227
+ if urn.id == upper:
228
+ continue
229
+ renamed = SdmxUrn[object](urn.package, urn.artefact_class, urn.agency, upper, urn.version)
230
+ yield Question(
231
+ key=f"fmr.id-case@{urn}",
232
+ rule="fmr.id-case",
233
+ urn=str(urn),
234
+ question=(
235
+ f"FMR stores {urn.agency}:{urn.id} as {upper}, and SDMX ids are case-sensitive, so a reference to "
236
+ f"{urn.id} stops resolving. Rename it to {upper}?"
237
+ ),
238
+ options=(
239
+ Option(
240
+ id="rename",
241
+ consequence=f"renamed to {upper}; references follow",
242
+ edits=(Move(old=urn, new=renamed),),
243
+ ),
244
+ Option(
245
+ id="accept",
246
+ consequence=(
247
+ f"sent as {urn.id}; FMR stores it as {upper}, and references to {urn.id} stop resolving"
248
+ ),
249
+ edits=(),
250
+ ),
251
+ ),
252
+ recommended="rename",
253
+ )
@@ -0,0 +1,152 @@
1
+ """The hierarchy rule of a 2.1 → 3.x migration: bind each hierarchy an HCL carried (GH-428).
2
+
3
+ SDMX-ML 2.1 groups hierarchies in a `HierarchicalCodelist` and binds them to
4
+ nothing. The 2.1 reader promotes each one to a top-level `Hierarchy`, and
5
+ `format.dropped` leaves the container out of 3.x. In 3.x a hierarchy applies
6
+ to a dimension only through a `HierarchyAssociation`, so without one no
7
+ consumer finds it (`unique_hierarchy`, `applicable_hierarchies`).
8
+
9
+ - **hierarchy.association** (change): a hierarchy whose codes all come from
10
+ one codelist, which enumerates exactly one dimension in the message, is
11
+ bound to that dimension by a new association with no context.
12
+ - **hierarchy.association** (question): that codelist enumerates several
13
+ dimensions. Bound to each of them (recommended), or to none.
14
+ - **hierarchy.association** (change, no edit): its codes come from several
15
+ codelists or none, or its codelist enumerates no dimension in the message,
16
+ so it is written unbound.
17
+
18
+ A hierarchy that an association in the message already links asks nothing.
19
+ Each association is maintained by the hierarchy's agency, named as the
20
+ hierarchy is, and has the id ``<hierarchy>@<DSD>@<dimension>``. It has the
21
+ DSD's version and moves with it (`Add.versioned_as`), so each version of a
22
+ DSD gets its own and a draft DSD's is a draft. Its references are rewritten
23
+ with the rest of the message, so they follow the version moves.
24
+ """
25
+
26
+ from collections.abc import Iterable, Iterator
27
+
28
+ from sdmxlib.migration._types import Add, Blocked, Change, Option, Question
29
+ from sdmxlib.model.datastructure import DataStructure, Dimension
30
+ from sdmxlib.model.hierarchy import HierarchicalCode, Hierarchy, HierarchyAssociation
31
+ from sdmxlib.model.message import StructureMessage
32
+ from sdmxlib.model.ref import Ref, artefact_urn
33
+ from sdmxlib.model.urn import SdmxUrn
34
+
35
+ type Finding = Change | Question | Blocked
36
+
37
+ #: The rule id of every finding here.
38
+ RULE = "hierarchy.association"
39
+
40
+ #: Each rule here that asks, and the option ids its questions take.
41
+ QUESTIONS: dict[str, tuple[str, ...]] = {RULE: ("each", "none")}
42
+
43
+
44
+ def findings(msg: StructureMessage) -> Iterator[Finding]:
45
+ """A finding for each hierarchy an HCL in *msg* carried and no association links."""
46
+ carried = {str(ref.urn) for hcl in msg.hierarchical_codelists for ref in hcl.hierarchies}
47
+ linked = {
48
+ str(association.linked_hierarchy.urn)
49
+ for association in msg.hierarchy_associations
50
+ if association.linked_hierarchy is not None
51
+ }
52
+ for hierarchy in msg.hierarchies:
53
+ urn = str(artefact_urn(hierarchy))
54
+ if urn in carried and urn not in linked:
55
+ yield _finding(hierarchy, msg.data_structures)
56
+
57
+
58
+ def _finding(hierarchy: Hierarchy, structures: Iterable[DataStructure]) -> Finding:
59
+ urn = str(artefact_urn(hierarchy))
60
+ codelists = sorted({str(code.code.urn.owner()) for code in _codes(hierarchy.tree) if code.code is not None})
61
+ if len(codelists) != 1:
62
+ held = "no codelist" if not codelists else f"{len(codelists)} codelists"
63
+ return _unbound(urn, f"its codes come from {held}, so no one dimension's codes are the ones it arranges")
64
+ (codelist,) = codelists
65
+ dimensions = [
66
+ (dsd, dimension)
67
+ for dsd in structures
68
+ for dimension in dsd.dimensions
69
+ if isinstance(dimension.representation, Ref) and str(dimension.representation.urn) == codelist
70
+ ]
71
+ if not dimensions:
72
+ return _unbound(urn, f"no dimension in the message is enumerated by {codelist}")
73
+ associations = [_association(hierarchy, dsd, dimension) for dsd, dimension in dimensions]
74
+ if len(associations) == 1:
75
+ (association,) = associations
76
+ return Change(
77
+ rule=RULE,
78
+ urn=urn,
79
+ path="",
80
+ before=None,
81
+ after=str(artefact_urn(association)),
82
+ reason=(
83
+ f"3.x binds a hierarchy to a dimension with a HierarchyAssociation, which 2.1 lacks; "
84
+ f"{_shown(dimensions[0])} is the one dimension enumerated by {codelist}"
85
+ ),
86
+ edits=(_add(association, dimensions[0][0]),),
87
+ )
88
+ shown = ", ".join(_shown(pair) for pair in dimensions)
89
+ return Question(
90
+ key=f"{RULE}@{urn}",
91
+ rule=RULE,
92
+ urn=urn,
93
+ question=(
94
+ f"{hierarchy.agency_id}:{hierarchy.id} arranges the codes of {codelist}, which enumerates {shown}. "
95
+ "3.x binds a hierarchy to each dimension it applies to. Which does it apply to?"
96
+ ),
97
+ options=(
98
+ Option(
99
+ id="each",
100
+ consequence=f"bound to {shown}, by an association each",
101
+ edits=tuple(
102
+ _add(association, dsd) for association, (dsd, _) in zip(associations, dimensions, strict=True)
103
+ ),
104
+ ),
105
+ Option(id="none", consequence="written unbound, so no consumer finds it for a dimension", edits=()),
106
+ ),
107
+ recommended="each",
108
+ )
109
+
110
+
111
+ def _unbound(urn: str, why: str) -> Change:
112
+ return Change(
113
+ rule=RULE,
114
+ urn=urn,
115
+ path="",
116
+ before=None,
117
+ after=None,
118
+ reason=f"written unbound, since {why}; bind it with a HierarchyAssociation",
119
+ edits=(),
120
+ )
121
+
122
+
123
+ def _association(hierarchy: Hierarchy, dsd: DataStructure, dimension: Dimension) -> HierarchyAssociation:
124
+ dsd_urn = SdmxUrn.parse(str(artefact_urn(dsd)))
125
+ return HierarchyAssociation(
126
+ id=f"{hierarchy.id}@{dsd.id}@{dimension.id}",
127
+ maintainer=hierarchy.agency_id,
128
+ version=dsd.version,
129
+ name=hierarchy.name,
130
+ linked_hierarchy=Ref[Hierarchy].unresolved(Hierarchy.parse_urn(str(artefact_urn(hierarchy)))),
131
+ linked_object=Ref[object].unresolved(
132
+ SdmxUrn[object](
133
+ "datastructure", "Dimension", dsd_urn.agency, dsd_urn.id, dsd_urn.version, item_id=dimension.id
134
+ )
135
+ ),
136
+ )
137
+
138
+
139
+ def _add(association: HierarchyAssociation, dsd: DataStructure) -> Add:
140
+ return Add(artefact=association, versioned_as=SdmxUrn.parse(str(artefact_urn(dsd))))
141
+
142
+
143
+ def _shown(pair: tuple[DataStructure, Dimension]) -> str:
144
+ dsd, dimension = pair
145
+ return f"{dsd.agency_id}:{dsd.id}({dsd.version}).{dimension.id}"
146
+
147
+
148
+ def _codes(codes: Iterable[HierarchicalCode]) -> Iterator[HierarchicalCode]:
149
+ """Each hierarchical code and, depth first, its children."""
150
+ for code in codes:
151
+ yield code
152
+ yield from _codes(code.children)