elecevm 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
elecevm-0.1.0/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Kyle Hagen
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
elecevm-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: elecevm
3
+ Version: 0.1.0
4
+ Summary: Earned value management engine for electrical construction contractors — reference implementation of the Electrical EVM Recommended Practice
5
+ Author: Kyle Hagen
6
+ License: Apache-2.0
7
+ Project-URL: Documentation, https://github.com/kylehagen2026/elecevm/blob/main/docs/standard.md
8
+ Project-URL: Source, https://github.com/kylehagen2026/elecevm
9
+ Keywords: earned value,EVM,ANSI-748,EIA-748,electrical construction,specialty contractor,project controls,Primavera P6,XER,Viewpoint Vista,job cost,rules of credit
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Other Audience
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Office/Business :: Scheduling
18
+ Classifier: Topic :: Office/Business :: Financial :: Accounting
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Provides-Extra: charts
23
+ Requires-Dist: matplotlib>=3.7; extra == "charts"
24
+ Provides-Extra: xlsx
25
+ Requires-Dist: openpyxl>=3.1; extra == "xlsx"
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7; extra == "dev"
28
+ Requires-Dist: matplotlib>=3.7; extra == "dev"
29
+ Requires-Dist: openpyxl>=3.1; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # elecevm — earned value for electrical construction
33
+
34
+ **elecevm** is an open earned-value management (EVM) engine for electrical specialty
35
+ contractors. It is the reference implementation of
36
+ [*Earned Value Management for Electrical Construction — A Recommended Practice for
37
+ Specialty Contractors*](docs/standard.md), which adapts ANSI/EIA-748 to how trade
38
+ contractors actually run work: labor-hour-driven scope, weekly payroll statusing,
39
+ a CPM schedule owned by the CM, and a job-cost ledger that was never designed to
40
+ feed an EVM system.
41
+
42
+ It takes three things every contractor already has — the schedule, the job-cost
43
+ detail, and what the foremen installed this week — and produces defensible
44
+ planned value, earned value, actual cost, indices, estimates at completion, a
45
+ funding-crossover forecast and a Weekly Status Report, with every number tied
46
+ back to its source and every statused week locked.
47
+
48
+ Pure Python 3.11+, no required dependencies. Charts and `.xlsx` ingest are optional extras.
49
+
50
+ ## Why
51
+
52
+ Electrical contractors keep cost in Vista, Spectrum or Sage and schedules in P6,
53
+ and the two never meet. EVM practice lives at the owner/CM level and in defense
54
+ work; specialty trades get a percent-complete column and a gut feel. This engine
55
+ makes the connection reproducible:
56
+
57
+ - **Planned value** from a cost-loaded copy of your own activities, allocated from
58
+ the estimate so that every discipline ties exactly and terminal PV equals BAC.
59
+ - **Earned value** from field quantities through published electrical rules of
60
+ credit (conduit, feeders, gear, fixtures, fire alarm, telecom, instrumentation …),
61
+ with measurement tiers so an invoiced percent is never mistaken for a physical one.
62
+ - **Actual cost** bucketed by transaction date to payroll weeks, reconciled to the
63
+ job-cost report to the cent, with declared basis rules per cost type (raw,
64
+ marked-up, or billed with a residual week).
65
+ - **Analysis** on dollars *and* labor hours — the hours indices are what the field
66
+ can act on — plus every EAC method with one selected by rule, TCPI, thresholds,
67
+ crew curves and the week the AC curve crosses the funding line.
68
+ - **A locked status log.** Statused weeks are never rewritten; restatements carry a
69
+ baseline change request and the old record stays in the file.
70
+ - **Thirteen integrity checks** on every run (terminal PV = BAC, allocation ties,
71
+ hours conserved, AC reconciles, EV ≤ BAC, history contiguous, CO log ties, EAC
72
+ not below statistical, every activity in the baseline …). A run that fails a check says so and exits non-zero.
73
+
74
+ ## Install
75
+
76
+ ```bash
77
+ pip install elecevm # core
78
+ pip install "elecevm[charts]" # + matplotlib for the report charts
79
+ pip install "elecevm[xlsx]" # + openpyxl for .xlsx job-cost exports
80
+ ```
81
+
82
+ From a checkout: `pip install -e ".[dev]"` then `pytest`.
83
+
84
+ ## Try it in one command
85
+
86
+ ```bash
87
+ elecevm example --out elecevm-example
88
+ ```
89
+
90
+ This writes a synthetic distribution-center electrical project (22 activities,
91
+ three disciplines, ~960 ledger lines, weekly field quantities), builds the
92
+ baseline, statuses 26 payroll weeks into a locked log and renders
93
+ `wsr_wk26.html` — a Weekly Status Report with the cost curve, crew chart,
94
+ discipline table, EAC methods, activity earned value and the integrity checks.
95
+ The same inputs and outputs are committed under [`examples/distribution-center`](examples/distribution-center).
96
+
97
+ ## Using it on a project
98
+
99
+ ```text
100
+ project/
101
+ ├── elecevm.toml # calendars, disciplines, budget on two bases, CO log, AC basis rules
102
+ ├── schedule.csv # or a P6 .xer export
103
+ ├── jobcost.csv # Vista-style JC Detail export (.csv or .xlsx)
104
+ └── quantities.csv # weekly field progress by activity
105
+ ```
106
+
107
+ ```bash
108
+ elecevm init project/ # writes a commented elecevm.toml
109
+ elecevm baseline --project elecevm.toml --schedule schedule.csv --out baseline.json
110
+ elecevm status --project elecevm.toml --schedule schedule.csv --baseline baseline.json \
111
+ --jobcost jobcost.csv --quantities quantities.csv \
112
+ --data-date 2026-09-05 --log status_log.jsonl --out snapshot.json
113
+ elecevm report --project elecevm.toml --schedule schedule.csv --baseline baseline.json \
114
+ --jobcost jobcost.csv --quantities quantities.csv --log status_log.jsonl --out wsr.html
115
+ elecevm check ... # integrity checks only, exit 2 on failure
116
+ elecevm backfill ... --through 2026-09-05 # status every unstatused week into the log
117
+ ```
118
+
119
+ Options worth knowing: `--source-totals "L=hours:amount,M=...,S=..."` (or a JSON
120
+ file) gives the totals printed on the job-cost report so check 5 can reconcile the
121
+ pull against something independent — without it the check is reported as NOT RUN;
122
+ `--billed-labor` / `--billed-material` supply billed-to-date values for the
123
+ *billed* AC basis; `--management-etc` supplies a bottom-up estimate to complete so
124
+ the reported EAC can follow the `max(management, BAC/CPI)` rule; `--invoiced-pct`
125
+ feeds Tier 3 activities; `--schedule-data-date` tells a backfill when the schedule
126
+ file was statused so earlier weeks are interpolated rather than taking a later
127
+ percent complete.
128
+
129
+ A week whose checks fail is **not** written to the log (pass
130
+ `--allow-failed-checks` to lock it with the failures recorded). Each `status`
131
+ saves the raw pull under `pulls/` beside the log; the next status compares the
132
+ two and annotates any late posting into a locked week (RP §7.2) instead of
133
+ rewriting that week's row.
134
+
135
+ ### Inputs
136
+
137
+ **`elecevm.toml`** — see [`src/elecevm/config.py`](src/elecevm/config.py) (`template_toml()`)
138
+ for the commented schema: project start and payroll week-ending day, work calendar
139
+ and holidays, standard hours per head per week, contracted value (the funding line),
140
+ reporting basis (`contracted` or `estimated`), disciplines with composite rates,
141
+ budget by discipline × cost type on each basis, the change-order log, AC basis per
142
+ cost type, EAC policy and thresholds, optional crew-cap leveling, and the
143
+ phase → discipline and cost-type maps for the ledger.
144
+
145
+ **Schedule** — a CSV with `id, name, discipline, area, start, finish, actual_start,
146
+ actual_finish, forecast_finish, original_duration, percent_complete, budget_hours,
147
+ hours_per_day, area_weight, activity_factor, ev_method, commodity, base_activity`,
148
+ or a P6 `.xer` (TASK/PROJWBS/TASKRSRC tables; discipline and area resolved from the
149
+ activity ID by default, pluggable).
150
+
151
+ **Job cost** — one row per ledger transaction with phase/cost code, cost type,
152
+ transaction date, posted date, hours, amount. Column names are matched
153
+ case-insensitively; disciplines come from `[phase_map]`, cost classes from
154
+ `[cost_type_map]`.
155
+
156
+ **Quantities** — `activity_id, as_of, commodity, item, uom, total_qty,
157
+ installed_qty, milestones, milestone_progress, percent_complete, reported_by`.
158
+ Milestones are the names in the rule of credit (`layout;supports`), partial
159
+ progress is `name=fraction` (`conduit_installed=0.4`).
160
+
161
+ ### Python API
162
+
163
+ ```python
164
+ from datetime import date
165
+ from elecevm import load_project, build_baseline, bucket_transactions, apply_basis, compute_status, StatusLog
166
+ from elecevm.ingest import activities_from_csv, read_jobcost_csv, read_quantities_csv, source_totals
167
+
168
+ project = load_project("elecevm.toml")
169
+ activities = activities_from_csv("schedule.csv")
170
+ baseline = build_baseline(project, activities, created=project.week_cal.start)
171
+ txns = read_jobcost_csv("jobcost.csv", project)
172
+ records = read_quantities_csv("quantities.csv")
173
+
174
+ data_date = date(2026, 9, 5)
175
+ week = project.week_cal.status_week(data_date)
176
+ actuals = apply_basis(bucket_transactions(txns, project.week_cal, week), project.ac_basis)
177
+ log = StatusLog("status_log.jsonl")
178
+ snap = compute_status(project, baseline, activities, actuals, records, data_date,
179
+ history=log.history(), source_totals=source_totals(txns))
180
+ log.append(snap.to_record())
181
+ print(snap.spi_hours, snap.cpi_hours, snap.eac, snap.crossover_week, snap.all_checks_pass)
182
+ ```
183
+
184
+ ## How the engine maps to the Recommended Practice
185
+
186
+ | RP section | Module |
187
+ | --- | --- |
188
+ | §4 Control structure, bases, calendars | `config.py`, `models.py`, `calendar.py` |
189
+ | §5 Cost-loaded schedule and PV, leveling, baseline control | `allocation.py`, `curves.py` |
190
+ | §6 EV measurement tiers and electrical rules of credit | `rules_of_credit.py`, `evm.py` |
191
+ | §7 Actual cost bucketing, basis rules, reconciliation, late postings | `actuals.py` |
192
+ | §8 Indices, EAC selection, funding crossover, crew | `evm.py`, `crew.py` |
193
+ | §9 Locked status log and the WSR | `status_log.py`, `report.py` |
194
+ | §11 Integrity checks | `evm.health_checks` |
195
+ | §12 Data pulls | `ingest/` |
196
+
197
+ ## Calibrate, don't copy
198
+
199
+ The rules of credit ship with default milestone weights. They are a reasonable
200
+ published starting point, not your labor-unit distribution. The practice asks
201
+ each contractor to calibrate the weights to its own estimating data and record
202
+ the calibrated set with the project; a future release will accept a custom
203
+ rules table in `elecevm.toml`.
204
+
205
+ ## Known limitations in 0.1.0
206
+
207
+ - Rules of credit are the shipped defaults; a custom table in `elecevm.toml` is the next release.
208
+ - The billed AC basis takes one billed-to-date figure per cost type for the status week; a backfill applies it to the final week only and carries earlier weeks at ledger × markup (noted on the report).
209
+ - `curves.taper_to_floor` is implemented and tested but not yet wired into baseline building; a long commissioning tail is phased by the activity dates for now.
210
+ - Check 7 (status week complete) is satisfied by construction in this engine and is kept for conformance reporting.
211
+ - A Vista JC Detail **PDF** is not parsed; export the detail to Excel/CSV first.
212
+
213
+ ## Status and roadmap
214
+
215
+ `0.1.0` is an alpha: the engine, the example and the test suite are complete;
216
+ the report is HTML. Planned: custom rules-of-credit tables in the configuration,
217
+ a PDF export of the WSR, a Vista JC Detail PDF text extractor, restatement
218
+ tooling for late postings, and a labor-unit calibration module that turns
219
+ quantity-tracked actuals into condition-adjusted productivity rates.
220
+
221
+ Contributions, field data corrections and challenges to the default weights are
222
+ welcome — open an issue with the commodity, the proposed weights and the basis
223
+ for them.
224
+
225
+ ## License
226
+
227
+ Apache-2.0. Copyright 2026 Kyle Hagen. Not affiliated with or endorsed by NECA,
228
+ AACE International, Oracle (Primavera) or Trimble (Viewpoint).
@@ -0,0 +1,197 @@
1
+ # elecevm — earned value for electrical construction
2
+
3
+ **elecevm** is an open earned-value management (EVM) engine for electrical specialty
4
+ contractors. It is the reference implementation of
5
+ [*Earned Value Management for Electrical Construction — A Recommended Practice for
6
+ Specialty Contractors*](docs/standard.md), which adapts ANSI/EIA-748 to how trade
7
+ contractors actually run work: labor-hour-driven scope, weekly payroll statusing,
8
+ a CPM schedule owned by the CM, and a job-cost ledger that was never designed to
9
+ feed an EVM system.
10
+
11
+ It takes three things every contractor already has — the schedule, the job-cost
12
+ detail, and what the foremen installed this week — and produces defensible
13
+ planned value, earned value, actual cost, indices, estimates at completion, a
14
+ funding-crossover forecast and a Weekly Status Report, with every number tied
15
+ back to its source and every statused week locked.
16
+
17
+ Pure Python 3.11+, no required dependencies. Charts and `.xlsx` ingest are optional extras.
18
+
19
+ ## Why
20
+
21
+ Electrical contractors keep cost in Vista, Spectrum or Sage and schedules in P6,
22
+ and the two never meet. EVM practice lives at the owner/CM level and in defense
23
+ work; specialty trades get a percent-complete column and a gut feel. This engine
24
+ makes the connection reproducible:
25
+
26
+ - **Planned value** from a cost-loaded copy of your own activities, allocated from
27
+ the estimate so that every discipline ties exactly and terminal PV equals BAC.
28
+ - **Earned value** from field quantities through published electrical rules of
29
+ credit (conduit, feeders, gear, fixtures, fire alarm, telecom, instrumentation …),
30
+ with measurement tiers so an invoiced percent is never mistaken for a physical one.
31
+ - **Actual cost** bucketed by transaction date to payroll weeks, reconciled to the
32
+ job-cost report to the cent, with declared basis rules per cost type (raw,
33
+ marked-up, or billed with a residual week).
34
+ - **Analysis** on dollars *and* labor hours — the hours indices are what the field
35
+ can act on — plus every EAC method with one selected by rule, TCPI, thresholds,
36
+ crew curves and the week the AC curve crosses the funding line.
37
+ - **A locked status log.** Statused weeks are never rewritten; restatements carry a
38
+ baseline change request and the old record stays in the file.
39
+ - **Thirteen integrity checks** on every run (terminal PV = BAC, allocation ties,
40
+ hours conserved, AC reconciles, EV ≤ BAC, history contiguous, CO log ties, EAC
41
+ not below statistical, every activity in the baseline …). A run that fails a check says so and exits non-zero.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ pip install elecevm # core
47
+ pip install "elecevm[charts]" # + matplotlib for the report charts
48
+ pip install "elecevm[xlsx]" # + openpyxl for .xlsx job-cost exports
49
+ ```
50
+
51
+ From a checkout: `pip install -e ".[dev]"` then `pytest`.
52
+
53
+ ## Try it in one command
54
+
55
+ ```bash
56
+ elecevm example --out elecevm-example
57
+ ```
58
+
59
+ This writes a synthetic distribution-center electrical project (22 activities,
60
+ three disciplines, ~960 ledger lines, weekly field quantities), builds the
61
+ baseline, statuses 26 payroll weeks into a locked log and renders
62
+ `wsr_wk26.html` — a Weekly Status Report with the cost curve, crew chart,
63
+ discipline table, EAC methods, activity earned value and the integrity checks.
64
+ The same inputs and outputs are committed under [`examples/distribution-center`](examples/distribution-center).
65
+
66
+ ## Using it on a project
67
+
68
+ ```text
69
+ project/
70
+ ├── elecevm.toml # calendars, disciplines, budget on two bases, CO log, AC basis rules
71
+ ├── schedule.csv # or a P6 .xer export
72
+ ├── jobcost.csv # Vista-style JC Detail export (.csv or .xlsx)
73
+ └── quantities.csv # weekly field progress by activity
74
+ ```
75
+
76
+ ```bash
77
+ elecevm init project/ # writes a commented elecevm.toml
78
+ elecevm baseline --project elecevm.toml --schedule schedule.csv --out baseline.json
79
+ elecevm status --project elecevm.toml --schedule schedule.csv --baseline baseline.json \
80
+ --jobcost jobcost.csv --quantities quantities.csv \
81
+ --data-date 2026-09-05 --log status_log.jsonl --out snapshot.json
82
+ elecevm report --project elecevm.toml --schedule schedule.csv --baseline baseline.json \
83
+ --jobcost jobcost.csv --quantities quantities.csv --log status_log.jsonl --out wsr.html
84
+ elecevm check ... # integrity checks only, exit 2 on failure
85
+ elecevm backfill ... --through 2026-09-05 # status every unstatused week into the log
86
+ ```
87
+
88
+ Options worth knowing: `--source-totals "L=hours:amount,M=...,S=..."` (or a JSON
89
+ file) gives the totals printed on the job-cost report so check 5 can reconcile the
90
+ pull against something independent — without it the check is reported as NOT RUN;
91
+ `--billed-labor` / `--billed-material` supply billed-to-date values for the
92
+ *billed* AC basis; `--management-etc` supplies a bottom-up estimate to complete so
93
+ the reported EAC can follow the `max(management, BAC/CPI)` rule; `--invoiced-pct`
94
+ feeds Tier 3 activities; `--schedule-data-date` tells a backfill when the schedule
95
+ file was statused so earlier weeks are interpolated rather than taking a later
96
+ percent complete.
97
+
98
+ A week whose checks fail is **not** written to the log (pass
99
+ `--allow-failed-checks` to lock it with the failures recorded). Each `status`
100
+ saves the raw pull under `pulls/` beside the log; the next status compares the
101
+ two and annotates any late posting into a locked week (RP §7.2) instead of
102
+ rewriting that week's row.
103
+
104
+ ### Inputs
105
+
106
+ **`elecevm.toml`** — see [`src/elecevm/config.py`](src/elecevm/config.py) (`template_toml()`)
107
+ for the commented schema: project start and payroll week-ending day, work calendar
108
+ and holidays, standard hours per head per week, contracted value (the funding line),
109
+ reporting basis (`contracted` or `estimated`), disciplines with composite rates,
110
+ budget by discipline × cost type on each basis, the change-order log, AC basis per
111
+ cost type, EAC policy and thresholds, optional crew-cap leveling, and the
112
+ phase → discipline and cost-type maps for the ledger.
113
+
114
+ **Schedule** — a CSV with `id, name, discipline, area, start, finish, actual_start,
115
+ actual_finish, forecast_finish, original_duration, percent_complete, budget_hours,
116
+ hours_per_day, area_weight, activity_factor, ev_method, commodity, base_activity`,
117
+ or a P6 `.xer` (TASK/PROJWBS/TASKRSRC tables; discipline and area resolved from the
118
+ activity ID by default, pluggable).
119
+
120
+ **Job cost** — one row per ledger transaction with phase/cost code, cost type,
121
+ transaction date, posted date, hours, amount. Column names are matched
122
+ case-insensitively; disciplines come from `[phase_map]`, cost classes from
123
+ `[cost_type_map]`.
124
+
125
+ **Quantities** — `activity_id, as_of, commodity, item, uom, total_qty,
126
+ installed_qty, milestones, milestone_progress, percent_complete, reported_by`.
127
+ Milestones are the names in the rule of credit (`layout;supports`), partial
128
+ progress is `name=fraction` (`conduit_installed=0.4`).
129
+
130
+ ### Python API
131
+
132
+ ```python
133
+ from datetime import date
134
+ from elecevm import load_project, build_baseline, bucket_transactions, apply_basis, compute_status, StatusLog
135
+ from elecevm.ingest import activities_from_csv, read_jobcost_csv, read_quantities_csv, source_totals
136
+
137
+ project = load_project("elecevm.toml")
138
+ activities = activities_from_csv("schedule.csv")
139
+ baseline = build_baseline(project, activities, created=project.week_cal.start)
140
+ txns = read_jobcost_csv("jobcost.csv", project)
141
+ records = read_quantities_csv("quantities.csv")
142
+
143
+ data_date = date(2026, 9, 5)
144
+ week = project.week_cal.status_week(data_date)
145
+ actuals = apply_basis(bucket_transactions(txns, project.week_cal, week), project.ac_basis)
146
+ log = StatusLog("status_log.jsonl")
147
+ snap = compute_status(project, baseline, activities, actuals, records, data_date,
148
+ history=log.history(), source_totals=source_totals(txns))
149
+ log.append(snap.to_record())
150
+ print(snap.spi_hours, snap.cpi_hours, snap.eac, snap.crossover_week, snap.all_checks_pass)
151
+ ```
152
+
153
+ ## How the engine maps to the Recommended Practice
154
+
155
+ | RP section | Module |
156
+ | --- | --- |
157
+ | §4 Control structure, bases, calendars | `config.py`, `models.py`, `calendar.py` |
158
+ | §5 Cost-loaded schedule and PV, leveling, baseline control | `allocation.py`, `curves.py` |
159
+ | §6 EV measurement tiers and electrical rules of credit | `rules_of_credit.py`, `evm.py` |
160
+ | §7 Actual cost bucketing, basis rules, reconciliation, late postings | `actuals.py` |
161
+ | §8 Indices, EAC selection, funding crossover, crew | `evm.py`, `crew.py` |
162
+ | §9 Locked status log and the WSR | `status_log.py`, `report.py` |
163
+ | §11 Integrity checks | `evm.health_checks` |
164
+ | §12 Data pulls | `ingest/` |
165
+
166
+ ## Calibrate, don't copy
167
+
168
+ The rules of credit ship with default milestone weights. They are a reasonable
169
+ published starting point, not your labor-unit distribution. The practice asks
170
+ each contractor to calibrate the weights to its own estimating data and record
171
+ the calibrated set with the project; a future release will accept a custom
172
+ rules table in `elecevm.toml`.
173
+
174
+ ## Known limitations in 0.1.0
175
+
176
+ - Rules of credit are the shipped defaults; a custom table in `elecevm.toml` is the next release.
177
+ - The billed AC basis takes one billed-to-date figure per cost type for the status week; a backfill applies it to the final week only and carries earlier weeks at ledger × markup (noted on the report).
178
+ - `curves.taper_to_floor` is implemented and tested but not yet wired into baseline building; a long commissioning tail is phased by the activity dates for now.
179
+ - Check 7 (status week complete) is satisfied by construction in this engine and is kept for conformance reporting.
180
+ - A Vista JC Detail **PDF** is not parsed; export the detail to Excel/CSV first.
181
+
182
+ ## Status and roadmap
183
+
184
+ `0.1.0` is an alpha: the engine, the example and the test suite are complete;
185
+ the report is HTML. Planned: custom rules-of-credit tables in the configuration,
186
+ a PDF export of the WSR, a Vista JC Detail PDF text extractor, restatement
187
+ tooling for late postings, and a labor-unit calibration module that turns
188
+ quantity-tracked actuals into condition-adjusted productivity rates.
189
+
190
+ Contributions, field data corrections and challenges to the default weights are
191
+ welcome — open an issue with the commodity, the proposed weights and the basis
192
+ for them.
193
+
194
+ ## License
195
+
196
+ Apache-2.0. Copyright 2026 Kyle Hagen. Not affiliated with or endorsed by NECA,
197
+ AACE International, Oracle (Primavera) or Trimble (Viewpoint).
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "elecevm"
7
+ version = "0.1.0"
8
+ description = "Earned value management engine for electrical construction contractors — reference implementation of the Electrical EVM Recommended Practice"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [{ name = "Kyle Hagen" }]
13
+ keywords = [
14
+ "earned value", "EVM", "ANSI-748", "EIA-748", "electrical construction", "specialty contractor",
15
+ "project controls", "Primavera P6", "XER", "Viewpoint Vista", "job cost", "rules of credit",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Intended Audience :: Other Audience",
20
+ "License :: OSI Approved :: Apache Software License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Office/Business :: Scheduling",
26
+ "Topic :: Office/Business :: Financial :: Accounting",
27
+ ]
28
+ dependencies = []
29
+
30
+ [project.optional-dependencies]
31
+ charts = ["matplotlib>=3.7"]
32
+ xlsx = ["openpyxl>=3.1"]
33
+ dev = ["pytest>=7", "matplotlib>=3.7", "openpyxl>=3.1"]
34
+
35
+ [project.scripts]
36
+ elecevm = "elecevm.cli:main"
37
+
38
+ [project.urls]
39
+ Documentation = "https://github.com/kylehagen2026/elecevm/blob/main/docs/standard.md"
40
+ Source = "https://github.com/kylehagen2026/elecevm"
41
+
42
+ [tool.setuptools.packages.find]
43
+ where = ["src"]
44
+
45
+ [tool.pytest.ini_options]
46
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+