Skip to main content

dataportalen

PyPI CI Licence

Python access to dataportal.se that gives you plain dicts, not RDF.

Sweden's open-data registry describes its 23,500 datasets in RDF, which means every value arrives as a web address: a dataset about roads is filed under http://publications.europa.eu/resource/authority/data-theme/TRAN rather than under "transport". Working out that it means "transport" is, per the registry's own documentation, your problem.

This package makes it not your problem. You search with words and you get dictionaries back.

Install

pip install dataportalen

Distribution and import name are both dataportalen. The unrelated dataportal package on PyPI is a Korean public-data client — not this.

Quick start

from dataportalen import Catalog, text

catalog = Catalog()      # downloads the catalogue the first time: ~7 min, ~95 MB
print(catalog.info())    # {'datasets': 17555, 'data_services': 578, ...}

page = catalog.datasets(theme="transport", format="csv")
print(page.total)                    # 44
print(page.facets["publisher"][:3])  # who publishes them

for dataset in page:
    print(text(dataset["title"]), text(dataset["publisher"]["name"]))
    for dist in dataset["distributions"]:
        print("   ", dist["format"], dist["access_url"])

That first line takes about seven minutes. It downloads the whole catalogue once, and every search after that is local and takes hundredths of a second. When the copy is over a week old, the next Catalog() catches up in under a minute.

By default the catalogue holds the datasets that say public, minus the distributions the registry's nightly link check got an HTTP error for or found no host for. Catalog(access_rights=None, exclude_broken=False) holds everything.

Publishers are there too: catalog.publishers() lists them, and catalog.publisher("scb") is one of them with what it publishes.

No room for a download, or one question to ask? LiveCatalog() has the same methods and asks the registry directly, a page at a time.

Documentation

  • docs/cheatsheet.md — every public name once, every argument spelled out, the output shape underneath.
  • docs/guide.md — how to use it, in the order you hit it: searching, discovering filters, reading a result, recipes.
  • docs/reference.md — every method, filter, record key and error, as tables.
  • docs/internals.md — how it is built: the short values, the module layout, development, releasing.

Licence

Code is MIT. The bundled label table is third-party data redistributed under CC BY 4.0 and EU Decision 2011/833/EU; the attributions are in NOTICE, with the details in docs/internals.md.

Metadata you retrieve is published by its respective publishers, each under its own licence — check the license field on the dataset.

Status

Most of the code here was written with an AI coding assistant. The design, features and scope are my decisions, and everything shipped has been reviewed and tested against the live registry.

This package exists to support NordicIntel's main project, so expect it to be maintained rather than extended. Bug reports are welcome; I am not looking for co-maintainers.

Metadata

Release files for dataportalen 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dataportalen 0.12.0
File Size Uploaded Provenance
dataportalen-0.12.0.tar.gz 250.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dataportalen 0.12.0
File Interpreter ABI Platform
dataportalen-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 378.3 kB

Release files / dataportalen-0.12.0.tar.gz

Download URL dataportalen-0.12.0.tar.gz
Size 250.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3fc31a91ad9753f32c76b5e76b9a95eb5966d43da9e577b9c06e163d29ae636d
BLAKE2b-256 checksum
How to use checksums
48135abfd0186531d35b96ec81672bc0ccf0677858591ffed1276f83bd5e0bc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / dataportalen-0.12.0-py3-none-any.whl

Download URL dataportalen-0.12.0-py3-none-any.whl
Size 128.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
629b82cc42dd771e023a02c8aecf8fc2f0c014dd085300f9dc500aeff57b78ba
BLAKE2b-256 checksum
How to use checksums
8ca4eaf47625a53385803648185522a6ad7cd6cbf3fe11d0db7ccdc17c9e6d4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for dataportalen 0.12.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page