How to use your own Python scripts as APIs in OpenRefine

As Python integration in OpenRefine can be cumbersome, I thought about a way to reuse and maintain more complex scripts. Using the Jupyter Kernel Gateway library, it is possible to run Jupyter notebook cells as local APIs. You can have as many APIs as you like within a single notebook, and all of them can be run simultaneously with a single command. When you make changes to the code in a notebook, simply save it and then kill and restart the service to update the APIs.

In this example notebook, decimal coordinates are transformed to gms (degrees, minutes, seconds) and vice versa. The second transformation showcases the usage of an external web service within these APIs (OpenStreetMap Nominatim).

Bildschirmaufnahme 2024-02-19 um 12.11.26(9)


I wonder if a function decToGMS() would be useful to add to OpenRefine? (internally could probably use some code like this or bits of Apache Sedona libraries)
How many other users have this need?
:+1: if so !