This is a scraper for statistical data from the statistcial databases http://www.socialstyrelsen.se built on top of the `Statscraper package <https://github.com/jplusplus/statscraper>`.
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
# [<SocialstyrelsenDataset: abort (Aborter)>, <SocialstyrelsenDataset: amning (Amning)>...]
dataset = scraper.get("ekonomisktbistandmanad") # Get a specific (by id)
# Inpect dataset
print dataset.dimensions
# [<SocialstyrelsenDimension: MATT>, <SocialstyrelsenDimension: FOR>, <SocialstyrelsenDimension: LANGD>, <SocialstyrelsenDimension: OMR>, <SocialstyrelsenDimension: AGI>, <SocialstyrelsenDimension: AR>]
print dataset.dimensions["OMR"].allowed_values
# [<SocialstyrelsenDimensionValue: 0 (Hela Riket)>, <SocialstyrelsenDimensionValue: 1 (Stockholm)>, ...]
# 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
Metadata
Release files for socialstyrelsen_scraper 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| socialstyrelsen_scraper-0.0.2.tar.gz | 6.1 kB | Without provenance | Details |
Security for socialstyrelsen_scraper 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release files / socialstyrelsen_scraper-0.0.2.tar.gz
How to use checksums
13154cc5a740869c4515bb4b1600d08449dd6c36a24ea3a5b6b79e8c2406e691How to use checksums
815851c4bbc5e270bf311c4c5b728a6470a139c4c72290a00730899d181a8e41What is trusted publishing?