Skip to content

Commit

Permalink
Merge pull request #259 from PowerGridModel/docs/filtering-function-doc
Browse files Browse the repository at this point in the history
add filtering functions documentation
  • Loading branch information
nitbharambe authored Jun 28, 2024
2 parents a136e3a + 5aa613e commit 22b1808
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/converters/tabular_converter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. 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.

```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.

Expand Down

0 comments on commit 22b1808

Please sign in to comment.