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.
- Host: GitHub
- URL: https://github.com/jplusplus/socialstyrelsen-scraper
- Owner: jplusplus
- License: mit
- Created: 2017-12-01T10:47:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-11-09T14:56:55.000Z (over 4 years ago)
- Last Synced: 2025-09-06T12:53:02.116Z (10 months ago)
- Language: HTML
- Size: 87.9 KB
- Stars: 3
- Watchers: 7
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
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