PyGrunn 2023: your API on-the-fly - Jan Murre

Tags: python, pygrunn, django

(One of my summaries of the May 2023 Dutch PyGrunn conference).

API on the fly? The talk is about autogenerating APIs using “Amsterdam Schema”. Jan works for datapunt Amsterdam, a project for being transparant as the city of Amsterdam. Your citizens pay taxes, so they have a right to access the open data that the municipality maintains.

They have api projects for many datasets. Like “BAG”, the official building database. Or a list of the power sockets for the weekly markets. Lots of geographical information.

They use postgres, docker containers, ubuntu, python + django + djangorestframework. Developed specific for this project: django gisserver.

DSO, digitaal stelsel omgevingswet, is a Dutch API specification for this kind of data. The various sorts of data are all specified in a json format that they call Amsterdam Schema. All data sets are available as geographical layers.

They have a custom django management command (import_schemas --create-tables) to read such a json schema file and create the empty tables in the database. He demonstrated (live) how it works. The data was in the dabase and a nice swagger-like page was shown in the website with the option to browse the REST API. There’s even support for generating an SQL file with migration instructions in case there’s a new version of the schema.

Geographical information is available as WFS, vector tiles and geojson.

The REST API contents are all read directly from the database. For debugging, there’s a possibility of generating a regular django database model.

The code is open source: https://github.com/amsterdam/dso-api

 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):