purchase 1.0.2 → 1.0.3

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.
@@ -8,23 +8,20 @@ Feature: Purchase Committee Calculations
8
8
  Then the committee should have used quorum "from purchase amount"
9
9
  And the conclusion of the committee should be "100"
10
10
 
11
- Scenario Outline: Cost committee from purchase amount and tax
11
+ Scenario: Cost committee from purchase amount and tax
12
12
  Given a purchase emitter
13
- And a characteristic "purchase_amount" of "<amount>"
14
- And a characteristic "tax" of "<tax>"
13
+ And a characteristic "purchase_amount" of "10.00"
14
+ And a characteristic "tax" of "1.00"
15
15
  When the "cost" committee is calculated
16
16
  Then the committee should have used quorum "from purchase amount and tax"
17
- And the conclusion of the committee should be "<cost>"
18
- Examples:
19
- | amount | tax | cost |
20
- | 10.00 | 1.00 | 9.00 |
17
+ And the conclusion of the committee should be "9.00"
21
18
 
22
19
  Scenario: Cost committee from default
23
20
  Given a purchase emitter
24
21
  When the "cost" committee is calculated
25
22
  Then the conclusion of the committee should be "100"
26
23
 
27
- Scenario Outline: Adjusted cost committee
24
+ Scenario Outline: Adjusted cost committee from cost and date
28
25
  Given a purchase emitter
29
26
  And a characteristic "cost" of "<cost>"
30
27
  And characteristic "date" of "<date>"
@@ -35,20 +32,15 @@ Feature: Purchase Committee Calculations
35
32
  | 831.23 | 2010-08-01 | 688.67439 |
36
33
  | 11.00 | 2005-07-14 | 9.11350 |
37
34
 
38
- Scenario Outline: Merchant category committee
35
+ Scenario Outline: Merchant category committee from merchant
39
36
  Given a purchase emitter
40
37
  And a characteristic "merchant.id" of "<id>"
41
38
  When the "merchant_category" committee is calculated
42
39
  Then the conclusion of the committee should have "mcc" of "<mcc>"
43
40
  Examples:
44
41
  | id | mcc |
45
- | 3 | 5812 |
46
- | 9 | 9999 |
47
-
48
- Scenario: Merchant category committee from default
49
- Given a purchase emitter
50
- When the "merchant_category" committee is calculated
51
- Then the conclusion of the committee should have "mcc" of "5111"
42
+ | 1 | 1111 |
43
+ | 2 | 2222 |
52
44
 
53
45
  Scenario Outline: Merchant category industries committee from merchant category
54
46
  Given a purchase emitter
@@ -57,134 +49,266 @@ Feature: Purchase Committee Calculations
57
49
  Then the conclusion of the committee should have a record identified with "naics_code" of "<naics>" and having "ratio" of "<ratio>"
58
50
  Examples:
59
51
  | mcc | naics | ratio |
60
- | 5812 | 72211 | 1 |
61
- | 9999 | 999991 | 0.5 |
62
- | 9999 | 999992 | 0.5 |
52
+ | 1111 | 111111 | 1 |
53
+ | 2222 | 399900 | 0.5 |
54
+ | 2222 | 459000 | 0.5 |
63
55
 
64
- Scenario Outline: Industry shares committee
56
+ Scenario Outline: Trade industry ratios from merchant category industries
65
57
  Given a purchase emitter
66
58
  And a characteristic "merchant_category.mcc" of "<mcc>"
67
59
  When the "merchant_category_industries" committee is calculated
68
- And the "industry_shares" committee is calculated
69
- Then the conclusion of the committee should have a record identified with "naics_code" of "<naics>" and having "ratio" of "<share>"
60
+ And the "trade_industry_ratios" committee is calculated
61
+ Then the committee should have used quorum "from merchant category industries"
62
+ And the conclusion of the committee should include a key of "<naics>" and value "<ratio>"
70
63
  Examples:
71
- | mcc | naics | share |
72
- | 5812 | 72211 | 1.0 |
73
- | 9999 | 999991 | 0.5 |
74
- | 9999 | 999992 | 0.5 |
64
+ | mcc | naics | ratio |
65
+ | 2222 | 459000 | 0.5 |
75
66
 
76
- Scenario Outline: Product line shares committee from industry
67
+ Scenario Outline: Trade industry ratios from industry
77
68
  Given a purchase emitter
78
- And a characteristic "naics_code" of "<naics>"
79
- When the "product_line_shares" committee is calculated
80
- Then the committee should have used quorum "from industry"
81
- And the conclusion of the committee should have a record identified with "ps_code" of "<ps_code>" and having "ratio" of "<share>"
69
+ And a characteristic "industry.naics_code" of "<naics>"
70
+ When the "trade_industry_ratios" committee is calculated
71
+ Then the committee should have used quorum "from naics code"
72
+ And the conclusion of the committee should include a key of "<naics>" and value "1"
82
73
  Examples:
83
- | naics | ps_code | share |
84
- | 72211 | | |
85
- | 999992 | 99992 | 0.75 |
86
- | 999992 | 99993 | 0.25 |
74
+ | naics |
75
+ | 459000 |
87
76
 
88
- Scenario Outline: Product line shares committee from merchant category
77
+ Scenario Outline: Non-trade industry ratios from merchant category industries
89
78
  Given a purchase emitter
90
79
  And a characteristic "merchant_category.mcc" of "<mcc>"
91
80
  When the "merchant_category_industries" committee is calculated
92
- And the "industry_shares" committee is calculated
93
- And the "product_line_shares" committee is calculated
94
- Then the conclusion of the committee should have a record identified with "ps_code" of "<ps_code>" and having "ratio" of "<share>"
95
- Examples:
96
- | mcc | ps_code | share |
97
- | 5812 | | |
98
- | 9999 | 99992 | 0.375 |
99
- | 9999 | 99993 | 0.125 |
100
-
101
- Scenario Outline: Industries sectors committee from industry
102
- Given a purchase emitter
103
- And a characteristic "naics_code" of "<naics>"
104
- When the "industry_sectors" committee is calculated
105
- Then the committee should have used quorum "from industry"
106
- And the conclusion of the committee should have a record identified with "io_code" of "<io_code>" and having "ratio" of "<share>"
107
- Examples:
108
- | naics | io_code | share |
109
- | 45321 | 4A0000 | 1.0 |
110
- | 443112 | 4A0000 | 1.0 |
111
- | 72211 | 26 | 1.0 |
112
- | 999991 | A | 0.75 |
113
- | 999991 | B | 0.25 |
114
- | 999992 | 4A0000 | 1.0 |
115
-
116
- Scenario Outline: Industries sectors committee from merchant category
81
+ And the "non_trade_industry_ratios" committee is calculated
82
+ Then the committee should have used quorum "from merchant category industries"
83
+ And the conclusion of the committee should include a key of "<naics>" and value "<ratio>"
84
+ Examples:
85
+ | mcc | naics | ratio |
86
+ | 1111 | 111111 | 1 |
87
+ | 2222 | 399900 | 0.5 |
88
+
89
+ Scenario Outline: Non-trade industry ratios from industry
90
+ Given a purchase emitter
91
+ And a characteristic "industry.naics_code" of "<naics>"
92
+ When the "non_trade_industry_ratios" committee is calculated
93
+ Then the conclusion of the committee should include a key of "<naics>" and value "1"
94
+ Examples:
95
+ | naics |
96
+ | 111111 |
97
+ | 399900 |
98
+
99
+ Scenario Outline: Non-trade industry ratios from default
100
+ Given a purchase emitter
101
+ When the "non_trade_industry_ratios" committee is calculated
102
+ Then the committee should have used quorum "from default"
103
+ And the conclusion of the committee should include a key of "111111" and value "1"
104
+
105
+ Scenario Outline: Product line ratios from trade industry ratios
106
+ Given a purchase emitter
107
+ And a characteristic "merchant_category.mcc" of "<mcc>"
108
+ When the "merchant_category_industries" committee is calculated
109
+ And the "trade_industry_ratios" committee is calculated
110
+ And the "product_line_ratios" committee is calculated
111
+ Then the conclusion of the committee should include a key of "<ps_code>" and value "<ratio>"
112
+ Examples:
113
+ | mcc | ps_code | ratio |
114
+ | 2222 | 45911 | 0.375 |
115
+ | 2222 | 45912 | 0.125 |
116
+
117
+ Scenario Outline: Product line industry product ratios from product line ratios
118
+ Given a purchase emitter
119
+ And a characteristic "merchant_category.mcc" of "<mcc>"
120
+ When the "merchant_category_industries" committee is calculated
121
+ And the "trade_industry_ratios" committee is calculated
122
+ And the "product_line_ratios" committee is calculated
123
+ And the "product_line_industry_product_ratios" committee is calculated
124
+ Then the conclusion of the committee should include a key of "<naics_product_code>" and value "<ratio>"
125
+ Examples:
126
+ | mcc | naics_product_code | ratio |
127
+ | 2222 | 399100A | 0.1875 |
128
+ | 2222 | 399100B | 0.1875 |
129
+ | 2222 | 399200A | 0.0625 |
130
+ | 2222 | 399200B | 0.0625 |
131
+
132
+ Scenario Outline: Industry product ratios from product line industry product ratios
133
+ Given a purchase emitter
134
+ And a characteristic "merchant_category.mcc" of "<mcc>"
135
+ When the "merchant_category_industries" committee is calculated
136
+ And the "trade_industry_ratios" committee is calculated
137
+ And the "product_line_ratios" committee is calculated
138
+ And the "product_line_industry_product_ratios" committee is calculated
139
+ And the "industry_product_ratios" committee is calculated
140
+ Then the conclusion of the committee should include a key of "<naics>" and value "<ratio>"
141
+ Examples:
142
+ | mcc | naics | ratio |
143
+ | 2222 | 399100 | 0.1875 |
144
+ | 2222 | 399200 | 0.0625 |
145
+
146
+ Scenario Outline: Industry ratios committee from non trade industry and industry product ratios
147
+ Given a purchase emitter
148
+ And a characteristic "merchant_category.mcc" of "<mcc>"
149
+ When the "merchant_category_industries" committee is calculated
150
+ And the "non_trade_industry_ratios" committee is calculated
151
+ And the "trade_industry_ratios" committee is calculated
152
+ And the "product_line_ratios" committee is calculated
153
+ And the "product_line_industry_product_ratios" committee is calculated
154
+ And the "industry_product_ratios" committee is calculated
155
+ And the "industry_ratios" committee is calculated
156
+ Then the conclusion of the committee should include a key of "<naics>" and value "<ratio>"
157
+ Examples:
158
+ | mcc | naics | ratio |
159
+ | 1111 | 111111 | 1.0 |
160
+ | 2222 | 399100 | 0.1875 |
161
+ | 2222 | 399200 | 0.0625 |
162
+ | 2222 | 399900 | 0.5 |
163
+
164
+ Scenario Outline: Industry ratios committee from industry
165
+ Given a purchase emitter
166
+ And a characteristic "industry.naics_code" of "<naics>"
167
+ When the "non_trade_industry_ratios" committee is calculated
168
+ And the "trade_industry_ratios" committee is calculated
169
+ And the "product_line_ratios" committee is calculated
170
+ And the "product_line_industry_product_ratios" committee is calculated
171
+ And the "industry_product_ratios" committee is calculated
172
+ And the "industry_ratios" committee is calculated
173
+ Then the conclusion of the committee should include a key of "<new_naics>" and value "<ratio>"
174
+ Examples:
175
+ | naics | new_naics | ratio |
176
+ | 111111 | 111111 | 1.0 |
177
+ | 459000 | 399100 | 0.375 |
178
+ | 459000 | 399200 | 0.125 |
179
+ | 399900 | 399900 | 1.0 |
180
+
181
+ Scenario Outline: Industry sector ratios committee from merchant category
117
182
  Given a purchase emitter
