Stream: python

Topic: metadata exporters


view this post on Zulip Philip Durbin 🚀 (Jul 03 2024 at 20:24):

What if you could write a metadata exporter in Python? @Eryk Kulikowski just proved you can! See https://github.com/ErykKul/dataverse-transformer-exporter/commit/0ab7c4cfe61c450f9fa5b5774463fe6492e00485

view this post on Zulip Eryk Kulikowski (Jul 04 2024 at 07:41):

I will make a new release an upload the jar to maven central later today (or tomorrow). I will also upload the documentation to include the Python examples.

view this post on Zulip Oliver Bertuch (Jul 04 2024 at 08:22):

As already mentioned on Slack: if you want me to move your repo to the GDCC umbrella, just make me a co-owner in your repo, then I can move it for you :smile:

view this post on Zulip Jan Range (Jul 04 2024 at 10:58):

This looks great! If I understand it correctly, this demonstrates how to use Python within Java?

view this post on Zulip Eryk Kulikowski (Jul 04 2024 at 12:26):

I made a new release. Basically, you need to set the exporters directory variable first as explained here: https://guides.dataverse.org/en/latest/installation/config.html#dataverse-spi-exporters-directory and download the JAR file there (https://repo1.maven.org/maven2/io/github/erykkul/dataverse-transformer-exporter/1.0.3/dataverse-transformer-exporter-1.0.3-jar-with-dependencies.jar). Than you add a new folder there (e.g. short-example-py) and place two files there: config.json and transformer.py, you can download the example files and the jar like this:

# download the jar
wget -O transformer-exporter-1.0.3.jar https://repo1.maven.org/maven2/io/github/erykkul/dataverse-transformer-exporter/1.0.3/dataverse-transformer-exporter-1.0.3-jar-with-dependencies.jar
# download the short-example-py example
mkdir short-example-py
wget -O short-example-py/config.json https://raw.githubusercontent.com/erykkul/dataverse-transformer-exporter/main/examples/short-example-py/config.json
wget -O short-example-py/transformer.py https://raw.githubusercontent.com/erykkul/dataverse-transformer-exporter/main/examples/short-example-py/transformer.py

After restarting the server, you have a new py-exporter ready to use! Note that you will need to restart the server after changing the python code or the config. Also mind that the exporters output is cached, you will need to remove the cached files before seeing the changes. I also made a test for easy debugging of your Python code: https://github.com/ErykKul/dataverse-transformer-exporter/commit/adacec90859e239183108565317af2813ea2db7d

You can have up to a 100 configuration-driven exporters like this (just make a new folder with the config and the transformer files in there for each exporter that you want to add).

view this post on Zulip Eryk Kulikowski (Jul 04 2024 at 12:28):

See also the README file: https://github.com/ErykKul/dataverse-transformer-exporter

view this post on Zulip Eryk Kulikowski (Jul 04 2024 at 12:49):

We are also in the process of moving of this repo to GDCC, the links might stop working at some point. I will let you know once the new links become available.

view this post on Zulip Eryk Kulikowski (Jul 07 2024 at 13:15):

The repo is moved and updated, there is also a new release and a real world example of the DDI-PDF exporter using Python with access to Java libraries: https://github.com/gdcc/exporter-transformer

view this post on Zulip Eryk Kulikowski (Jul 07 2024 at 13:16):

https://github.com/gdcc/exporter-transformer/blob/main/examples/ddi-pdf/transformer.py


Last updated: Nov 01 2025 at 14:11 UTC