plat-costmodel 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.
Files changed (92) hide show
  1. plat_costmodel-0.1.0/LICENSE +201 -0
  2. plat_costmodel-0.1.0/PKG-INFO +89 -0
  3. plat_costmodel-0.1.0/README.md +50 -0
  4. plat_costmodel-0.1.0/pyproject.toml +77 -0
  5. plat_costmodel-0.1.0/setup.cfg +4 -0
  6. plat_costmodel-0.1.0/src/plat_costmodel/__init__.py +3 -0
  7. plat_costmodel-0.1.0/src/plat_costmodel/amenity_estimator.py +116 -0
  8. plat_costmodel-0.1.0/src/plat_costmodel/bid_eval.py +193 -0
  9. plat_costmodel-0.1.0/src/plat_costmodel/bridge/__init__.py +26 -0
  10. plat_costmodel-0.1.0/src/plat_costmodel/bridge/deal_projection.py +204 -0
  11. plat_costmodel-0.1.0/src/plat_costmodel/bridge/uw_projection.py +209 -0
  12. plat_costmodel-0.1.0/src/plat_costmodel/category_mapping.py +880 -0
  13. plat_costmodel-0.1.0/src/plat_costmodel/cli.py +269 -0
  14. plat_costmodel-0.1.0/src/plat_costmodel/data/knowledge_base.yaml +444 -0
  15. plat_costmodel-0.1.0/src/plat_costmodel/estimator.py +317 -0
  16. plat_costmodel-0.1.0/src/plat_costmodel/exterior_estimator.py +59 -0
  17. plat_costmodel-0.1.0/src/plat_costmodel/ingest.py +156 -0
  18. plat_costmodel-0.1.0/src/plat_costmodel/matrix.py +325 -0
  19. plat_costmodel-0.1.0/src/plat_costmodel/models.py +255 -0
  20. plat_costmodel-0.1.0/src/plat_costmodel/risk.py +82 -0
  21. plat_costmodel-0.1.0/src/plat_costmodel/roi.py +203 -0
  22. plat_costmodel-0.1.0/src/plat_costmodel/sampling.py +1004 -0
  23. plat_costmodel-0.1.0/src/plat_costmodel/schemas/__init__.py +74 -0
  24. plat_costmodel-0.1.0/src/plat_costmodel/schemas/actuals.py +27 -0
  25. plat_costmodel-0.1.0/src/plat_costmodel/schemas/errors.py +51 -0
  26. plat_costmodel-0.1.0/src/plat_costmodel/schemas/estimate.py +131 -0
  27. plat_costmodel-0.1.0/src/plat_costmodel/schemas/property.py +57 -0
  28. plat_costmodel-0.1.0/src/plat_costmodel/schemas/results.py +53 -0
  29. plat_costmodel-0.1.0/src/plat_costmodel/schemas/scenario.py +66 -0
  30. plat_costmodel-0.1.0/src/plat_costmodel/schemas/scope.py +162 -0
  31. plat_costmodel-0.1.0/src/plat_costmodel/scope_service.py +477 -0
  32. plat_costmodel-0.1.0/src/plat_costmodel/server.py +511 -0
  33. plat_costmodel-0.1.0/src/plat_costmodel/sow.py +153 -0
  34. plat_costmodel-0.1.0/src/plat_costmodel/store/__init__.py +6 -0
  35. plat_costmodel-0.1.0/src/plat_costmodel/store/db.py +55 -0
  36. plat_costmodel-0.1.0/src/plat_costmodel/store/ids.py +139 -0
  37. plat_costmodel-0.1.0/src/plat_costmodel/store/migrations/001_initial.sql +94 -0
  38. plat_costmodel-0.1.0/src/plat_costmodel/store/migrations/002_floor_plan_id_on_estimates.sql +17 -0
  39. plat_costmodel-0.1.0/src/plat_costmodel/store/migrations/003_scope_b_estimate_polymorphism.sql +82 -0
  40. plat_costmodel-0.1.0/src/plat_costmodel/store/repo.py +406 -0
  41. plat_costmodel-0.1.0/src/plat_costmodel.egg-info/PKG-INFO +89 -0
  42. plat_costmodel-0.1.0/src/plat_costmodel.egg-info/SOURCES.txt +90 -0
  43. plat_costmodel-0.1.0/src/plat_costmodel.egg-info/dependency_links.txt +1 -0
  44. plat_costmodel-0.1.0/src/plat_costmodel.egg-info/entry_points.txt +2 -0
  45. plat_costmodel-0.1.0/src/plat_costmodel.egg-info/requires.txt +11 -0
  46. plat_costmodel-0.1.0/src/plat_costmodel.egg-info/top_level.txt +1 -0
  47. plat_costmodel-0.1.0/tests/test_amenity_estimator.py +131 -0
  48. plat_costmodel-0.1.0/tests/test_bid_eval.py +137 -0
  49. plat_costmodel-0.1.0/tests/test_bridge.py +483 -0
  50. plat_costmodel-0.1.0/tests/test_bridge_deal_projection.py +262 -0
  51. plat_costmodel-0.1.0/tests/test_bridge_uw_projection.py +65 -0
  52. plat_costmodel-0.1.0/tests/test_category_mapping.py +786 -0
  53. plat_costmodel-0.1.0/tests/test_category_mapping_ordering.py +130 -0
  54. plat_costmodel-0.1.0/tests/test_cli.py +115 -0
  55. plat_costmodel-0.1.0/tests/test_cost_bridge_rent_premium_rounding.py +149 -0
  56. plat_costmodel-0.1.0/tests/test_cost_bridge_scope_default.py +150 -0
  57. plat_costmodel-0.1.0/tests/test_estimator.py +169 -0
  58. plat_costmodel-0.1.0/tests/test_estimator_denominators.py +133 -0
  59. plat_costmodel-0.1.0/tests/test_exterior_estimator.py +51 -0
  60. plat_costmodel-0.1.0/tests/test_hardening.py +257 -0
  61. plat_costmodel-0.1.0/tests/test_ingest.py +139 -0
  62. plat_costmodel-0.1.0/tests/test_knowledge_base_slice_b.py +113 -0
  63. plat_costmodel-0.1.0/tests/test_matrix.py +591 -0
  64. plat_costmodel-0.1.0/tests/test_mcp_estimate_from_deal.py +72 -0
  65. plat_costmodel-0.1.0/tests/test_mcp_estimate_scope.py +40 -0
  66. plat_costmodel-0.1.0/tests/test_mcp_get_property_history.py +37 -0
  67. plat_costmodel-0.1.0/tests/test_mcp_register_property.py +60 -0
  68. plat_costmodel-0.1.0/tests/test_mcp_validated.py +83 -0
  69. plat_costmodel-0.1.0/tests/test_migration_003.py +99 -0
  70. plat_costmodel-0.1.0/tests/test_property_model.py +372 -0
  71. plat_costmodel-0.1.0/tests/test_risk.py +165 -0
  72. plat_costmodel-0.1.0/tests/test_roi.py +55 -0
  73. plat_costmodel-0.1.0/tests/test_sampling.py +703 -0
  74. plat_costmodel-0.1.0/tests/test_sanitize.py +97 -0
  75. plat_costmodel-0.1.0/tests/test_schemas_actuals.py +28 -0
  76. plat_costmodel-0.1.0/tests/test_schemas_errors.py +29 -0
  77. plat_costmodel-0.1.0/tests/test_schemas_estimate.py +248 -0
  78. plat_costmodel-0.1.0/tests/test_schemas_property.py +84 -0
  79. plat_costmodel-0.1.0/tests/test_schemas_results.py +106 -0
  80. plat_costmodel-0.1.0/tests/test_schemas_scenario.py +128 -0
  81. plat_costmodel-0.1.0/tests/test_schemas_scope.py +315 -0
  82. plat_costmodel-0.1.0/tests/test_scope_service.py +493 -0
  83. plat_costmodel-0.1.0/tests/test_smoke_test_parity.py +230 -0
  84. plat_costmodel-0.1.0/tests/test_sow.py +67 -0
  85. plat_costmodel-0.1.0/tests/test_store_actuals_repo.py +61 -0
  86. plat_costmodel-0.1.0/tests/test_store_db.py +52 -0
  87. plat_costmodel-0.1.0/tests/test_store_estimate_repo.py +270 -0
  88. plat_costmodel-0.1.0/tests/test_store_history.py +88 -0
  89. plat_costmodel-0.1.0/tests/test_store_ids.py +192 -0
  90. plat_costmodel-0.1.0/tests/test_store_property_repo.py +99 -0
  91. plat_costmodel-0.1.0/tests/test_store_scope_repo.py +151 -0
  92. plat_costmodel-0.1.0/tests/test_store_snapshot_repo.py +45 -0
