{ "info": { "author": "Michael Williamson", "author_email": "mike@zwobble.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "SDMX\n====\n\nRead SDMX XML files. I've only added the features I've needed, so this\nis far from being a thorough implementation. Contributions welcome.\n\nInstallation\n------------\n\n``pip install sdmx``\n\nUsage\n-----\n\n``sdmx.generic_data_message_reader(fileobj, dsd_fileobj=None, lazy=None)``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nGiven a file-like object representing the XML of a generic data message,\nreturn a data message reader.\n\n``sdmx.compact_data_message_reader(fileobj, dsd_fileobj=None, lazy=None)``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nGiven a file-like object representing the XML of a compact data message,\nreturn a data message reader.\n\nOptional arguments for data message readers\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n* ``dsd_fileobj``: the file-like object representing the XML of the\n relevant DSD. Only used if the data message does not contain a URL to\n the relevant DSD.\n\n* ``lazy``: set to ``True`` to read observations lazily to allow\n datasets to be read without loading the entire dataset into memory.\n Use with caution: lazy reading makes some assumptions about the\n structure of the XML (for instance, that series keys always appear\n before any observations in that series). These assumptions seem to be\n safe on files that I've tested, but that doesn't mean they're\n universally true.\n\nData message readers\n~~~~~~~~~~~~~~~~~~~~\n\nEach data message reader has the following attributes:\n\n* ``datasets()``: returns an iterable of ``DatasetReader`` instances.\n Each instance corresponds to a ```` element.\n\n``DatasetReader``\n~~~~~~~~~~~~~~~~~\n\nA ``DatasetReader`` has the following attributes:\n\n* ``key_family()``: returns the ``KeyFamily`` for the dataset. This\n corresponds to the ```` element.\n\n* ``series()``: returns an iterable of ``Series`` instances. Each\n instance corresponds to a ```` element.\n\n``KeyFamily``\n~~~~~~~~~~~~~\n\nA ``KeyFamily`` has the following attributes:\n\n* ``name(lang)``: the name of the key family in the language ``lang``.\n\n* ``describe_dimensions(lang)``: for each dimension of the key family,\n find the referenced concept and use its name in the language\n ``lang``. Returns a list of strings in the same order as in the\n source file.\n\n``Series``\n~~~~~~~~~~\n\nA ``Series`` has the following attributes:\n\n* ``describe_key(lang)``: the key of a series is a mapping from each\n dimension of the dataset to a value. For instance, if the dataset has\n a dimension named ``Country``, the value for the series might be\n ``United Kingdom``. Returns an ordered dictionary mapping strings to\n lists of strings. The items in the dictionary are in the same order\n as the dimensions returned from ``describe_dimensions()``. For\n instance, if the dataset has a single dimension called ``Country``,\n the returned value would be ``{\"Country\": [\"United Kingdom\"]}``. All\n ancestors of a value are also described, with ancestors appearing\n before descendents. For instance, if the value ``United Kingdom`` has\n the parent value ``Europe``, which has the parent value ``World``,\n the returned value would be\n ``{\"Country\": [\"World\", \"Europe\", \"United Kingdom\"]}``.\n\n* ``observations()``: returns an iterable of ``Observation`` instances.\n Each instance corresponds to an ```` element.\n\n``Observation``\n~~~~~~~~~~~~~~~\n\nAn ``Observation`` has the following attributes:\n\n* ``time``\n* ``value``\n\nExample\n-------\n\nThe script below can be used to print out the values contained in a\ngeneric data message. (If you have a compact data message, then using\n``compact_data_message_reader`` instead of\n``generic_data_message_reader`` should also work.) Assuming the script\nis saved as ``read-sdmx-values.py``, it can be used like so:\n\n.. code-block:: sh\n\n python read-sdmx-values.py path/to/generic-data-message.xml path/to/dsd.xml\n\n.. code-block:: python\n\n import sys\n\n import sdmx\n\n\n def main():\n dataset_path = sys.argv[1]\n dsd_path = sys.argv[2]\n \n with open(dataset_path) as dataset_fileobj:\n with open(dsd_path) as dsd_fileobj:\n dataset_reader = sdmx.generic_data_message_reader(\n fileobj=dataset_fileobj,\n dsd_fileobj=dsd_fileobj,\n )\n _print_values(dataset_reader)\n\n\n def _print_values(dataset_reader):\n for dataset in dataset_reader.datasets():\n key_family = dataset.key_family()\n name = key_family.name(lang=\"en\")\n \n print name\n \n dimension_names = key_family.describe_dimensions(lang=\"en\") + [\"Time\", \"Value\"]\n \n for series in dataset.series():\n row_template = []\n key = series.describe_key(lang=\"en\")\n for key_name, key_value in key.iteritems():\n row_template.append(key_value)\n \n for observation in series.observations(lang=\"en\"):\n row = row_template[:]\n row.append(observation.time)\n row.append(observation.value)\n \n print zip(dimension_names, row)\n\n main()", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/mwilliamson/sdmx.py", "keywords": "sdmx", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "sdmx", "package_url": "https://pypi.org/project/sdmx/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/sdmx/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/mwilliamson/sdmx.py" }, "release_url": "https://pypi.org/project/sdmx/0.2.10/", "requires_dist": null, "requires_python": null, "summary": "Read SDMX XML files", "version": "0.2.10" }, "last_serial": 1534668, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3d8d5d80faf30e0a8d11df0714c26c91", "sha256": "fe674a0f26aa587ccc9b2e354f2076f5e2d867ef8328a9520b47fa1d2dec582f" }, "downloads": -1, "filename": "sdmx-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3d8d5d80faf30e0a8d11df0714c26c91", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3988, "upload_time": "2013-11-08T15:43:49", "url": "https://files.pythonhosted.org/packages/ad/a3/bcc33182cdcf404353ec1bf6a6fc1b07ccdd347e5c6be77e0099b07262c0/sdmx-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "28bd059d54fbf3f9c650d0173991ef2d", "sha256": "2a9a83d4ecdb141b29925008a4c4b7904cb62c86f7252a2db07ce442795051b8" }, "downloads": -1, "filename": "sdmx-0.2.0.tar.gz", "has_sig": false, "md5_digest": "28bd059d54fbf3f9c650d0173991ef2d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5097, "upload_time": "2013-11-28T18:03:05", "url": "https://files.pythonhosted.org/packages/e2/10/795ae593f628b5107cf05a1d7e0f5304b96eb0e1fe6a391887514a5f626a/sdmx-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "b4a4e5bdd40776cee08239c9972aa86c", "sha256": "8a2a32258379b5d5e81339dae6eb5fa3e1414a6d16fb91cfb010ff92e46958b2" }, "downloads": -1, "filename": "sdmx-0.2.1.tar.gz", "has_sig": false, "md5_digest": "b4a4e5bdd40776cee08239c9972aa86c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5096, "upload_time": "2013-11-28T18:13:27", "url": "https://files.pythonhosted.org/packages/ec/1d/a6ad05ffa93a90dbefbb3285b85c52a2c3b24012607def523a2532cc6ad6/sdmx-0.2.1.tar.gz" } ], "0.2.10": [ { "comment_text": "", "digests": { "md5": "c8ae888a707140b69d7bfe2394941417", "sha256": "96e4d0120d93c029fa1b54ead19c2c0c3883bc68d56b33da45c1f1fb6f1eda8e" }, "downloads": -1, "filename": "sdmx-0.2.10.tar.gz", "has_sig": false, "md5_digest": "c8ae888a707140b69d7bfe2394941417", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10050, "upload_time": "2015-05-05T20:45:52", "url": "https://files.pythonhosted.org/packages/88/81/dd6f588555f0f690e906badb301ba4525fd81bc3f74f53dc87faec751983/sdmx-0.2.10.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "1ce09245a10331ebb1f09b91ebbd10c5", "sha256": "935e7d7356027eec6d9a8e0c2de33414501fa010e20d88b4eee8ffd4df0bcc42" }, "downloads": -1, "filename": "sdmx-0.2.2.tar.gz", "has_sig": false, "md5_digest": "1ce09245a10331ebb1f09b91ebbd10c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5517, "upload_time": "2014-01-21T13:49:37", "url": "https://files.pythonhosted.org/packages/01/2e/b4cef38ea86cc9ff5041cd300bd3049e1b1b465c2bc5a3977190fbb7d6cc/sdmx-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "53b75bce20248f63babaf6594ef2c737", "sha256": "8bf1a94808ab8d6fa0a8fafc64fddf5a46b8ba15c3015ec0772272477dee7f6b" }, "downloads": -1, "filename": "sdmx-0.2.3.tar.gz", "has_sig": false, "md5_digest": "53b75bce20248f63babaf6594ef2c737", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5526, "upload_time": "2014-01-21T14:24:54", "url": "https://files.pythonhosted.org/packages/72/c2/bfe69a0f0737367ef529b092a3cff7130bae51843d70da58aafdb4e33811/sdmx-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "014738e08a61448cc1651e5eb2a6956c", "sha256": "ee14e8b89ab3f89e3ead4f1a771874e9f6fa948903953356808665303e0e3b7f" }, "downloads": -1, "filename": "sdmx-0.2.4.tar.gz", "has_sig": false, "md5_digest": "014738e08a61448cc1651e5eb2a6956c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5541, "upload_time": "2014-01-21T14:29:52", "url": "https://files.pythonhosted.org/packages/75/40/21c6d970ec4464f861f99454d6ec62d845e49a34aa599db683f439d03088/sdmx-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "07e12b4a28cb17730c9feefa480e0505", "sha256": "8ee3b5aee1405c477ced30275d2de5dbc5aa37afb8b6e1e6467a9475644674a4" }, "downloads": -1, "filename": "sdmx-0.2.5.tar.gz", "has_sig": false, "md5_digest": "07e12b4a28cb17730c9feefa480e0505", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5544, "upload_time": "2014-01-21T14:37:53", "url": "https://files.pythonhosted.org/packages/92/41/f7f589ad7cea542d5df0464f99216f16387289c86437f05d795f626c3402/sdmx-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "07bd636ddf1115594daa70cde3bb1ce3", "sha256": "bb928de0afda7c803864f6d388457599984830810e19214b1a10345c89db4441" }, "downloads": -1, "filename": "sdmx-0.2.6.tar.gz", "has_sig": false, "md5_digest": "07bd636ddf1115594daa70cde3bb1ce3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6449, "upload_time": "2014-01-22T16:43:34", "url": "https://files.pythonhosted.org/packages/e6/49/aff75a097c02e06ac4366fafbb519815d1bc84ce36a5d01f096974ade13c/sdmx-0.2.6.tar.gz" } ], "0.2.7": [ { "comment_text": "", "digests": { "md5": "8208b53d0e5543057c8e68f9f7d47314", "sha256": "4540ae0cdff4c52a85c38b0358c3da7cbea671f537611a9877905bbf2d93d6d8" }, "downloads": -1, "filename": "sdmx-0.2.7.tar.gz", "has_sig": false, "md5_digest": "8208b53d0e5543057c8e68f9f7d47314", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6443, "upload_time": "2014-01-23T15:50:22", "url": "https://files.pythonhosted.org/packages/21/01/90e77a725f9e7e010d19d45f15f74302ae6b7ca211e124ba8d28170834c1/sdmx-0.2.7.tar.gz" } ], "0.2.8": [ { "comment_text": "", "digests": { "md5": "79097bf0417e97b0d05e427e96b0e007", "sha256": "c9fca0a7b145d7abeb7886cc08fd3519a2ef4b2746bf125c374d3882ba179c28" }, "downloads": -1, "filename": "sdmx-0.2.8.tar.gz", "has_sig": false, "md5_digest": "79097bf0417e97b0d05e427e96b0e007", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7289, "upload_time": "2014-01-23T16:45:38", "url": "https://files.pythonhosted.org/packages/97/02/cf0f77aabcfce8e6e7a321095401bc61bdfd416bb01eded1b14fd3b22ed9/sdmx-0.2.8.tar.gz" } ], "0.2.9": [ { "comment_text": "", "digests": { "md5": "cb07c9f212b9edcfab538da4c238dd7b", "sha256": "cb5c818439861c3f41f8466b18587da1968cf192023c2bc515b63fe1f0a01388" }, "downloads": -1, "filename": "sdmx-0.2.9.tar.gz", "has_sig": false, "md5_digest": "cb07c9f212b9edcfab538da4c238dd7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10026, "upload_time": "2014-07-05T15:27:21", "url": "https://files.pythonhosted.org/packages/09/a2/02ceb4488727caa4bc3d928a21f786f2131dd7718781cf817bee9c7c26c7/sdmx-0.2.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c8ae888a707140b69d7bfe2394941417", "sha256": "96e4d0120d93c029fa1b54ead19c2c0c3883bc68d56b33da45c1f1fb6f1eda8e" }, "downloads": -1, "filename": "sdmx-0.2.10.tar.gz", "has_sig": false, "md5_digest": "c8ae888a707140b69d7bfe2394941417", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10050, "upload_time": "2015-05-05T20:45:52", "url": "https://files.pythonhosted.org/packages/88/81/dd6f588555f0f690e906badb301ba4525fd81bc3f74f53dc87faec751983/sdmx-0.2.10.tar.gz" } ] }