@dra2020/district-analytics 5.8.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -89102,7 +89102,7 @@ exports.scorePolsbyPopper = scorePolsbyPopper;
89102
89102
  /*! exports provided: partisan, minority, traditionalPrinciples, default */
89103
89103
  /***/ (function(module) {
89104
89104
 
89105
- module.exports = JSON.parse("{\"partisan\":{\"bias\":{\"range\":[0,0.2],\"weight\":[50,80]},\"impact\":{\"weight\":[50,0],\"threshold\":4},\"competitiveness\":{\"overall\":{\"range\":[0,0.67],\"weight\":100},\"marginal\":{\"range\":[0,0.85],\"weight\":0},\"range\":[0.45,0.55],\"distribution\":[0.25,0.75],\"weight\":[0,20]},\"bonus\":2,\"weight\":[100,80]},\"minority\":{\"range\":[0.37,0.5],\"distribution\":[0.25,0.75],\"shift\":0.15,\"bonus\":20},\"traditionalPrinciples\":{\"compactness\":{\"reock\":{\"range\":[0.25,0.5],\"weight\":50},\"polsby\":{\"range\":[0.1,0.5],\"weight\":50},\"weight\":[0,50]},\"splitting\":{\"county\":{\"range\":[[1.26,1.68],[1.09,1.45]],\"weight\":50},\"district\":{\"range\":[[1.26,1.68],[1.09,1.45]],\"weight\":50},\"weight\":[0,50]},\"popdev\":{\"range\":[[0.0075,0.002],[0.1,-1]],\"weight\":[0,0]},\"weight\":[0,20]}}");
89105
+ module.exports = JSON.parse("{\"partisan\":{\"bias\":{\"range\":[0,0.2],\"weight\":[50,80]},\"impact\":{\"weight\":[50,0],\"threshold\":4},\"competitiveness\":{\"overall\":{\"range\":[0,0.67],\"weight\":100},\"marginal\":{\"range\":[0,0.85],\"weight\":0},\"range\":[0.45,0.55],\"distribution\":[0.25,0.75],\"weight\":[0,20]},\"bonus\":2,\"weight\":[100,80]},\"minority\":{\"range\":[0.37,0.5],\"distribution\":[0.25,0.75],\"shift\":0.15,\"coalition\":{\"weight\":0.5},\"bonus\":20},\"traditionalPrinciples\":{\"compactness\":{\"reock\":{\"range\":[0.25,0.5],\"weight\":50},\"polsby\":{\"range\":[0.1,0.5],\"weight\":50},\"weight\":[0,50]},\"splitting\":{\"county\":{\"range\":[[1.26,1.68],[1.09,1.45]],\"weight\":50},\"district\":{\"range\":[[1.26,1.68],[1.09,1.45]],\"weight\":50},\"weight\":[0,50]},\"popdev\":{\"range\":[[0.0075,0.002],[0.1,-1]],\"weight\":[0,0]},\"weight\":[0,20]}}");
89106
89106
 
89107
89107
  /***/ }),
89108
89108
 
@@ -89206,11 +89206,11 @@ function minorityShift(overridesJSON) {
89206
89206
  return shift;
89207
89207
  }
89208
89208
  exports.minorityShift = minorityShift;
89209
- function opportunityDistrictBonus(overridesJSON) {
89210
- const bonus = config_json_1.default.minority.bonus;
89211
- return bonus;
89209
+ function coalitionDistrictWeight(overridesJSON) {
89210
+ const weight = config_json_1.default.minority.coalition.weight;
89211
+ return weight;
89212
89212
  }
89213
- exports.opportunityDistrictBonus = opportunityDistrictBonus;
89213
+ exports.coalitionDistrictWeight = coalitionDistrictWeight;
89214
89214
  function minorityBonus(overridesJSON) {
89215
89215
  const bonus = config_json_1.default.minority.bonus;
89216
89216
  return bonus;
@@ -89396,9 +89396,6 @@ function __export(m) {
89396
89396
  }
89397
89397
  Object.defineProperty(exports, "__esModule", { value: true });
89398
89398
  __export(__webpack_require__(/*! ./_api */ "./src/_api.ts"));
89399
- var types_1 = __webpack_require__(/*! ./types */ "./src/types.ts");
89400
- exports.sampleScorecard = types_1.sampleScorecard;
89401
- exports.sampleProfile = types_1.sampleProfile;
89402
89399
 
89403
89400
 
89404
89401
  /***/ }),
