Skip to content

Commit

Permalink
refac: Rename effect settlement to capacity settlement (#3067)
Browse files Browse the repository at this point in the history
* Rename effect settlement to capacity settlement in python

* Rename to capacity settlement in dotnet

* Revert "Rename to capacity settlement in dotnet"

This reverts commit 8911013.

* dotnet

* Create 2024120161500_alter_tables__metering_point_type_constraints.sql

* Update 202412161500_alter_tables__metering_point_type_constraints.sql

* Update MeteringPointTypeMapperTests.cs

* .

* .
  • Loading branch information
johevemi authored Dec 18, 2024
1 parent 7cfc1c5 commit 5099f93
Show file tree
Hide file tree
Showing 21 changed files with 49 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# 've_production' | 'net_production' | 'supply_to_grid' |
# 'consumption_from_grid' | 'wholesale_services_information' |
# 'own_production' | 'net_from_grid' 'net_to_grid' | 'total_consumption' |
# 'electrical_heating' | 'net_consumption' | 'effect_settlement'
# 'electrical_heating' | 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'non_profiled' | 'flex'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# When wholesale calculations types also:
# 've_production' | 'net_production' | 'supply_to_grid' 'consumption_from_grid' |
# 'wholesale_services_information' | 'own_production' | 'net_from_grid' 'net_to_grid' |
# 'total_consumption' | 'electrical_heating' | 'net_consumption' | 'effect_settlement'
# 'total_consumption' | 'electrical_heating' | 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'PT15M' | 'PT1H'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# 'production' | 'consumption' | 've_production' | 'net_production' |
# 'supply_to_grid' | 'consumption_from_grid' | 'wholesale_services_information' |
# 'own_production' | 'net_from_grid' 'net_to_grid' | 'total_consumption' |
# 'electrical_heating' | 'net_consumption' | 'effect_settlement'
# 'electrical_heating' | 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'flex' | 'non_profiled'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# 'production' | 'consumption' | 've_production' | 'net_production' |
# 'supply_to_grid' | 'consumption_from_grid' | 'wholesale_services_information' |
# 'own_production' | 'net_from_grid' 'net_to_grid' | 'total_consumption' |
# 'electrical_heating' | 'net_consumption' | 'effect_settlement'
# 'electrical_heating' | 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'flex' | 'non_profiled'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# 'net_production' | 'supply_to_grid' 'consumption_from_grid' |
# 'wholesale_services_information' | 'own_production' | 'net_from_grid' |
# 'net_to_grid' | 'total_consumption' | 'electrical_heating' |
# 'net_consumption' | 'effect_settlement'
# 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'flex' | 'non_profiled'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# 'net_production' | 'supply_to_grid' 'consumption_from_grid' |
# 'wholesale_services_information' | 'own_production' | 'net_from_grid' |
# 'net_to_grid' | 'total_consumption' | 'electrical_heating' |
# 'net_consumption' | 'effect_settlement'
# 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'subscription' | 'fee' | 'tariff'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# 've_production' | 'net_production' | 'supply_to_grid' |
# 'consumption_from_grid' | 'wholesale_services_information' |
# 'own_production' | 'net_from_grid' 'net_to_grid' | 'total_consumption' |
# 'electrical_heating' | 'net_consumption' | 'effect_settlement'
# 'electrical_heating' | 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'non_profiled' | 'flex'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# When wholesale calculations types also:
# 've_production' | 'net_production' | 'supply_to_grid' 'consumption_from_grid' |
# 'wholesale_services_information' | 'own_production' | 'net_from_grid' 'net_to_grid' |
# 'total_consumption' | 'electrical_heating' | 'net_consumption' | 'effect_settlement'
# 'total_consumption' | 'electrical_heating' | 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'PT15M' | 'PT1H'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ def _fix_metering_point_type(df: DataFrame) -> DataFrame:
)
.when(
col(Colname.metering_point_type)
== InputMeteringPointType.EFFECT_SETTLEMENT.value,
lit(MeteringPointType.EFFECT_SETTLEMENT.value),
== InputMeteringPointType.CAPACITY_SETTLEMENT.value,
lit(MeteringPointType.CAPACITY_SETTLEMENT.value),
)
.otherwise(lit("Unknown type")),
# The otherwise is to avoid changing the nullability of the column.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ class InputMeteringPointType(Enum):
TOTAL_CONSUMPTION = "D12"
ELECTRICAL_HEATING = "D14"
NET_CONSUMPTION = "D15"
EFFECT_SETTLEMENT = "D19"
CAPACITY_SETTLEMENT = "D19"
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ class MeteringPointType(Enum):
TOTAL_CONSUMPTION = "total_consumption"
ELECTRICAL_HEATING = "electrical_heating"
NET_CONSUMPTION = "net_consumption"
EFFECT_SETTLEMENT = "effect_settlement"
CAPACITY_SETTLEMENT = "capacity_settlement"
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ALTER TABLE {CATALOG_NAME}.{WHOLESALE_BASIS_DATA_INTERNAL_DATABASE_NAME}.time_series_points
DROP CONSTRAINT IF EXISTS metering_point_type_chk
GO