118
183
  And a characteristic "merchant_category.mcc" of "<mcc>"
119
184
  And a characteristic "cost" of "100"
120
185
  And a characteristic "date" of "2010-08-01"
121
- When the "adjusted_cost" committee is calculated
122
- And the "merchant_category_industries" committee is calculated
123
- And the "industry_shares" committee is calculated
124
- And the "industry_sectors" committee is calculated
125
- Then the committee should have used quorum "from industry shares"
126
- And the conclusion of the committee should have a record identified with "io_code" of "<io_code>" and having "ratio" of "<share>"
186
+ When the "merchant_category_industries" committee is calculated
187
+ And the "non_trade_industry_ratios" committee is calculated
188
+ And the "trade_industry_ratios" committee is calculated
189
+ And the "product_line_ratios" committee is calculated
190
+ And the "product_line_industry_product_ratios" committee is calculated
191
+ And the "industry_product_ratios" committee is calculated
192
+ And the "industry_ratios" committee is calculated
193
+ And the "industry_sector_ratios" committee is calculated
194
+ Then the conclusion of the committee should include a key of "<io_code>" and value "<ratio>"
195
+ Examples:
196
+ | mcc | io_code | ratio |
197
+ | 1111 | 111000 | 1.0 |
198
+ | 2222 | 3991A0 | 0.140625 |
199
+ | 2222 | 3991B0 | 0.046875 |
200
+ | 2222 | 399200 | 0.0625 |
201
+ | 2222 | 399900 | 0.5 |
202
+
203
+ Scenario Outline: Industry sector ratios committee from industry
204
+ Given a purchase emitter
205
+ And a characteristic "industry.naics_code" of "<naics>"
206
+ When the "non_trade_industry_ratios" committee is calculated
207
+ And the "trade_industry_ratios" committee is calculated
208
+ And the "product_line_ratios" committee is calculated
209
+ And the "product_line_industry_product_ratios" committee is calculated
210
+ And the "industry_product_ratios" committee is calculated
211
+ And the "industry_ratios" committee is calculated
212
+ And the "industry_sector_ratios" committee is calculated
213
+ Then the conclusion of the committee should include a key of "<io_code>" and value "<ratio>"
214
+ Examples:
215
+ | naics | io_code | ratio |
216
+ | 111111 | 111000 | 1.0 |
217
+ | 399100 | 3991A0 | 0.75 |
218
+ | 399100 | 3991B0 | 0.25 |
219
+ | 399200 | 399200 | 1.0 |
220
+ | 399900 | 399900 | 1.0 |
221
+
222
+ Scenario Outline: Industry sector shares committee from merchant category
223
+ Given a purchase emitter
224
+ And a characteristic "merchant_category.mcc" of "<mcc>"
225
+ And a characteristic "adjusted_cost" of "100.00"
226
+ When the "merchant_category_industries" committee is calculated
227
+ And the "non_trade_industry_ratios" committee is calculated
228
+ And the "trade_industry_ratios" committee is calculated
229
+ And the "product_line_ratios" committee is calculated
230
+ And the "product_line_industry_product_ratios" committee is calculated
231
+ And the "industry_product_ratios" committee is calculated
232
+ And the "industry_ratios" committee is calculated
233
+ And the "industry_sector_ratios" committee is calculated
234
+ And the "industry_sector_shares" committee is calculated
235
+ Then the conclusion of the committee should include a key of "<io_code>" and value "<share>"
127
236
  Examples:
128
- | mcc | io_code | share |
129
- | 5812 | 26 | 1.0 |
130
- | 9999 | A | 0.375 |
131
- | 9999 | B | 0.125 |
237
+ | mcc | io_code | share |
238
+ | 1111 | 111000 | 100.0 |
239
+ | 2222 | 3991A0 | 14.0625 |
240
+ | 2222 | 3991B0 | 4.6875 |
241
+ | 2222 | 399200 | 6.25 |
242
+ | 2222 | 399900 | 50.0 |
132
243
 
133
244
  Scenario Outline: Sector shares committee from industry and product line shares
134
245
  Given a purchase emitter
135
246
  And a characteristic "merchant_category.mcc" of "<mcc>"
136
- And a characteristic "adjusted_cost" of "1"
247
+ And a characteristic "adjusted_cost" of "100.00"
137
248
  When the "merchant_category_industries" committee is calculated
138
- And the "industry_shares" committee is calculated
139
- And the "product_line_shares" committee is calculated
140
- And the "industry_sectors" committee is calculated
249
+ And the "non_trade_industry_ratios" committee is calculated
250
+ And the "trade_industry_ratios" committee is calculated
251
+ And the "product_line_ratios" committee is calculated
252
+ And the "product_line_industry_product_ratios" committee is calculated
253
+ And the "industry_product_ratios" committee is calculated
254
+ And the "industry_ratios" committee is calculated
255
+ And the "industry_sector_ratios" committee is calculated
256
+ And the "industry_sector_shares" committee is calculated
141
257
  And the "sector_shares" committee is calculated
142
- Then the conclusion of the committee should be a vector with values "<1>,<10>,<11>,<12>,<13>,<14>,<15>,<16>,<17>,<18>,<19>,<2>,<20>,<21>,<22>,<23>,<24>,<25>,<26>,<3>,<4>,<44100>,<44102>,<44103>,<44104>,<44105>,<5>,<6>,<7>,<8>,<9>,<A>,<B>,<C>,<D>"
258
+ Then the conclusion of the committee should be a vector with values "<111000>,<3991A0>,<3991B0>,<399200>,<399900>,<4A0000>"
143
259
  Examples:
144
- | mcc|1|10|11|12|13|14|15|16|17|18|19|2|20|21|22|23|24|25| 26|3|4|44100|44102|44103|44104|44105|5|6|7|8|9| A| B| C| D|
145
- |5812|0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0| 0| 0| 0| 0| 0| 0|1.0|0|0| 0| 0| 0| 0| 0|0|0|0|0|0| 0| 0| 0| 0|
146
- |9999|0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0| 0| 0| 0| 0| 0| 0| 0|0|0| 0| 0| 0| 0| 0|0|0|0|0|0|0.1875|0.1875|0.0625|0.0625|
260
+ | mcc|111000|3991A0 |3991B0|399200|399900|4A0000|
261
+ |1111|100.00| 0| 0| 0| 0| 0|
262
+ |2222| 0|14.0625|4.6875| 6.25| 50.0| 0|
147
263
 
148
- Scenario: Sector direct requirements
264
+ Scenario: Sector direct requirements committee
149
265
  Given a purchase emitter
150
266
  When the "sector_direct_requirements" committee is calculated
151
- Then the conclusion of the committee should be a square matrix with "35" rows and columns
267
+ Then the conclusion of the committee should be a square matrix with "6" rows and columns
152
268
 
153
269
  Scenario: Economic flows from merchant category
154
270
  Given a purchase emitter
155
- And a characteristic "merchant_category.mcc" of "5812"
156
- And a characteristic "date" of "2010-08-01"
157
- And a characteristic "cost" of "100"
158
- When the "adjusted_cost" committee is calculated
159
- And the "merchant_category_industries" committee is calculated
160
- And the "industry_shares" committee is calculated
161
- And the "product_line_shares" committee is calculated
162
- And the "industry_sectors" committee is calculated
271
+ And a characteristic "merchant_category.mcc" of "1111"
272
+ And a characteristic "adjusted_cost" of "100"
273
+ When the "merchant_category_industries" committee is calculated
274
+ And the "non_trade_industry_ratios" committee is calculated
275
+ And the "trade_industry_ratios" committee is calculated
276
+ And the "product_line_ratios" committee is calculated
277
+ And the "product_line_industry_product_ratios" committee is calculated
278
+ And the "industry_product_ratios" committee is calculated
279
+ And the "industry_ratios" committee is calculated
280
+ And the "industry_sector_ratios" committee is calculated
281
+ And the "industry_sector_shares" committee is calculated
163
282
  And the "sector_shares" committee is calculated
164
283
  And the "sector_direct_requirements" committee is calculated
165
284
  And the "economic_flows" committee is calculated
166
- Then the conclusion of the committee should be a vector with "35" items
285
+ Then the conclusion of the committee should be a vector with "6" items
286
+
287
+ Scenario: Impact vectors committee
288
+ Given a purchase emitter
289
+ When the "impact_vectors" committee is calculated
290
+ Then the conclusion of the committee should be a square matrix with "6" rows and columns
167
291
 
168
292
  Scenario Outline: Impacts committee from economic flows
169
293
  Given a purchase emitter
170
294
  And a characteristic "merchant_category.mcc" of "<mcc>"
171
- And a characteristic "date" of "2010-08-01"
172
- And a characteristic "cost" of "100"
173
- When the "adjusted_cost" committee is calculated
174
- And the "merchant_category_industries" committee is calculated
175
- And the "industry_shares" committee is calculated
176
- And the "product_line_shares" committee is calculated
177
- And the "industry_sectors" committee is calculated
295
+ And a characteristic "adjusted_cost" of "100"
296
+ When the "merchant_category_industries" committee is calculated
297
+ And the "non_trade_industry_ratios" committee is calculated
298
+ And the "trade_industry_ratios" committee is calculated
299
+ And the "product_line_ratios" committee is calculated
300
+ And the "product_line_industry_product_ratios" committee is calculated
301
+ And the "industry_product_ratios" committee is calculated
302
+ And the "industry_ratios" committee is calculated
303
+ And the "industry_sector_ratios" committee is calculated
304
+ And the "industry_sector_shares" committee is calculated
178
305
  And the "sector_shares" committee is calculated
