Skip to content

Enable download of datapackage as zip#422

Open
Bachibouzouk wants to merge 15 commits intomainfrom
feature/download-datapackage
Open

Enable download of datapackage as zip#422
Bachibouzouk wants to merge 15 commits intomainfrom
feature/download-datapackage

Conversation

@Bachibouzouk
Copy link

@Bachibouzouk Bachibouzouk commented Dec 8, 2025

This enable the download of a datapackage of a scenario.

One can use the URL:
http://127.0.0.1:8000/en/scenario/export/datapackage/

Or click on "Export as datapackage" on the scenario step 2 footer

TODO:

  • Generate the datapackage.json automatically as well
  • Get the foreign keys of datapackage.json correctly
  • Figure out a parameter matching between open_plan parameters and the placades parameters --> this is done in Add components from openPlan tool placades#5

@Bachibouzouk
Copy link
Author

The idea is to enable download of datapackage and then iterate to make changes to the to_datapackage method

@Bachibouzouk Bachibouzouk force-pushed the feature/download-datapackage branch 2 times, most recently from 8f898dd to b43ac95 Compare December 15, 2025 13:38
Copy link

@paulapreuss paulapreuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the current pinned version of tabular in the requirements (pointing to the dev branch), I get the error infer_metadata_from_data() got an unexpected keyword argument 'fk_targets'. I looked around the oemof-tabular repo and saw your PR which introduces this keyword in fix/datapackage. However, pointing to this branch instead causes the following dependency conflict in the requirements:

ERROR: Cannot install datapackage==1.5.1 and jsonschema==4.4.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested jsonschema==4.4.0
    datapackage 1.5.1 depends on jsonschema<3.0 and >=2.5

I was able to bypass this error by unpinning the jsonschema version, but now I am not sure if the version installed might cause issues within the functions that use the package. Would have to double check this.

After this, the datapackage export seems to work and contain all the necessary files. Very cool feature!

@Bachibouzouk Bachibouzouk force-pushed the feature/download-datapackage branch from 2374394 to 836ddc6 Compare January 20, 2026 10:23
@Bachibouzouk
Copy link
Author

Bachibouzouk commented Jan 20, 2026

I was able to bypass this error by unpinning the jsonschema version, but now I am not sure if the version installed might cause issues within the functions that use the package. Would have to double check this.

I think we should now soon be able to upgrade the datapackage package in oemof-tabular. Moreover we decided with @uvchik it would be more convenient to create https://github.com/oemof/oemof-datapackage instead of making breaking changes in oemof-tabular. I will focus now on making the datapackages downloaded from OpenPlan app run using placade

@Bachibouzouk Bachibouzouk force-pushed the feature/download-datapackage branch from 836ddc6 to 8a7a2fd Compare February 2, 2026 22:14
@Bachibouzouk
Copy link
Author

Note @paulapreuss : the structure of the Storage Assets is outdated, as soon as we simulate using placades we can simplify the storages and bring their structure one to one with the fields of the corresponding placades

@Bachibouzouk Bachibouzouk force-pushed the feature/download-datapackage branch 4 times, most recently from 3bb0c50 to 9d53876 Compare February 12, 2026 22:02
@Bachibouzouk
Copy link
Author

Bachibouzouk commented Feb 12, 2026

@paulapreuss - everything is ready to be reviewed. Currently there is still the error you mentionned and I plan to fix it by following the changes made in oemof/oemof-tabular#188 in order to free ourselves from the datapackage dependency problem

@Bachibouzouk
Copy link
Author

@paulapreuss, @uvchik - I fixed the installation problem in a branch based on oemof/oemof-datapackage#1. However I don't have the rights to push it to oemof-datapackage repo. Once this is merged, we should have a pypi installable version of oemof-datapackage (@paulapreuss this is why we currently still need 9d53876). Locally you need to install pip install git+https://github.com/oemof/oemof-datapackage.git@fix/infer_datapackage (once fix/infer_datapackage is pushed as I get the rights)

@Bachibouzouk Bachibouzouk mentioned this pull request Feb 13, 2026
3 tasks
@Bachibouzouk Bachibouzouk force-pushed the feature/download-datapackage branch from 9d53876 to 87505f2 Compare February 13, 2026 22:25
python manage.py datapackage <scen number> -o <output path>
I think this was because I first used installs from github with pip,
this is likely not needed anymore
@paulapreuss paulapreuss self-requested a review February 17, 2026 14:55
Copy link

@paulapreuss paulapreuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really, really nice 😀 I tested around a bit and found that it works really nicely, I also had no issues with the depency install. Imo, this is ready to be merged to main and tested on the staging server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants