Integrate kpi-calculator from PyPI#63
Conversation
a713153 to
685a0eb
Compare
5617f0c to
2122d49
Compare
There was a problem hiding this comment.
Pull request overview
This PR integrates KPI calculation functionality into the simulator-worker by adding the kpi-calculator package from PyPI. The integration adds KPI computation to the simulation workflow while maintaining graceful error handling to ensure simulations can complete even if KPI calculation fails.
Changes:
- Added kpi-calculator>=0.1.1 dependency and updated urllib3 to 2.6.3
- Integrated KPI calculation into simulator_worker.py after simulation completion
- Added convert_simulator_to_kpi_format utility function to transform simulator output format to KPI calculator format
- Added comprehensive integration tests for KPI functionality
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Added kpi-calculator dependency and updated pytest configuration to include new test file |
| dev-requirements.txt | Updated urllib3 dependency version |
| src/simulator_worker/simulator_worker.py | Integrated KPI calculation workflow with error handling |
| src/simulator_worker/utils.py | Added utility function to convert simulator DataFrame format to KPI calculator format |
| unit_test/test_kpi_integration.py | Added comprehensive integration tests for KPI functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2122d49 to
7ae989c
Compare
969737b to
5ee1199
Compare
5ee1199 to
85a8e8c
Compare
85a8e8c to
6c4befb
Compare
6c4befb to
770dfb1
Compare
|
This PR is now updated with the new pre-release of the KPI calculator. |
770dfb1 to
3615575
Compare
b2d21ae to
4e5a900
Compare
…imulator worker - Bump kpi-calculator to 0.4.1 - Pass simulation results to calculate_kpis_from_simulator - Embed KPI results in output ESDL via build_esdl_string_with_kpis - Support optional system_lifetime, discount_rate, and round_up_replacement config params - Add end-to-end integration test verifying CAPEX, OPEX, and energy KPIs
4e5a900 to
6c6f6e0
Compare
samvanderzwan
left a comment
There was a problem hiding this comment.
Some small comments
4f54bad to
c2d017f
Compare
…uality
- Bump kpi-calculator to >=0.4.2a1 to get DEFAULT_SYSTEM_LIFETIME_YEARS
and DEFAULT_DISCOUNT_RATE_PERCENT from the public API
- Add save_debug_esdl() to capture input/output ESDL files per run;
opt-in via debug_esdl workflow config key
- Upload debug ESDL as CI artifact on every test run for inspection
- Move _parse_bool_config/_parse_float_config to utils.py with proper
defaults and warnings when system_lifetime or discount_rate are absent
- Rewrite integration tests with unittest.TestCase, AAA pattern, and
setUpClass; add TestAllKPICategories covering all KPI categories
(costs, NPV, energy, CO2 emissions) with debug artifact enabled
1649c9f to
f0c1af5
Compare
Bump kpi-calculator from 0.4.2a1 to 0.4.2a2 in pyproject.toml, requirements.txt, and dev-requirements.txt. Save ESDL files from integration tests to a temp dir with automatic cleanup. Suppress the parameterized mypy warning via config instead of a per-line type: ignore comment.
f0c1af5 to
bc7cd07
Compare
Thank you for your comments, @samvanderzwan. |
|
The kpi calculator version can now be updated to v0.4.2a6 |
kpi-calculator>=0.4.1as a dependencycalculate_kpis_from_simulatorandbuild_esdl_string_with_kpisto compute KPIs and embed the results into the output ESDL stringsystem_lifetime(years),discount_rate(%), andround_up_replacement(bool, defaultTruefor MESIDO optimizer compatibility)