@@ -0,0 +1,201 @@
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
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: plat-costmodel
3
+ Version: 0.1.0
4
+ Summary: Multifamily renovation cost estimation engine: line-item estimates, SOW generation, contractor bid evaluation, and ROI gating
5
+ Author: paintbrush
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/paintbrushv/plat-costmodel
8
+ Project-URL: Repository, https://github.com/paintbrushv/plat-costmodel
9
+ Project-URL: Issues, https://github.com/paintbrushv/plat-costmodel/issues
10
+ Project-URL: Changelog, https://github.com/paintbrushv/plat-costmodel/blob/main/README.md
11
+ Keywords: multifamily,real-estate,renovation,cost-estimation,value-add,proptech
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Topic :: Office/Business :: Financial :: Accounting
15
+ Classifier: Topic :: Office/Business :: Financial :: Investment
16
+ Classifier: Intended Audience :: End Users/Desktop
17
+ Classifier: Topic :: Office/Business :: Financial :: Accounting
18
+ Classifier: Topic :: Office/Business :: Financial :: Investment
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Office/Business :: Financial :: Investment
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: click>=8.0
30
+ Requires-Dist: pydantic>=2.0
31
+ Requires-Dist: pyyaml>=6.0
32
+ Requires-Dist: python-ulid>=2.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0; extra == "dev"
35
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
36
+ Provides-Extra: server
37
+ Requires-Dist: mcp<2,>=1.0; extra == "server"
38
+ Dynamic: license-file
39
+
40
+ # plat-costmodel
41
+
42
+ Multifamily renovation cost estimation engine for Plat — a domain-expert real estate intelligence agent.
43
+
44
+ ## What It Does
45
+
46
+ - **Per-unit cost estimation** with line-item breakdowns (flooring, kitchen, bath, paint, appliances, fixtures, contingency)
47
+ - **Scope of Work (SOW) generation** — contractor-ready documents from property profile
48
+ - **Contractor bid evaluation** — flags inflated line items, vague lump sums, unrealistic timelines
49
+ - **ROI gating** — 15% minimum threshold check on all renovation plans
50
+ - **Risk flagging** — age-based warnings (galvanized pipe, asbestos, foundation concerns)
51
+ - **Budget vs. actual tracking** — Yardi Voyager integration for model calibration
52
+
53
+ ## Architecture
54
+
55
+ MCP tool server callable by Plat's orchestration layer. CLI-first interface.
56
+
57
+ ```
58
+ Plat (agent) ──MCP──▶ plat-costmodel (tool server)
59
+ ├── estimate — per-unit cost range
60
+ ├── sow — scope of work generation
61
+ ├── evaluate — contractor bid evaluation
62
+ ├── roi — ROI threshold check
63
+ └── ingest — Yardi CSV import
64
+ ```
65
+
66
+ ## Two Scope Levels
67
+
68
+ | Scope | Cost Range | Description |
69
+ |-------|-----------|-------------|
70
+ | Light | $3K-$5K/unit | Paint, clean, patch, hardware, carpet |
71
+ | Standard Value-Add | $12K-$18K/unit | Full kitchen/bath update, LVP, appliances, fixtures |
72
+
73
+ Gut renos excluded — don't pencil at Class C rents.
74
+
75
+ ## Cost Model Inputs
76
+
77
+ - Unit square footage (<700 small, 700-950 medium, 950+ large)
78
+ - Finish tier (basic vs. upgraded)
79
+ - Number of bedrooms/bathrooms
80
+ - Property year built (drives risk flags)
81
+ - Property class (B or C)
82
+ - Market (Dallas, Birmingham — more later)
83
+
84
+ ## Data Sources
85
+
86
+ - **Brain dump knowledge** — Day 1 baseline from operator experience
87
+ - **Yardi Voyager CSV exports** — historical actuals tagged to unit numbers
88
+ - **RSMeans benchmarks** — industry reference data (future)
89
+ - **Cross-user pooled data** — anonymous Glassdoor-style model (SaaS future)
@@ -0,0 +1,50 @@
1
+ # plat-costmodel
2
+
3
+ Multifamily renovation cost estimation engine for Plat — a domain-expert real estate intelligence agent.
4
+
5
+ ## What It Does
6
+
7
+ - **Per-unit cost estimation** with line-item breakdowns (flooring, kitchen, bath, paint, appliances, fixtures, contingency)
8
+ - **Scope of Work (SOW) generation** — contractor-ready documents from property profile
9
+ - **Contractor bid evaluation** — flags inflated line items, vague lump sums, unrealistic timelines
10
+ - **ROI gating** — 15% minimum threshold check on all renovation plans
11
+ - **Risk flagging** — age-based warnings (galvanized pipe, asbestos, foundation concerns)
12
+ - **Budget vs. actual tracking** — Yardi Voyager integration for model calibration
13
+
14
+ ## Architecture
15
+
16
+ MCP tool server callable by Plat's orchestration layer. CLI-first interface.
17
+
18
+ ```
19
+ Plat (agent) ──MCP──▶ plat-costmodel (tool server)
20
+ ├── estimate — per-unit cost range
21
+ ├── sow — scope of work generation
22
+ ├── evaluate — contractor bid evaluation
23
+ ├── roi — ROI threshold check
24
+ └── ingest — Yardi CSV import
25
+ ```
26
+
27
+ ## Two Scope Levels
28
+
29
+ | Scope | Cost Range | Description |
30
+ |-------|-----------|-------------|
31
+ | Light | $3K-$5K/unit | Paint, clean, patch, hardware, carpet |
32
+ | Standard Value-Add | $12K-$18K/unit | Full kitchen/bath update, LVP, appliances, fixtures |
33
+
34
+ Gut renos excluded — don't pencil at Class C rents.
35
+
36
+ ## Cost Model Inputs
37
+
38
+ - Unit square footage (<700 small, 700-950 medium, 950+ large)
39
+ - Finish tier (basic vs. upgraded)
40
+ - Number of bedrooms/bathrooms
41
+ - Property year built (drives risk flags)
42
+ - Property class (B or C)
43
+ - Market (Dallas, Birmingham — more later)
44
+
45
+ ## Data Sources
46
+
47
+ - **Brain dump knowledge** — Day 1 baseline from operator experience
48
+ - **Yardi Voyager CSV exports** — historical actuals tagged to unit numbers
49
+ - **RSMeans benchmarks** — industry reference data (future)
50
+ - **Cross-user pooled data** — anonymous Glassdoor-style model (SaaS future)
@@ -0,0 +1,77 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "plat-costmodel"
7
+ version = "0.1.0"
8
+ description = "Multifamily renovation cost estimation engine: line-item estimates, SOW generation, contractor bid evaluation, and ROI gating"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ {name = "paintbrush"}
15
+ ]
16
+ keywords = [
17
+ "multifamily",
18
+ "real-estate",
19
+ "renovation",
20
+ "cost-estimation",
21
+ "value-add",
22
+ "proptech",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: End Users/Desktop",
27
+ "Topic :: Office/Business :: Financial :: Accounting",
28
+ "Topic :: Office/Business :: Financial :: Investment",
29
+ "Intended Audience :: End Users/Desktop",
30
+ "Topic :: Office/Business :: Financial :: Accounting",
31
+ "Topic :: Office/Business :: Financial :: Investment",
32
+ "Operating System :: OS Independent",
33
+ "Programming Language :: Python :: 3",
34
+ "Programming Language :: Python :: 3.10",
35
+ "Programming Language :: Python :: 3.11",
36
+ "Programming Language :: Python :: 3.12",
37
+ "Programming Language :: Python :: 3.13",
38
+ "Topic :: Office/Business :: Financial :: Investment",
39
+ ]
40
+ dependencies = [
41
+ "click>=8.0",
42
+ "pydantic>=2.0",
43
+ "pyyaml>=6.0",
44
+ "python-ulid>=2.0",
45
+ ]
46
+
47
+ [project.urls]
48
+ Homepage = "https://github.com/paintbrushv/plat-costmodel"
49
+ Repository = "https://github.com/paintbrushv/plat-costmodel"
50
+ Issues = "https://github.com/paintbrushv/plat-costmodel/issues"
51
+ Changelog = "https://github.com/paintbrushv/plat-costmodel/blob/main/README.md"
52
+
53
+ [project.scripts]
54
+ plat-cost = "plat_costmodel.cli:cli"
55
+
56
+ [project.optional-dependencies]
57
+ dev = [
58
+ "pytest>=7.0",
59
+ "pytest-cov>=4.0",
60
+ ]
61
+ # The standalone plat-costmodel MCP server. Pinned to mcp 1.x (2.x renames
62
+ # FastMCP); the service modules (estimator/roi/sow/bid_eval) never import mcp,
63
+ # so the core package installs cleanly alongside mcp 2.x consumers like
64
+ # platworks.
65
+ server = [
66
+ "mcp>=1.0,<2",
67
+ ]
68
+
69
+ [tool.setuptools.packages.find]
70
+ where = ["src"]
71
+
72
+ [tool.setuptools.package-data]
73
+ plat_costmodel = ["data/*.yaml"]
74
+ "plat_costmodel.store" = ["migrations/*.sql"]
75
+
76
+ [tool.pytest.ini_options]
77
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """plat-costmodel: Multifamily renovation cost estimation engine for Plat."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,116 @@
1
+ """Pure amenity-program cost estimator.
2
+
3
+ Given an AmenityCohort + the loaded knowledge base, compute install + opex
4
+ cost ranges and optional success-metric results (occupancy lift, rent premium).
5
+
6
+ Quantity rules:
7
+ - install + opex multiply by ``cohort.quantity``
8
+ - ``typical_occupancy_lift_pct`` is per-installation (saturation effect on
9
+ a second pool), so NOT multiplied by quantity
10
+ - ``typical_rent_premium_monthly`` IS multiplied by quantity (per-unit pricing
11
+ for ev_chargers etc.)
12
+
13
+ Gates fire only when both the caller's expected target AND the KB's typical
14
+ projection are present. If either is missing, the corresponding result is
15
+ None — we don't fabricate a projection from no data.
16
+
17
+ This module is dependency-free of the persistence layer; it returns a plain
18
+ dict that scope_service._estimate_amenity shapes into an AmenityScopeEstimate.
19
+ """
20
+ from __future__ import annotations
21
+
22
+ from typing import Optional
23
+
24
+ from plat_costmodel.schemas import (
25
+ AmenityCohort,
26
+ OccupancyLiftResult,
27
+ RentPremiumResult,
28
+ raise_problem,
29
+ )
30
+
31
+
32
+ def estimate_amenity(cohort: AmenityCohort, kb: dict) -> dict:
33
+ """Compute amenity cost components + optional success-metric results.
34
+
35
+ Returns a dict with keys: install_cost_low, install_cost_high,
36
+ annual_opex_low, annual_opex_high, expected_occupancy_lift_result,
37
+ expected_rent_premium_result.
38
+ """
39
+ catalog = kb.get("amenity_catalog", {})
40
+ entry = catalog.get(cohort.amenity_type)
41
+ if entry is None:
42
+ raise_problem(
43
+ "validation_error",
44
+ f"amenity_type {cohort.amenity_type!r} not in knowledge_base.amenity_catalog",
45
+ field_errors=[{
46
+ "loc": ["cohort", "amenity_type"],
47
+ "msg": f"unknown amenity_type: {cohort.amenity_type!r}",
48
+ }],
49
+ hint="Use one of: " + ", ".join(sorted(catalog.keys())),
50
+ )
51
+
52
+ qty = cohort.quantity
53
+ install_low = float(entry["install_low"]) * qty
54
+ install_high = float(entry["install_high"]) * qty
55
+ annual_opex_low: Optional[float] = (
56
+ float(entry["annual_opex_low"]) * qty
57
+ if "annual_opex_low" in entry else None
58
+ )
59
+ annual_opex_high: Optional[float] = (
60
+ float(entry["annual_opex_high"]) * qty
61
+ if "annual_opex_high" in entry else None
62
+ )
63
+
64
+ # Occupancy lift gate — fires only if caller supplied a target AND
65
+ # KB has a typical projection.
66
+ lift_result: Optional[OccupancyLiftResult] = None
67
+ if (
68
+ cohort.expected_occupancy_lift_pct is not None
69
+ and "typical_occupancy_lift_pct" in entry
70
+ ):
71
+ target = float(cohort.expected_occupancy_lift_pct)
72
+ # NOT multiplied by quantity — saturation effect on second-pool etc.
73
+ projected = float(entry["typical_occupancy_lift_pct"])
74
+ clears = projected >= target
75
+ shortfall = (target - projected) if not clears else None
76
+ lift_result = OccupancyLiftResult(
77
+ target_lift_pct=target,
78
+ projected_lift_pct=projected,
79
+ clears_threshold=clears,
80
+ shortfall_pct=shortfall,
81
+ )
82
+
83
+ # Rent premium gate — fires only if caller supplied a target AND KB has
84
+ # a typical premium. typical_rent_premium_monthly IS multiplied by qty.
85
+ premium_result: Optional[RentPremiumResult] = None
86
+ if (
87
+ cohort.expected_rent_premium_monthly is not None
88
+ and "typical_rent_premium_monthly" in entry
89
+ ):
90
+ target = float(cohort.expected_rent_premium_monthly)
91
+ projected = float(entry["typical_rent_premium_monthly"]) * qty
92
+ clears = projected >= target
93
+ shortfall_monthly = (target - projected) if not clears else None
94
+ premium_result = RentPremiumResult(
95
+ target_premium_monthly=target,
96
+ projected_premium_monthly=projected,
97
+ clears_threshold=clears,
98
+ shortfall_monthly=shortfall_monthly,
99
+ )
100
+
101
+ # deluxe field is read here to acknowledge it has been considered. The KB
102
+ # does not yet encode deluxe-tier cost multipliers, so this is intentionally
103
+ # a no-op until a future PR adds the pricing logic. The assignment to _ keeps
104
+ # this acknowledgment durable: a future automated refactor or linter sweep
105
+ # will not silently strip a bare attribute access, preserving the intent that
106
+ # deluxe was evaluated and deliberately left as a no-op rather than forgotten.
107
+ _ = cohort.deluxe
108
+
109
+ return {
110
+ "install_cost_low": install_low,
111
+ "install_cost_high": install_high,
112
+ "annual_opex_low": annual_opex_low,
113
+ "annual_opex_high": annual_opex_high,
114
+ "expected_occupancy_lift_result": lift_result,
115
+ "expected_rent_premium_result": premium_result,
116
+ }