Decode SCD data sources from live XML

This commit is contained in:
2026-08-14 12:04:12 +03:00
parent adc5d88e5f
commit 41a3f47c69
4 changed files with 29 additions and 3 deletions
+6 -1
View File
@@ -161,6 +161,10 @@ def scd_node_item(root: ET.Element, node: ET.Element, category: str) -> dict[str
item["value_type"] = value_type
if category == "datasets":
item["type"] = node.attrib.get("{http://www.w3.org/2001/XMLSchema-instance}type") or node.attrib.get("type") or ""
if category == "data_sources":
data_source_type = child_text(node, "dataSourceType")
if data_source_type:
item["data_source_type"] = data_source_type
return item
@@ -171,7 +175,7 @@ def inspect_scd_payload(data: bytes, *, sections: list[str] | None = None) -> di
synthesized from report code or form attributes.
"""
requested = sections or ["parameters", "datasets", "fields", "calculated_fields", "resources", "settings", "variants", "total_fields"]
requested = sections or ["data_sources", "parameters", "datasets", "fields", "calculated_fields", "resources", "settings", "variants", "total_fields"]
root, container = xml_from_scd_payload(data)
if root is None:
return {"status": "partial", "container": container, "sections": {name: [] for name in requested}}
@@ -198,6 +202,7 @@ def inspect_scd_payload(data: bytes, *, sections: list[str] | None = None) -> di
tag = local_name(node.tag)
xml_tag_counts[tag] = xml_tag_counts.get(tag, 0) + 1
node_names = {
"data_sources": {"dataSource"},
"parameters": {"parameter"},
"datasets": {"dataSet"},
"fields": {"field"},