ALTER TABLE {CATALOG_NAME}.{WHOLESALE_BASIS_DATA_INTERNAL_DATABASE_NAME}.time_series_points
ADD CONSTRAINT metering_point_type_chk
CHECK (metering_point_type IN ( 'production' , 'consumption' , 'exchange' , 've_production' , 'net_production' , 'supply_to_grid' , 'consumption_from_grid' , 'wholesale_services_information' , 'own_production' , 'net_from_grid' , 'net_to_grid' , 'total_consumption' , 'electrical_heating' , 'net_consumption' , 'effect_settlement', 'capacity_settlement' ))
GO

ALTER TABLE {CATALOG_NAME}.{WHOLESALE_RESULTS_INTERNAL_DATABASE_NAME}.amounts_per_charge
DROP CONSTRAINT IF EXISTS metering_point_type_chk
GO

ALTER TABLE {CATALOG_NAME}.{WHOLESALE_RESULTS_INTERNAL_DATABASE_NAME}.amounts_per_charge
ADD CONSTRAINT metering_point_type_chk
CHECK (metering_point_type IN ( 'production' , 'consumption' , 'exchange' , 've_production' , 'net_production' , 'supply_to_grid' , 'consumption_from_grid' , 'wholesale_services_information' , 'own_production' , 'net_from_grid' , 'net_to_grid' , 'total_consumption' , 'electrical_heating' , 'net_consumption' , 'effect_settlement', 'capacity_settlement' ))
GO

ALTER TABLE {CATALOG_NAME}.{WHOLESALE_BASIS_DATA_INTERNAL_DATABASE_NAME}.metering_point_periods
DROP CONSTRAINT IF EXISTS metering_point_type_chk
GO

