An open API service indexing awesome lists of open source software.

https://github.com/jplusplus/socialstyrelsen-scraper

A scraper of statistical data from socialstyrelsen.se built on top of Statscraper.
https://github.com/jplusplus/socialstyrelsen-scraper

Last synced: 5 months ago
JSON representation

A scraper of statistical data from socialstyrelsen.se built on top of Statscraper.

Awesome Lists containing this project

README

          

This is a scraper for statistical data from the statistcial databases http://www.socialstyrelsen.se built on top of the `Statscraper package `.

Very much alpha. Only tested on a selected topics.

Install
-------

pip install -r requirements.txt

Example usage
-------------

.. code:: python

from socialstyrelsen import SocialstyrelsenScraper

scraper = SocialstyrelsenScraper()
scraper.items # List databasese
# [, ...]

dataset = scraper.get("ekonomisktbistandmanad") # Get a specific (by id)

# Inpect dataset
print dataset.dimensions
# [, , , , , ]

print dataset.dimensions["OMR"].allowed_values
# [, , ...]

# Make a query, you have to explicitly define all dimension values you want
# to query.
res = dataset.fetch({
"TABELL": "1",
"OMR": ["01", "03"],
"MANAD": ["4", "5", "6"],
"AR": "2017",
"MATT": "1",
})

# Do something with the result
df = res.pandas

TODO
----

- Currently only properly tested on "ekonomiskt bistånd"
- Handle large queries.
- Handle dimension labels

Develop
------

Run tests:

make tests