Skip to content

Split costing calculations and PDF template generation

Pre-release
Pre-release

Choose a tag to compare

@craastad craastad released this 10 Dec 09:14
· 56 commits to main since this release
831c422

Summary

This versionrepresents a major architectural overhaul of the PyFECONS codebase, systematically separating calculation logic from report generation. The changes establish a clean separation of concerns between costing calculations and presentation logic, while simultaneously implementing robust code quality standards and development tooling.

Key Changes

• Split Costing & Report: Extracted all report generation functionality from the costing module into a dedicated report module, creating a clear boundary between business logic and presentation layer

• CAS Code Refactoring: Split all CAS (Cost Account Structure) calculations and their corresponding report specifications, covering CAS10 through CAS90 across both IFE and MFE reactor types. Share calculations between IFE and MFE whenever possible.

• Report Section Architecture: Created individual report section classes for each cost category (CAS220101, CAS220102, etc.) with dedicated template handling and content generation.

• Figure Generation Extraction: Moved figure generation logic (radial build, capacity derate, target PFR) into external classes to reduce coupling between costing and visualization.

• Cost Table Restructuring: Relocated cost table functionality from costing to report modules with specialized builders for IFE and MFE.

• Code Quality Infrastructure: Updated styling setup with pre-commit hooks, flake8 configuration, black formatting, and pre commit checks. Added setup-dev.sh runner script.

• Data Structure Improvements: Renamed and restructured data classes to avoid circular imports and improve code organization. Extracted individual data classes.

This refactoring significantly improves code maintainability and eliminates coupling between costing and report generation, establishing a solid foundation for creating automated tests for costing calculations.