Can we combine/chain expectations or use expectations with specific rules depending on values of another column?


Here is an example to explain my use case.

We deal with power grid data, and in most cases, the power generated by generators is expected to be positiive. However for some of them, like wind turbine, the value might be slightly negative some of the time.

So I would like to write an expectation saying that for generators with production type wind turbine it is allowed to have negative values as long as they are over -2MW (i.e. min_value=-2MW IF production_type=‘wind turbine’)

  • solution 1: Is there already today a way to solve such test with an extra constrain/rule without having to create a batch filtering on the production_type?
  • solution 2: Would it be possible to combine existing expectation using an AND/OR/NAND/NOR operator like such: expect_column_values_to_be_between(min_value=-2) AND expect_column_values_to_be_in_set(column='production_type', ['wind turbine','hydro pumped storage'])
  • solution 3: I create a new Multi-column: expect_column_values_A_to_be_between_if_column_values_B_in_set(...)

We are interested in any feedback on the feasibility of these solutions?