ALTER TABLE {CATALOG_NAME}.{WHOLESALE_BASIS_DATA_INTERNAL_DATABASE_NAME}.metering_point_periods
ADD CONSTRAINT metering_point_type_chk
CHECK (metering_point_type IN ( 'production' , 'consumption' , 'exchange' , 've_production' , 'net_production' , 'supply_to_grid' , 'consumption_from_grid' , 'wholesale_services_information' , 'own_production' , 'net_from_grid' , 'net_to_grid' , 'total_consumption' , 'electrical_heating' , 'net_consumption' , 'effect_settlement', 'capacity_settlement' ))
GO
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class TestWhenValidInput:
],
[InputMeteringPointType.NET_CONSUMPTION, MeteringPointType.NET_CONSUMPTION],
[
InputMeteringPointType.EFFECT_SETTLEMENT,
MeteringPointType.EFFECT_SETTLEMENT,
InputMeteringPointType.CAPACITY_SETTLEMENT,
MeteringPointType.CAPACITY_SETTLEMENT,
],
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
MeteringPointTypeDataProductValue.TOTAL_CONSUMPTION.value: "D12",
MeteringPointTypeDataProductValue.ELECTRICAL_HEATING.value: "D14",
MeteringPointTypeDataProductValue.NET_CONSUMPTION.value: "D15",
MeteringPointTypeDataProductValue.EFFECT_SETTLEMENT.value: "D19",
MeteringPointTypeDataProductValue.CAPACITY_SETTLEMENT.value: "D19",
MeteringPointTypeDataProductValue.CONSUMPTION.value: "E17",
MeteringPointTypeDataProductValue.PRODUCTION.value: "E18",
MeteringPointTypeDataProductValue.EXCHANGE.value: "E20",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ class MeteringPointTypeDataProductValue(Enum):
TOTAL_CONSUMPTION = "total_consumption"
ELECTRICAL_HEATING = "electrical_heating"
NET_CONSUMPTION = "net_consumption"
EFFECT_SETTLEMENT = "effect_settlement"
CAPACITY_SETTLEMENT = "capacity_settlement"
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# 've_production' | 'net_production' | 'supply_to_grid' |
# 'consumption_from_grid' | 'wholesale_services_information' |
# 'own_production' | 'net_from_grid' 'net_to_grid' | 'total_consumption' |
# 'electrical_heating' | 'net_consumption' | 'effect_settlement'
# 'electrical_heating' | 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'non_profiled' | 'flex'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# When wholesale calculations types also:
# 've_production' | 'net_production' | 'supply_to_grid' 'consumption_from_grid' |
# 'wholesale_services_information' | 'own_production' | 'net_from_grid' 'net_to_grid' |
# 'total_consumption' | 'electrical_heating' | 'net_consumption' | 'effect_settlement'
# 'total_consumption' | 'electrical_heating' | 'net_consumption' | 'capacity_settlement'
t.StructField("metering_point_type", t.StringType(), not nullable),
#
# 'PT15M' | 'PT1H'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ def test_mapping_of_energy_business_process(
id="when metering point type is net_consumption, then type of mp is D15",
),
pytest.param(
MeteringPointTypeDataProductValue.EFFECT_SETTLEMENT,
MeteringPointTypeDataProductValue.CAPACITY_SETTLEMENT,
"D19",
id="when metering point type is effect_settlement, then type of mp is D19",
id="when metering point type is capacity_settlement, then type of mp is D19",
),
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ public enum MeteringPointType
TotalConsumption = 11,
ElectricalHeating = 12,
NetConsumption = 13,
EffectSettlement = 14,
CapacitySettlement = 14,
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Map_WhenValidMeteringPointType_ReturnsExpectedString()
(MeteringPointType.TotalConsumption, WholesaleServicesRequestSeries.Types.MeteringPointType.TotalConsumption),
(MeteringPointType.ElectricalHeating, WholesaleServicesRequestSeries.Types.MeteringPointType.ElectricalHeating),
(MeteringPointType.NetConsumption, WholesaleServicesRequestSeries.Types.MeteringPointType.NetConsumption),
(MeteringPointType.EffectSettlement, WholesaleServicesRequestSeries.Types.MeteringPointType.EffectSettlement),
(MeteringPointType.CapacitySettlement, WholesaleServicesRequestSeries.Types.MeteringPointType.EffectSettlement),
};

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static WholesaleServicesRequestSeries.Types.MeteringPointType Map(Meterin
MeteringPointType.TotalConsumption => WholesaleServicesRequestSeries.Types.MeteringPointType.TotalConsumption,
MeteringPointType.ElectricalHeating => WholesaleServicesRequestSeries.Types.MeteringPointType.ElectricalHeating,
MeteringPointType.NetConsumption => WholesaleServicesRequestSeries.Types.MeteringPointType.NetConsumption,
MeteringPointType.EffectSettlement => WholesaleServicesRequestSeries.Types.MeteringPointType.EffectSettlement,
MeteringPointType.CapacitySettlement => WholesaleServicesRequestSeries.Types.MeteringPointType.EffectSettlement,
_ => throw new ArgumentOutOfRangeException(
nameof(seriesMeteringPointType),
actualValue: seriesMeteringPointType,
Expand Down

0 comments on commit 5099f93

Please sign in to comment.