@@ -89451,7 +89448,7 @@ function evalMinorityOpportunity(p, bLog = false) {
89451
89448
  for (let i = 0; i < p.nDistricts; i++) {
89452
89449
  // Find the opportunities for minority representation
89453
89450
  for (let j = 0; j < nDemos; j++) {
89454
- const proportion = U.deepCopy(demosByDistrict[i][j + offset]);
89451
+ const proportion = U.deepCopy(demosByDistrict[i][j + offset]); // Skip the 'White' entries
89455
89452
  if (exceedsMinimumThreshold(proportion)) {
89456
89453
  // Bucket opportunity districts
89457
89454
  const bucket = (exceedsMaximumThreshold(proportion)) ? 1 : 0;
@@ -89461,30 +89458,44 @@ function evalMinorityOpportunity(p, bLog = false) {
89461
89458
  }
89462
89459
  }
89463
89460
  }
89464
- // Sum the # of opportunity districts - ignore total minority
89465
- const oD = U.sumArray(opptyByDemo.slice(1));
89466
- // Sum the # of proportional districts - ignore total minority
89467
- const pD = U.sumArray(districtsByDemo.slice(1));
89461
+ // The # of opportunity districts for each separate demographic and all minorities
89462
+ const oD = U.sumArray(opptyByDemo.slice(1)); // Sum individual demos, skipping all minorities
89463
+ const cD = opptyByDemo[0]; // All minorities
89464
+ // The # of proportional districts for each separate demographic and all minorities
89465
+ const pOd = U.sumArray(districtsByDemo.slice(1)); // Sum individual demos, skipping all minorities
89466
+ const pCd = districtsByDemo[0]; // All minorities
89468
89467
  // Score opportunity
89469
- const score = scoreMinority(oD, pD);
89468
+ const score = scoreMinority(oD, pOd, cD, pCd);
89470
89469
  let mS = {
89471
89470
  report: {
89472
89471
  averageDVf: averageDVf,
89473
89472
  averageRVf: averageRVf,
89474
89473
  bucketsByDemographic: bucketsByDemo
89475
89474
  },
89476
- nProportional: pD,
89475
+ proportionalOpportunities: pOd,
89477
89476
  opportunityDistricts: oD,
89477
+ proportionalCoalitions: pCd,
89478
+ coalitionDistricts: cD,
89478
89479
  score: score,
89479
89480
  details: {}
89480
89481
  };
89481
89482
  return mS;
89482
89483
  }
89483
89484
  exports.evalMinorityOpportunity = evalMinorityOpportunity;
89484
- function scoreMinority(oD, pD) {
89485
+ // NOTE - The probable # of opportunity & coalition districts can be *larger* than
89486
+ // what would be a proportional # based on the statewide percentage, because of
89487
+ // how minority opportunities are estimated (so that 37% minority shares score
89488
+ // like 52% share).
89489
+ function scoreMinority(oD, pOd, cD, pCd) {
89485
89490
  // Score minority opportunity [0–100] here; weight it later
89486
89491
  const bonus = 100; // C.minorityBonus();
89487
- const score = (pD > 0) ? Math.round((Math.min(oD, pD) / pD) * bonus) : 0;
89492
+ const cDWeight = C.coalitionDistrictWeight();
89493
+ // Cap opportunity & coalition districts
89494
+ const oDCapped = Math.min(oD, pOd);
89495
+ const cdCapped = Math.min(cD, pCd);
89496
+ const opportunityScore = (pOd > 0) ? Math.round((oDCapped / pOd) * bonus) : 0;
89497
+ const coalitionScore = (pCd > 0) ? Math.round((cdCapped / pCd) * bonus) : 0;
89498
+ const score = Math.round(Math.min(opportunityScore + cDWeight * Math.max(coalitionScore - opportunityScore, 0), 100));
89488
89499
  return score;
89489
89500
  }
89490
89501
  exports.scoreMinority = scoreMinority;
@@ -89510,7 +89521,7 @@ function estMinorityOpportunity(Mf) {
89510
89521
  _normalizer.wipNum += shift;
89511
89522
  _normalizer.clip(dist[C.BEG], dist[C.END]);
89512
89523
  _normalizer.unitize(dist[C.BEG], dist[C.END]);
89513
- const oppty = (Mf < range[C.BEG]) ? 0.0 : partisan_1.estSeatProbability(_normalizer.wipNum, dist);
89524
+ const oppty = (Mf < range[C.BEG]) ? 0.0 : Math.min(partisan_1.estSeatProbability(_normalizer.wipNum, dist), 1.0);
89514
89525
  return oppty;
89515
89526
  }
89516
89527
  exports.estMinorityOpportunity = estMinorityOpportunity;
@@ -89728,23 +89739,25 @@ function scorePartisan(Vf, VfArray, options) {
89728
89739
  const impactScore = scoreImpact(unearnedS, Vf, estSf, N);
89729
89740
  // Calculate additional alternate metrics for reference
89730
89741
  // NOTE - Use the uncompressed seat probability function
89731
- const inferredSVpoints = bAlternateMetrics ? inferSVpoints(Vf, VfArray, shift) : undefined;
89742
+ const dSVpoints = inferSVpoints(Vf, VfArray, shift);
89743
+ const rSVpoints = invertSVPoints(dSVpoints);
89744
+ // const dSVpoints = bAlternateMetrics ? inferSVpoints(Vf, VfArray, shift) : undefined;
89732
89745
  const TOf = bAlternateMetrics ? calcTurnoutBias(Vf, VfArray) : undefined;
89733
- const Bs50 = bAlternateMetrics ? estPartisanBias(inferredSVpoints, N) : undefined;
89746
+ const Bs50 = bAlternateMetrics ? estPartisanBias(dSVpoints, N) : undefined;
89734
89747
  const Bs50f = (!(Bs50 === undefined)) ? U.trim(Bs50 / N) : undefined;
89735
- const Bv50f = bAlternateMetrics ? estVotesBias(inferredSVpoints, N) : undefined;
89748
+ const Bv50f = bAlternateMetrics ? estVotesBias(dSVpoints, N) : undefined;
89736
89749
  const rvPoints = bAlternateMetrics ? keyRVpoints(VfArray) : undefined;
89737
89750
  const decl = bAlternateMetrics ? calcDeclination(VfArray) : undefined;
89738
- const gSym = bAlternateMetrics ? calcGlobalSymmetry(inferredSVpoints, Bs50f) : undefined;
89751
+ const gSym = bAlternateMetrics ? calcGlobalSymmetry(dSVpoints, rSVpoints, Bs50f) : undefined;
89739
89752
  const EG = bAlternateMetrics ? calcEfficiencyGap(Vf, estSf) : undefined;
89740
- const BsGf = bAlternateMetrics ? estGeometricSeatsBias(Vf, inferredSVpoints) : undefined;
89753
+ const BsGf = bAlternateMetrics ? estGeometricSeatsBias(Vf, dSVpoints, rSVpoints) : undefined;
89741
89754
  const prop = bAlternateMetrics ? calcDisproportionality(Vf, estSf) : undefined;
89742
89755
  const mMs = bAlternateMetrics ? estMeanMedianDifference(VfArray, Vf) : undefined;
89743
89756
  const mMd = bAlternateMetrics ? estMeanMedianDifference(VfArray) : undefined;
89744
89757
  const LO = bAlternateMetrics ? calcLopsidedOutcomes(VfArray) : undefined;
89745
89758
  // Calculate alternate responsiveness metrics for reference
89746
89759
  const bigR = bAlternateMetrics ? calcBigR(Vf, estSf) : undefined;
89747
- const littleR = bAlternateMetrics ? estResponsiveness(Vf, inferredSVpoints) : undefined;
89760
+ const littleR = bAlternateMetrics ? estResponsiveness(Vf, dSVpoints) : undefined;
89748
89761
  const MIR = (bAlternateMetrics && littleR) ? calcMinimalInverseResponsiveness(Vf, littleR) : undefined;
89749
89762
  const rD = (!bConstrained || bAlternateMetrics) ? estResponsiveDistricts(VfArray) : undefined;
89750
89763
  const rDf = bAlternateMetrics ? estResponsiveDistrictsShare(rD, N) : undefined;
@@ -89810,6 +89823,8 @@ function scorePartisan(Vf, VfArray, options) {
89810
89823
  bias: biasScoring,
89811
89824
  impact: impactScoring,
89812
89825
  competitiveness: competitiveScoring,
89826
+ dSVpoints: dSVpoints,
89827
+ rSVpoints: rSVpoints,
89813
89828
  score: acrossStatesPartisanScore,
89814
89829
  score2: withinStatesPartisanScore,
89815
89830
  details: {}
@@ -90281,9 +90296,9 @@ function estVotesBias(inferredSVpoints, nDistricts) {
90281
90296
  }
90282
90297
  exports.estVotesBias = estVotesBias;
90283
90298
  // GEOMETRIC SEATS BIAS (@ V = statewide vote share)
90284
- function estGeometricSeatsBias(Vf, inferredSVpoints) {
90299
+ function estGeometricSeatsBias(Vf, dSVpoints, rSVpoints) {
90285
90300
  let BsGf = undefined;
90286
- const bgsSVpoints = inferGeometricSeatsBiasPoints(inferredSVpoints);
90301
+ const bgsSVpoints = inferGeometricSeatsBiasPoints(dSVpoints, rSVpoints);
90287
90302
  // Interpolate the seat fraction @ Vf
90288
90303
  const lowerPt = findBracketingLowerVf(Vf, bgsSVpoints);
90289
90304
  const upperPt = findBracketingUpperVf(Vf, bgsSVpoints);
@@ -90296,14 +90311,13 @@ function estGeometricSeatsBias(Vf, inferredSVpoints) {
90296
90311
  return BsGf;
90297
90312
  }
90298
90313
  exports.estGeometricSeatsBias = estGeometricSeatsBias;
90299
- function inferGeometricSeatsBiasPoints(inferredSVpoints) {
90300
- const nPoints = inferredSVpoints.length;
90301
- const inverseSVpoints = invertSVPoints(inferredSVpoints);
90314
+ function inferGeometricSeatsBiasPoints(dSVpoints, rSVpoints) {
90315
+ const nPoints = dSVpoints.length;
90302
90316
  let bgsSVpoints = [];
90303
90317
  for (let i = 0; i < nPoints; i++) {
90304
- const Vf = inferredSVpoints[i].v;
90305
- const sD = inferredSVpoints[i].s;
90306
- const sR = inverseSVpoints[i].s;
90318
+ const Vf = dSVpoints[i].v;
90319
+ const sD = dSVpoints[i].s;
90320
+ const sR = rSVpoints[i].s;
90307
90321
  const BsGf = 0.5 * (sR - sD);
90308
90322
  bgsSVpoints.push({ v: Vf, s: BsGf });
90309
90323
  }
@@ -90462,11 +90476,10 @@ function calcLopsidedOutcomes(VfArray) {
90462
90476
  }
90463
90477
  exports.calcLopsidedOutcomes = calcLopsidedOutcomes;
90464
90478
  // GLOBAL SYMMETRY - Fig. 17 in Section 5.1
90465
- function calcGlobalSymmetry(inferredSVpoints, S50V) {
90466
- const invertedSVpoints = invertSVPoints(inferredSVpoints);
90479
+ function calcGlobalSymmetry(dSVpoints, rSVpoints, S50V) {
90467
90480
  let gSym = 0.0;
90468
- for (let i in inferredSVpoints) {
90469
- gSym += Math.abs(inferredSVpoints[i].s - invertedSVpoints[i].s) / 2;
90481
+ for (let i in dSVpoints) {
90482
+ gSym += Math.abs(dSVpoints[i].s - rSVpoints[i].s) / 2;
90470
90483
  }
90471
90484
  const sign = (S50V < 0) ? -1 : 1;
90472
90485
  gSym *= sign;
@@ -90732,30 +90745,6 @@ exports.AVERAGE_BLOCK_SIZE = 30;
90732
90745
  exports.EQUAL_TOLERANCE = exports.AVERAGE_BLOCK_SIZE / 2;
90733
90746
 
90734
90747
 
90735
- /***/ }),
90736
-
90737
- /***/ "./src/types.ts":
90738
- /*!**********************!*\
90739
- !*** ./src/types.ts ***!
90740
- \**********************/
90741
- /*! no static exports found */
90742
- /***/ (function(module, exports, __webpack_require__) {
90743
-
90744
- "use strict";
90745
-
90746
- //
90747
- // TYPE DEFINITIONS
90748
- //
90749
- var __importDefault = (this && this.__importDefault) || function (mod) {
90750
- return (mod && mod.__esModule) ? mod : { "default": mod };
90751
- };
90752
- Object.defineProperty(exports, "__esModule", { value: true });
90753
- const sample_profile_json_1 = __importDefault(__webpack_require__(/*! ../testdata/samples/sample-profile.json */ "./testdata/samples/sample-profile.json"));
90754
- exports.sampleProfile = sample_profile_json_1.default;
90755
- const sample_scorecard_json_1 = __importDefault(__webpack_require__(/*! ../testdata/samples/sample-scorecard.json */ "./testdata/samples/sample-scorecard.json"));
90756
- exports.sampleScorecard = sample_scorecard_json_1.default;
90757
-
90758
-
90759
90748
  /***/ }),
90760
90749
 
90761
90750
  /***/ "./src/utils.ts":
@@ -90854,28 +90843,6 @@ function deepCopy(src) {
90854
90843
  exports.deepCopy = deepCopy;
90855
90844
 
90856
90845
 
90857
- /***/ }),
90858
-
90859
- /***/ "./testdata/samples/sample-profile.json":
90860
- /*!**********************************************!*\
90861
- !*** ./testdata/samples/sample-profile.json ***!
90862
- \**********************************************/
90863
- /*! exports provided: state, planName, nDistricts, nCounties, legislativeDistricts, populationProfile, compactnessProfile, splittingProfile, partisanProfile, demographicProfile, default */
90864
- /***/ (function(module) {
90865
-
90866
- module.exports = JSON.parse("{\"state\":\"NC\",\"planName\":\"NC 116th Congressional\",\"nDistricts\":13,\"nCounties\":100,\"legislativeDistricts\":false,\"populationProfile\":{\"totalPopByDistrict\":[733499,733499,733498,733499,733499,733498,733499,733499,733498,733499,733499,733498,733499],\"targetSize\":733499},\"compactnessProfile\":{\"geometryByDistrict\":[[1.577393519870778,10.159603194222512,2.6574239327900613],[0.7058443860242223,7.806818205304456,1.7632772181381422],[2.9200833695730037,9.972779463090355,2.733997011824872],[0.1913918462294299,3.5460738146162076,0.9224411598627837],[1.039017192939366,6.4920493759205495,2.1060599512212406],[1.0334601456545682,6.466840626614781,1.6394147493749138],[1.6241884494008865,7.988593581066711,1.9529170345835551],[0.7706777049448708,6.980189925133433,2.188634395661598],[0.9976766364327585,8.350880983965949,2.5604199958307654],[0.6762837622380331,5.8543721706585545,1.7264608756890525],[1.719230725216499,10.37139670690812,3.1586859214584764],[0.11329839503948308,2.2954988975477066,0.5379072920877442],[0.48371245467321944,5.3384017624136435,1.4517375375301198]]},\"splittingProfile\":{\"countyPopByDistrict\":[[0,0,0,0,0,0,0,21282,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240299,56552,0,0,0,12197,0,59916,0,0,54691,0,0,0,24669,0,0,0,0,0,0,0,0,0,0,0,0,24505,0,0,0,0,0,0,22099,0,0,0,0,0,0,0,80880,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45422,0,20972,13228,0,0,0,56787,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,0,60619,0,0,0,0,0,0,0,114678,0,0,0,0,0,0,0,109332,0,0,0,0,0,0,0,0,0,0,0,0,95840,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,328583,0,0,0,0,0,24447,0,0],[0,0,0,0,0,0,47759,0,0,0,0,0,0,0,9980,66469,0,0,0,0,14793,0,0,0,103505,0,23547,33920,0,0,0,0,0,0,0,0,0,0,0,21362,0,0,0,0,0,0,0,5810,0,0,0,10153,0,59495,0,0,0,0,0,0,0,0,0,0,0,0,177772,0,13144,40661,0,13453,0,87268,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4407,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,0,0,0,0,0,0,0,27288,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,133801,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,572410,0,0,0,0,0,0,0,0],[0,37198,11155,0,27281,17797,0,0,0,0,0,0,0,0,0,0,0,9499,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,350670,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47401,73673,0,0,0,0,0,0,0,0,51079,0,69340,0,38406,0],[151131,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23719,0,63505,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162418,0,0,0,0,0,0,0,0,0,0,0,57866,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39464,0,0,141752,0,0,93643,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,8981,107431,0,0,0,0,0,0,0,0,0,0,0,0,0,58098,0,0,0,0,0,0,58505,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59546,0,0,0,0,0,0,0,0,0,0,0,0,0,202667,0,0,0,0,0,52217,0,0,0,0,0,0,0,0,0,0,63431,0,0,0,0,0,0,0,0,0,0,0,0,0,122623,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,178011,0,0,0,0,0,0,0,0,0,0,0,0,243476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46952,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27798,88247,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,88430,0,0,0,60585,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,26948,0,0,0,0,26209,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75955,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,186130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46639,134168,0,0,0,0,36157,0,0,0,0,0,0,201292,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,111849,0,0,0,0,0,0,144859,0,0,0,0,98078,0,0,0,0,0,0,0,0,0,0,0,0,206086,0,0,0,0,0,0,0,0,0,0,0,0,6042,0,0,0,0,0,78265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20510,0,0,0,0,0,67810,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,126469,90912,0,83029,0,0,0,0,0,27444,0,10587,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8861,0,0,0,0,0,59036,106740,0,0,0,0,40271,0,0,0,0,0,44996,33922,20764,0,0,15579,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,13981,33090,0,0,0,0,0,0,0,0,0,0,0,17818],[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,733498,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,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,162878,41240,0,0,0,0,0,0,0,0,0,0,325988,0,0,0,0,0,0,0,153395,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,49998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]},\"partisanProfile\":{\"statewideVf\":0.488799,\"vfArray\":[0.38133475250631976,0.3849820112175976,0.3932778243643098,0.4232536822067312,0.42479562842958446,0.43309446651496813,0.43760621455968074,0.43980028165892326,0.4545677480810613,0.4642133701735491,0.6853270858231137,0.6938881738049054,0.6953207231271951]},\"demographicProfile\":{\"stateMfArray\":[0.684371246819619,0.31562875318038097,0.21168281993226215,0.06787156278984616,0.0012540930000187486,0.024136155044881008,0.017483272326632705],\"mfArrayByDistrict\":[[0.46201994876162167,0.5379800512383783,0.44446912914151915,0.065885219684988,0.0009221497550043815,0.0218600624522836,0.01298238746863721],[0.7062964810448031,0.2937035189551968,0.19676408791341676,0.07140508797387993,0.0009787472035794184,0.02027027027027027,0.011283934941653062],[0.7125415968218078,0.2874584031781921,0.21181863608495496,0.05374539732717163,0.002106863519897368,0.01628256424250371,0.010404964330393058],[0.6162003899079305,0.3837996100920695,0.22386087117385056,0.08687191382180923,0.0012060108434249284,0.07153885560599377,0.010091002234143982],[0.7766842620090415,0.22331573799095852,0.14015703622760559,0.06690518783542039,0.0007790124871119258,0.013001753659331847,0.007680851626320752],[0.7111584046318987,0.2888415953681012,0.19851813634865356,0.07148666466027488,0.0008061395588804333,0.013621967123837368,0.010186021181764765],[0.7086112059348308,0.2913887940651691,0.20229594619799895,0.06953648210647081,0.001149028868250555,0.009700759801937688,0.014166663733974303],[0.6697822118227867,0.33021778817721326,0.2240088599271958,0.07249565635824667,0.002909229825482943,0.022877125445843145,0.01884938491094157],[0.6406346877484486,0.35936531225155144,0.19622106825202063,0.059419121439330605,0.0010389455633486816,0.02217720538538736,0.08616917683114156],[0.8192767260107778,0.18072327398922214,0.11582505713398979,0.045060025957170666,0.0006806703721468273,0.014117738340433936,0.008000521964844963],[0.8956213645578734,0.1043786354421266,0.032662784268536554,0.04329373425036473,0.0012436075643032956,0.010267513422177209,0.019651410943402076],[0.46574079494234033,0.5342592050576597,0.36183998712169996,0.12151883451384417,0.001650032195750161,0.050651598079962536,0.010997775566352515],[0.6979595109954735,0.3020404890045265,0.21171009017357523,0.0572352710553516,0.0008767865416830024,0.028566846063370996,0.009525252165235058]]}}");
90867
-
90868
- /***/ }),
90869
-
90870
- /***/ "./testdata/samples/sample-scorecard.json":
90871
- /*!************************************************!*\
90872
- !*** ./testdata/samples/sample-scorecard.json ***!
90873
- \************************************************/
90874
- /*! exports provided: score, partisan, minority, traditionalPrinciples, details, default */
90875
- /***/ (function(module) {
90876
-
90877
- module.exports = JSON.parse("{\"score\":5,\"partisan\":{\"bias\":{\"bestS\":7,\"bestSf\":0.5385,\"estS\":4.1925,\"estSf\":0.3225,\"bias\":0.216,\"tOf\":-0.0023,\"fptpS\":3,\"bS50\":0.2172,\"bV50\":0.045,\"decl\":36.5164,\"gSym\":0.066602,\"gamma\":0.0123,\"eG\":0.2846,\"bSV\":0.2098,\"prop\":0.2695,\"mMd\":0.0593,\"mMs\":0.057,\"lO\":0.1106,\"score\":0},\"impact\":{\"unearnedS\":2.8075,\"score\":0},\"competitiveness\":{\"bigR\":-16.926,\"littleR\":4.3523,\"mIR\":0.1298,\"rD\":4.0207,\"rDf\":0.3093,\"cSimple\":6,\"cD\":0.7266,\"cDf\":0.0559,\"mRange\":[5,11],\"mD\":0.7134,\"mDf\":0.1019,\"score\":10},\"score\":3,\"score2\":2,\"details\":{\"election\":\"2016 Presidential, US Senate, Governor, and AG election results\"}},\"minority\":{\"report\":{\"bucketsByDemographic\":[[10,14],[3,0],[1,9],[0,0],[0,0],[0,0]],\"averageDVf\":0.6737588682747838},\"nProportional\":18,\"opportunityDistricts\":12.9424,\"score\":14,\"details\":{\"vap\":\"2010 Voting Age Population\"}},\"traditionalPrinciples\":{\"score\":18,\"compactness\":{\"score\":35,\"reock\":{\"raw\":0.3373,\"normalized\":35,\"notes\":{}},\"polsby\":{\"raw\":0.2418,\"normalized\":35,\"notes\":{}}},\"splitting\":{\"score\":0,\"county\":{\"raw\":1.1474,\"normalized\":0,\"notes\":{}},\"district\":{\"raw\":1.4839,\"normalized\":3,\"notes\":{}}},\"populationDeviation\":{\"raw\":0.016,\"normalized\":0,\"notes\":{\"maxDeviation\":11693}},\"details\":{\"countiesSplitUnexpectedly\":[\"Bladen\",\"Buncombe\",\"Catawba\",\"Cumberland\",\"Durham\",\"Guilford\",\"Iredell\",\"Johnston\",\"Pitt\",\"Rowan\",\"Wilson\"],\"unexpectedAffected\":0.3096,\"nSplitVTDs\":12,\"splitVTDs\":[\"VTD-01\",\"VTD-02\",\"VTD-03\",\"VTD-04\",\"VTD-05\",\"VTD-06\",\"VTD-07\",\"VTD-08\",\"VTD-09\",\"VTD-10\",\"VTD-11\",\"VTD-12\"],\"shapes\":\"2010 VTD shapes\",\"census\":\"2010 Census Total Population\"}},\"details\":{}}");
90878
-
90879
90846
  /***/ })
90880
90847
 
90881
90848
  /******/ });