179
306
  And the "sector_direct_requirements" committee is calculated
180
307
  And the "economic_flows" committee is calculated
181
308
  And the "impact_vectors" committee is calculated
182
309
  And the "impacts" committee is calculated
183
- Then the conclusion of the committee should be a vector with values "<1>,<10>,<11>,<12>,<13>,<14>,<15>,<16>,<17>,<18>,<19>,<2>,<20>,<21>,<22>,<23>,<24>,<25>,<26>,<3>,<4>,<44100>,<44102>,<44103>,<44104>,<44105>,<5>,<6>,<7>,<8>,<9>,<A>,<B>,<C>,<D>"
184
- Examples:
185
- | mcc|1|10|11|12|13|14|15|16|17|18|19|2|20|21|22|23|24|25| 26|3|4|44100|44102|44103|44104|44105|5|6|7|8|9| A| B| C| D|
186
- |3504| 34.20759 | 22.83238 | 21.58704 | 71.66304 | 75.34399 | 43.05229 | 44.19605 | 24.59386 | 31.74734 | 34.23285 | 38.90812 | 50.97981 | 42.48382 | 38.68232 | 7.06766 | 14.44985 | 11.89899 | 7.95409 | 24.56535 | 75.44609 | 41.91640 | 21.38395 | 3.61236 | 20.87780 | 20.49698 | 5.33446 | 0.28203 | 2.65319 | 3.94288 | 4.60106 | 71.40280 | 24.44457 | 24.44457 | 24.56517 | 21.88041 |
187
- |5111| 43.11882 | 14.80914 | 11.03291 | 36.54622 | 46.29633 | 26.17054 | 32.10542 | 13.52681 | 17.39109 | 19.28008 | 12.79735 | 29.46601 | 26.80161 | 25.34407 | 4.74774 | 9.84523 | 8.12740 | 5.76849 | 17.87935 | 55.05595 | 39.96103 | 15.46327 | 2.35871 | 13.67770 | 13.18761 | 4.14058 | 2.01647 | 4.80043 | 6.27992 | 12.36538 | 79.88824 | 27.42322 | 27.42322 | 27.48354 | 24.08718 |
188
- |5172| 35.58872 | 23.75424 | 19.71380 | 65.44441 | 70.92181 | 40.52542 | 46.99530 | 26.65128 | 34.40320 | 37.53618 | 24.68486 | 55.96723 | 82.58029 | 48.39434 | 8.55823 | 16.05688 | 13.17485 | 7.93908 | 24.20801 | 72.40388 | 39.79780 | 20.18866 | 3.40454 | 19.65695 | 19.28569 | 4.97658 | 0.23634 | 2.57416 | 3.79738 | 4.40459 | 68.84678 | 23.57193 | 23.57193 | 23.68206 | 20.88125 |
189
- |5732| 23.82496 | 38.07691 | 13.11535 | 67.43841 | 47.01503 | 26.86485 | 28.54448 | 16.48957 | 21.28581 | 23.75176 | 16.05288 | 36.48537 | 34.13793 | 33.78076 | 6.37445 | 13.50597 | 11.33464 | 10.34780 | 23.80141 | 71.08195 | 37.57537 | 19.56198 | 3.32479 | 19.24582 | 18.92542 | 4.96435 | 0.29751 | 2.39136 | 3.54334 | 4.20360 | 64.55618 | 22.09769 | 22.09769 | 22.17096 | 20.29572 |
190
- |5812| 34.59232 | 23.08918 | 19.48251 | 64.67657 | 70.88026 | 40.50168 | 43.64568 | 25.42384 | 32.81874 | 37.49322 | 25.83877 | 58.82688 | 56.29772 | 54.71279 | 11.61328 | 25.17174 | 21.33815 | 14.31873 | 81.35713 | 123.84802 | 53.98569 | 22.37338 | 3.51343 | 20.06660 | 19.35014 | 4.96561 | 0.24528 | 2.52186 | 3.73916 | 4.34106 | 67.67328 | 23.16928 | 23.16928 | 23.27813 | 20.55662 |
310
+ Then the conclusion of the committee should be a vector with values "<111000>,<3991A0>,<3991B0>,<399200>,<399900>,<4A0000>"
311
+ Examples:
312
+ |mcc |111000 |3991A0 |3991B0 |399200 |399900 |4A0000 |
313
+ |1111|90.44460| 6.83919| 5.58981| 18.5568|19.91952 |11.38220|
314
+ |2222|28.14742|26.31519|16.92866|58.00083|105.81262|31.07553|
@@ -4,17 +4,17 @@ Feature: Purchase Emissions Calculations
4
4
  Scenario: Calculations starting from nothing
5
5
  Given a purchase has nothing
6
6
  When emissions are calculated
7
- Then the emission value should be within "0.001" kgs of "756.667"
7
+ Then the emission value should be within "0.001" kgs of "126.538"
8
8
 
9
9
  Scenario: Calculations starting from purchase amount
10
10
  Given a purchase has "purchase_amount" of "107.11"
11
11
  When emissions are calculated
12
- Then the emission value should be within "0.001" kgs of "756.667"
12
+ Then the emission value should be within "0.001" kgs of "126.538"
13
13
 
14
14
  Scenario: Calculations starting from date
15
15
  Given a purchase has "date" of "2010-07-28"
16
16
  When emissions are calculated
17
- Then the emission value should be within "0.001" kgs of "756.667"
17
+ Then the emission value should be within "0.001" kgs of "126.538"
18
18
 
19
19
  Scenario Outline: Calculations starting from a merchant
20
20
  Given a purchase has "merchant.id" of "<id>"
@@ -22,11 +22,8 @@ Feature: Purchase Emissions Calculations
22
22
  Then the emission value should be within "0.001" kgs of "<emission>"
23
23
  Examples:
24
24
  | id | emission |
25
- | 1 | 756.667 |
26
- | 2 | 828.562 |
27
- | 3 | 1158.876 |
28
- | 4 | 1007.731 |
29
- | 5 | 1034.378 |
25
+ | 1 | 126.538 |
26
+ | 2 | 220.613 |
30
27
 
31
28
  Scenario Outline: Calculations starting from a merchant with purchase amount
32
29
  Given a purchase has "merchant.id" of "<id>"
@@ -35,11 +32,8 @@ Feature: Purchase Emissions Calculations
35
32
  Then the emission value should be within "0.001" kgs of "<emission>"
36
33
  Examples:
37
34
  | id | amount | emission |
38
- | 1 | 107.11 | 756.667 |
39
- | 2 | 107.11 | 828.562 |
40
- | 3 | 107.11 | 1158.876 |
41
- | 4 | 107.11 | 1007.731 |
42
- | 5 | 107.11 | 1034.378 |
35
+ | 1 | 107.11 | 126.538 |
36
+ | 2 | 107.11 | 220.613 |
43
37
 
44
38
  Scenario Outline: Calculations starting from a merchant with purchase amount and date
45
39
  Given a purchase has "merchant.id" of "<id>"
@@ -49,11 +43,8 @@ Feature: Purchase Emissions Calculations
49
43
  Then the emission value should be within "0.001" kgs of "<emission>"
50
44
  Examples:
51
45
  | id | amount | date | emission |
52
- | 1 | 107.11 | 2010-07-28 | 756.667 |
53
- | 2 | 107.11 | 2010-07-28 | 828.562 |
54
- | 3 | 107.11 | 2010-07-28 | 1158.876 |
55
- | 4 | 107.11 | 2010-07-28 | 1007.731 |
56
- | 5 | 107.11 | 2010-07-28 | 1034.378 |
46
+ | 1 | 107.11 | 2010-07-28 | 126.538 |
47
+ | 2 | 107.11 | 2010-07-28 | 220.613 |
57
48
 
58
49
  Scenario Outline: Calculations starting from a merchant with purchase amount, date, and tax
59
50
  Given a purchase has "merchant.id" of "<id>"
@@ -64,11 +55,8 @@ Feature: Purchase Emissions Calculations
64
55
  Then the emission value should be within "0.001" kgs of "<emission>"
65
56
  Examples:
66
57
  | id | amount | tax | date | emission |
67
- | 1 | 108.00 | 8.00 | 2010-07-28 | 756.667 |
68
- | 2 | 108.00 | 8.00 | 2010-07-28 | 828.562 |
69
- | 3 | 108.00 | 8.00 | 2010-07-28 | 1158.876 |
70
- | 4 | 108.00 | 8.00 | 2010-07-28 | 1007.731 |
71
- | 5 | 108.00 | 8.00 | 2010-07-28 | 1034.378 |
58
+ | 1 | 108.00 | 8.00 | 2010-07-28 | 126.538 |
59
+ | 2 | 108.00 | 8.00 | 2010-07-28 | 220.613 |
72
60
 
73
61
  Scenario Outline: Calculations starting from a merchant category
74
62
  Given a purchase has "merchant_category.mcc" of "<mcc>"
@@ -78,26 +66,18 @@ Feature: Purchase Emissions Calculations
78
66
  Then the emission value should be within "0.001" kgs of "<emission>"
79
67
  Examples:
80
68
  | mcc | cost | date | emission |
81
- | 5111 | 100.00 | 2010-07-28 | 756.667 |
82
- | 5732 | 100.00 | 2010-07-28 | 828.562 |
83
- | 5812 | 100.00 | 2010-07-28 | 1158.876 |
84
- | 3504 | 100.00 | 2010-07-28 | 1007.731 |
85
- | 5172 | 100.00 | 2010-07-28 | 1034.378 |
69
+ | 1111 | 100.00 | 2010-07-28 | 126.538 |
70
+ | 2222 | 100.00 | 2010-07-28 | 220.613 |
71
+ | 5111 | 100.00 | 2010-07-28 | 126.538 |
86
72
 
87
73
  Scenario Outline: Calculations starting from industry
88
- Given a purchase has "naics_code" of "<naics>"
74
+ Given a purchase has "industry.naics_code" of "<naics>"
89
75
  And it has "cost" of "<cost>"
90
76
  And it has "date" of "<date>"
91
77
  When emissions are calculated
92
78
  Then the emission value should be within "0.001" kgs of "<emission>"
93
79
  Examples:
94
80
  | naics | cost | date | emission |
