get_structure_diagram
Generate SDMX-aware Mermaid diagrams to visualize structural relationships and impact across dataflows, DSDs, codelists, and concept schemes.
Instructions
Generate an SDMX-aware Mermaid diagram for any structural artifact.
The visualization adapts based on the artifact type to show the most
relevant information following the SDMX information model:
**Dataflow**: Shows full SDMX hierarchy (entry point view)
- Dataflow → DSD → Components (Dimensions, Attributes, Measure)
- Components → Concepts (semantic meaning from ConceptSchemes)
- Components → Representations (Codelists or free text)
**DSD/DataStructure**: Shows component structure + relationships
- Parent dataflows that use this DSD
- Child codelists and concept schemes referenced
**Codelist**: Shows impact/usage view (building block)
- Parent DSDs/dimensions that reference this codelist
- Useful for impact analysis (what breaks if I change this?)
**ConceptScheme**: Shows usage across structures
- Parent DSDs/components that use these concepts
Args:
structure_type: Type of structure - one of:
- "dataflow": Statistical data publication (shows full hierarchy)
- "datastructure" or "dsd": Data Structure Definition
- "codelist": Code list (enumeration of valid values)
- "conceptscheme": Concept scheme (definitions)
- "categoryscheme": Category scheme (classification)
structure_id: The structure identifier
agency_id: Agency ID (uses current endpoint's default if not specified)
version: Version string (default "latest") - query a specific version
direction: Relationship direction to explore (ignored for dataflow):
- "parents": Show structures that USE this one
- "children": Show structures this one REFERENCES
- "both": Show both directions (default)
show_versions: If True, display version numbers on each node
endpoint: Optional endpoint key (e.g. "FBOS", "ECB") to target a
specific provider for this call only. Defaults to the session's
current endpoint.
Returns:
StructureDiagramResult with:
- mermaid_diagram: Ready-to-render Mermaid code
- nodes: All structures in the relationship graph
- edges: Relationships between structures
- interpretation: Human-readable explanation
Examples:
>>> get_structure_diagram("dataflow", "DF_SDG")
# Shows complete SDG dataflow structure with SDMX hierarchy
>>> get_structure_diagram("codelist", "CL_FREQ", show_versions=True)
# Shows what structures use CL_FREQ (impact analysis)
>>> get_structure_diagram("dsd", "DSD_POP", direction="children")
# Shows codelists and concept schemes used by DSD_POP
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| version | No | latest | |
| endpoint | No | ||
| agency_id | No | ||
| direction | No | both | |
| structure_id | Yes | ||
| show_versions | No | ||
| structure_type | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Additional notes or warnings | |
| depth | Yes | Traversal depth used | |
| edges | Yes | All edges (relationships) in the graph | |
| nodes | Yes | All nodes in the relationship graph | |
| target | Yes | The queried target structure | |
| direction | Yes | Direction queried: 'parents', 'children', or 'both' | |
| api_calls_made | Yes | Number of SDMX API calls made | |
| interpretation | Yes | Human-readable explanation of the relationships | |
| discovery_level | No | Discovery workflow level | structure_relationships |
| mermaid_diagram | Yes | Ready-to-render Mermaid diagram code showing structure relationships |