diff --git a/rules-engine/src/rules_engine/pydantic_models.py b/rules-engine/src/rules_engine/pydantic_models.py index d65e5a0f..3c233b14 100644 --- a/rules-engine/src/rules_engine/pydantic_models.py +++ b/rules-engine/src/rules_engine/pydantic_models.py @@ -5,7 +5,7 @@ from dataclasses import dataclass from datetime import date from enum import Enum -from typing import Annotated, Any, Optional +from typing import Annotated, Any, Optional, Sequence from pydantic import BaseModel, BeforeValidator, ConfigDict, Field @@ -104,7 +104,7 @@ class NaturalGasBillingRecordInput(BaseModel): class NaturalGasBillingInput(BaseModel): """From Natural Gas tab. Container for holding all rows of the billing input table.""" - records: list[NaturalGasBillingRecordInput] + records: Sequence[NaturalGasBillingRecordInput] class NormalizedBillingPeriodRecordBase(BaseModel): diff --git a/rules-engine/tests/test_rules_engine/cases/examples/breslow/natural-gas.csv b/rules-engine/tests/test_rules_engine/cases/examples/breslow/natural-gas.csv index f85c55d9..2e8f9629 100644 --- a/rules-engine/tests/test_rules_engine/cases/examples/breslow/natural-gas.csv +++ b/rules-engine/tests/test_rules_engine/cases/examples/breslow/natural-gas.csv @@ -1,36 +1,36 @@ -start_date,end_date,days_in_bill,usage,inclusion_code,inclusion_override,avg_daily_usage,daily_htg_usage -3/3/2019,3/29/2019,27,120,1,,4.44,4.03 -3/31/2019,4/30/2019,31,88,0,,2.84,2.43 -5/2/2019,6/3/2019,33,66,0,,2.00,1.59 -6/5/2019,6/27/2019,23,18,0,,0.78,0.37 -6/29/2019,7/31/2019,33,14,-1,,0.42,0.01 -8/2/2019,8/28/2019,27,13,-1,,0.48,0.07 -8/30/2019,10/1/2019,33,34,0,,1.03,0.62 -10/3/2019,10/28/2019,26,50,0,,1.92,1.51 -10/30/2019,11/27/2019,29,118,0,,4.07,3.66 -11/29/2019,12/30/2019,32,158,1,,4.94,4.53 -1/1/2020,1/29/2020,29,138,1,,4.76,4.35 -1/31/2020,2/26/2020,27,140,1,,5.19,4.78 -2/28/2020,3/30/2020,32,127,1,,3.97,3.56 -4/1/2020,4/28/2020,28,86,0,,3.07,2.66 -4/30/2020,5/27/2020,28,44,0,,1.57,1.16 -5/29/2020,6/26/2020,29,14,0,,0.48,0.07 -6/28/2020,7/29/2020,32,11,-1,,0.34,-0.07 -7/31/2020,8/27/2020,28,9,-1,,0.32,-0.09 -8/29/2020,9/28/2020,31,22,-1,,0.71,0.30 -9/30/2020,10/27/2020,28,36,0,,1.29,0.88 -10/29/2020,11/30/2020,33,106,0,,3.21,2.80 -12/2/2020,12/28/2020,27,131,1,,4.85,4.44 -12/30/2020,1/28/2021,30,122,1,,4.07,3.66 -1/30/2021,2/26/2021,28,153,1,,5.46,5.05 -2/28/2021,3/30/2021,31,141,0,0,4.55,4.14 -4/1/2021,4/29/2021,29,77,0,,2.66,2.25 -5/1/2021,5/28/2021,28,38,0,,1.36,0.95 -5/30/2021,6/29/2021,31,23,0,,0.74,0.33 -7/1/2021,7/29/2021,29,10,-1,,0.34,-0.07 -7/31/2021,8/31/2021,32,10,-1,,0.31,-0.10 -9/2/2021,9/28/2021,27,9,-1,,0.33,-0.08 -9/30/2021,10/28/2021,29,26,0,,0.90,0.49 -10/30/2021,11/29/2021,31,102,0,,3.29,2.88 -12/1/2021,12/27/2021,27,111,1,,4.11,3.70 -12/29/2021,1/27/2022,30,166,1,,5.53,5.12 \ No newline at end of file +start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage,hdd_at_66f,hdd_at_68f,hdd_at_70f,ua_at_66f,ua_at_68f,ua_at_70f,ua_sensitivity_at_0.31_therms,ua_sensitivity_at_0.51_therms,unused1,estimated_heating_use_therms,estimated_other_use_therms,estimated_total_use_therms,estimated_savings_therms,estimated_savings_percent,unused2,start_row,end_row +3/3/2019,3/29/2019,27,120,,1,4.44,4.03,816.2,870.2,924.2,472.7,443.3,417.4,454.3,432.3,,,,,,,,2986,3012 +3/31/2019,4/30/2019,31,88,,0,2.84,2.43,511.3,570.1,632.1, , , , , ,,,,,,,,3014,3044 +5/2/2019,6/3/2019,33,66,,0,2,1.59,300.6,363.7,428.3, , , , , ,,,,,,,,3046,3078 +6/5/2019,6/27/2019,23,18,,0,0.78,0.37,18.3,42.4,85, , , , , ,,,,,,,,3080,3102 +6/29/2019,7/31/2019,33,14,,-1,0.42,0.01,0,4.9,31, , , , , ,,,,,,,,3104,3136 +8/2/2019,8/28/2019,27,13,,-1,0.48,0.07,13.6,28.4,59, , , , , ,,,,,,,,3138,3164 +8/30/2019,10/1/2019,33,34,,0,1.03,0.62,94.2,145.4,206.8, , , , , ,,,,,,,,3166,3198 +10/3/2019,10/28/2019,26,50,,0,1.92,1.51,306.6,356.6,407.9, , , , , ,,,,,,,,3200,3225 +10/30/2019,11/27/2019,29,118,,0,4.07,3.66,744.2,801.1,859.1, , , , , ,,,,,,,,3227,3255 +11/29/2019,12/30/2019,32,158,,1,4.94,4.53,1080.2,1144.2,1208.2,475,448.4,424.7,458.4,438.5,,,,,,,,3257,3288 +1/1/2020,1/29/2020,29,138,,1,4.76,4.35,925.8,983.8,1041.8,482.4,454,428.7,464.4,443.5,,,,,,,,3290,3318 +1/31/2020,2/26/2020,27,140,,1,5.19,4.78,873.8,927.8,981.8,522.6,492.2,465.1,502.5,481.9,,,,,,,,3320,3346 +2/28/2020,3/30/2020,32,127,,1,3.97,3.56,773,837,901,521.8,481.9,447.6,495.4,468.3,,,,,,,,3348,3379 +4/1/2020,4/28/2020,28,86,,0,3.07,2.66,584.1,640.1,696.1, , , , , ,,,,,,,,3381,3408 +4/30/2020,5/27/2020,28,44,,0,1.57,1.16,294.3,348.5,404.5, , , , , ,,,,,,,,3410,3437 +5/29/2020,6/26/2020,29,14,,0,0.48,0.07,56.7,85.3,126.2, , , , , ,,,,,,,,3439,3467 +6/28/2020,7/29/2020,32,11,,-1,0.34,-0.07,2,9,41.7, , , , , ,,,,,,,,3469,3500 +7/31/2020,8/27/2020,28,9,,-1,0.32,-0.09,12.1,26.4,61.1, , , , , ,,,,,,,,3502,3529 +8/29/2020,9/28/2020,31,22,,-1,0.71,0.3,141.6,188,243.8, , , , , ,,,,,,,,3531,3561 +9/30/2020,10/27/2020,28,36,,0,1.29,0.88,322.2,377.2,433.2, , , , , ,,,,,,,,3563,3590 +10/29/2020,11/30/2020,33,106,,0,3.21,2.8,718.4,784.4,850.4, , , , , ,,,,,,,,3592,3624 +12/2/2020,12/28/2020,27,131,,1,4.85,4.44,880.9,934.9,988.9,482.2,454.3,429.5,464.6,444.1,,,,,,,,3626,3652 +12/30/2020,1/28/2021,30,122,,1,4.07,3.66,1030.2,1090.2,1150.2,377.1,356.4,337.8,366.1,346.6,,,,,,,,3654,3683 +1/30/2021,2/26/2021,28,153,,1,5.46,5.05,1091.1,1147.1,1203.1,459.4,436.9,416.6,445.6,428.3,,,,,,,,3685,3712 +2/28/2021,3/30/2021,31,141,0,0,4.55,4.14,817.7,879.7,941.7, , , , , ,,,,,,,,3714,3744 +4/1/2021,4/29/2021,29,77,,0,2.66,2.25,498.5,556.5,614.5, , , , , ,,,,,,,,3746,3774 +5/1/2021,5/28/2021,28,38,,0,1.36,0.95,212.7,262.1,318, , , , , ,,,,,,,,3776,3803 +5/30/2021,6/29/2021,31,23,,0,0.74,0.33,68.1,101.7,145, , , , , ,,,,,,,,3805,3835 +7/1/2021,7/29/2021,29,10,,-1,0.34,-0.07,21.6,45.8,91, , , , , ,,,,,,,,3837,3865 +7/31/2021,8/31/2021,32,10,,-1,0.31,-0.1,7.5,25.2,53.4, , , , , ,,,,,,,,3867,3898 +9/2/2021,9/28/2021,27,9,,-1,0.33,-0.08,42.2,78.3,125.7, , , , , ,,,,,,,,3900,3926 +9/30/2021,10/28/2021,29,26,,0,0.9,0.49,266.7,322.7,380.5, , , , , ,,,,,,,,3928,3956 +10/30/2021,11/29/2021,31,102,,0,3.29,2.88,708.1,770.1,832.1, , , , , ,,,,,,,,3958,3988 +12/1/2021,12/27/2021,27,111,,1,4.11,3.7,783.6,837.6,891.6,451.7,422.5,396.9,434,411.1,,,,,,,,3990,4016 +12/29/2021,1/27/2022,30,166,,1,5.53,5.12,1154.1,1214.1,1274.1,471.7,448.4,427.2,457.1,439.6,,,,,,,,4018,4047 \ No newline at end of file diff --git a/rules-engine/tests/test_rules_engine/cases/examples/cali/natural-gas.csv b/rules-engine/tests/test_rules_engine/cases/examples/cali/natural-gas.csv index 927afed5..564a3eb5 100644 --- a/rules-engine/tests/test_rules_engine/cases/examples/cali/natural-gas.csv +++ b/rules-engine/tests/test_rules_engine/cases/examples/cali/natural-gas.csv @@ -1,37 +1,37 @@ -start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage -2/28/2018,3/27/2018,28,132,,1,4.71,4.29 -3/28/2018,4/30/2018,34,98,,0,2.88,2.46 -5/1/2018,5/30/2018,30,23,,0,0.77,0.34 -5/31/2018,6/28/2018,29,16,,0,0.55,0.13 -6/29/2018,7/29/2018,31,16,,-1,0.52,0.09 -7/30/2018,8/27/2018,29,12,,-1,0.41,-0.01 -8/28/2018,9/26/2018,30,16,,-1,0.53,0.11 -9/27/2018,10/25/2018,29,37,,0,1.28,0.85 -10/26/2018,11/27/2018,33,119,,0,3.61,3.18 -11/28/2018,12/28/2018,31,151,,1,4.87,4.45 -12/29/2018,1/29/2019,32,183,,1,5.72,5.29 -1/30/2019,2/28/2019,30,158,,1,5.27,4.84 -3/1/2019,3/27/2019,27,128,,1,4.74,4.32 -3/28/2019,4/29/2019,33,64,,0,1.94,1.52 -4/30/2019,6/3/2019,35,41,,0,1.17,0.75 -6/4/2019,6/27/2019,24,11,,0,0.46,0.03 -6/28/2019,7/31/2019,34,13,,-1,0.38,-0.04 -8/1/2019,8/28/2019,28,11,,-1,0.39,-0.03 -8/29/2019,9/30/2019,33,15,,-1,0.45,0.03 -10/1/2019,10/25/2019,25,14,,0,0.56,0.14 -10/26/2019,11/27/2019,33,100,,0,3.03,2.61 -11/28/2019,1/2/2020,36,163,,1,4.53,4.10 -1/3/2020,1/30/2020,28,124,,1,4.43,4.00 -1/31/2020,2/28/2020,29,118,,1,4.07,3.65 -2/29/2020,3/30/2020,31,85,0,0,2.74,2.32 -3/31/2020,4/30/2020,31,93,,0,3.00,2.58 -5/1/2020,5/28/2020,28,36,,0,1.29,0.86 -5/29/2020,6/29/2020,32,13,,0,0.41,-0.02 -6/30/2020,7/29/2020,30,9,,-1,0.30,-0.12 -7/30/2020,8/27/2020,29,12,,-1,0.41,-0.01 -8/28/2020,9/28/2020,32,13,,-1,0.41,-0.02 -9/29/2020,10/27/2020,29,33,,0,1.14,0.71 -10/28/2020,11/30/2020,34,100,,0,2.94,2.52 -12/1/2020,12/29/2020,29,133,,1,4.59,4.16 -12/30/2020,1/29/2021,31,172,0,0,5.55,5.12 -1/30/2021,2/25/2021,27,167,,1,6.19,5.76 \ No newline at end of file +start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage,hdd_at_54f,hdd_at_56f,hdd_at_58f,ua_at_54f,ua_at_56f,ua_at_58f,ua_sensitivity_at_0.32_therms,ua_sensitivity_at_0.52_therms,unused1,estimated_heating_use_therms,estimated_other_use_therms,estimated_total_use_therms,estimated_savings_therms,estimated_savings_percent,unused2,start_row,end_row +2/28/2018,3/27/2018,28,132,,1,4.71,4.29,534.8,590.8,646.8,870.4,787.9,719.7,806.3,769.6,,,,,,,,2618,2645 +3/28/2018,4/30/2018,34,98,,0,2.88,2.46,332.1,393.3,455.4, , , , , ,,,,,,,,2646,2679 +5/1/2018,5/30/2018,30,23,,0,0.77,0.34,14,21.8,38.9, , , , , ,,,,,,,,2680,2709 +5/31/2018,6/28/2018,29,16,,0,0.55,0.13,2.1,4.1,9.6, , , , , ,,,,,,,,2710,2738 +6/29/2018,7/29/2018,31,16,,-1,0.52,0.09,0,0,0, , , , , ,,,,,,,,2739,2769 +7/30/2018,8/27/2018,29,12,,-1,0.41,-0.01,0,0,0, , , , , ,,,,,,,,2770,2798 +8/28/2018,9/26/2018,30,16,,-1,0.53,0.11,3.2,7.4,14.6, , , , , ,,,,,,,,2799,2828 +9/27/2018,10/25/2018,29,37,,0,1.28,0.85,106.3,132.7,171.2, , , , , ,,,,,,,,2829,2857 +10/26/2018,11/27/2018,33,119,,0,3.61,3.18,440.5,500.6,564.6, , , , , ,,,,,,,,2858,2890 +11/28/2018,12/28/2018,31,151,,1,4.87,4.45,600.2,660.2,721.3,890,809.2,740.6,827.3,791,,,,,,,,2891,2921 +12/29/2018,1/29/2019,32,183,,1,5.72,5.29,781.8,845.8,909.8,839.8,776.3,721.7,790.9,761.6,,,,,,,,2922,2953 +1/30/2019,2/28/2019,30,158,,1,5.27,4.84,714.4,774.4,834.4,788,727,674.7,742,712,,,,,,,,2954,2983 +3/1/2019,3/27/2019,27,128,,1,4.74,4.32,513.1,566.5,620.5,880.2,797.3,727.9,815.7,778.8,,,,,,,,2984,3010 +3/28/2019,4/29/2019,33,64,,0,1.94,1.52,186.2,237.5,293.5, , , , , ,,,,,,,,3011,3043 +4/30/2019,6/3/2019,35,41,,0,1.17,0.75,52.8,80,113.3, , , , , ,,,,,,,,3044,3078 +6/4/2019,6/27/2019,24,11,,0,0.46,0.03,0,0.2,2.2, , , , , ,,,,,,,,3079,3102 +6/28/2019,7/31/2019,34,13,,-1,0.38,-0.04,0,0,0, , , , , ,,,,,,,,3103,3136 +8/1/2019,8/28/2019,28,11,,-1,0.39,-0.03,0,0,0, , , , , ,,,,,,,,3137,3164 +8/29/2019,9/30/2019,33,15,,-1,0.45,0.03,0,1.5,4, , , , , ,,,,,,,,3165,3197 +10/1/2019,10/25/2019,25,14,,0,0.56,0.14,23,43.4,81.9, , , , , ,,,,,,,,3198,3222 +10/26/2019,11/27/2019,33,100,,0,3.03,2.61,407,466.3,528, , , , , ,,,,,,,,3223,3255 +11/28/2019,1/2/2020,36,163,,1,4.53,4.1,744.1,816.1,888.1,769.4,701.5,644.6,718.6,684.4,,,,,,,,3256,3291 +1/3/2020,1/30/2020,28,124,,1,4.43,4,569.1,621.1,673.1,763.5,699.6,645.5,717,682.1,,,,,,,,3292,3319 +1/31/2020,2/28/2020,29,118,,1,4.07,3.65,570,628,686,718.6,652.2,597.1,670.1,634.4,,,,,,,,3320,3348 +2/29/2020,3/30/2020,31,85,0,0,2.74,2.32,362.6,420.1,478.1, , , , , ,,,,,,,,3349,3379 +3/31/2020,4/30/2020,31,93,,0,3,2.58,267.7,327.7,387.7, , , , , ,,,,,,,,3380,3410 +5/1/2020,5/28/2020,28,36,,0,1.29,0.86,47.2,70.8,96.8, , , , , ,,,,,,,,3411,3438 +5/29/2020,6/29/2020,32,13,,0,0.41,-0.02,0,2,4.5, , , , , ,,,,,,,,3439,3470 +6/30/2020,7/29/2020,30,9,,-1,0.3,-0.12,0,0,0, , , , , ,,,,,,,,3471,3500 +7/30/2020,8/27/2020,29,12,,-1,0.41,-0.01,0,0,0, , , , , ,,,,,,,,3501,3529 +8/28/2020,9/28/2020,32,13,,-1,0.41,-0.02,19.8,29.8,39.8, , , , , ,,,,,,,,3530,3561 +9/29/2020,10/27/2020,29,33,,0,1.14,0.71,60.9,85.7,118.4, , , , , ,,,,,,,,3562,3590 +10/28/2020,11/30/2020,34,100,,0,2.94,2.52,352.2,408.1,465, , , , , ,,,,,,,,3591,3624 +12/1/2020,12/29/2020,29,133,,1,4.59,4.16,567,621,677.2,824.9,753.2,690.7,771.3,735.1,,,,,,,,3625,3653 +12/30/2020,1/29/2021,31,172,0,0,5.55,5.12,696.2,758.2,820.2, , , , , ,,,,,,,,3654,3684 +1/30/2021,2/25/2021,27,167,,1,6.19,5.76,719.2,773.2,827.2,838.1,779.6,728.7,793.1,766.1,,,,,,,,3685,3711 \ No newline at end of file diff --git a/rules-engine/tests/test_rules_engine/cases/examples/feldman/natural-gas.csv b/rules-engine/tests/test_rules_engine/cases/examples/feldman/natural-gas.csv index 0fdd2b71..167913dc 100644 --- a/rules-engine/tests/test_rules_engine/cases/examples/feldman/natural-gas.csv +++ b/rules-engine/tests/test_rules_engine/cases/examples/feldman/natural-gas.csv @@ -1,37 +1,37 @@ -start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage -1/23/2019,2/19/2019,28,200,,1,7.14,6.69 -2/20/2019,3/20/2019,29,191,,1,6.59,6.13 -3/21/2019,4/19/2019,30,115,,0,3.83,3.38 -4/20/2019,5/17/2019,28,67,,0,2.39,1.94 -5/18/2019,6/18/2019,32,30,,0,0.94,0.48 -6/19/2019,7/18/2019,30,13,,-1,0.43,-0.02 -7/19/2019,8/19/2019,32,14,,-1,0.44,-0.02 -8/20/2019,9/17/2019,29,13,,-1,0.45,-0.01 -9/18/2019,10/22/2019,35,43,,0,1.23,0.77 -10/23/2019,11/20/2019,29,115,,0,3.97,3.51 -11/21/2019,12/17/2019,27,161,,1,5.96,5.51 -12/18/2019,1/21/2020,35,234,,1,6.69,6.23 -1/22/2020,2/19/2020,29,177,,1,6.10,5.65 -2/20/2020,3/19/2020,29,146,,1,5.03,4.58 -3/20/2020,4/17/2020,29,118,,0,4.07,3.61 -4/18/2020,5/19/2020,32,93,,0,2.91,2.45 -5/20/2020,6/18/2020,30,25,,0,0.83,0.38 -6/19/2020,7/17/2020,29,16,,-1,0.55,0.10 -7/18/2020,8/18/2020,32,16,,-1,0.50,0.04 -8/19/2020,9/17/2020,30,15,,-1,0.50,0.04 -9/18/2020,10/20/2020,33,43,,0,1.30,0.85 -10/21/2020,11/18/2020,29,91,,0,3.14,2.68 -11/19/2020,12/21/2020,33,186,,1,5.64,5.18 -12/22/2020,1/20/2021,30,189,,1,6.30,5.84 -1/21/2021,2/18/2021,29,229,,1,7.90,7.44 -2/19/2021,3/17/2021,27,164,,1,6.07,5.62 -3/18/2021,4/16/2021,30,96,,0,3.20,2.74 -4/17/2021,5/18/2021,32,68,,0,2.13,1.67 -5/19/2021,6/17/2021,30,23,,0,0.77,0.31 -6/18/2021,7/19/2021,32,11,,-1,0.34,-0.11 -7/20/2021,8/17/2021,29,14,,-1,0.48,0.03 -8/18/2021,9/17/2021,31,13,,-1,0.42,-0.04 -9/18/2021,10/19/2021,32,28,,0,0.88,0.42 -10/20/2021,11/18/2021,30,89,,0,2.97,2.51 -11/19/2021,12/17/2021,29,124,,1,4.28,3.82 -12/18/2021,1/18/2022,32,184,,1,5.75,5.29 \ No newline at end of file +start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage,hdd_at_60.5f,hdd_at_61.5f,hdd_at_62.5f,ua_at_60.5f,ua_at_61.5f,ua_at_62.5f,ua_sensitivity_at_0.36_therms,ua_sensitivity_at_0.56_therms,unused1,estimated_heating_use_therms,estimated_other_use_therms,estimated_total_use_therms,estimated_savings_therms,estimated_savings_percent,unused2,start_row,end_row +1/23/2019,2/19/2019,28,200,,1,7.14,6.69,837.6,865.6,893.6,838.2,811.1,785.7,823.2,799,,,,,,,,2947,2974 +2/20/2019,3/20/2019,29,191,,1,6.59,6.13,836.6,865.6,894.6,796.8,770.1,745.2,782.7,757.6,,,,,,,,2975,3003 +3/21/2019,4/19/2019,30,115,,0,3.83,3.38,449.5,477.5,505.5, , , , , ,,,,,,,,3004,3033 +4/20/2019,5/17/2019,28,67,,0,2.39,1.94,231.3,256.6,282.6, , , , , ,,,,,,,,3034,3061 +5/18/2019,6/18/2019,32,30,,0,0.94,0.48,26.3,35.6,49, , , , , ,,,,,,,,3062,3093 +6/19/2019,7/18/2019,30,13,,-1,0.43,-0.02,0,0,0, , , , , ,,,,,,,,3094,3123 +7/19/2019,8/19/2019,32,14,,-1,0.44,-0.02,0,0,0, , , , , ,,,,,,,,3124,3155 +8/20/2019,9/17/2019,29,13,,-1,0.45,-0.01,3.5,7.3,11.3, , , , , ,,,,,,,,3156,3184 +9/18/2019,10/22/2019,35,43,,0,1.23,0.77,146.8,170.1,195.7, , , , , ,,,,,,,,3185,3219 +10/23/2019,11/20/2019,29,115,,0,3.97,3.51,497.8,525.8,553.8, , , , , ,,,,,,,,3220,3248 +11/21/2019,12/17/2019,27,161,,1,5.96,5.51,683.1,710.1,737.1,816.2,785.2,756.4,799.4,770.9,,,,,,,,3249,3275 +12/18/2019,1/21/2020,35,234,,1,6.69,6.23,955.2,990.2,1025.2,856,825.7,797.5,839,812.5,,,,,,,,3276,3310 +1/22/2020,2/19/2020,29,177,,1,6.1,5.65,802.8,831.8,860.8,765,738.3,713.5,751.4,725.2,,,,,,,,3311,3339 +2/20/2020,3/19/2020,29,146,,1,5.03,4.58,583.7,612.7,641.7,853,812.6,775.9,830.4,794.9,,,,,,,,3340,3368 +3/20/2020,4/17/2020,29,118,,0,4.07,3.61,467.6,496.6,525.6, , , , , ,,,,,,,,3369,3397 +4/18/2020,5/19/2020,32,93,,0,2.91,2.45,344.9,373.7,403.7, , , , , ,,,,,,,,3398,3429 +5/20/2020,6/18/2020,30,25,,0,0.83,0.38,29.8,38,49.3, , , , , ,,,,,,,,3430,3459 +6/19/2020,7/17/2020,29,16,,-1,0.55,0.1,0,0,0, , , , , ,,,,,,,,3460,3488 +7/18/2020,8/18/2020,32,16,,-1,0.5,0.04,0,0,0, , , , , ,,,,,,,,3489,3520 +8/19/2020,9/17/2020,30,15,,-1,0.5,0.04,12.4,16.8,22.6, , , , , ,,,,,,,,3521,3550 +9/18/2020,10/20/2020,33,43,,0,1.3,0.85,181.5,205.7,232.3, , , , , ,,,,,,,,3551,3583 +10/21/2020,11/18/2020,29,91,,0,3.14,2.68,383.5,408.9,436, , , , , ,,,,,,,,3584,3612 +11/19/2020,12/21/2020,33,186,,1,5.64,5.18,797.6,830.6,863.6,803.7,771.8,742.3,786.7,756.9,,,,,,,,3613,3645 +12/22/2020,1/20/2021,30,189,,1,6.3,5.84,788.4,818.4,848.4,833.9,803.3,774.9,817.1,789.6,,,,,,,,3646,3675 +1/21/2021,2/18/2021,29,229,,1,7.9,7.44,1022.6,1051.6,1080.6,791.3,769.4,748.8,779.8,759.1,,,,,,,,3676,3704 +2/19/2021,3/17/2021,27,164,,1,6.07,5.62,720.8,747.8,774.8,789.1,760.6,734.1,774.2,747.1,,,,,,,,3705,3731 +3/18/2021,4/16/2021,30,96,,0,3.2,2.74,396.9,426.1,456.1, , , , , ,,,,,,,,3732,3761 +4/17/2021,5/18/2021,32,68,,0,2.13,1.67,219.2,248.3,278.8, , , , , ,,,,,,,,3762,3793 +5/19/2021,6/17/2021,30,23,,0,0.77,0.31,43.1,49.1,57.6, , , , , ,,,,,,,,3794,3823 +6/18/2021,7/19/2021,32,11,,-1,0.34,-0.11,3.5,4.9,8.4, , , , , ,,,,,,,,3824,3855 +7/20/2021,8/17/2021,29,14,,-1,0.48,0.03,0,0,0, , , , , ,,,,,,,,3856,3884 +8/18/2021,9/17/2021,31,13,,-1,0.42,-0.04,0,0,1.5, , , , , ,,,,,,,,3885,3915 +9/18/2021,10/19/2021,32,28,,0,0.88,0.42,62.6,80.4,99.6, , , , , ,,,,,,,,3916,3947 +10/20/2021,11/18/2021,30,89,,0,2.97,2.51,380.3,408.3,436.4, , , , , ,,,,,,,,3948,3977 +11/19/2021,12/17/2021,29,124,,1,4.28,3.82,614.7,643.7,672.7,675.8,645.3,617.5,662.2,628.4,,,,,,,,3978,4006 +12/18/2021,1/18/2022,32,184,,1,5.75,5.29,968.4,1000.4,1032.4,656,635,615.3,647,623,,,,,,,,4007,4038 \ No newline at end of file diff --git a/rules-engine/tests/test_rules_engine/cases/examples/lewitus/natural-gas.csv b/rules-engine/tests/test_rules_engine/cases/examples/lewitus/natural-gas.csv index b3112918..0764197d 100644 --- a/rules-engine/tests/test_rules_engine/cases/examples/lewitus/natural-gas.csv +++ b/rules-engine/tests/test_rules_engine/cases/examples/lewitus/natural-gas.csv @@ -1,37 +1,37 @@ -start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage -3/17/2018,4/17/2018,32,222,,0,6.94,6.41 -4/18/2018,5/17/2018,30,72,,0,2.40,1.88 -5/18/2018,6/19/2018,33,48,,0,1.45,0.93 -6/20/2018,7/17/2018,28,13,,-1,0.46,-0.06 -7/18/2018,8/16/2018,30,11,,-1,0.37,-0.16 -8/17/2018,9/18/2018,33,17,,-1,0.52,-0.01 -9/19/2018,10/16/2018,28,35,,0,1.25,0.73 -10/17/2018,11/15/2018,30,167,,0,5.57,5.04 -11/16/2018,12/15/2018,30,278,,1,9.27,8.74 -12/16/2018,1/16/2019,32,303,,1,9.47,8.94 -1/17/2019,2/15/2019,30,329,,1,10.97,10.44 -2/16/2019,3/18/2019,31,268,,1,8.65,8.12 -3/19/2019,4/17/2019,30,147,,0,4.90,4.38 -4/18/2019,5/17/2019,30,85,,0,2.83,2.31 -5/18/2019,6/18/2019,32,51,,0,1.59,1.07 -6/19/2019,7/19/2019,31,17,,-1,0.55,0.02 -7/20/2019,8/19/2019,31,11,,-1,0.35,-0.17 -8/20/2019,9/17/2019,29,17,,-1,0.59,0.06 -9/18/2019,10/17/2019,30,39,,0,1.30,0.78 -10/18/2019,11/14/2019,28,127,,0,4.54,4.01 -11/15/2019,12/18/2019,34,276,,1,8.12,7.59 -12/19/2019,1/16/2020,29,235,,1,8.10,7.58 -1/17/2020,2/19/2020,34,306,,1,9.00,8.48 -2/20/2020,3/18/2020,28,170,,1,6.07,5.55 -3/19/2020,4/21/2020,34,165,,0,4.85,4.33 -4/22/2020,5/15/2020,24,82,,0,3.42,2.89 -5/16/2020,6/16/2020,32,60,,0,1.88,1.35 -6/17/2020,7/17/2020,31,25,,-1,0.81,0.28 -7/18/2020,8/14/2020,28,13,,-1,0.46,-0.06 -8/15/2020,9/15/2020,32,19,,-1,0.59,0.07 -9/16/2020,10/14/2020,29,41,,0,1.41,0.89 -10/15/2020,11/16/2020,33,142,,0,4.30,3.78 -11/17/2020,12/16/2020,30,243,,1,8.10,7.58 -12/17/2020,1/19/2021,34,335,,1,9.85,9.33 -1/20/2021,2/17/2021,29,335,,1,11.55,11.03 -2/18/2021,3/18/2021,29,255,,1,8.79,8.27 \ No newline at end of file +start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage,hdd_at_57.5f,hdd_at_59.5f,hdd_at_61.5f,ua_at_57.5f,ua_at_59.5f,ua_at_61.5f,ua_sensitivity_at_0.42_therms,ua_sensitivity_at_0.62_therms,unused1,estimated_heating_use_therms,estimated_other_use_therms,estimated_total_use_therms,estimated_savings_therms,estimated_savings_percent,unused2,start_row,end_row +3/17/2018,4/17/2018,32,222,,0,6.94,6.41,625.8,689.8,753.8, , , , , ,,,,,,,,2635,2666 +4/18/2018,5/17/2018,30,72,,0,2.4,1.88,137.2,175.3,221.9, , , , , ,,,,,,,,2667,2696 +5/18/2018,6/19/2018,33,48,,0,1.45,0.93,24.9,40.3,59.9, , , , , ,,,,,,,,2697,2729 +6/20/2018,7/17/2018,28,13,,-1,0.46,-0.06,0,0,1.8, , , , , ,,,,,,,,2730,2757 +7/18/2018,8/16/2018,30,11,,-1,0.37,-0.16,0,0,0, , , , , ,,,,,,,,2758,2787 +8/17/2018,9/18/2018,33,17,,-1,0.52,-0.01,2.2,5.3,9.3, , , , , ,,,,,,,,2788,2820 +9/19/2018,10/16/2018,28,35,,0,1.25,0.73,63.3,97.3,131.7, , , , , ,,,,,,,,2821,2848 +10/17/2018,11/15/2018,30,167,,0,5.57,5.04,404.7,462.7,520.7, , , , , ,,,,,,,,2849,2878 +11/16/2018,12/15/2018,30,278,,1,9.27,8.74,720.4,780.4,840.4,"1,365.30","1,260.30","1,170.40","1,274.80","1,245.90",,,,,,,,2879,2908 +12/16/2018,1/16/2019,32,303,,1,9.47,8.94,790.7,854.7,918.7,"1,357.50","1,255.90","1,168.40","1,269.90","1,241.80",,,,,,,,2909,2940 +1/17/2019,2/15/2019,30,329,,1,10.97,10.44,860.7,920.7,980.7,"1,365.00","1,276.00","1,197.90","1,288.20","1,263.80",,,,,,,,2941,2970 +2/16/2019,3/18/2019,31,268,,1,8.65,8.12,822,884,946,"1,148.50","1,068.00",998,"1,081.10","1,054.80",,,,,,,,2971,3001 +3/19/2019,4/17/2019,30,147,,0,4.9,4.38,400.9,457.8,515.8, , , , , ,,,,,,,,3002,3031 +4/18/2019,5/17/2019,30,85,,0,2.83,2.31,168.4,218.7,271, , , , , ,,,,,,,,3032,3061 +5/18/2019,6/18/2019,32,51,,0,1.59,1.07,12.1,19.2,35.6, , , , , ,,,,,,,,3062,3093 +6/19/2019,7/19/2019,31,17,,-1,0.55,0.02,0,0,0, , , , , ,,,,,,,,3094,3124 +7/20/2019,8/19/2019,31,11,,-1,0.35,-0.17,0,0,0, , , , , ,,,,,,,,3125,3155 +8/20/2019,9/17/2019,29,17,,-1,0.59,0.06,0.1,2.1,7.3, , , , , ,,,,,,,,3156,3184 +9/18/2019,10/17/2019,30,39,,0,1.3,0.78,52.7,85.1,121.4, , , , , ,,,,,,,,3185,3214 +10/18/2019,11/14/2019,28,127,,0,4.54,4.01,316.1,366.1,419.8, , , , , ,,,,,,,,3215,3242 +11/15/2019,12/18/2019,34,276,,1,8.12,7.59,760.4,828.4,896.4,"1,273.30","1,168.80","1,080.10","1,184.20","1,153.40",,,,,,,,3243,3276 +12/19/2019,1/16/2020,29,235,,1,8.1,7.58,638.2,692.9,750.8,"1,291.60","1,189.60","1,097.90","1,205.30","1,173.90",,,,,,,,3277,3305 +1/17/2020,2/19/2020,34,306,,1,9,8.48,903.6,971.6,1039.6,"1,196.00","1,112.30","1,039.50","1,125.40","1,099.20",,,,,,,,3306,3339 +2/20/2020,3/18/2020,28,170,,1,6.07,5.55,483.4,537.1,593,"1,205.00","1,084.50",982.3,"1,104.10","1,065.00",,,,,,,,3340,3367 +3/19/2020,4/21/2020,34,165,,0,4.85,4.33,454.7,522,590, , , , , ,,,,,,,,3368,3401 +4/22/2020,5/15/2020,24,82,,0,3.42,2.89,201.7,242.3,285.1, , , , , ,,,,,,,,3402,3425 +5/16/2020,6/16/2020,32,60,,0,1.88,1.35,17.3,32.6,52.9, , , , , ,,,,,,,,3426,3457 +6/17/2020,7/17/2020,31,25,,-1,0.81,0.28,0,0,0, , , , , ,,,,,,,,3458,3488 +7/18/2020,8/14/2020,28,13,,-1,0.46,-0.06,0,0,0, , , , , ,,,,,,,,3489,3516 +8/15/2020,9/15/2020,32,19,,-1,0.59,0.07,5,8.9,14.8, , , , , ,,,,,,,,3517,3548 +9/16/2020,10/14/2020,29,41,,0,1.41,0.89,84.1,114.1,150.1, , , , , ,,,,,,,,3549,3577 +10/15/2020,11/16/2020,33,142,,0,4.3,3.78,301.5,353.3,411.7, , , , , ,,,,,,,,3578,3610 +11/17/2020,12/16/2020,30,243,,1,8.1,7.58,573.4,633.4,693.4,"1,486.40","1,345.60","1,229.20","1,363.40","1,327.90",,,,,,,,3611,3640 +12/17/2020,1/19/2021,34,335,,1,9.85,9.33,844,912,980,"1,409.30","1,304.20","1,213.70","1,318.20","1,290.30",,,,,,,,3641,3674 +1/20/2021,2/17/2021,29,335,,1,11.55,11.03,929.8,987.8,1045.8,"1,289.80","1,214.10","1,146.80","1,225.10","1,203.10",,,,,,,,3675,3703 +2/18/2021,3/18/2021,29,255,,1,8.79,8.27,688.8,746.8,804.8,"1,305.60","1,204.20","1,117.40","1,218.70","1,189.60",,,,,,,,3704,3732 \ No newline at end of file diff --git a/rules-engine/tests/test_rules_engine/cases/examples/quateman/natural-gas.csv b/rules-engine/tests/test_rules_engine/cases/examples/quateman/natural-gas.csv index c1304d24..4a761eda 100644 --- a/rules-engine/tests/test_rules_engine/cases/examples/quateman/natural-gas.csv +++ b/rules-engine/tests/test_rules_engine/cases/examples/quateman/natural-gas.csv @@ -1,26 +1,26 @@ -start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage -10/3/2020,11/4/2020,33,29,,0,0.88,0.58 -11/6/2020,12/3/2020,28,36,,1,1.29,0.99 -12/5/2020,1/7/2021,34,97,,1,2.85,2.56 -1/9/2021,2/5/2021,28,105,,1,3.75,3.45 -2/7/2021,3/5/2021,27,98,,1,3.63,3.33 -3/7/2021,4/6/2021,31,66,,0,2.13,1.83 -4/8/2021,5/5/2021,28,22,,0,0.79,0.49 -5/7/2021,6/7/2021,32,19,,0,0.59,0.30 -6/9/2021,7/6/2021,28,7,,-1,0.25,-0.05 -7/8/2021,8/4/2021,28,10,,-1,0.36,0.06 -8/6/2021,9/8/2021,34,11,,-1,0.32,0.03 -9/10/2021,10/5/2021,26,8,,0,0.31,0.01 -10/7/2021,11/3/2021,28,13,,0,0.46,0.17 -11/5/2021,12/6/2021,32,41,0,0,1.28,0.99 -12/8/2021,1/5/2022,29,86,,1,2.97,2.67 -1/7/2022,2/3/2022,28,132,,1,4.71,4.42 -2/5/2022,3/7/2022,31,116,,1,3.74,3.45 -3/9/2022,4/4/2022,27,49,,0,1.81,1.52 -4/6/2022,5/5/2022,30,39,,0,1.30,1.00 -5/7/2022,6/6/2022,31,20,,0,0.65,0.35 -6/8/2022,7/5/2022,28,9,,-1,0.32,0.03 -7/7/2022,8/3/2022,28,7,,-1,0.25,-0.05 -8/5/2022,9/3/2022,30,8,,-1,0.27,-0.03 -9/5/2022,10/3/2022,29,8,,0,0.28,-0.02 -10/5/2022,11/3/2022,30,19,,0,0.63,0.34 \ No newline at end of file +start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage,hdd_at_50.5f,hdd_at_51.5f,hdd_at_52.5f,ua_at_50.5f,ua_at_51.5f,ua_at_52.5f,ua_sensitivity_at_0.2_therms,ua_sensitivity_at_0.4_therms,unused1,estimated_heating_use_therms,estimated_other_use_therms,estimated_total_use_therms,estimated_savings_therms,estimated_savings_percent,unused2,start_row,end_row +10/3/2020,11/4/2020,33,29,,0,0.88,0.58,104.9,120.6,136.6, , , , , ,,,,,,,,3566,3598 +11/6/2020,12/3/2020,28,36,,1,1.29,0.99,152.1,171.1,190.1,736.8,655,589.5,721.1,588.8,,,,,,,,3600,3627 +12/5/2020,1/7/2021,34,97,,1,2.85,2.56,559.7,592.7,625.7,627.9,592.9,561.7,616.1,569.8,,,,,,,,3629,3662 +1/9/2021,2/5/2021,28,105,,1,3.75,3.45,569.6,597.6,625.6,686.3,654.2,624.9,673.1,635.2,,,,,,,,3664,3691 +2/7/2021,3/5/2021,27,98,,1,3.63,3.33,550.3,577.3,604.3,661.2,630.2,602.1,649.2,611.3,,,,,,,,3693,3719 +3/7/2021,4/6/2021,31,66,,0,2.13,1.83,272.9,298.9,324.9, , , , , ,,,,,,,,3721,3751 +4/8/2021,5/5/2021,28,22,,0,0.79,0.49,68.1,84.1,102.9, , , , , ,,,,,,,,3753,3780 +5/7/2021,6/7/2021,32,19,,0,0.59,0.3,11.8,15.8,19.8, , , , , ,,,,,,,,3782,3813 +6/9/2021,7/6/2021,28,7,,-1,0.25,-0.05,0,0,0, , , , , ,,,,,,,,3815,3842 +7/8/2021,8/4/2021,28,10,,-1,0.36,0.06,0,0,0, , , , , ,,,,,,,,3844,3871 +8/6/2021,9/8/2021,34,11,,-1,0.32,0.03,0,0,0, , , , , ,,,,,,,,3873,3906 +9/10/2021,10/5/2021,26,8,,0,0.31,0.01,0,0,0, , , , , ,,,,,,,,3908,3933 +10/7/2021,11/3/2021,28,13,,0,0.46,0.17,21.9,27.9,35.8, , , , , ,,,,,,,,3935,3962 +11/5/2021,12/6/2021,32,41,0,0,1.28,0.99,310.4,339.1,368.1, , , , , ,,,,,,,,3964,3995 +12/8/2021,1/5/2022,29,86,,1,2.97,2.67,432.1,459.1,486.4,724.3,681.7,643.4,707.2,656.1,,,,,,,,3997,4025 +1/7/2022,2/3/2022,28,132,,1,4.71,4.42,732.9,760.9,788.9,682.3,657.2,633.9,672.1,642.3,,,,,,,,4027,4054 +2/5/2022,3/7/2022,31,116,,1,3.74,3.45,581.3,609.3,637.3,742.8,708.7,677.6,729.3,688.1,,,,,,,,4056,4086 +3/9/2022,4/4/2022,27,49,,0,1.81,1.52,255.6,279.6,303.6, , , , , ,,,,,,,,4088,4114 +4/6/2022,5/5/2022,30,39,,0,1.3,1,92.6,115.9,139.9, , , , , ,,,,,,,,4116,4145 +5/7/2022,6/6/2022,31,20,,0,0.65,0.35,12.6,16.6,21.2, , , , , ,,,,,,,,4147,4177 +6/8/2022,7/5/2022,28,9,,-1,0.32,0.03,0,0,0, , , , , ,,,,,,,,4179,4206 +7/7/2022,8/3/2022,28,7,,-1,0.25,-0.05,0,0,0, , , , , ,,,,,,,,4208,4235 +8/5/2022,9/3/2022,30,8,,-1,0.27,-0.03,0,0,0, , , , , ,,,,,,,,4237,4266 +9/5/2022,10/3/2022,29,8,,0,0.28,-0.02,0.4,2.6,6, , , , , ,,,,,,,,4268,4296 +10/5/2022,11/3/2022,30,19,,0,0.63,0.34,39.6,51.3,64, , , , , ,,,,,,,,4298,4327 \ No newline at end of file diff --git a/rules-engine/tests/test_rules_engine/cases/examples/shen/natural-gas.csv b/rules-engine/tests/test_rules_engine/cases/examples/shen/natural-gas.csv index 76a4521a..724ba54f 100644 --- a/rules-engine/tests/test_rules_engine/cases/examples/shen/natural-gas.csv +++ b/rules-engine/tests/test_rules_engine/cases/examples/shen/natural-gas.csv @@ -1,19 +1,19 @@ -start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage -12/8/2021,1/7/2022,31,218,,1,7.03,6.43 -1/8/2022,2/8/2022,32,312,,1,9.75,9.15 -2/9/2022,3/9/2022,29,200,,1,6.90,6.30 -3/10/2022,4/7/2022,29,128,,0,4.41,3.82 -4/8/2022,5/9/2022,32,80,,0,2.50,1.90 -5/10/2022,6/8/2022,30,30,,0,1.00,0.40 -6/9/2022,7/8/2022,30,22,,-1,0.73,0.14 -7/9/2022,8/9/2022,32,17,,-1,0.53,-0.07 -8/10/2022,9/8/2022,30,16,,-1,0.53,-0.06 -8/17/2022,10/7/2022,52,29,,0,0.56,-0.04 -10/8/2022,11/8/2022,32,66,,0,2.06,1.46 -11/9/2022,12/9/2022,31,157,,1,5.06,4.47 -12/10/2022,1/10/2023,32,221,,1,6.91,6.31 -1/11/2023,2/8/2023,29,215,,1,7.41,6.82 -2/9/2023,3/10/2023,30,199,,1,6.63,6.04 -3/11/2023,4/10/2023,31,138,,0,4.45,3.85 -4/11/2023,5/9/2023,29,62,,0,2.14,1.54 -5/10/2023,6/9/2023,31,20,,0,0.65,0.05 \ No newline at end of file +start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage,hdd_at_60f,hdd_at_61f,hdd_at_62f,ua_at_60f,ua_at_61f,ua_at_62f,ua_sensitivity_at_0.5_therms,ua_sensitivity_at_0.7_therms,unused1,estimated_heating_use_therms,estimated_other_use_therms,estimated_total_use_therms,estimated_savings_therms,estimated_savings_percent,unused2,start_row,end_row +12/8/2021,1/7/2022,31,218,,1,7.03,6.43,751.8,782.8,813.8,994.9,955.5,919.1,970.4,940.7,,,,,,,,3997,4027 +1/8/2022,2/8/2022,32,312,,1,9.75,9.15,1145.3,1177.3,1209.3,958.9,932.9,908.2,943.1,922.7,,,,,,,,4028,4059 +2/9/2022,3/9/2022,29,200,,1,6.9,6.3,772.3,801.3,830.3,886.9,854.8,825,868.4,841.3,,,,,,,,4060,4088 +3/10/2022,4/7/2022,29,128,,0,4.41,3.82,477.8,506.8,535.8, , , , , ,,,,,,,,4089,4117 +4/8/2022,5/9/2022,32,80,,0,2.5,1.9,301.4,333.4,365.4, , , , , ,,,,,,,,4118,4149 +5/10/2022,6/8/2022,30,30,,0,1,0.4,24.3,34.4,46.5, , , , , ,,,,,,,,4150,4179 +6/9/2022,7/8/2022,30,22,,-1,0.73,0.14,3.5,4.5,6.2, , , , , ,,,,,,,,4180,4209 +7/9/2022,8/9/2022,32,17,,-1,0.53,-0.07,0,0,0, , , , , ,,,,,,,,4210,4241 +8/10/2022,9/8/2022,30,16,,-1,0.53,-0.06,0,0,1.4, , , , , ,,,,,,,,4242,4271 +8/17/2022,10/7/2022,52,29,,0,0.56,-0.04,75.5,89.1,107.4, , , , , ,,,,,,,,4249,4300 +10/8/2022,11/8/2022,32,66,,0,2.06,1.46,219.2,244.2,270.8, , , , , ,,,,,,,,4301,4332 +11/9/2022,12/9/2022,31,157,,1,5.06,4.47,551.4,580.4,609.4,941.7,894.6,852.1,914.7,874.6,,,,,,,,4333,4363 +12/10/2022,1/10/2023,32,221,,1,6.91,6.31,814.8,846.8,878.8,929.1,894,861.4,908.1,879.8,,,,,,,,4364,4395 +1/11/2023,2/8/2023,29,215,,1,7.41,6.82,756.6,785.6,814.6,979.7,943.5,909.9,957.4,929.7,,,,,,,,4396,4424 +2/9/2023,3/10/2023,30,199,,1,6.63,6.04,697.3,727.3,757.3,973.7,933.6,896.6,949.1,918.1,,,,,,,,4425,4454 +3/11/2023,4/10/2023,31,138,,0,4.45,3.85,548,579,610, , , , , ,,,,,,,,4455,4485 +4/11/2023,5/9/2023,29,62,,0,2.14,1.54,220.8,244.8,268.8, , , , , ,,,,,,,,4486,4514 +5/10/2023,6/9/2023,31,20,,0,0.65,0.05,81.6,100.8,121.6, , , , , ,,,,,,,,4515,4545 \ No newline at end of file diff --git a/rules-engine/tests/test_rules_engine/cases/examples/vitti/natural-gas.csv b/rules-engine/tests/test_rules_engine/cases/examples/vitti/natural-gas.csv index b11a6bbd..dd83f5c0 100644 --- a/rules-engine/tests/test_rules_engine/cases/examples/vitti/natural-gas.csv +++ b/rules-engine/tests/test_rules_engine/cases/examples/vitti/natural-gas.csv @@ -1,37 +1,37 @@ -start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage -12/30/2018,1/29/2019,31,247,,1,7.97,7.37 -1/31/2019,2/28/2019,29,234,,1,8.07,7.48 -3/2/2019,3/27/2019,26,195,0,0,7.50,6.91 -3/29/2019,4/29/2019,32,135,,0,4.22,3.63 -5/1/2019,6/3/2019,34,83,,0,2.44,1.85 -6/5/2019,6/27/2019,23,16,,0,0.70,0.10 -6/29/2019,7/31/2019,33,21,,-1,0.64,0.04 -8/2/2019,8/28/2019,27,15,,-1,0.56,-0.04 -8/30/2019,10/1/2019,33,27,,0,0.82,0.22 -10/3/2019,10/25/2019,23,66,,0,2.87,2.28 -10/27/2019,11/27/2019,32,169,,0,5.28,4.69 -11/29/2019,1/2/2020,35,242,,1,6.91,6.32 -1/4/2020,1/30/2020,27,193,,1,7.15,6.55 -2/1/2020,2/28/2020,28,197,,1,7.04,6.44 -3/1/2020,3/30/2020,30,160,0,0,5.33,4.74 -4/1/2020,4/30/2020,30,138,,0,4.60,4.01 -5/2/2020,5/28/2020,27,68,,0,2.52,1.93 -5/30/2020,6/29/2020,31,22,,0,0.71,0.12 -7/1/2020,7/29/2020,29,16,,-1,0.55,-0.04 -7/31/2020,8/27/2020,28,15,,-1,0.54,-0.06 -8/29/2020,9/28/2020,31,29,,-1,0.94,0.34 -9/30/2020,10/29/2020,30,73,,0,2.43,1.84 -10/31/2020,11/30/2020,31,143,,0,4.61,4.02 -12/2/2020,12/29/2020,28,189,,1,6.75,6.16 -12/31/2020,1/29/2021,30,225,,1,7.50,6.91 -1/31/2021,2/25/2021,26,214,,1,8.23,7.64 -2/27/2021,3/30/2021,32,185,,1,5.78,5.19 -4/1/2021,4/29/2021,29,106,,0,3.66,3.06 -5/1/2021,5/28/2021,28,51,,0,1.82,1.23 -5/30/2021,6/29/2021,31,27,,0,0.87,0.28 -7/1/2021,7/29/2021,29,15,,-1,0.52,-0.08 -7/31/2021,9/1/2021,33,15,,-1,0.45,-0.14 -9/3/2021,9/28/2021,26,14,,-1,0.54,-0.05 -9/30/2021,10/27/2021,28,41,,0,1.46,0.87 -10/29/2021,11/29/2021,32,154,,0,4.81,4.22 -12/1/2021,12/27/2021,27,167,,1,6.19,5.59 \ No newline at end of file +start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage,hdd_at_62.5f,hdd_at_63.5f,hdd_at_64.5f,ua_at_62.5f,ua_at_63.5f,ua_at_64.5f,ua_sensitivity_at_0.49_therms,ua_sensitivity_at_0.69_therms,unused1,estimated_heating_use_therms,estimated_other_use_therms,estimated_total_use_therms,estimated_savings_therms,estimated_savings_percent,unused2,start_row,end_row +12/30/2018,1/29/2019,31,247,,1,7.97,7.37,1047.9,1078.9,1109.9,818.1,794.6,772.4,805.4,783.8,,,,,,,,2923,2953 +1/31/2019,2/28/2019,29,234,,1,8.07,7.48,945.4,974.4,1003.4,859.9,834.3,810.2,845.5,823.2,,,,,,,,2955,2983 +3/2/2019,3/27/2019,26,195,0,0,7.5,6.91,719,745,771, , , , , ,,,,,,,,2985,3010 +3/29/2019,4/29/2019,32,135,,0,4.22,3.63,416.8,445.8,475.7, , , , , ,,,,,,,,3012,3043 +5/1/2019,6/3/2019,34,83,,0,2.44,1.85,210.9,239.9,270, , , , , ,,,,,,,,3045,3078 +6/5/2019,6/27/2019,23,16,,0,0.7,0.1,7.4,9.4,12.3, , , , , ,,,,,,,,3080,3102 +6/29/2019,7/31/2019,33,21,,-1,0.64,0.04,0,0,0, , , , , ,,,,,,,,3104,3136 +8/2/2019,8/28/2019,27,15,,-1,0.56,-0.04,1.8,4,7.5, , , , , ,,,,,,,,3138,3164 +8/30/2019,10/1/2019,33,27,,0,0.82,0.22,34.7,47.2,62.7, , , , , ,,,,,,,,3166,3198 +10/3/2019,10/25/2019,23,66,,0,2.87,2.28,187.8,209.8,231.8, , , , , ,,,,,,,,3200,3222 +10/27/2019,11/27/2019,32,169,,0,5.28,4.69,676.2,707.2,738.2, , , , , ,,,,,,,,3224,3255 +11/29/2019,1/2/2020,35,242,,1,6.91,6.32,1046.8,1081.8,1116.8,792.5,766.9,742.9,779,754.8,,,,,,,,3257,3291 +1/4/2020,1/30/2020,27,193,,1,7.15,6.55,790.5,817.5,844.5,839.6,811.8,785.9,824.2,799.5,,,,,,,,3293,3319 +2/1/2020,2/28/2020,28,197,,1,7.04,6.44,799.7,827.7,855.7,845.9,817.3,790.5,830,804.6,,,,,,,,3321,3348 +3/1/2020,3/30/2020,30,160,0,0,5.33,4.74,595.4,625.4,655.4, , , , , ,,,,,,,,3350,3379 +4/1/2020,4/30/2020,30,138,,0,4.6,4.01,517.7,547.7,577.7, , , , , ,,,,,,,,3381,3410 +5/2/2020,5/28/2020,27,68,,0,2.52,1.93,187.4,208.9,231.3, , , , , ,,,,,,,,3412,3438 +5/30/2020,6/29/2020,31,22,,0,0.71,0.12,20.6,29.5,39.4, , , , , ,,,,,,,,3440,3470 +7/1/2020,7/29/2020,29,16,,-1,0.55,-0.04,0,0,0, , , , , ,,,,,,,,3472,3500 +7/31/2020,8/27/2020,28,15,,-1,0.54,-0.06,2.5,3.8,6.7, , , , , ,,,,,,,,3502,3529 +8/29/2020,9/28/2020,31,29,,-1,0.94,0.34,81.4,96.3,111.9, , , , , ,,,,,,,,3531,3561 +9/30/2020,10/29/2020,30,73,,0,2.43,1.84,265.4,293.4,322.3, , , , , ,,,,,,,,3563,3592 +10/31/2020,11/30/2020,31,143,,0,4.61,4.02,556.1,586.1,616.1, , , , , ,,,,,,,,3594,3624 +12/2/2020,12/29/2020,28,189,,1,6.75,6.16,816.7,844.7,872.7,791.6,765.3,740.8,777.7,752.9,,,,,,,,3626,3653 +12/31/2020,1/29/2021,30,225,,1,7.5,6.91,942.3,972.3,1002.3,824.6,799.1,775.2,810.7,787.6,,,,,,,,3655,3684 +1/31/2021,2/25/2021,26,214,,1,8.23,7.64,912.2,938.2,964.2,816.3,793.7,772.3,804.1,783.3,,,,,,,,3686,3711 +2/27/2021,3/30/2021,32,185,,1,5.78,5.19,737.5,769.5,801.5,844.2,809,776.7,824.6,793.5,,,,,,,,3713,3744 +4/1/2021,4/29/2021,29,106,,0,3.66,3.06,397,426,455, , , , , ,,,,,,,,3746,3774 +5/1/2021,5/28/2021,28,51,,0,1.82,1.23,131.6,153.3,176.7, , , , , ,,,,,,,,3776,3803 +5/30/2021,6/29/2021,31,27,,0,0.87,0.28,28,36.4,46.9, , , , , ,,,,,,,,3805,3835 +7/1/2021,7/29/2021,29,15,,-1,0.52,-0.08,7.9,10.9,14.2, , , , , ,,,,,,,,3837,3865 +7/31/2021,9/1/2021,33,15,,-1,0.45,-0.14,0,0.8,2.1, , , , , ,,,,,,,,3867,3899 +9/3/2021,9/28/2021,26,14,,-1,0.54,-0.05,5.8,10.7,18.3, , , , , ,,,,,,,,3901,3926 +9/30/2021,10/27/2021,28,41,,0,1.46,0.87,153.4,179,205, , , , , ,,,,,,,,3928,3955 +10/29/2021,11/29/2021,32,154,,0,4.81,4.22,620.5,652.5,684.5, , , , , ,,,,,,,,3957,3988 +12/1/2021,12/27/2021,27,167,,1,6.19,5.59,689.1,716.1,743.1,821.6,790.7,761.9,804.8,776.5,,,,,,,,3990,4016 \ No newline at end of file diff --git a/rules-engine/tests/test_rules_engine/cases/examples/yellepeddi/natural-gas.csv b/rules-engine/tests/test_rules_engine/cases/examples/yellepeddi/natural-gas.csv index dd3b931d..4dbcdf4e 100644 --- a/rules-engine/tests/test_rules_engine/cases/examples/yellepeddi/natural-gas.csv +++ b/rules-engine/tests/test_rules_engine/cases/examples/yellepeddi/natural-gas.csv @@ -1,21 +1,21 @@ -start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage -6/15/2021,7/14/2021,30,9,,-1,0.30,0.00 -7/15/2021,8/12/2021,29,9,,-1,0.31,0.01 -8/13/2021,9/14/2021,33,11,,-1,0.33,0.03 -9/15/2021,10/13/2021,29,23,,0,0.79,0.49 -10/14/2021,11/10/2021,28,75,,0,2.68,2.38 -11/11/2021,12/13/2021,33,140,0,0,4.24,3.94 -12/14/2021,1/12/2022,30,142,,1,4.73,4.43 -1/13/2022,2/10/2022,29,177,,1,6.10,5.80 -2/11/2022,3/14/2022,32,131,,1,4.09,3.79 -3/15/2022,4/13/2022,30,55,,0,1.83,1.53 -4/14/2022,5/13/2022,30,22,,0,0.73,0.43 -5/14/2022,6/13/2022,31,14,,0,0.45,0.15 -6/14/2022,7/14/2022,31,11,,-1,0.35,0.06 -7/15/2022,8/11/2022,28,6,,-1,0.21,-0.08 -8/12/2022,9/13/2022,33,9,,-1,0.27,-0.03 -9/14/2022,10/12/2022,29,24,,0,0.83,0.53 -10/13/2022,11/10/2022,29,52,,0,1.79,1.49 -11/11/2022,12/13/2022,33,111,,1,3.36,3.06 -12/14/2022,1/12/2023,30,137,,1,4.57,4.27 -1/13/2023,2/10/2023,29,132,,1,4.55,4.25 \ No newline at end of file +start_date,end_date,days_in_bill,usage,inclusion_override,inclusion_code,avg_daily_usage,daily_htg_usage,hdd_at_56.5f,hdd_at_57.5f,hdd_at_58.5f,ua_at_56.5f,ua_at_57.5f,ua_at_58.5f,ua_sensitivity_at_0.2_therms,ua_sensitivity_at_0.4_therms,unused1,estimated_heating_use_therms,estimated_other_use_therms,estimated_total_use_therms,estimated_savings_therms,estimated_savings_percent,unused2,start_row,end_row +6/15/2021,7/14/2021,30,9,,-1,0.3,0,0,0.5,1.5, , , , , ,,,,,,,,3821,3850 +7/15/2021,8/12/2021,29,9,,-1,0.31,0.01,0,0,0, , , , , ,,,,,,,,3851,3879 +8/13/2021,9/14/2021,33,11,,-1,0.33,0.03,0,0,0, , , , , ,,,,,,,,3880,3912 +9/15/2021,10/13/2021,29,23,,0,0.79,0.49,8.2,12.5,18.1, , , , , ,,,,,,,,3913,3941 +10/14/2021,11/10/2021,28,75,,0,2.68,2.38,199.3,220.3,242, , , , , ,,,,,,,,3942,3969 +11/11/2021,12/13/2021,33,140,0,0,4.24,3.94,543.9,575.9,607.9, , , , , ,,,,,,,,3970,4002 +12/14/2021,1/12/2022,30,142,,1,4.73,4.43,696.7,726.7,756.7,755.8,724.6,695.9,741,708.3,,,,,,,,4003,4032 +1/13/2022,2/10/2022,29,177,,1,6.1,5.8,906.1,935.1,964.1,735.4,712.6,691.1,724.8,700.3,,,,,,,,4033,4061 +2/11/2022,3/14/2022,32,131,,1,4.09,3.79,730.7,762.7,794.7,657.8,630.2,604.9,646.8,613.6,,,,,,,,4062,4093 +3/15/2022,4/13/2022,30,55,,0,1.83,1.53,312.1,339.9,368.9, , , , , ,,,,,,,,4094,4123 +4/14/2022,5/13/2022,30,22,,0,0.73,0.43,164,190,217.5, , , , , ,,,,,,,,4124,4153 +5/14/2022,6/13/2022,31,14,,0,0.45,0.15,0.4,1.4,3.8, , , , , ,,,,,,,,4154,4184 +6/14/2022,7/14/2022,31,11,,-1,0.35,0.06,0,1,2, , , , , ,,,,,,,,4185,4215 +7/15/2022,8/11/2022,28,6,,-1,0.21,-0.08,0,0,0, , , , , ,,,,,,,,4216,4243 +8/12/2022,9/13/2022,33,9,,-1,0.27,-0.03,0,0,0, , , , , ,,,,,,,,4244,4276 +9/14/2022,10/12/2022,29,24,,0,0.83,0.53,60.8,76.2,93.1, , , , , ,,,,,,,,4277,4305 +10/13/2022,11/10/2022,29,52,,0,1.79,1.49,130.2,149.2,168.3, , , , , ,,,,,,,,4306,4334 +11/11/2022,12/13/2022,33,111,,1,3.36,3.06,543.1,574.1,605.1,737.1,697.3,661.6,720.1,674.6,,,,,,,,4335,4367 +12/14/2022,1/12/2023,30,137,,1,4.57,4.27,641.2,671.2,701.2,790.4,755.1,722.8,772.8,737.4,,,,,,,,4368,4397 +1/13/2023,2/10/2023,29,132,,1,4.55,4.25,634.4,663.4,692.4,769.5,735.9,705.1,753.2,718.6,,,,,,,,4398,4426 \ No newline at end of file diff --git a/rules-engine/tests/test_rules_engine/test_examples.py b/rules-engine/tests/test_rules_engine/test_examples.py index cab80ee8..28b51d65 100644 --- a/rules-engine/tests/test_rules_engine/test_examples.py +++ b/rules-engine/tests/test_rules_engine/test_examples.py @@ -23,18 +23,31 @@ # Each subdirectory contains a JSON file (named summary.json) which specifies the inputs for the test runner ROOT_DIR = pathlib.Path(__file__).parent / "cases" / "examples" -# Filter out example 2 for now, since it's for oil fuel type -INPUT_DATA = filter(lambda d: d != "example-2", next(os.walk(ROOT_DIR))[1]) -# INPUT_DATA = filter(lambda d: d == "cali", next(os.walk(ROOT_DIR))[1]) +# TODO: example-2 is OIL; need to find the source data for example-1 and example-4 for Natural Gas and update csv +YET_TO_BE_UPDATED_EXAMPLES = ("example-1", "example-2", "example-4") +# Filter out failing examples for now +INPUT_DATA = filter( + lambda d: d not in YET_TO_BE_UPDATED_EXAMPLES, next(os.walk(ROOT_DIR))[1] +) class Summary(SummaryInput, SummaryOutput): local_weather_station: str +# Extend NG Billing Record Input to capture whole home heat loss input from example data +class NaturalGasBillingRecordExampleInput(NaturalGasBillingRecordInput): + whole_home_heat_loss_rate: float + + +# Then overload NG Billing Input to contain new NG Billing Record Example Input subclass +class NaturalGasBillingExampleInput(NaturalGasBillingInput): + records: list[NaturalGasBillingRecordExampleInput] + + class Example(BaseModel): summary: Summary - natural_gas_usage: NaturalGasBillingInput + natural_gas_usage: NaturalGasBillingExampleInput temperature_data: TemperatureInput @@ -44,7 +57,9 @@ def load_summary(folder: str) -> Summary: return Summary(**d) -def load_natural_gas(folder: str) -> NaturalGasBillingInput: +def load_natural_gas( + folder: str, estimated_balance_point: float +) -> NaturalGasBillingExampleInput: records = [] with open(ROOT_DIR / folder / "natural-gas.csv") as f: @@ -57,17 +72,42 @@ def load_natural_gas(folder: str) -> NaturalGasBillingInput: else: inclusion_override = int(inclusion_override) - item = NaturalGasBillingRecordInput( + # Choose the correct billing period heat loss (aka "ua") column based on the estimated balance point provided in SummaryOutput + ua_column_name = None + # First we will look for an exact match to the value of the estimated balance point + for column_name in row: + if ( + "ua_at_" in column_name + and str(estimated_balance_point) in column_name + ): + ua_column_name = column_name + break + # If we don't find that exact match, we round the balance point up to find our match + # It's possible that with further updates to summary data in xls and regen csv files, we wouldn't have this case + if ua_column_name == None: + ua_column_name = ( + "ua_at_" + str(int(round(estimated_balance_point, 0))) + "f" + ) + ua = ( + row[ua_column_name].replace(",", "").strip() + ) # Remove commas and whitespace to cleanup the data + if bool(ua): + whole_home_heat_loss_rate = float(ua) + else: + whole_home_heat_loss_rate = 0 + + item = NaturalGasBillingRecordExampleInput( period_start_date=datetime.strptime( row["start_date"], "%m/%d/%Y" ).date(), period_end_date=datetime.strptime(row["end_date"], "%m/%d/%Y").date(), usage_therms=row["usage"], inclusion_override=inclusion_override, + whole_home_heat_loss_rate=whole_home_heat_loss_rate, ) records.append(item) - return NaturalGasBillingInput(records=records) + return NaturalGasBillingExampleInput(records=records) def load_temperature_data(weather_station: str) -> TemperatureInput: @@ -89,7 +129,9 @@ def data(request): summary = load_summary(request.param) if summary.fuel_type == engine.FuelType.GAS: - natural_gas_usage = load_natural_gas(request.param) + natural_gas_usage = load_natural_gas( + request.param, summary.estimated_balance_point + ) else: natural_gas_usage = None @@ -159,7 +201,7 @@ def test_average_heat_load_natural_gas(data: Example) -> None: ) -def test_design_temperaure_natural_gas(data: Example) -> None: +def test_design_temperature_natural_gas(data: Example) -> None: rules_engine_result = engine.get_outputs_natural_gas( data.summary, data.temperature_data, data.natural_gas_usage ) @@ -175,3 +217,22 @@ def test_maximum_heat_load_natural_gas(data: Example) -> None: assert rules_engine_result.summary_output.maximum_heat_load == approx( data.summary.maximum_heat_load, abs=1 ) + + +def test_billing_records_whole_home_heat_loss_rate(data: Example) -> None: + rules_engine_result = engine.get_outputs_natural_gas( + data.summary, data.temperature_data, data.natural_gas_usage + ) + + data_iter = iter(data.natural_gas_usage.records) + for result in rules_engine_result.billing_records: + example = next(data_iter) + whole_home_heat_loss_rate = ( + example.whole_home_heat_loss_rate + if example.whole_home_heat_loss_rate + else None + ) + + assert result.whole_home_heat_loss_rate == approx( + whole_home_heat_loss_rate, abs=0.1 + )