95
- | 45321 | 100.00 | 2010-07-28 | 756.667 |
96
- | 443112 | 100.00 | 2010-07-28 | 828.562 |
97
- | 72211 | 100.00 | 2010-07-28 | 1158.876 |
98
- | 72111 | 100.00 | 2010-07-28 | 1007.731 |
99
- | 32411 | 100.00 | 2010-07-28 | 1029.897 |
100
- | 324121 | 100.00 | 2010-07-28 | 1032.748 |
101
- | 324122 | 100.00 | 2010-07-28 | 1029.932 |
102
- | 324191 | 100.00 | 2010-07-28 | 1059.298 |
103
- | 324199 | 100.00 | 2010-07-28 | 1087.243 |
81
+ | 111111 | 100.00 | 2010-07-28 | 126.538 |
82
+ | 399900 | 100.00 | 2010-07-28 | 334.190 |
83
+ | 459000 | 100.00 | 2010-07-28 | 107.036 |
@@ -46,130 +46,137 @@ module BrighterPlanet
46
46
  end
47
47
 
48
48
  committee :sector_shares do
49
- quorum 'from industry sectors and product line shares', :needs => [:industry_sectors, :product_line_shares, :adjusted_cost] do |characteristics|
50
- industry_sector_shares = {}
51
- characteristics[:industry_sectors].each do |industry_sector|
52
- unless ['420000','4A0000'].include?(industry_sector.io_code)
53
- industry_sector_shares[industry_sector.io_code] ||= 0
54
- industry_sector_shares[industry_sector.io_code] +=
55
- industry_sector.ratio * characteristics[:adjusted_cost]
56
- end
49
+ quorum 'from industry sector shares', :needs => :industry_sector_shares do |characteristics|
50
+ shares = BrighterPlanet::Purchase.key_map.map do |key|
51
+ characteristics[:industry_sector_shares][key] || 0
57
52
  end
53
+ Vector[*shares]
54
+ end
55
+ end
58
56
 
59
- product_line_sector_shares = {}
60
- characteristics[:product_line_shares].each do |product_line_share|
61
- product_line_share.product_line_sectors.each do |product_line_sector|
62
- io_code = product_line_sector.io_code
63
- product_line_sector_shares[io_code] ||= 0
64
- product_line_sector_shares[io_code] +=
65
- product_line_sector.ratio * product_line_share.ratio * characteristics[:adjusted_cost]
66
- end
57
+ committee :industry_sector_shares do
58
+ quorum 'from industry sector ratios', :needs => [:industry_sector_ratios, :adjusted_cost] do |characteristics|
59
+ characteristics[:industry_sector_ratios].inject({}) do |new_ratios, (io_code, ratio)|
60
+ new_ratios[io_code] = ratio * characteristics[:adjusted_cost]
61
+ new_ratios
67
62
  end
68
- sector_shares = industry_sector_shares.merge product_line_sector_shares
63
+ end
64
+ end
69
65
 
70
- shares = BrighterPlanet::Purchase.key_map.map do |key|
71
- sector_shares[key] || 0
66
+ committee :industry_sector_ratios do
67
+ quorum 'from industry ratios', :needs => :industry_ratios do |characteristics|
68
+ characteristics[:industry_ratios].inject({}) do |new_ratios, (naics_code, ratio)|
69
+ IndustrySector.where(:naics_code => naics_code).each do |industry_sector|
70
+ new_ratio = ratio * industry_sector.ratio
71
+ new_ratios[industry_sector.io_code] = new_ratio
72
+ end
73
+ new_ratios
72
74
  end
73
- Vector[*shares]
74
75
  end
76
+ end
75
77
 
76
- quorum 'from industry sectors', :needs => [:industry_sectors, :adjusted_cost] do |characteristics|
77
- industry_sector_shares = {}
78
- characteristics[:industry_sectors].each do |industry_sector|
79
- unless ['420000','4A0000'].include?(industry_sector.io_code)
80
- industry_sector_shares[industry_sector.io_code] ||= 0
81
- industry_sector_shares[industry_sector.io_code] +=
82
- industry_sector.ratio * characteristics[:adjusted_cost]
78
+ # industries = the industries needed to produce the purchased item
79
+ # ratios = the portion of the purchase amount that goes to each industry
80
+ committee :industry_ratios do
81
+ quorum 'from non trade industry and industry product ratios', :needs => [:non_trade_industry_ratios, :industry_product_ratios] do |characteristics|
82
+ combined_ratios = characteristics[:non_trade_industry_ratios].
83
+ merge characteristics[:industry_product_ratios]
84
+ end
85
+ end
86
+
87
+ committee :industry_product_ratios do
88
+ quorum 'from product line industry product ratios', :needs => :product_line_industry_product_ratios do |characteristics|
89
+ characteristics[:product_line_industry_product_ratios].inject({}) do |new_ratios, (naics_product_code, ratio)|
90
+ IndustryProduct.where(:naics_product_code => naics_product_code).each do |industry_product|
91
+ new_ratios[industry_product.naics_code] = ratio
83
92
  end
93
+ new_ratios
84
94
  end
85
-
86
- shares = BrighterPlanet::Purchase.key_map.map do |key|
87
- industry_sector_shares[key] || 0
88
- end
89
- Vector[*shares]
90
95
  end
91
96
  end
92
97
 
93
- committee :industry_sectors do
94
- quorum 'from industry', :needs => :naics_code do |characteristics|
95
- industry_sectors = IndustrySector.
96
- find_all_by_naics_code characteristics[:naics_code]
97
- industry_sectors.map do |industry_sector|
98
- IndustrySectorShare.new industry_sector.io_code, industry_sector.ratio
98
+ committee :product_line_industry_product_ratios do
99
+ quorum 'from product line ratios', :needs => :product_line_ratios do |characteristics|
100
+ characteristics[:product_line_ratios].inject({}) do |new_ratios, (ps_code, ratio)|
101
+ ProductLineIndustryProduct.where(:ps_code => ps_code).each do |plip|
102
+ new_ratio = ratio * plip.ratio
103
+ new_ratios[plip.naics_product_code] = new_ratio
104
+ end
105
+ new_ratios
99
106
  end
100
107
  end
101
-
102
- quorum 'from industry shares', :needs => :industry_shares do |characteristics|
103
- characteristics[:industry_shares].inject([]) do |list, industry_share|
104
- sectors = IndustrySector.
105
- find_all_by_naics_code industry_share.naics_code
106
- sectors.each do |sector|
107
- ratio = industry_share.ratio * sector.ratio
108
- list << IndustrySectorShare.new(sector.io_code, ratio)
108
+ end
109
+
110
+ committee :product_line_ratios do
111
+ quorum 'from trade industry ratios', :needs => :trade_industry_ratios do |characteristics|
112
+ characteristics[:trade_industry_ratios].inject({}) do |new_ratios, (naics, ratio)|
113
+ IndustryProductLine.where(:naics_code => naics).each do |industry_product_line|
114
+ new_ratio = ratio * industry_product_line.ratio
115
+ new_ratios[industry_product_line.ps_code] = new_ratio
109
116
  end
110
- list
117
+ new_ratios
111
118
  end
112
119
  end
113
120
  end
114
121
 
115
- # only used for purchases from the wholesale and retail trade industries
116
- # product lines = the product lines sold by particular types of stores
117
- # ratios = the portion of the purchase amount that goes to each product line
118
- committee :product_line_shares do
119
- quorum 'from industry', :needs => :naics_code do |characteristics|
120
- IndustryProductLine.
121
- find_all_by_naics_code(characteristics[:naics_code]).
122
- map do |industry_product_line|
123
- ProductLineShare.new industry_product_line.ps_code,
124
- industry_product_line.ratio
122
+ committee :non_trade_industry_ratios do
123
+ quorum 'from merchant category industries', :needs => :merchant_category_industries do |characteristics|
124
+ characteristics[:merchant_category_industries].inject({}) do |hash, merchant_category_industry|
125
+ unless merchant_category_industry.industry.trade_industry?
126
+ hash[merchant_category_industry.naics_code] = merchant_category_industry.ratio
125
127
  end
128
+ hash
129
+ end
126
130
  end
127
131
 
128
- quorum 'from industry shares', :needs => :industry_shares do |characteristics|
129
- industry_shares = characteristics[:industry_shares]
130
- industry_shares.inject([]) do |list, industry_share|
131
- industry_product_lines = IndustryProductLine.
132
- find_all_by_naics_code industry_share.naics_code
133
- industry_product_lines.each do |industry_product_line|
134
- ratio = industry_product_line.ratio * industry_share.ratio
135
- list << ProductLineShare.new(industry_product_line.ps_code,
136
- ratio)
137
- end
138
- list
132
+ quorum 'from industry', :needs => :industry do |characteristics|
133
+ if characteristics[:industry].trade_industry?
134
+ {}
135
+ else
136
+ { characteristics[:industry].naics_code.to_s => 1 }
139
137
  end
140
138
  end
139
+
140
+ quorum 'default' do
141
+ mci = MerchantCategoryIndustry.where(:mcc => 5111).first
142
+ { mci.naics_code.to_s => mci.ratio }
143
+ end
141
144
  end
142
-
143
- # industries = the industries needed to produce the purchased item
144
- # ratios = the portion of the purchase amount that goes to each industry
145
- committee :industry_shares do
145
+
146
+ committee :trade_industry_ratios do
146
147
  quorum 'from merchant category industries', :needs => :merchant_category_industries do |characteristics|
147
- characteristics[:merchant_category_industries].map do |mci|
148
- IndustryShare.new mci.naics_code, mci.ratio
148
+ characteristics[:merchant_category_industries].inject({}) do |hash, merchant_category_industry|
149
+ if merchant_category_industry.industry.trade_industry?
150
+ hash[merchant_category_industry.naics_code] = merchant_category_industry.ratio
151
+ end
152
+ hash
153
+ end
154
+ end
155
+
156
+ quorum 'from naics code', :needs => :industry do |characteristics|
157
+ if characteristics[:industry].trade_industry?
158
+ { characteristics[:industry].naics_code.to_s => 1 }
159
+ else
160
+ {}
149
161
  end
150
162
  end
163
+
164
+ quorum 'default' do
165
+ {}
166
+ end
151
167
  end
152
168
 
153
169
  # a dictionary to go from merchant categories to industries
154
170
  committee :merchant_category_industries do
155
171
  quorum 'from merchant category', :needs => :merchant_category do |characteristics|
156
- puts 'here'
157
172
  characteristics[:merchant_category].merchant_category_industries
158
173
  end
159
- quorum 'from industry', :needs => :naics_code do |characteristics|
160
- MerchantCategoryIndustry.find_all_by_naics_code characteristics[:naics_code]
161
- end
162
174
  end
