power-grid-model
power-grid-model copied to clipboard
[FEATURE] Add custom attributes for serialization
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
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.
Initial thoughts: we could go a number of ways:
- 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) - 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
- 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