Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A scraper of statistical data from the Siris database of Skolverket, built on top of Statscraper.

Project description

This is a scraper for statistical data from the Skolverket’s (http://siris.skolverket.se/siris)[SIRIS database] built on top of the Statscraper package <https://github.com/jplusplus/statscraper>.

The scraper is limited to the data avialble through http://siris.skolverket.se/siris/ris.export_stat.form

Install

pip install siris_scraper

Example usage

from siris.scraper import SirisScraper

# Init scraper
scraper = SirisScraper()

# List all schooltypes
verksamhetsformer = scraper.items
# [<Verksamhetsform: 15 (Fritidshem)>, <Verksamhetsform: 10 (Förskola)>, <Verksamhetsform: 14 (Förskoleklass)>,... ]

# Select a schooltype
verksamhetsform = verksamhetsformer.get_by_label(u"Öppen förskola")

# List all available datasets
datasets = verksamhetsform.items
# [<SirisDataset: 40 (Kostnader per kommun)>...]

# Select a dataset
dataset = datasets.get_by_label("Kostnader per kommun")

# Make a query
res = dataset.fetch()  # Get latest available data
#res = dataset.fetch({"period": "2015"})  # Get data for a given period
#res = dataset.fetch({"period": "*"})  # Get data all periods

# List all avilable periods
print(dataset.periods)

# Use the result
# ...in Python Pandas for example
dataframe = res.pandas

Develop

Set up:

pip install -r requirements.txt

Run tests:

make tests

Deploy

To pypi:

python3 deploy_to_pypi.py

Todo

  • The scraper does not handle “uttag” at the moment. Fetches latest by default.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for siris-scraper, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size siris_scraper-0.2.1-py3-none-any.whl (7.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size siris_scraper-0.2.1.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page