163
175
 
164
176
  committee :merchant_category do
165
177
  quorum 'from merchant', :needs => [:merchant] do |characteristics|
166
178
  characteristics[:merchant].merchant_category
167
179
  end
168
-
169
- quorum 'default' do
170
- # FIXME TODO figure out a better merchant category or fallback sectors to use
171
- MerchantCategory.find_by_mcc 5111
172
- end
173
180
  end
174
181
 
175
182
  committee :adjusted_cost do
@@ -210,22 +217,6 @@ module BrighterPlanet
210
217
  end
211
218
  end
212
219
  end
213
-
214
- class IndustryShare < Struct.new(:naics_code, :ratio); end
215
- class IndustrySectorShare < Struct.new(:io_code, :ratio); end
216
-
217
- class ProductLineShare
218
- attr_accessor :ps_code, :ratio
219
-
220
- def initialize(ps_code, ratio)
221
- self.ps_code = ps_code
222
- self.ratio = ratio
223
- end
224
-
225
- def product_line_sectors
226
- ProductLineSector.find_all_by_ps_code ps_code
227
- end
228
- end
229
220
  end
230
221
  end
231
222
  end
@@ -6,14 +6,13 @@ module BrighterPlanet
6
6
  def self.included(base)
7
7
  base.send :include, Characterizable
8
8
  base.characterize do
9
- has :purchase_amount
10
- has :merchant
11
- has :merchant_category
12
- has :naics_code
13
- has :total # full purchase amount
14
- has :tax # tax portion of purchase
15
9
  has :cost # cost before tax
10
+ has :purchase_amount # full purchase amount, including tax
11
+ has :tax # tax portion of purchase
16
12
  has :date
13
+ has :merchant
14
+ has :merchant_category
15
+ has :industry
17
16
  end
18
17
  base.add_implicit_characteristics
19
18
  end
data/lib/purchase/data.rb CHANGED
@@ -6,25 +6,16 @@ module BrighterPlanet
6
6
  def self.included(base)
7
7
  base.data_miner do
8
8
  schema do
9
- string 'merchant_id'
10
- string 'mcc'
11
- string 'naics_code'
12
- string 'ps_code'
13
- string 'io_code'
9
+ float 'cost'
10
+ string 'cost_units'
14
11
  float 'purchase_amount'
15
12
  string 'purchase_amount_units'
16
13
  float 'tax'
17
14
  string 'tax_units'
18
- float 'cost'
19
- string 'cost_units'
20
- string 'line_item'
21
- string 'customer_code'
22
- string 'zip_code_name'
23
15
  date 'date'
24
- float 'adjusted_cost'
25
- string 'adjusted_cost_units'
26
- float 'emission_factor'
27
- string 'emission_factor_units'
16
+ string 'merchant_id'
17
+ string 'mcc'
18
+ string 'naics_code'
28
19
  end
29
20
 
30
21
  process :run_data_miner_on_belongs_to_associations
@@ -0,0 +1,11 @@
1
+ module BrighterPlanet
2
+ module Purchase
3
+ module Relationships
4
+ def self.included(target)
5
+ target.belongs_to :merchant, :foreign_key => 'merchant_id'
6
+ target.belongs_to :merchant_category, :foreign_key => 'mcc'
7
+ target.belongs_to :industry, :foreign_key => 'naics_code'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -6,9 +6,4 @@ require 'sniff'
6
6
  class PurchaseRecord < ActiveRecord::Base
7
7
  include Sniff::Emitter
8
8
  include BrighterPlanet::Purchase
9
-
10
- belongs_to :merchant, :foreign_key => 'merchant_id'
11
- belongs_to :merchant_category, :foreign_key => 'mcc'
12
-
13
- attr_accessor :naics_code, :purchase_amount
14
9
  end
@@ -13,43 +13,13 @@ module BrighterPlanet
13
13
 
14
14
  def data
15
15
  matrix_text = <<-MATRIX
16
- | X| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26|44100|44102|44103|44104|44105| A| B| C| D|
17
- | 1|0.81| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
18
- | 2| 0|0.546| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
19
- | 3| 0| 0|0.358| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
20
- | 4| 0| 0| 0|1.2| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
21
- | 5| 0| 0| 0| 0|1.08| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
22
- | 6| 0| 0| 0| 0| 0|0.623| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
23
- | 7| 0| 0| 0| 0| 0| 0|0.567| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
24
- | 8| 0| 0| 0| 0| 0| 0| 0|0.284| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
25
- | 9| 0| 0| 0| 0| 0| 0| 0| 0|0.37| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
26
- | 10| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.362| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
27
- | 11| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.22| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
28
- | 12| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.549| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
29
- | 13| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.544| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
30
- | 14| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.535| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
31
- | 15| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.101| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
32
- | 16| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.245| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
33
- | 17| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.23| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
34
- | 18| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.186| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
35
- | 19| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.559| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
36
- | 20| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|2.0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
37
- | 21| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|1.3| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
38
- | 22| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.9| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
39
- | 23| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.2| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
40
- | 24| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|1.2| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
41
- | 25| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|1.6| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|
42
- | 26| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.8| 0| 0| 0| 0| 0| 0| 0| 0| 0|
43
- |44100| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0.7| 0| 0| 0| 0| 0| 0| 0| 0|
44
- |44102| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0.7| 0| 0| 0| 0| 0| 0| 0|
45
- |44103| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1.2| 0| 0| 0| 0| 0| 0|
46
- |44104| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1.4| 0| 0| 0| 0| 0|
47
- |44105| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0.3| 0| 0| 0| 0|
48
- | A| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.1| 0| 0| 0|
49
- | B| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.1| 0| 0|
50
- | C| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.1| 0|
51
- | D| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0.1|
52
-
16
+ | X |111000|3991A0|3991B0|399200|399900|4A0000|
17
+ |111000|0.81 |0 |0 |0 |0 |0 |
18
+ |3991A0|0 |0.546 |0 |0 |0 |0 |
19
+ |3991B0|0 |0 |0.358 |0 |0 |0 |
20
+ |399200|0 |0 |0 |1.2 |0 |0 |
21
+ |399900|0 |0 |0 |0 |1.08 |0 |
22
+ |4A0000|0 |0 |0 |0 |0 |0.623 |
53
23
  MATRIX
54
24
  lines = matrix_text.split(/\n/)
55
25
  lines.shift
@@ -7,42 +7,13 @@ module BrighterPlanet
7
7
 
8
8
  def self.data
9
9
  matrix_text = <<-MATRIX
