From 45e65cf1bbd55b435de6bcb521d97d9a03f2b105 Mon Sep 17 00:00:00 2001 From: Nitish Bharambe Date: Thu, 27 Jun 2024 10:56:42 +0200 Subject: [PATCH 1/2] add filtering doc Signed-off-by: Nitish Bharambe --- docs/converters/tabular_converter.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/converters/tabular_converter.md b/docs/converters/tabular_converter.md index 44b83895..f6cbf45d 100644 --- a/docs/converters/tabular_converter.md +++ b/docs/converters/tabular_converter.md @@ -302,6 +302,34 @@ Then the following IDs will be generated / retrieved: * `sym_load.node`: `{"table": "Transformer loads", "name": "internal_node", "key" {"Node_Number": 103, "Subnumber": 1} -> 6` +## Table filters + +Consider for example, the mapping is supplied in the folllowing way: + +```yaml +Transformer Load: + transformer: ... + node: ... + sym_load: ... + sym_gen: ... + sym_gen: ... +``` + +Then for each row in `Transformer Load` table, all 5 corresponding PGM components are created. But if it is the intention is to make some of these components optional, then it is possible to do so with the help of `filters` functions. These functions apply a mask based on the rules provided by the funciton. The filters start from all components selected and the `filters` are applied in a recursive `and` way. + +For example, `exclude_value` excludes all rows which match at the `value` for the `col` specified. + +```yaml +Transformers: + transformers: ... + transformer_tap_regulator: + filters: + - power_grid_model_io.functions.filters.exclude_value: + col: Control + value: 0 +``` + + ## Security Considerations Mapping files enable the specification of custom mappings or filter functions. These functions can come from the `power-grid-model-io` library, be user-provided, or even supplied by third parties. To ensure security, we have implemented several measures. Best practices are recommended to prevent malicious code execution. From 5aa613e3c5eab7605722896ba93b54b1fd37a745 Mon Sep 17 00:00:00 2001 From: Nitish Bharambe <78108900+nitbharambe@users.noreply.github.com> Date: Fri, 28 Jun 2024 09:11:10 +0200 Subject: [PATCH 2/2] Update docs/converters/tabular_converter.md Signed-off-by: Nitish Bharambe <78108900+nitbharambe@users.noreply.github.com> --- docs/converters/tabular_converter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/converters/tabular_converter.md b/docs/converters/tabular_converter.md index f6cbf45d..eefbcefb 100644 --- a/docs/converters/tabular_converter.md +++ b/docs/converters/tabular_converter.md @@ -315,7 +315,7 @@ Transformer Load: sym_gen: ... ``` -Then for each row in `Transformer Load` table, all 5 corresponding PGM components are created. But if it is the intention is to make some of these components optional, then it is possible to do so with the help of `filters` functions. These functions apply a mask based on the rules provided by the funciton. The filters start from all components selected and the `filters` are applied in a recursive `and` way. +Then for each row in `Transformer Load` table, all 5 corresponding PGM components are created. But if it is the intention is to make some of these components optional, then it is possible to do so with the help of `filters` functions. These functions apply a mask based on the rules provided by the funciton. All components are selected from the start and the `filters` are then applied in a recursive `and` way. For example, `exclude_value` excludes all rows which match at the `value` for the `col` specified.