open-plan-tool / gui

Energy Planning Application
Other
8 stars 4 forks source link

Create a new timeseries model #252

Closed Bachibouzouk closed 1 year ago

Bachibouzouk commented 1 year ago

Important: this PR requires that Django is updated to 4.2.4

A form to upload the timeseries can be found under this local url http://127.0.0.1:8000/en/upload/timeseries

Assign it to the asset as a new field in a first step, then the content of existing old input_timeseries field will be copied and then the old field deleted

In order to activate the timeseries selection for an asset field one need to assign the field TimeseriesField in the projects/forms.py::AssetCreateForm class (the asset in DB need to be a TextField). Then one has to change the format of the json data previously saved into the database: we need to add the information about the input method in order to link to a Timeseries instance or to load the TimeseriesInputWidget with already the right input method selected. Previously the json was simply either a number or a list of number and now it is a dict with a key values and other keys to store the input method, see decompress method of TimeseriesInputWidget class for more informations.

paulapreuss commented 1 year ago

Uploading timeseries works and they show up properly in the database. For CP Nigeria probably all available timeseries will be for modeling demand so that category is most likely not the most helpful for filtering, probably more Households/Enterprises/Facilities to not have a huge list of timeseries. These are all things that can be adapted later in the CPN app though, the functionality works :)