10
- | X | 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 3 | 4 | 44100 | 44102 | 44103 | 44104 | 44105 | 5 | 6 | 7 | 8 | 9 | A | B | C | D |
11
- | 1 | 1.11660147325124 | 0.251599615658254 | 0.373774515688194 | 0.49894260973828 | 0.526839445017405 | 0.50533975009216 | 0.536592476995616 | 0.537767202953766 | 0.538565319780854 | 0.539575777502643 | 0.509735365850664 | 0.528275313128452 | 0.53114006519536 | 0.530216618045907 | 0.527171283798139 | 0.5252186048262 | 0.525470221157555 | 0.522429651950689 | 0.515468420725235 | 0.501915252111428 | 0.420989361897459 | 0.464897922343403 | 0.446150323797142 | 0.419189862221039 | 0.381775901565955 | 0.196865497902236 | 0.0238224813015868 | 0.0235988888362268 | 0.0233757422182553 | 0.023153040115459 | 0.0229307812009271 | 0.021625365692315 | 0.000825976713963838 | 0.000751615465658293 | 0.000843563079940414 |
12
- | 10 | 0.125262243121322 | 1.22952510962239 | 0.370110059652035 | 0.494051015525159 | 0.521674352419195 | 0.500385438816747 | 0.531331766436835 | 0.532494975473827 | 0.533285267626139 | 0.534285818899676 | 0.504737960303109 | 0.523096143391899 | 0.525932809654229 | 0.525018415908202 | 0.52200293787855 | 0.5200694028181 | 0.520318552322677 | 0.517307792617839 | 0.510414808757341 | 0.49699451434563 | 0.416862015212189 | 0.46034009957533 | 0.441776301014817 | 0.415080157689461 | 0.37803300057021 | 0.194935444001234 | 0.0235889275633359 | 0.0233675271809696 | 0.0231465682749391 | 0.0229260495260918 | 0.0227059696205258 | 0.0214133523031747 | 0.000817878903042624 | 0.000744246686583212 | 0.000835292853666488 |
13
- | 11 | 0.156149281881415 | 0.310606386989918 | 1.43230986305468 | 0.61617110878513 | 0.647081078444029 | 0.615276049268739 | 0.650534310068097 | 0.647919897130358 | 0.646052451420649 | 0.644990940676493 | 0.727808979721915 | 0.655795603491823 | 0.66345364645156 | 0.665538027750066 | 0.671449101309309 | 0.674607046088545 | 0.666199646822493 | 0.664196130024955 | 0.656854500308926 | 0.639594320146738 | 0.536114277488773 | 0.592280180418301 | 0.568359857457187 | 0.533976085249523 | 0.486349236217753 | 0.250780821745999 | 0.0303467164155268 | 0.0300618889429797 | 0.0297776294215245 | 0.0294939361540962 | 0.029210807450384 | 0.0275478793220013 | 0.00105218599134002 | 0.000957459514863257 | 0.00107458871481431 |
14
- | 12 | 0.154647846478709 | 0.307619787115015 | 0.456999191294535 | 1.57178484812373 | 0.640859144997452 | 0.609359933410386 | 0.644279172471288 | 0.64168989811949 | 0.639840408618527 | 0.638789104708449 | 0.720810816455358 | 0.649489876535171 | 0.657074284466449 | 0.659138623637085 | 0.664992859950566 | 0.668120439876155 | 0.659793880987661 | 0.657809628774715 | 0.65053859165211 | 0.633444374760712 | 0.53095933251292 | 0.586585178683509 | 0.562894858827791 | 0.528841699814431 | 0.48167280125412 | 0.248369467690749 | 0.0300549210653775 | 0.029772832318528 | 0.0294913060617022 | 0.0292103406141529 | 0.0289299343018226 | 0.027282995866982 | 0.00104206881834637 | 0.000948253173374187 | 0.00106425613101802 |
15
- | 13 | 0.184449553718395 | 0.366933853087441 | 0.545117239239925 | 0.728080450188034 | 1.71418420752924 | 0.720077272820542 | 0.759079531162292 | 0.752822907504661 | 0.748425811534256 | 0.736120970326851 | 0.842038876483725 | 0.879228980066539 | 0.789376574276721 | 0.794346046748593 | 0.808981868658016 | 0.818330415474245 | 0.800655891515154 | 0.799747435861132 | 0.792152623613159 | 0.771434035794818 | 0.646283812510399 | 0.714207869066124 | 0.685342219410289 | 0.643842308115151 | 0.586444669354947 | 0.302386280828225 | 0.036591437289149 | 0.0362479982673708 | 0.0359052440691654 | 0.0355631726482472 | 0.0352217819664751 | 0.0332166579361551 | 0.00126870390824032 | 0.00115448469993586 | 0.00129571664463958 |
16
- | 14 | 0.182709463588976 | 0.363472212963975 | 0.539974623775398 | 0.721211766695694 | 0.754616431986516 | 1.65668031741658 | 0.751918403509817 | 0.745720804603674 | 0.741365190670725 | 0.729176432870938 | 0.83409511349803 | 0.870934367047043 | 0.781929625462789 | 0.786852216118889 | 0.801349964236715 | 0.810610317215054 | 0.79310253404803 | 0.792202648730367 | 0.784679485654544 | 0.764156356211848 | 0.640186795411244 | 0.707470058980595 | 0.678876726774343 | 0.637768324076329 | 0.580912172474241 | 0.299533580065695 | 0.0362462350505722 | 0.0359060360195654 | 0.0355665153515317 | 0.0352276710194901 | 0.0348895010045272 | 0.0329032932386442 | 0.0012567350034456 | 0.00114359333484212 | 0.00128349290270901 |
17
- | 15 | 0.212193869651688 | 0.422164528332642 | 0.627169341955671 | 0.837859668653946 | 0.87352422556479 | 0.820704782473821 | 1.79693533112508 | 0.852501310618306 | 0.837959665312599 | 0.822183524763731 | 0.940822523948768 | 0.991800736132706 | 1.01522794226959 | 0.91544048508758 | 0.941491969567255 | 0.958110546088266 | 0.94954105823658 | 0.935464791236729 | 0.929106556094517 | 0.906004805233736 | 0.757801074512588 | 0.838000392733056 | 0.804185416646659 | 0.755323876548388 | 0.688068529628399 | 0.354764432585494 | 0.0429296608689297 | 0.0425267327024958 | 0.0421246079820568 | 0.0417232843068776 | 0.0413227592857784 | 0.0389703156268542 | 0.00148846376526439 | 0.00135445995889622 | 0.00152015554068163 |
18
- | 16 | 0.242406786718193 | 0.482320941609924 | 0.71653966329168 | 0.957487144014299 | 0.994349987201864 | 0.927588809968975 | 0.971992910363318 | 1.88029572085916 | 0.932624994095769 | 0.915084622598097 | 1.0452392678578 | 1.10278884511392 | 1.13764711320185 | 1.15525084940753 | 1.08023417626027 | 1.10513929046828 | 1.11061677963145 | 1.10137413581581 | 1.08051355703546 | 1.05658298311275 | 0.885271152612735 | 0.977106241239471 | 0.938285482888756 | 0.881354521637801 | 0.802663202626527 | 0.413906564740078 | 0.0500863864120119 | 0.0496162868251107 | 0.0491471246252223 | 0.0486788970113895 | 0.048211601193803 | 0.0454669859387909 | 0.00173660284750275 | 0.00158025951073778 | 0.00177357790105551 |
19
- | 17 | 0.240182871243715 | 0.477895978842861 | 0.709965904912858 | 0.948702858289397 | 0.985227510255058 | 0.919078820886691 | 0.963075544213196 | 0.945614108741182 | 1.84149999414994 | 0.906689350831143 | 1.03564991677653 | 1.09267151625966 | 1.12720998372293 | 1.14465221776158 | 1.07032377097348 | 1.09500039789518 | 1.10042763486419 | 1.09126978594594 | 1.0706005886223 | 1.04688956124933 | 0.87714939891904 | 0.968141963796907 | 0.929677359192529 | 0.873268700338371 | 0.795299320033623 | 0.410109256806682 | 0.0496268782797916 | 0.0491610915331372 | 0.0486962335736148 | 0.0482323016259639 | 0.04776929292597 | 0.0450498576274258 | 0.00172067071128713 | 0.00156576171706129 | 0.00175730654416509 |
20
- | 18 | 0.271782183469522 | 0.540832745313607 | 0.803467531208225 | 1.07395928155164 | 1.11007792831509 | 1.02721146364839 | 1.07387859710272 | 1.04423697755425 | 1.02019046950976 | 1.91070476111306 | 1.14141043345737 | 1.1995282046653 | 1.24523598438383 | 1.26936527137919 | 1.32805634958021 | 1.24272130711313 | 1.26711455263427 | 1.26518949342746 | 1.25011949089346 | 1.20861638539411 | 1.01793708290226 | 1.12339407267671 | 1.07721712999349 | 1.01281877546985 | 0.922260965145154 | 0.475613882440562 | 0.0575535222878011 | 0.0570133378386847 | 0.0564742305270541 | 0.0559361971343709 | 0.055399234454907 | 0.0522454378533439 | 0.00199550452425609 | 0.00181585271941169 | 0.00203799200880401 |
21
- | 19 | 0.300602475946448 | 0.598263334407089 | 0.888789982738558 | 1.18840187466383 | 1.22168792117974 | 1.12128348321563 | 1.16447216004152 | 1.12920562782696 | 1.10439138167824 | 1.08517394199199 | 2.13464117822183 | 1.29010368488038 | 1.33550718179812 | 1.36350349414729 | 1.44681434284062 | 1.49431333269763 | 1.41327920780033 | 1.42243695868643 | 1.41760936714279 | 1.38043404653272 | 1.15453136633639 | 1.27728803876375 | 1.22544387405263 | 1.15103279057963 | 1.04860047929701 | 0.540637213792007 | 0.0654219253944537 | 0.0648078898789101 | 0.0641950787612042 | 0.0635834883827765 | 0.0629731150996293 | 0.0593881486583924 | 0.00226831899978861 | 0.00206410618176618 | 0.0023166151410811 |
22
- | 2 | 0.273652258887148 | 0.544633059518311 | 0.809116185463372 | 1.08190192207294 | 1.11166589256965 | 1.01955671428974 | 1.05819306958555 | 1.02588799029688 | 1.00344230956417 | 0.904886249553391 | 1.12081309328616 | 2.0643413122774 | 1.21240122621208 | 1.23799317086212 | 1.31531989785274 | 1.3700139898063 | 1.2875254155312 | 1.29677328107071 | 1.29333432896353 | 1.26019656527849 | 1.05333581102069 | 1.16558063907151 | 1.11832230999917 | 1.0503254642825 | 0.956893245986751 | 0.493344570593814 | 0.0596990937134495 | 0.0591387714122516 | 0.0585795664037779 | 0.0580214753495043 | 0.0574644949241944 | 0.0541931260941796 | 0.00206989610476763 | 0.00188354695519579 | 0.0021139675051068 |
23
- | 20 | 0.256733916330697 | 0.51104230441626 | 0.75921611300497 | 1.01557979047912 | 1.03675002652783 | 0.939022929118602 | 0.966825358334092 | 0.936248842166872 | 0.852074921334713 | 0.821610405030754 | 0.942609848594383 | 1.06181814301638 | 1.9803730402916 | 1.11890746121298 | 1.21511881035419 | 1.27639498512683 | 1.34861727863252 | 1.24009629976239 | 1.24910584790243 | 1.22630310781183 | 1.017301127635 | 1.12878582849953 | 1.08360819562401 | 1.01663172604512 | 0.926664799074554 | 0.477633446129552 | 0.0577979075088326 | 0.0572554293148549 | 0.0567140328321314 | 0.0561737148284572 | 0.0556344720844918 | 0.0524672837520854 | 0.00200397788600432 | 0.00182356323912541 | 0.00204664578198302 |
24
- | 21 | 0.248227779488166 | 0.494218368734223 | 0.734226003303193 | 0.982687643398007 | 0.994479034454911 | 0.883155696567892 | 0.907368134918183 | 0.846735544045006 | 0.790129655278206 | 0.775393006491093 | 0.872702204723139 | 0.92703689329313 | 1.01689274306809 | 1.9153542736887 | 1.13754644945804 | 1.20265820993786 | 1.31040849777737 | 1.34669100041271 | 1.23436161840835 | 1.22631771544052 | 1.03746925066632 | 1.13295943081614 | 1.09192804077095 | 1.02618811044321 | 0.933163800959011 | 0.481579621805752 | 0.058275429965844 | 0.0577284698532082 | 0.0571826003888529 | 0.0566378183138688 | 0.0560941203823175 | 0.0529007649511441 | 0.00202053461764335 | 0.00183862939698467 | 0.0020635550329329 |
25
- | 22 | 0.247740481072168 | 0.493396019374998 | 0.733009653160218 | 0.9817939611424 | 0.981251566457224 | 0.854244634978202 | 0.876760757470747 | 0.786275311878566 | 0.766496818915394 | 0.756558965456113 | 0.84462045011121 | 0.856460482725332 | 0.940671337094794 | 0.990872541046555 | 1.96139382784761 | 1.15628669412462 | 1.29573257263814 | 1.34816250726081 | 1.38784532256333 | 1.2557893478117 | 1.09091964247158 | 1.20305826270504 | 1.14393680981988 | 1.08158513098675 | 0.98407201882014 | 0.507707871768901 | 0.0614371812773887 | 0.0608605456762237 | 0.0602850598967958 | 0.0597107205033827 | 0.0591375240739366 | 0.0557709121652278 | 0.00213015934252483 | 0.0019383847983737 | 0.00217551384362969 |
26
- | 23 | 0.216927165525523 | 0.432226758418132 | 0.642141228192199 | 0.861067944812799 | 0.843674196018218 | 0.716825352225776 | 0.695610255206846 | 0.654734822364087 | 0.647905732513161 | 0.642298989917132 | 0.711876443894582 | 0.703337906783647 | 0.704083681085624 | 0.732419249914895 | 0.906887100092866 | 1.82308975918707 | 1.09321195475424 | 1.16997863357336 | 1.24009348466059 | 1.26752354823618 | 1.01124390900566 | 1.13785151927113 | 1.0956491075349 | 1.02216090329094 | 0.934121689750038 | 0.480825228903178 | 0.0581841416953897 | 0.0576380383939816 | 0.0570930240323569 | 0.0565490953567116 | 0.0560062491261919 | 0.0528178960758577 | 0.00201736945677288 | 0.00183574919004745 | 0.00206032248072257 |
27
- | 24 | 0.193492192907198 | 0.385569347517664 | 0.572825592020731 | 0.768302509701516 | 0.749698371981323 | 0.616747317011816 | 0.59311574425243 | 0.57374314116502 | 0.569108306448091 | 0.564704120297908 | 0.624438679973295 | 0.613037186156672 | 0.609762817938952 | 0.621974156710297 | 0.766078270982995 | 0.852600174774314 | 1.83100700605279 | 1.04981189809783 | 1.11978907938031 | 1.15351134275698 | 0.914348555479648 | 1.03092842014415 | 0.993381470568937 | 0.925847679527178 | 0.846439888126328 | 0.435601982265045 | 0.0527117254573296 | 0.0522169850270957 | 0.0517232311181584 | 0.0512304607827449 | 0.0507386710848148 | 0.0478501934729921 | 0.00182762900427627 | 0.00166309074078794 | 0.00186654215036771 |
28
- | 25 | 0.165925826746795 | 0.33086784402779 | 0.491565979529305 | 0.660452428268094 | 0.627527747278574 | 0.470962759812992 | 0.48165365507294 | 0.474157744369669 | 0.471902467756529 | 0.469117708397332 | 0.516160631110634 | 0.500300930798932 | 0.492007476935382 | 0.497052697771133 | 0.54069464832611 | 0.60224363469453 | 0.791621863699181 | 1.70473787279777 | 0.929177916732962 | 0.997955357774641 | 0.961995500948763 | 0.949059809593501 | 0.938161788176031 | 0.892132379953116 | 0.798736088424077 | 0.415590375973661 | 0.0502901425910015 | 0.0498181305943133 | 0.0493470597980173 | 0.0488769273897617 | 0.0484077305683882 | 0.0456519499577332 | 0.00174366751289344 | 0.00158668815657922 | 0.00178079298447732 |
29
- | 26 | 0.172808437336453 | 0.344822811294809 | 0.512307030731636 | 0.689462611066773 | 0.633914938943071 | 0.479108285645414 | 0.493450793768153 | 0.487554687273473 | 0.485522230185971 | 0.482937020852494 | 0.530418382279189 | 0.511923309454059 | 0.503848240787414 | 0.507818997145943 | 0.543299289585638 | 0.572427734369471 | 0.768932368523526 | 0.8457310081337 | 1.75667381746505 | 0.988836108575665 | 1.00041561438658 | 1.17264294385693 | 1.03335791765504 | 1.0100048589901 | 0.922762833986326 | 0.475045615443243 | 0.05748475691214 | 0.0569452178794133 | 0.0564067546972005 | 0.0558693641508089 | 0.0553330430383404 | 0.0521830146163681 | 0.00199312028063746 | 0.00181368312510309 | 0.00203555700082345 |
30
- | 3 | 0.151185191337698 | 0.301929277729937 | 0.448588806166573 | 0.604967212263329 | 0.532719818778295 | 0.4033103234474 | 0.421891249725435 | 0.418857559466621 | 0.417497963908512 | 0.415626457496146 | 0.455317172137666 | 0.436702568040918 | 0.429935661541026 | 0.432095581519658 | 0.446634997140905 | 0.460772417860325 | 0.520675183515443 | 0.633865790925671 | 0.747422847917021 | 1.64497605894068 | 0.862144054484936 | 1.07918318071632 | 1.12095503389319 | 0.971446848036996 | 0.908406264900471 | 0.462039996955376 | 0.0559109610639886 | 0.0553861933260404 | 0.0548624719843793 | 0.0543397939123231 | 0.0538181559956341 | 0.0507543678557532 | 0.00193855339036901 | 0.00176402879714773 | 0.00197982829414269 |
31
- | 4 | 0.131049030350643 | 0.262160099158857 | 0.389518146811556 | 0.527504519834192 | 0.442316019133042 | 0.342154353033725 | 0.360152070109594 | 0.358339072613479 | 0.357338908706596 | 0.355970989575256 | 0.38917767600088 | 0.37135982051374 | 0.366574696444962 | 0.367924155990893 | 0.374894958762277 | 0.380614941224336 | 0.401516167997669 | 0.429583627766712 | 0.501236422436724 | 0.648700314125699 | 1.53055041120305 | 0.946910165209208 | 1.037148725901 | 1.07525227502152 | 0.885296222779025 | 0.481873724984365 | 0.0583110190738792 | 0.0577637249298592 | 0.0572175221001842 | 0.0566724073239547 | 0.0561283773532501 | 0.0529330717233137 | 0.00202176856863845 | 0.00183975225751585 | 0.00206481525671926 |
32
- |44100| 0.101802251583302 | 0.2041615762505 | 0.303362144064407 | 0.413342771816601 | 0.284622594699509 | 0.251867108036271 | 0.266099348597074 | 0.265219069168578 | 0.264658806354956 | 0.264191822310273 | 0.286782552531528 | 0.269217726827595 | 0.269859942524894 | 0.270539438020624 | 0.27319781366125 | 0.275077767377702 | 0.278474262223577 | 0.284657241284663 | 0.300051918238832 | 0.331358253707055 | 0.518530079410501 | 1.55312344110517 | 0.847084571247971 | 0.9481498344351 | 0.953967515708387 | 0.467512216045307 | 0.0565731483864864 | 0.0560421655068788 | 0.0555122414166623 | 0.0549833729521235 | 0.054455556962141 | 0.0513554825265779 | 0.00196151285045803 | 0.00178492125694028 | 0.00200327659787697 |
33
- |44102| 0.0786003663073115 | 0.157742684717276 | 0.234392686933455 | 0.319920514187864 | 0.206791220744278 | 0.191402811111519 | 0.202446561435298 | 0.201882974907995 | 0.201498026768017 | 0.201268386510349 | 0.218006017990471 | 0.203626068635594 | 0.205080035469048 | 0.205523611078922 | 0.206970236850932 | 0.207858324019256 | 0.207658702953865 | 0.208999408566081 | 0.212035521576962 | 0.217910571996919 | 0.253000902868432 | 0.565820701995427 | 1.47613166218156 | 0.756861642484798 | 0.795063546650924 | 0.381440179941917 | 0.0461576642487795 | 0.0457244387667657 | 0.0452920771441377 | 0.0448605767996425 | 0.0444299351623004 | 0.0419006045695359 | 0.00160038559198758 | 0.00145630565803969 | 0.00163446036219419 |
34
- |44103| 0.0747202542534306 | 0.151085686209771 | 0.224541552072727 | 0.312040927748068 | 0.197664444987144 | 0.184190895856601 | 0.194845757487178 | 0.194310988156741 | 0.193941174360235 | 0.193733758957363 | 0.209995908441732 | 0.195840239899937 | 0.197383709387289 | 0.197806084595572 | 0.199134453782789 | 0.19992259887598 | 0.199321087591085 | 0.200139037105878 | 0.201836582360058 | 0.204952918088907 | 0.223545284511533 | 0.45757281726198 | 0.61787585399038 | 1.52472063910656 | 0.792422155343949 | 0.569519311016879 | 0.0689169167891968 | 0.0682700780684594 | 0.0676245291557394 | 0.0669802661970289 | 0.066337285353659 | 0.0625608016682105 | 0.0023894978757846 | 0.00217437553412187 | 0.00244037410925871 |
35
- |44104| 0.0549174321105287 | 0.111348367233971 | 0.165495331393948 | 0.231473232529146 | 0.14394441384678 | 0.135569788984884 | 0.143447866589725 | 0.143069512622344 | 0.142802636343115 | 0.142669267562676 | 0.154624093972315 | 0.143993487969017 | 0.145288480973515 | 0.145589016539356 | 0.146477959618935 | 0.146972753534402 | 0.146073945362429 | 0.146130900617773 | 0.145972642961014 | 0.145353633748688 | 0.14161792626782 | 0.236913900138336 | 0.354476928856865 | 0.53067709278976 | 1.39909427099508 | 0.474309162195365 | 0.057395639499927 | 0.0568569369032395 | 0.0563193084891974 | 0.0557827510480917 | 0.0552472613829881 | 0.0521021163839691 | 0.00199003038809585 | 0.00181087141021786 | 0.00203240131952514 |
36
- |44105| 0.0236726533638111 | 0.0528419473958301 | 0.0787105155710479 | 0.133703058223812 | 0.0738960374559481 | 0.069838323071707 | 0.073882321455352 | 0.0736595119014691 | 0.0735013996827904 | 0.0734189535785694 | 0.0804837676639267 | 0.0742446374496168 | 0.0749744240992277 | 0.0751517195134499 | 0.0756658181928333 | 0.0759463876934597 | 0.0753283469309581 | 0.0752648369364433 | 0.0749187015795843 | 0.0740286163259196 | 0.0686848084891527 | 0.102858361773066 | 0.135509890729056 | 0.209725983382074 | 0.384892545448841 | 1.09147594591117 | 0.132078325504823 | 0.130838667970984 | 0.129601482336515 | 0.128366761215261 | 0.127134497250468 | 0.119896918079653 | 0.00457943989566919 | 0.00416716087929357 | 0.00467694349911398 |
37
- | 5 | 0.00428206805760895 | 0.00143066948454697 | 0.00248609622013471 | 0.0143117389077685 | 0.00399723884855405 | 0.00368776360460498 | 0.0038837959153822 | 0.00384817138869325 | 0.00382329399451112 | 0.00380498715486426 | 0.00486317124205566 | 0.00399893037788482 | 0.00405494366918949 | 0.00408316199355551 | 0.0041691900054045 | 0.00421928484955422 | 0.00415518112338903 | 0.00418380759293969 | 0.00422943429719749 | 0.00429682184501568 | 0.00469640136199786 | 0.00965375227436077 | 0.0153530270373853 | 0.0280591806267465 | 0.0576326391564692 | 0.177464596687384 | 0.780529204483932 | 0.217058498282155 | 0.2156480201853 | 0.214240351805769 | 0.212835484756346 | 0.204584138628267 | 0.000604139081936176 | 0.00692343936454599 | 0.00777620026969846 |
38
- | 6 | 0.0259402288354608 | 0.0453067426790929 | 0.067079346258279 | 0.0390920098750296 | 0.0436167929042948 | 0.0416693653940306 | 0.0441500318608842 | 0.0441068690385687 | 0.0440743149903576 | 0.0440784347669058 | 0.04574864583306 | 0.0439952376544178 | 0.0443781531355459 | 0.0444131175895012 | 0.0444943156685055 | 0.0445240818635329 | 0.0442366504206094 | 0.0440375653817638 | 0.0434841380133667 | 0.0423015074177095 | 0.0352251014092748 | 0.0379153673265637 | 0.0350318480649831 | 0.0298833037282514 | 0.0200879211521154 | 0.0224788345113363 | 0.384172117569439 | 0.615255016128572 | 0.381328671975407 | 0.37991119735408 | 0.37849654357777 | 0.370187716087991 | 0.0064102855341364 | 0.0042413464396756 | 0.00475875747304311 |
39
- | 7 | 0.0232078133677134 | 0.0339272275917191 | 0.0501135004887265 | 0.0443092196934612 | 0.0375804954755689 | 0.0357951203347312 | 0.0379144448526338 | 0.0378627346044663 | 0.0378248250112203 | 0.0378194279746241 | 0.0396588983260008 | 0.0378449115375506 | 0.0381783528972693 | 0.0382198900092202 | 0.0383276188469578 | 0.0383771160743835 | 0.0381282932410054 | 0.0379960424275712 | 0.0376097319839136 | 0.0367676539958474 | 0.0317270862523631 | 0.0387079346991589 | 0.0421418709491858 | 0.0507811599939226 | 0.0725698614086085 | 0.158648479992167 | 0.264214527838954 | 0.263097441769912 | 0.735026389890218 | 0.26086994544499 | 0.25975952190391 | 0.253237560277727 | 0.00222942561270641 | 0.000425315374909903 | 0.00944154681479051 |
40
- | 8 | 0.0182907332924413 | 0.0351597425158603 | 0.052033993145768 | 0.0444018564173223 | 0.0373303300991636 | 0.0355389861905309 | 0.0376354365783722 | 0.0375730140647305 | 0.037527608260277 | 0.0375159471649261 | 0.0396677710847952 | 0.0376088431525067 | 0.0379509426699467 | 0.0380009704744415 | 0.0381343985393365 | 0.0381988491664444 | 0.0379289998237746 | 0.0378035261819059 | 0.0374261535221454 | 0.0365943930720028 | 0.0316144366657436 | 0.0387208637274869 | 0.0423406202037888 | 0.0513852580456434 | 0.0741022669535889 | 0.163962325837437 | 0.274129442680653 | 0.273008701093938 | 0.271890194286061 | 0.725242020675586 | 0.26965985832289 | 0.263116554432538 | 0.00258327120194925 | 0.00871848943562744 | 0.000834110680426044 |
41
- | 9 | 1.55596163072858 | 2.63641405458023 | 3.90003008467143 | 2.91386832729571 | 2.72330930990013 | 2.59663823089974 | 2.75054926392216 | 2.74698455270021 | 2.74435624445472 | 2.7440884674722 | 2.87277297556912 | 2.74457794830801 | 2.76887083104418 | 2.77173907981294 | 2.77902135392293 | 2.78224737634749 | 2.76376852139839 | 2.75318156846493 | 2.72272190511781 | 2.65671885877008 | 2.26167492252177 | 2.63725825108415 | 2.72052412446678 | 2.98081243909448 | 3.71421620035713 | 6.5182699867831 | 9.95531339228791 | 9.95082299332193 | 9.94634154829207 | 9.94186903044355 | 8.94238053750617 | 8.95198482308775 | 0.348279118154781 | 0.310394862809376 | 0.349153967999911 |
42
- | A | 1.60140161530726 | 2.70906326046144 | 4.00731495999829 | 2.98835193545263 | 2.79724629228759 | 2.66719361217727 | 2.82529735381085 | 2.82165026130486 | 2.81896055812585 | 2.81869398995385 | 2.95046005061251 | 2.81910531837086 | 2.84404796494854 | 2.84698270960749 | 2.8544270390703 | 2.85771920366709 | 2.83875653496251 | 2.82786162138841 | 2.79653322257733 | 2.72866253609162 | 2.32244209786277 | 2.70619070500343 | 2.78914593246354 | 3.0508189285373 | 3.79099563674582 | 6.61782698097902 | 10.082765652096 | 10.0792551111839 | 10.0757515703534 | 10.0722550086879 | 10.0687654053541 | 9.04826956913328 | 0.352774173894877 | 0.32248044240785 | 0.362759028653842 |
43
- | B | 1.60140161530726 | 2.70906326046144 | 4.00731495999829 | 2.98835193545263 | 2.79724629228759 | 2.66719361217727 | 2.82529735381085 | 2.82165026130486 | 2.81896055812585 | 2.81869398995385 | 2.95046005061251 | 2.81910531837086 | 2.84404796494854 | 2.84698270960749 | 2.8544270390703 | 2.85771920366709 | 2.83875653496251 | 2.82786162138841 | 2.79653322257733 | 2.72866253609162 | 2.32244209786277 | 2.70619070500343 | 2.78914593246354 | 3.0508189285373 | 3.79099563674582 | 6.61782698097902 | 10.082765652096 | 10.0792551111839 | 10.0757515703534 | 10.0722550086879 | 10.0687654053541 | 10.0482695691333 | 0.647225826105123 | 0.32248044240785 | 0.362759028653842 |
44
- | C | 1.60452460094489 | 2.71527538820124 | 4.03596115725938 | 3.00067535762834 | 2.81018791385647 | 2.67949913316264 | 2.83830804001222 | 2.83460865924746 | 2.83188160715427 | 2.83159380876738 | 2.96501623020695 | 2.8322212304407 | 2.85731703787758 | 2.86029347016249 | 2.86785602109649 | 2.87121134458886 | 2.85208052789896 | 2.84114554398891 | 2.80967031258351 | 2.74145442249456 | 2.33316438341254 | 2.7180363086118 | 2.80051312961269 | 3.06149845024229 | 3.80072262147018 | 6.62284259741394 | 10.0821587177676 | 10.078653873405 | 10.075156017765 | 10.0716651299648 | 10.0681811892051 | 10.0477186115468 | 0.35275313017505 | 0.677538706782447 | 0.362737536879545 |
45
- | D | 0.880295136150399 | 2.55484170189327 | 3.8073308206926 | 2.6825243723863 | 2.4742130853796 | 2.35718105609542 | 2.49602827306575 | 2.49153917629882 | 2.48827467381092 | 2.48731946279743 | 2.64096633220124 | 2.49540023294212 | 2.51871053196511 | 2.52230804871015 | 2.53190917764079 | 2.53656532191272 | 2.51718688061478 | 2.50820823152121 | 2.48118438411519 | 2.4216054518236 | 2.06488244095408 | 2.42177546089277 | 2.51619901771912 | 2.79436480065111 | 3.55743177781448 | 6.49738783199494 | 10.0973398634495 | 10.0936925322591 | 10.0900524739126 | 10.0864196666783 | 10.0827940889112 | 10.0614996204536 | 0.353279493179214 | 0.322940268675082 | 0.636724893005641 |
10
+ | X |111000 |3991A0 |3991B0 |399200 |399900 |4A0000 |
11
+ |111000|1.11660|0.25159|0.37377|0.49894|0.52683|0.50533|
12
+ |3991A0|0.12526|1.22952|0.37011|0.49405|0.52167|0.50038|
13
+ |3991B0|0.15614|0.31060|1.43230|0.61617|0.64708|0.61527|
14
+ |399200|0.15464|0.30761|0.45699|1.57178|0.64085|0.60935|
15
+ |399900|0.18444|0.36693|0.54511|0.72808|1.71418|0.72007|
16
+ |4A0000|0.18270|0.36347|0.53997|0.72121|0.75461|1.65668|
46
17
  MATRIX
47
18
  lines = matrix_text.split(/\n/)
48
19
  lines.shift
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: purchase
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Rossmeissl
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-09-21 00:00:00 -04:00
22
+ date: 2010-10-05 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -63,12 +63,12 @@ dependencies:
63
63
  requirements:
64
64
  - - ~>
65
65
  - !ruby/object:Gem::Version
66
- hash: 57
66
+ hash: 59
67
67
  segments:
68
68
  - 0
69
- - 8
70
- - 3
71
- version: 0.8.3
69
+ - 9
70
+ - 0
71
+ version: 0.9.0
72
72
  requirement: *id003
73
73
  - !ruby/object:Gem::Dependency
74
74
  type: :development
@@ -151,8 +151,24 @@ dependencies:
151
151
  - !ruby/object:Gem::Dependency
152
152
  type: :runtime
153
153
  prerelease: false
154
- name: emitter
154
+ name: earth
155
155
  version_requirements: &id009 !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ~>
159
+ - !ruby/object:Gem::Version
160
+ hash: 31
161
+ segments:
162
+ - 0
163
+ - 2
164
+ - 4
165
+ version: 0.2.4
166
+ requirement: *id009
167
+ - !ruby/object:Gem::Dependency
168
+ type: :runtime
169
+ prerelease: false
170
+ name: emitter
171
+ version_requirements: &id010 !ruby/object:Gem::Requirement
156
172
  none: false
157
173
  requirements:
158
174
  - - ~>
@@ -163,7 +179,39 @@ dependencies:
163
179
  - 1
164
180
  - 4
165
181
  version: 0.1.4
166
- requirement: *id009
182
+ requirement: *id010
183
+ - !ruby/object:Gem::Dependency
184
+ type: :runtime
185
+ prerelease: false
186
+ name: fastercsv
187
+ version_requirements: &id011 !ruby/object:Gem::Requirement
188
+ none: false
189
+ requirements:
190
+ - - ~>
191
+ - !ruby/object:Gem::Version
192
+ hash: 5
193
+ segments:
194
+ - 1
195
+ - 5
196
+ - 3
197
+ version: 1.5.3
198
+ requirement: *id011
199
+ - !ruby/object:Gem::Dependency
200
+ type: :runtime
201
+ prerelease: false
202
+ name: slither
203
+ version_requirements: &id012 !ruby/object:Gem::Requirement
204
+ none: false
205
+ requirements:
206
+ - - ~>
207
+ - !ruby/object:Gem::Version
208
+ hash: 405
209
+ segments:
210
+ - 0
211
+ - 99
212
+ - 3
213
+ version: 0.99.3
214
+ requirement: *id012
167
215
  description: A software model in Ruby for the greenhouse gas emissions of a purchase
168
216
  email: seamus@brighterplanet.com
169
217
  executables: []
@@ -180,6 +228,7 @@ files:
180
228
  - lib/purchase/carbon_model.rb
181
229
  - lib/purchase/characterization.rb
182
230
  - lib/purchase/data.rb
231
+ - lib/purchase/relationships.rb
183
232
  - lib/purchase/summarization.rb
184
233
  - lib/test_support/db/schema.rb
185
234
  - lib/test_support/purchase_record.rb