Skip to content

Commit

Permalink
Created and integrated a tool to auto-generate the test example files…
Browse files Browse the repository at this point in the history
… from original example excel sheets (codeforboston#213)

* Update test example files by auto-generating them from original example excel files.
Fixes codeforboston#207

* Created and integrated a tool to auto-generate the test example files from original example excel sheets

* Add dependency types-openpyxl to pyproject.toml and regen requirements-dev.txt
  • Loading branch information
eriksynn authored Jul 2, 2024
1 parent aa12b23 commit 9033c6f
Show file tree
Hide file tree
Showing 27 changed files with 626 additions and 406 deletions.
5 changes: 4 additions & 1 deletion rules-engine/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ lint: black isort pydocstyle
mypy:
mypy .

gen_examples:
python .\tests\test_rules_engine\generate_example_data.py

test:
pytest .

build:
pip install -q build
python -m build

all: lint mypy test build
all: lint mypy gen_examples test build
2 changes: 2 additions & 0 deletions rules-engine/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ dev = [
"black",
"isort",
"mypy",
"openpyxl",
"pydantic",
"pydocstyle",
"pytest",
"types-openpyxl",
]

[tool.isort]
Expand Down
12 changes: 11 additions & 1 deletion rules-engine/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --extra=dev --output-file=requirements-dev.txt pyproject.toml
Expand All @@ -10,6 +10,12 @@ black==23.3.0
# via rules-engine (pyproject.toml)
click==8.1.3
# via black
colorama==0.4.6
# via
# click
# pytest
et-xmlfile==1.1.0
# via openpyxl
iniconfig==2.0.0
# via pytest
isort==5.12.0
Expand All @@ -20,6 +26,8 @@ mypy-extensions==1.0.0
# via
# black
# mypy
openpyxl==3.1.4
# via rules-engine (pyproject.toml)
packaging==23.1
# via
# black
Expand All @@ -40,6 +48,8 @@ pytest==7.3.2
# via rules-engine (pyproject.toml)
snowballstemmer==2.2.0
# via pydocstyle
types-openpyxl==3.1.4.20240626
# via rules-engine (pyproject.toml)
typing-extensions==4.6.3
# via
# mypy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
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
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
2019-03-03 00:00:00,2019-03-29 00:00:00,27,120,,1,4.444444444444445,4.0344026034402605,816.1999999999999,870.2,924.1999999999999,472.6657056529955,443.3345770558203,417.4310202921174,454.3234301930301,432.3457239186105
2019-03-31 00:00:00,2019-04-30 00:00:00,31,88,,0,2.838709677419355,2.428667836415171,511.29999999999995,570.0999999999999,632.0999999999999,,,,,
2019-05-02 00:00:00,2019-06-03 00:00:00,33,66,,0,2,1.5899581589958158,300.59999999999997,363.7000000000001,428.3000000000001,,,,,
2019-06-05 00:00:00,2019-06-27 00:00:00,23,18,,0,0.782608695652174,0.37256685464798983,18.300000000000004,42.40000000000001,85.00000000000001,,,,,
2019-06-29 00:00:00,2019-07-31 00:00:00,33,14,,-1,0.42424242424242425,0.014200583238240139,0,4.900000000000006,31,,,,,
2019-08-02 00:00:00,2019-08-28 00:00:00,27,13,,-1,0.48148148148148145,0.07143964047729734,13.599999999999994,28.400000000000006,59.000000000000014,,,,,
2019-08-30 00:00:00,2019-10-01 00:00:00,33,34,,0,1.0303030303030303,0.6202611892988461,94.19999999999997,145.39999999999998,206.79999999999995,,,,,
2019-10-03 00:00:00,2019-10-28 00:00:00,26,50,,0,1.9230769230769231,1.513035082072739,306.6,356.6,407.90000000000003,,,,,
2019-10-30 00:00:00,2019-11-27 00:00:00,29,118,,0,4.068965517241379,3.658923676237195,744.1999999999999,801.1,859.1,,,,,
2019-11-29 00:00:00,2019-12-30 00:00:00,32,158,,1,4.9375,4.527458158995816,1080.2000000000003,1144.2000000000003,1208.2000000000005,475.0156681042329,448.4460100386229,424.6912139432149,458.35103829708584,438.54098178015994
2020-01-01 00:00:00,2020-01-29 00:00:00,29,138,,1,4.758620689655173,4.348578848650988,925.8000000000001,983.8000000000001,1041.8000000000002,482.431719500463,453.98992266063084,428.7149989571209,464.42988335724937,443.5499619640123
2020-01-31 00:00:00,2020-02-26 00:00:00,27,140,,1,5.185185185185185,4.775143344181001,873.8,927.8,981.8,522.5716208369286,492.15680350000883,465.087678027407,502.4634428619403,481.85016413807745
2020-02-28 00:00:00,2020-03-30 00:00:00,32,127,,1,3.96875,3.558708158995816,773,837.0000000000001,901.0000000000001,521.7597128325043,481.86410755020995,447.63624641456795,495.40452969278266,468.32368540763724
2020-04-01 00:00:00,2020-04-28 00:00:00,28,86,,0,3.0714285714285716,2.6613867304243874,584.0999999999999,640.0999999999999,696.1,,,,,
2020-04-30 00:00:00,2020-05-27 00:00:00,28,44,,0,1.5714285714285714,1.1613867304243872,294.30000000000007,348.49999999999994,404.49999999999994,,,,,
2020-05-29 00:00:00,2020-06-26 00:00:00,29,14,,0,0.4827586206896552,0.07271677968547108,56.699999999999996,85.29999999999998,126.19999999999997,,,,,
2020-06-28 00:00:00,2020-07-29 00:00:00,32,11,,-1,0.34375,-0.06629184100418412,2,8.999999999999986,41.699999999999974,,,,,
2020-07-31 00:00:00,2020-08-27 00:00:00,28,9,,-1,0.32142857142857145,-0.08861326957561266,12.100000000000001,26.399999999999984,61.09999999999999,,,,,
2020-08-29 00:00:00,2020-09-28 00:00:00,31,22,,-1,0.7096774193548387,0.29963557835065463,141.6,187.99999999999997,243.8,,,,,
2020-09-30 00:00:00,2020-10-27 00:00:00,28,36,,0,1.2857142857142858,0.8756724447101016,322.2,377.20000000000005,433.20000000000005,,,,,
2020-10-29 00:00:00,2020-11-30 00:00:00,33,106,,0,3.212121212121212,2.8020793711170278,718.3999999999999,784.3999999999999,850.3999999999996,,,,,
2020-12-02 00:00:00,2020-12-28 00:00:00,27,131,,1,4.851851851851852,4.441810010847668,880.9000000000002,934.9000000000002,988.9000000000002,482.1751416588808,454.324614704576,429.5157066309112,464.5529813748081,444.09624803434394
2020-12-30 00:00:00,2021-01-28 00:00:00,30,122,,1,4.066666666666666,3.6566248256624823,1030.2,1090.2,1150.2,377.1271478612295,356.3716636641338,337.7815925288112,366.11758184428425,346.62574548398334
2021-01-30 00:00:00,2021-02-26 00:00:00,28,153,,1,5.464285714285714,5.05424387328153,1091.1000000000004,1147.1000000000004,1203.1000000000001,459.3644188743026,436.9388173949539,416.6008789242388,445.5838062073213,428.29382858258646
2021-02-28 00:00:00,2021-03-30 00:00:00,31,141,0,0,4.548387096774194,4.13834525577001,817.6999999999999,879.6999999999999,941.6999999999999,,,,,
2021-04-01 00:00:00,2021-04-29 00:00:00,29,77,,0,2.6551724137931036,2.2451305727889195,498.49999999999994,556.5,614.5,,,,,
2021-05-01 00:00:00,2021-05-28 00:00:00,28,38,,0,1.3571428571428572,0.947101016138673,212.69999999999993,262.09999999999997,318.00000000000006,,,,,
2021-05-30 00:00:00,2021-06-29 00:00:00,31,23,,0,0.7419354838709677,0.33189364286678363,68.1,101.69999999999999,145,,,,,
2021-07-01 00:00:00,2021-07-29 00:00:00,29,10,,-1,0.3448275862068966,-0.06521425479728754,21.6,45.800000000000004,90.99999999999999,,,,,
2021-07-31 00:00:00,2021-08-31 00:00:00,32,10,,-1,0.3125,-0.09754184100418412,7.499999999999986,25.19999999999999,53.39999999999998,,,,,
2021-09-02 00:00:00,2021-09-28 00:00:00,27,9,,-1,0.3333333333333333,-0.0767085076708508,42.19999999999999,78.29999999999998,125.69999999999999,,,,,
2021-09-30 00:00:00,2021-10-28 00:00:00,29,26,,0,0.896551724137931,0.48650988313374693,266.69999999999993,322.6999999999999,380.5,,,,,
2021-10-30 00:00:00,2021-11-29 00:00:00,31,102,,0,3.2903225806451615,2.8802807396409773,708.1,770.1,832.1,,,,,
2021-12-01 00:00:00,2021-12-27 00:00:00,27,111,,1,4.111111111111111,3.7010692701069265,783.6000000000001,837.6,891.6000000000001,451.6523085170684,422.53432301095364,396.9434151569928,433.95087028889066,411.1177757330167
2021-12-29 00:00:00,2022-01-27 00:00:00,30,166,,1,5.533333333333333,5.123291492329149,1154.1,1214.1,1274.1000000000001,471.66599173379444,448.35657776128176,427.24254066397623,457.1079162012784,439.605239321285
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"heating_system_efficiency": 0.85,
"other_fuel_usage": 0.41,
"other_fuel_usage_override": null,
"thermostat_set_point": 68.0,
"setback_temperature": 62.0,
"setback_hours_per_day": 12.0,
"estimated_balance_point": 68.0,
"balance_point_sensitivity": 2.0,
"average_indoor_temperature": 65.0,
"difference_between_ti_and_tbp": -3.0,
"thermostat_set_point": 68,
"setback_temperature": 62,
"setback_hours_per_day": 12,
"estimated_balance_point": 68,
"balance_point_sensitivity": 2,
"average_indoor_temperature": 65,
"difference_between_ti_and_tbp": -3,
"design_temperature": 8.4,
"whole_home_heat_loss_rate": 444,
"whole_home_heat_loss_rate": 444.0,
"standard_deviation_of_heat_loss_rate": 0.0787,
"average_heat_load": 28672,
"maximum_heat_load": 27340
"average_heat_load": 28672.0,
"maximum_heat_load": 27340.0
}
Loading

0 comments on commit 9033c6f

Please sign in to comment.