pest_control_2026 0.1.0

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 (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/pest_control_2026.rb +145 -0
  3. metadata +50 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 54200fc1e3dc3debb02acd9b45e6647927863cbd2303de9e006d31b112d075c0
4
+ data.tar.gz: 1c84f7c99d11070baf056d4772db21835b6822563353a2fe9535aa09742f0f6f
5
+ SHA512:
6
+ metadata.gz: 441aa8d3a39e6a6e7bc114b0e37fef6f2521914b0b206f98b598127a7818da3572093b3a6c73a06357240ecfcb272d9c4668db31961de2d923aeb753cc9bc7d9
7
+ data.tar.gz: 5b8ba10abee7e69d5665264d41ae6e659fa1ba7dd0d16698f9dd53a14a610b5f56a9b73cc83443def4b40869960961841242eba871bdc6cc7a81efe147bad670
@@ -0,0 +1,145 @@
1
+ # Pest Control Cost Calculator — Ruby Engine
2
+ #
3
+ # Built by Treebark Termite and Pest Control
4
+ # https://treebarktermiteandpestcontrol.com
5
+
6
+ module PestControl2026
7
+ VERSION = "0.1.0"
8
+
9
+ PEST_BASE_RATES = {
10
+ "subterranean_termite" => 0.55,
11
+ "drywood_termite" => 0.65,
12
+ "dampwood_termite" => 0.50,
13
+ "ants" => 0.12,
14
+ "cockroaches" => 0.14,
15
+ "spiders" => 0.10,
16
+ "rodents" => 0.20,
17
+ "fleas" => 0.15,
18
+ "general_pest" => 0.12,
19
+ "multi_pest" => 0.22
20
+ }.freeze
21
+
22
+ TREATMENT_MULTIPLIERS = {
23
+ "liquid_barrier" => 1.0,
24
+ "bait_stations" => 0.6,
25
+ "fumigation" => 2.2,
26
+ "heat_treatment" => 1.8,
27
+ "spot_treatment" => 0.4,
28
+ "ipm" => 0.9,
29
+ "organic" => 1.1
30
+ }.freeze
31
+
32
+ SEVERITY_MULTIPLIERS = {
33
+ "preventive" => 0.6,
34
+ "light" => 0.85,
35
+ "moderate" => 1.0,
36
+ "severe" => 1.5
37
+ }.freeze
38
+
39
+ FREQUENCY_FACTORS = {
40
+ "one_time" => 1.0,
41
+ "annual" => 0.95,
42
+ "quarterly" => 0.85,
43
+ "bimonthly" => 0.80,
44
+ "monthly" => 0.70
45
+ }.freeze
46
+
47
+ TREATMENTS_PER_YEAR = {
48
+ "one_time" => 1,
49
+ "annual" => 1,
50
+ "quarterly" => 4,
51
+ "bimonthly" => 6,
52
+ "monthly" => 12
53
+ }.freeze
54
+
55
+ ACCESS_MULTIPLIERS = {
56
+ "standard" => 1.0,
57
+ "crawl_space" => 1.25,
58
+ "attic" => 1.20,
59
+ "multi_story" => 1.35,
60
+ "slab_drill" => 1.50
61
+ }.freeze
62
+
63
+ PROPERTY_MINIMUMS = {
64
+ "single_family" => 150,
65
+ "multi_family" => 250,
66
+ "condo" => 120,
67
+ "commercial_office" => 350,
68
+ "restaurant" => 300,
69
+ "warehouse" => 400
70
+ }.freeze
71
+
72
+ REGIONAL_MULTIPLIERS = {
73
+ "orange_county" => 1.10,
74
+ "los_angeles_county" => 1.05,
75
+ "riverside_county" => 0.90
76
+ }.freeze
77
+
78
+ SEASONAL_ADJUSTMENTS = {
79
+ "Q1" => 0.95,
80
+ "Q2" => 1.15,
81
+ "Q3" => 1.05,
82
+ "Q4" => 1.00
83
+ }.freeze
84
+
85
+ ADDON_COSTS = {
86
+ "wdi_wdo_inspection" => 150,
87
+ "exclusion_sealing" => 350,
88
+ "attic_insulation_treatment" => 500,
89
+ "termite_damage_repair_estimate" => 0
90
+ }.freeze
91
+
92
+ LABOR_RATIO = 0.65
93
+ DEFAULT_PROFIT_MARGIN = 0.25
94
+
95
+ TERMITE_TYPES = %w[subterranean_termite drywood_termite dampwood_termite].freeze
96
+
97
+ def self.calculate(property_type:, property_sqft:, pest_type:, treatment_method:,
98
+ infestation_severity:, service_frequency:, access_difficulty:,
99
+ region:, quarter: "Q2", addons: [], profit_margin: DEFAULT_PROFIT_MARGIN)
100
+
101
+ base_rate = PEST_BASE_RATES.fetch(pest_type, 0.12)
102
+ raw_cost = [base_rate * property_sqft, PROPERTY_MINIMUMS.fetch(property_type, 150)].max
103
+
104
+ treat_mult = TREATMENT_MULTIPLIERS.fetch(treatment_method, 1.0)
105
+ sev_mult = SEVERITY_MULTIPLIERS.fetch(infestation_severity, 1.0)
106
+ acc_mult = ACCESS_MULTIPLIERS.fetch(access_difficulty, 1.0)
107
+ reg_mult = REGIONAL_MULTIPLIERS.fetch(region, 1.0)
108
+ sea_mult = SEASONAL_ADJUSTMENTS.fetch(quarter, 1.0)
109
+
110
+ adjusted = raw_cost * treat_mult * sev_mult * acc_mult * reg_mult * sea_mult
111
+
112
+ labor = (adjusted * LABOR_RATIO).round(2)
113
+ materials = (adjusted * (1 - LABOR_RATIO)).round(2)
114
+ subtotal = (labor + materials).round(2)
115
+
116
+ margin_amount = (subtotal * profit_margin).round(2)
117
+ per_treatment = (subtotal + margin_amount).round(2)
118
+
119
+ addon_total = addons.sum { |a| ADDON_COSTS.fetch(a, 0) }
120
+ per_treatment_total = (per_treatment + addon_total).round(2)
121
+
122
+ freq_factor = FREQUENCY_FACTORS.fetch(service_frequency, 1.0)
123
+ treats_year = TREATMENTS_PER_YEAR.fetch(service_frequency, 1)
124
+ annual_per = (per_treatment_total * freq_factor).round(2)
125
+ annual_total = (annual_per * treats_year).round(2)
126
+
127
+ cost_per_sqft = property_sqft > 0 ? (per_treatment_total / property_sqft).round(4) : 0
128
+
129
+ fumigation = nil
130
+ savings = nil
131
+ if TERMITE_TYPES.include?(pest_type)
132
+ fum_adj = raw_cost * TREATMENT_MULTIPLIERS["fumigation"] * sev_mult * acc_mult * reg_mult * sea_mult
133
+ fumigation = (fum_adj * (1.0 + profit_margin)).round(2)
134
+ savings = (fumigation - per_treatment_total).round(2)
135
+ end
136
+
137
+ {
138
+ per_treatment_cost: per_treatment_total,
139
+ cost_per_sqft: cost_per_sqft,
140
+ annual_total: annual_total,
141
+ fumigation_comparison: fumigation,
142
+ savings_vs_fumigation: savings
143
+ }
144
+ end
145
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pest_control_2026
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Treebark Termite and Pest Control
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-04-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A free, open-source pest control and termite treatment cost calculator
14
+ for homeowners, property managers, and facility managers in Southern California.
15
+ Built and maintained by Treebark Termite and Pest Control.
16
+ email:
17
+ - info@treebarktermiteandpestcontrol.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - lib/pest_control_2026.rb
23
+ homepage: https://github.com/treebarktermiteandpestcontrol/pest-control-2026
24
+ licenses:
25
+ - MIT
26
+ metadata:
27
+ homepage_uri: https://github.com/treebarktermiteandpestcontrol/pest-control-2026
28
+ source_code_uri: https://github.com/treebarktermiteandpestcontrol/pest-control-2026
29
+ changelog_uri: https://github.com/treebarktermiteandpestcontrol/pest-control-2026/blob/main/CONTRIBUTING.md
30
+ bug_tracker_uri: https://github.com/treebarktermiteandpestcontrol/pest-control-2026/issues
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 3.0.0
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubygems_version: 3.5.22
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Pest control and termite treatment cost calculator for Southern California.
50
+ test_files: []