PowerGridModel / power-grid-model

Python/C++ library for distribution power system analysis
Mozilla Public License 2.0
146 stars 30 forks source link

[FEATURE] Add custom attributes for serialization #493

Open TonyXiang8787 opened 9 months ago

TonyXiang8787 commented 9 months ago

Background

Currently the (de-)serialization only supports attributes which are defined by PGM self. Users wish to add custom attributes to the (de-)serialization format and parser. Following attribute types are desired.

Approach

To be continued

IrenaDk commented 9 months ago

This would be very useful for our product because we do a lot of manipulations on the initial PGM network that we use and it would be useful to (de)serialize it with the additional attributes. Such output can be used as input in the next steps of our workflow, final output, and has the additional benefit of making debugging easier.

mgovers commented 9 months ago

Initial thoughts: we could go a number of ways:

  1. always aggregate. the results would end up in the meta data of the output. this marks a compatible change tot the serialization schema. the difficult decision here is whether it should be ignored or checked for strict=true when deserializing. It wouldn't be possible to make these fields "custom" (as mentioned in the feature request)
  2. add optional flags to aggregate across multiple dimensions and output to a user-defined custom identifier. I don't like this because it prevents us from just adding new fields with good names because there could be name clashes
  3. similarly to the extra_info attribute to the PgmJsonConverter: make this optional and output "all the rest" as an new string of the same data type as the input. This would not break current functionality and with the visitor pattern, it should be relatively straight forward to produce, but i do not think this enables all of the above requested features, but it ties better into the "custom" part of the feature request