power-grid-model icon indicating copy to clipboard operation
power-grid-model copied to clipboard

[FEATURE] Add custom attributes for serialization

Open TonyXiang8787 opened this issue 1 year ago • 2 comments

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.

  • Attributes per element
  • Aggregated attributes along all elements for a given type and scenario
  • Aggregated attributes along all scenarios for a given type and element
  • Global attributes for a given type

Approach

To be continued

TonyXiang8787 avatar Feb 13 '24 13:02 TonyXiang8787

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.

IrenaDk avatar Feb 13 '24 16:02 IrenaDk

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

mgovers avatar Feb 14 '24 07:02 mgovers