Closed brockfanning closed 3 years ago
The key reference is the SDMX Information Model (IM). There's a link from the front page of the documentation. You can also find it by going to https://sdmx.org/?page_id=5008 (“Standards”) and clicking on “Section 2 – Information Model”.
To answer this particular question, you would find “Figure 25: Representation of DSD Components” on p.60. The contents of this diagram and the accompanying text is exactly reflected in the classes and attributes of the sdmx
package and thus in the API documentation. Like so:
model.Dimension
inherits from [model.DimensionComponent
]() inherits from [model.Component
]()—see the links to the base classes.Component
has an attribute local_representation
—see that this matches the diagram.model.Representation
object.Representation
has an attribute enumerated
—again, look at the diagram.model.ItemScheme
. This is an abstract class.model.Codelist
or a model.ConceptScheme
, depending on the type of Component.So this means you need to go from the Dimension (Component) via its local_representation
attribute to a Representation object; and from that via its enumerated
attribute to the Codelist (ItemScheme):
def get_codelists_from_dimension(dimension):
return dimension.local_representation.enumerated
Note that "get codelists" plural seems a misnomer given the 1-to-1 relationships shown in the IM and reflected in the code.
In general: the IM document is 170 pages long, and the front page of the sdmx
docs tries to be clear:
This documentation does not repeat full descriptions of SDMX, the IM, or SDMX web services.
I personally feel the IM is a bit dense, and think it would be wonderful if there were some learning materials to help new users understand it. But those would take many hours to write, and that is not in scope for this project given current resources (i.e. none).
I've written this comment as one general example of how to read the IM and the package docs together, in case other users are trying to do the same thing. When similar questions are asked in the future, I will answer by linking to this example. I hope it helps! Please close the issue if the question is answered.
Thank you very much for the detail!
As with all my newbie questions - please feel free to point me to some documentation or code if that is easier.
If I have a DataStructureDefinition object, I can loop through the dimensions. What I'm wondering is, how would get the CodeLists associated with a particular dimension. Here is the basic code: