features/purchase_committees.feature in purchase-0.1.8 vs features/purchase_committees.feature in purchase-1.0.0

- old
+ new

@@ -1,264 +1,196 @@ Feature: Purchase Committee Calculations The purchase model should generate correct committee calculations - Scenario Outline: Cost committee from purchase amount - Given a purchase emitter - And a characteristic "purchase_amount" of "<amount>" + Scenario: Cost committee from purchase amount + Given a purchase emitter + And a characteristic "purchase_amount" of "107.11" When the "cost" committee is calculated - Then the conclusion of the committee should be "<cost>" - Examples: - | amount | cost | - | 831.23 | 748.107 | - | 11.00 | 9.9 | + Then the committee should have used quorum "from purchase amount" + And the conclusion of the committee should be "100" Scenario Outline: Cost committee from purchase amount and tax Given a purchase emitter And a characteristic "purchase_amount" of "<amount>" And a characteristic "tax" of "<tax>" When the "cost" committee is calculated - Then the conclusion of the committee should be "<cost>" + Then the committee should have used quorum "from purchase amount and tax" + And the conclusion of the committee should be "<cost>" Examples: | amount | tax | cost | | 10.00 | 1.00 | 9.00 | - Scenario Outline: Adjusted cost committee from cost and date - Given a purchase emitter + Scenario: Cost committee from default + Given a purchase emitter + When the "cost" committee is calculated + Then the conclusion of the committee should be "100" + + Scenario Outline: Adjusted cost committee + Given a purchase emitter And a characteristic "cost" of "<cost>" And characteristic "date" of "<date>" When the "adjusted_cost" committee is calculated - Then the committee should have used quorum "from cost and date" - And the conclusion of the committee should be "<adjusted_cost>" + Then the conclusion of the committee should be "<adjusted_cost>" Examples: | cost | date | adjusted_cost | | 831.23 | 2010-08-01 | 688.67439 | | 11.00 | 2005-07-14 | 9.11350 | - Scenario Outline: Merchant category committee from merchant - Given a purchase emitter + Scenario Outline: Merchant category committee + Given a purchase emitter And a characteristic "merchant.id" of "<id>" When the "merchant_category" committee is calculated Then the conclusion of the committee should have "mcc" of "<mcc>" Examples: | id | mcc | - | 1 | 5111 | - | 2 | 5732 | + | 3 | 5812 | + | 9 | 9999 | - Scenario Outline: Merchant categories industries committee from merchant category - Given a purchase emitter + Scenario: Merchant category committee from default + Given a purchase emitter + When the "merchant_category" committee is calculated + Then the conclusion of the committee should have "mcc" of "5111" + + Scenario Outline: Merchant categories industries committee + Given a purchase emitter And a characteristic "merchant_category.mcc" of "<mcc>" When the "merchant_categories_industries" committee is calculated Then the conclusion of the committee should have a record identified with "naics_code" of "<naics>" and having "ratio" of "<ratio>" Examples: | mcc | naics | ratio | - | 3504 | 72111 | 1 | - | 5111 | 45321 | 1 | - | 5172 | 32411 | 0.8 | - | 5172 | 324121 | 0.05 | - | 5172 | 324122 | 0.05 | - | 5172 | 324191 | 0.05 | - | 5172 | 324199 | 0.05 | - | 5732 | 443112 | 1 | | 5812 | 72211 | 1 | - | 8225 | 6623 | 0.5 | + | 9999 | 999991 | 0.5 | + | 9999 | 999992 | 0.5 | - Scenario Outline: Merchant categories industries committee from industry - Given a purchase emitter - And a characteristic "naics_code" of "<naics>" - When the "merchant_categories_industries" committee is calculated - Then the conclusion of the committee should have a record identified with "naics_code" of "<naics>" and having "ratio" of "<ratio>" - Examples: - | naics | ratio | - | 72111 | 1 | - | 45321 | 1 | - | 32411 | 0.8 | - | 324121 | 0.05 | - | 324122 | 0.05 | - | 324191 | 0.05 | - | 324199 | 0.05 | - | 443112 | 1 | - | 72211 | 1 | - | 6623 | 0.5 | - - Scenario Outline: Industry shares committee from merchant categories industries - Given a purchase emitter + Scenario Outline: Industry shares committee + Given a purchase emitter And a characteristic "merchant_category.mcc" of "<mcc>" When the "merchant_categories_industries" committee is calculated And the "industry_shares" committee is calculated Then the conclusion of the committee should have a record identified with "naics_code" of "<naics>" and having "ratio" of "<share>" Examples: | mcc | naics | share | - | 5111 | 45321 | 1.0 | - | 5172 | 32411 | 0.8 | - | 5172 | 324121 | 0.05 | - | 5172 | 324122 | 0.05 | - | 5172 | 324191 | 0.05 | - | 5172 | 324199 | 0.05 | + | 5812 | 72211 | 1.0 | + | 9999 | 999991 | 0.5 | + | 9999 | 999992 | 0.5 | + Scenario Outline: Product line shares committee from industry + Given a purchase emitter + And a characteristic "naics_code" of "<naics>" + When the "product_line_shares" committee is calculated + Then the committee should have used quorum "from industry" + And the conclusion of the committee should have a record identified with "ps_code" of "<ps_code>" and having "ratio" of "<share>" + Examples: + | naics | ps_code | share | + | 72211 | | | + | 999992 | 99992 | 0.75 | + | 999992 | 99993 | 0.25 | + Scenario Outline: Product line shares committee from merchant category - Given a purchase emitter + Given a purchase emitter And a characteristic "merchant_category.mcc" of "<mcc>" When the "merchant_categories_industries" committee is calculated And the "industry_shares" committee is calculated And the "product_line_shares" committee is calculated Then the conclusion of the committee should have a record identified with "ps_code" of "<ps_code>" and having "ratio" of "<share>" Examples: | mcc | ps_code | share | - | 5111 | 20340 | 0.084 | - | 5111 | 20370 | 0.283 | - | 5111 | 20440 | 0.006 | - | 5111 | 20851 | 0.122 | - | 5111 | 20852 | 0.145 | - | 5111 | 20853 | 0.265 | - | 5111 | 20854 | 0.071 | - | 5111 | 29938 | 0.011 | - | 5111 | 29979 | 0.013 | + | 5812 | | | + | 9999 | 99992 | 0.375 | + | 9999 | 99993 | 0.125 | - Scenario Outline: Product line shares committee from industry - Given a purchase emitter - And a characteristic "naics_code" of "<naics>" - When the "product_line_shares" committee is calculated - Then the conclusion of the committee should have a record identified with "ps_code" of "<ps_code>" and having "ratio" of "<share>" - Examples: - | naics | ps_code | share | - | 45321 | 20340 | 0.084 | - | 45321 | 20370 | 0.283 | - | 45321 | 20440 | 0.006 | - | 45321 | 20851 | 0.122 | - | 45321 | 20852 | 0.145 | - | 45321 | 20853 | 0.265 | - | 45321 | 20854 | 0.071 | - | 45321 | 29938 | 0.011 | - | 45321 | 29979 | 0.013 | - | 443112 | 20375 | 0.5 | - | 443112 | 20321 | 0.25 | - | 443112 | 20865 | 0.2 | + Scenario Outline: Industries sectors committee from industry + Given a purchase emitter + And a characteristic "naics_code" of "<naics>" + When the "industries_sectors" committee is calculated + Then the committee should have used quorum "from industry" + And the conclusion of the committee should have a record identified with "io_code" of "<io_code>" and having "ratio" of "<share>" + Examples: + | naics | io_code | share | + | 45321 | 4A0000 | 1.0 | + | 443112 | 4A0000 | 1.0 | + | 72211 | 26 | 1.0 | + | 999991 | A | 0.75 | + | 999991 | B | 0.25 | + | 999992 | 4A0000 | 1.0 | - Scenario Outline: Sector shares committee from industry and product line shares + Scenario Outline: Industries sectors committee from merchant category Given a purchase emitter And a characteristic "merchant_category.mcc" of "<mcc>" + And a characteristic "cost" of "100" + And a characteristic "date" of "2010-08-01" + When the "adjusted_cost" committee is calculated + And the "merchant_categories_industries" committee is calculated + And the "industry_shares" committee is calculated + And the "industries_sectors" committee is calculated + Then the committee should have used quorum "from industry shares" + And the conclusion of the committee should have a record identified with "io_code" of "<io_code>" and having "ratio" of "<share>" + Examples: + | mcc | io_code | share | + | 5812 | 26 | 1.0 | + | 9999 | A | 0.375 | + | 9999 | B | 0.125 | + + Scenario Outline: Sector shares committee from industry and product line shares + Given a purchase emitter + And a characteristic "merchant_category.mcc" of "<mcc>" When the "merchant_categories_industries" committee is calculated And the "industry_shares" committee is calculated And the "product_line_shares" committee is calculated + And the "industries_sectors" committee is calculated And the "sector_shares" committee is calculated - Then the conclusion of the committee should be a vector with value "<share>" and position for key "<io_code>" + Then the conclusion of the committee should be a vector with values "<26>,<A>,<B>,<C>,<D>" Examples: - | mcc | io_code | share | - | 3504 | 19 | 0.559 | - | 5111 | 1 | 0.27916245 | - | 5111 | 3 | 0.00573573 | - | 5111 | 4 | 0.041823625 | - | 5111 | 5 | 0.000650412 | - | 5111 | 6 | 0.002021635 | - | 5111 | 7 | 0.131016 | - | 5111 | 8 | 0.016074 | - | 5111 | 9 | 0.005444 | - | 5111 | 10 | 0.006146 | - | 5111 | 11 | 0.001041495 | - | 5111 | 12 | 0.00452952 | - | 5111 | 13 | 0.045696 | - | 5111 | 14 | 0.06289245 | - | 5111 | 15 | 0.00614676 | - | 5111 | 16 | 0.00017721 | - | 5111 | 17 | 0.00035178 | - | 5111 | 18 | 0.00040365 | - | 5172 | 20 | 1.6 | - | 5172 | 21 | 0.065 | - | 5172 | 22 | 0.045 | - | 5172 | 23 | 0.01 | - | 5172 | 24 | 0.06 | - | 5732 | 10 | 0.181 | - | 5732 | 12 | 0.13725 | - | 5732 | 25 | 0.32 | - | 5812 | 26 | 0.8 | + |mcc | 26 | A | B | C | D | + |5218| 1.0 | 0 | 0 | 0 | 0 | + |9999| 0 | 0.5625| 0.3125| 0.0625| 0.0625| - Scenario Outline: Economic flows from merchant category code - Given a purchase emitter + Scenario: Sector direct requirements + Given a purchase emitter + When the "sector_direct_requirements" committee is calculated + Then the conclusion of the committee should be a square matrix with "32" rows and columns + + Scenario Outline: Economic flows from merchant category + Given a purchase emitter And a characteristic "merchant_category.mcc" of "<mcc>" - When the "industry_shares" committee is calculated + And a characteristic "date" of "2010-08-01" + And a characteristic "cost" of "100" + When the "adjusted_cost" committee is calculated + And the "merchant_categories_industries" committee is calculated + And the "industry_shares" committee is calculated And the "product_line_shares" committee is calculated + And the "industries_sectors" committee is calculated And the "sector_shares" committee is calculated - And the "emission_factors" committee is calculated - Then the conclusion of the committee should have a record identified with "io_code" of "<io_code>" and having "factor" of "<emission_factor_share>" + And the "sector_direct_requirements" committee is calculated + And the "economic_flows" committee is calculated + Then the conclusion of the committee should be a vector with values "<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>,<44101>,<44102>,<44103>,<44104>,<44105>" Examples: - | mcc | io_code | emission_factor_share | - | 3504 | 19 | 0.559 | - | 5111 | 1 | 0.06289245 | - | 5111 | 3 | 0.00017721 | - | 5111 | 4 | 0.131016 | - | 5111 | 5 | 0.01052952 | - | 5111 | 6 | 0.000650412 | - | 5111 | 6 | 0.001371223 | - | 5111 | 7 | 0.001449252 | - | 5111 | 8 | 0.0120984 | - | 5111 | 8 | 0.0160744 | - | 5111 | 9 | 0.00407185 | - | 5111 | 9 | 0.00544492 | - | 5111 | 10 | 0.004574956 | - | 5111 | 10 | 0.00614676 | - | 5111 | 11 | 0.00035178 | - | 5111 | 12 | 0.000418338 | - | 5111 | 13 | 0.045696 | - | 5111 | 14 | 0.041823625 | - | 5111 | 15 | 0.019665104 | - | 5111 | 16 | 0.001041495 | - | 5111 | 17 | 0.00040365 | - | 5111 | 18 | 0.00100347 | - | 5172 | 20 | 1.6 | - | 5172 | 21 | 0.065 | - | 5172 | 22 | 0.045 | - | 5172 | 23 | 0.01 | - | 5172 | 24 | 0.06 | - | 5732 | 10 | 0.181 | - | 5732 | 12 | 0.13725 | - | 5732 | 25 | 0.32 | - | 5812 | 26 | 0.8 | + |mcc | 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| 44101| 44102| 44103| 44104| 44105| + |3504|192.42878|190.54222|245.14686|242.78968|295.60384|292.81512|346.78566|404.30912|400.59986|465.29127|528.62004|482.35635|466.74323|468.52286|501.11032|468.42401|424.06313|393.05155|506.82714|413.31948|408.00708|380.41657|307.66401|449.85893|372.82038|836.30767|931.90473|897.58914|713.25686|712.54645|62108.49751|64007.92880| + |5111|217.60851|188.33439|240.23898|246.58722|289.15336|286.35133|338.69552|401.57566|392.30640|454.36248|510.67639|465.48678|453.29908|452.07535|479.07926|433.58397|390.81556|366.40189|414.39616|398.88015|410.43100|392.65385|319.38796|469.25412|389.47876|878.05118|979.36178|943.33243|749.79844|749.05163|65344.72371|67343.77541| + |5172|183.87087|182.06822|234.24153|231.98921|282.45806|279.79336|331.44594|386.67305|383.12559|443.95827|505.08363|460.93482|446.66308|449.71238|471.64803|451.80455|409.65115|384.25908|428.91553|462.17754|412.89024|378.40441|304.83450|439.98234|360.24151|801.81579|892.45620|859.55691|682.82806|682.14796|59460.87972|61279.36469| + |5732|183.11569|181.32043|231.15559|228.93294|278.83247|276.20197|324.59174|375.74672|372.29950|465.95439|483.12194|455.69859|419.53135|417.80920|435.45569|407.12840|367.62744|345.95575|392.16116|378.09709|388.34638|373.09854|303.76218|440.33643|377.80083|806.53673|894.12118|861.03177|683.26595|682.58541|59509.68769|61329.79292| + |5812|171.55784|169.87590|218.54218|216.44081|263.51360|261.02763|309.15838|360.69762|357.38846|414.47227|471.13666|429.92363|416.23221|419.67110|442.44048|419.01368|379.60402|362.16497|413.97706|402.64335|419.92739|407.41210|332.40488|496.30587|413.33528|951.16340|982.78937|943.83794|734.26687|733.53553|64092.82756|66054.79463| - Scenario Outline: Sector emissions from merchant id, cost, and date + Scenario Outline: Impacts committee from economic flows Given a purchase emitter - And a characteristic "merchant.id" of "<merchant>" - And a characteristic "cost" of "<cost>" - And a characteristic "date" of "<date>" + And a characteristic "merchant_category.mcc" of "<mcc>" + And a characteristic "date" of "2010-08-01" + And a characteristic "cost" of "100" When the "adjusted_cost" committee is calculated - And the "merchant_category" committee is calculated + And the "merchant_categories_industries" committee is calculated And the "industry_shares" committee is calculated And the "product_line_shares" committee is calculated + And the "industries_sectors" committee is calculated And the "sector_shares" committee is calculated - And the "emission_factors" committee is calculated - And the "sector_emissions" committee is calculated - Then the conclusion of the committee should include "<emission>" + And the "sector_direct_requirements" committee is calculated + And the "economic_flows" committee is calculated + And the "impact_vectors" committee is calculated + And the "impacts" committee is calculated + Then the conclusion of the committee should be a vector with values "<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>,<44101>,<44102>,<44103>,<44104>,<44105>" Examples: - | merchant | io_code | cost | date | emission | - | 1 | 1 | 100.00 | 2010-07-28 | 0.48 | - | 1 | 1 | 100.00 | 2010-07-28 | 5.21 | - | 1 | 1 | 100.00 | 2010-07-28 | 8.19 | - | 1 | 1 | 100.00 | 2010-07-28 | 9.73 | - | 1 | 3 | 100.00 | 2010-07-28 | 0.01 | - | 1 | 4 | 100.00 | 2010-07-28 | 10.85 | - | 1 | 5 | 100.00 | 2010-07-28 | 0.38 | - | 1 | 6 | 100.00 | 2010-07-28 | 0.05 | - | 1 | 6 | 100.00 | 2010-07-28 | 0.11 | - | 1 | 7 | 100.00 | 2010-07-28 | 0.12 | - | 1 | 8 | 100.00 | 2010-07-28 | 1.00 | - | 1 | 8 | 100.00 | 2010-07-28 | 1.33 | - | 1 | 9 | 100.00 | 2010-07-28 | 0.34 | - | 1 | 9 | 100.00 | 2010-07-28 | 0.45 | - | 1 | 10 | 100.00 | 2010-07-28 | 0.38 | - | 1 | 10 | 100.00 | 2010-07-28 | 0.51 | - | 1 | 11 | 100.00 | 2010-07-28 | 0.03 | - | 1 | 12 | 100.00 | 2010-07-28 | 0.03 | - | 1 | 13 | 100.00 | 2010-07-28 | 3.79 | - | 1 | 14 | 100.00 | 2010-07-28 | 3.47 | - | 1 | 15 | 100.00 | 2010-07-28 | 1.63 | - | 1 | 16 | 100.00 | 2010-07-28 | 0.09 | - | 1 | 17 | 100.00 | 2010-07-28 | 0.03 | - | 1 | 18 | 100.00 | 2010-07-28 | 0.08 | - | 2 | 10 | 100.00 | 2010-07-28 | 15.00 | - | 2 | 12 | 100.00 | 2010-07-28 | 11.37 | - | 2 | 25 | 100.00 | 2010-07-28 | 26.51 | - | 3 | 26 | 100.00 | 2010-07-28 | 66.28 | - | 4 | 19 | 100.00 | 2010-07-28 | 46.31 | - | 5 | 20 | 100.00 | 2010-07-28 | 132.56 | - | 5 | 21 | 100.00 | 2010-07-28 | 5.39 | - | 5 | 22 | 100.00 | 2010-07-28 | 3.73 | - | 5 | 23 | 100.00 | 2010-07-28 | 0.83 | - | 5 | 24 | 100.00 | 2010-07-28 | 4.97 | + |mcc | 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| 44101| 44102| 44103| 44104| 44105| + |3504|155.86731|104.03605|87.76257|291.34762|319.25215|182.42382|196.62746|114.82379|148.22195|168.43544|116.29640|264.81364|253.90832|250.65973|50.61214|114.76388|97.53452|73.10758|283.31637|826.63897|530.40921|342.37491|61.53280|539.83071|596.51261|669.04614|652.33331|89.75891|499.27980|855.05574|86951.89652|19202.37864| + |5111|176.26289|102.83058|86.00555|295.90467|312.28563|178.39687|192.04036|114.04748|145.15336|164.47922|112.34880|255.55224|246.59470|241.86031|48.38700|106.22807|89.88757|68.15075|231.64745|797.76030|533.56031|353.38847|63.87759|563.10495|623.16602|702.44095|685.55325|94.33324|524.85891|898.86196|91482.61320|20203.13262| + |5172|148.93540| 99.40924|83.85847|278.38705|305.05470|174.31126|187.92985|109.81514|141.75647|160.71289|111.11839|253.05321|242.98472|240.59612|47.63645|110.69211|94.21976|71.47218|239.76378|924.35508|536.75732|340.56397|60.96690|527.97880|576.38642|641.45263|624.71934|85.95569|477.97964|818.57755|83245.23160|18383.80940| + |5732|148.32370| 99.00095|82.75370|274.71953|301.13906|172.07383|184.04352|106.71206|137.75081|168.67549|106.28682|250.17853|228.22505|223.52792|43.98102| 99.74646|84.55431|64.34777|219.21809|756.19418|504.85029|335.78869|60.75243|528.40372|604.48133|645.22938|625.88482|86.10317|478.28616|819.10249|83313.56277|18398.93787| + |5812|138.96185| 92.75224|78.23810|259.72898|284.59469|162.62021|175.29280|102.43812|132.23373|150.03896|103.65006|236.02807|226.43032|224.52403|44.68648|102.65835|87.30892|67.36268|231.41317|805.28671|545.90561|366.67089|66.48097|595.56705|661.33645|760.93072|687.95256|94.38379|513.98681|880.24264|89729.95858|19816.43838|