@dra2020/district-analytics 5.0.0 → 5.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.
package/dist/cli.js CHANGED
@@ -91185,7 +91185,7 @@ function calcMinimalInverseResponsiveness(Vf, r) {
91185
91185
  const bBalanced = isBalanced(Vf);
91186
91186
  const ideal = bBalanced ? 0.1 : 0.2;
91187
91187
  MIR = (1 / r) - ideal;
91188
- MIR = U.trim(MIR);
91188
+ MIR = U.trim(Math.max(MIR, 0.0));
91189
91189
  }
91190
91190
  return MIR;
91191
91191
  }
@@ -102185,7 +102185,7 @@ Compactness: None
102185
102185
  Proportionality: 27.67% gap
102186
102186
  Cohesiveness: 11 unexpected splits, affecting 27.14% of the total population
102187
102187
 
102188
- These counties are split unexpectedly:
102188
+ These counties are split unexpectedly (meaning that they're smaller than a district):
102189
102189
 
102190
102190
  • Bladen
102191
102191
  • Buncombe
@@ -102289,6 +102289,7 @@ function doFindCountiesSplitUnexpectedly(s, bLog = false) {
102289
102289
  }
102290
102290
  countiesSplitUnexpectedly = countiesSplitUnexpectedly.sort();
102291
102291
  test['score'] = U.trim(unexpectedAffected);
102292
+ test['details']['nSplits'] = nSplits;
102292
102293
  test['details']['unexpectedSplits'] = unexpectedSplits;
102293
102294
  test['details']['countiesSplitUnexpectedly'] = countiesSplitUnexpectedly;
102294
102295
  return test;
@@ -102571,6 +102572,49 @@ function gfDiameter(poly) {
102571
102572
  exports.gfDiameter = gfDiameter;
102572
102573
 
102573
102574
 
102575
+ /***/ }),
102576
+
102577
+ /***/ "./src/minority.ts":
102578
+ /*!*************************!*\
102579
+ !*** ./src/minority.ts ***!
102580
+ \*************************/
102581
+ /*! no static exports found */
102582
+ /***/ (function(module, exports, __webpack_require__) {
102583
+
102584
+ "use strict";
102585
+
102586
+ //
102587
+ // PROTECTS MINORITIES
102588
+ //
102589
+ var __importDefault = (this && this.__importDefault) || function (mod) {
102590
+ return (mod && mod.__esModule) ? mod : { "default": mod };
102591
+ };
102592
+ Object.defineProperty(exports, "__esModule", { value: true });
102593
+ const majority_minority_json_1 = __importDefault(__webpack_require__(/*! ../static/majority-minority.json */ "./static/majority-minority.json"));
102594
+ const vra5_preclearance_json_1 = __importDefault(__webpack_require__(/*! ../static/vra5-preclearance.json */ "./static/vra5-preclearance.json"));
102595
+ // import stateContacts from '../static/state-contacts.json';
102596
+ // import demographicDefs from '../static/demographic-defns.json';
102597
+ // TODO - 2020: Update/revise this, when the update comes out in September:
102598
+ // Sources for majority-minority info:
102599
+ // - https://en.wikipedia.org/wiki/List_of_majority-minority_United_States_congressional_districts
102600
+ // - http://www.ncsl.org/Portals/1/Documents/Redistricting/Redistricting_2010.pdf (PP. 80–84)
102601
+ // - https://www.justice.gov/crt/jurisdictions-previously-covered-section-5
102602
+ function getMajorityMinority(s) {
102603
+ const xx = s.state.xx;
102604
+ const mMDict = majority_minority_json_1.default;
102605
+ const stateMM = mMDict[xx];
102606
+ return stateMM;
102607
+ }
102608
+ exports.getMajorityMinority = getMajorityMinority;
102609
+ function getVRASection5(s) {
102610
+ const xx = s.state.xx;
102611
+ const vraPreDict = vra5_preclearance_json_1.default;
102612
+ const stateVRAPre = vraPreDict[xx];
102613
+ return stateVRAPre;
102614
+ }
102615
+ exports.getVRASection5 = getVRASection5;
102616
+
102617
+
102574
102618
  /***/ }),
102575
102619
 
102576
102620
  /***/ "./src/political.ts":
@@ -103000,6 +103044,7 @@ function doAnalyzePostProcessing(s, bLog = false) {
103000
103044
  scorecard.traditionalPrinciples.details['census'] = datasets.census;
103001
103045
  const simpleSplits = s.getTest(5 /* UnexpectedCountySplits */);
103002
103046
  scorecard.traditionalPrinciples.details['unexpectedAffected'] = simpleSplits['score'];
103047
+ scorecard.traditionalPrinciples.details['nSplits'] = simpleSplits['details']['nSplits'];
103003
103048
  scorecard.traditionalPrinciples.details['countiesSplitUnexpectedly'] = U.deepCopy(simpleSplits['details']['countiesSplitUnexpectedly']);
103004
103049
  // NOTE - Add split precincts in dra-client directly
103005
103050
  // Derive secondary tests
@@ -103035,6 +103080,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
103035
103080
  const Score = __importStar(__webpack_require__(/*! @dra2020/dra-score */ "./node_modules/@dra2020/dra-score/dist/dra-score.bundle.js"));
103036
103081
  const U = __importStar(__webpack_require__(/*! ./utils */ "./src/utils.ts"));
103037
103082
  const D = __importStar(__webpack_require__(/*! ./_data */ "./src/_data.ts"));
103083
+ const M = __importStar(__webpack_require__(/*! ./minority */ "./src/minority.ts"));
103038
103084
  // PROFILE A PLAN
103039
103085
  function profilePlan(s, bLog = false) {
103040
103086
  const state = s.state.xx;
@@ -103154,7 +103200,9 @@ function scorePlan(s, p, bLog = false, overridesJSON) {
103154
103200
  let summaryRow = s.districts.numberOfRows() - 1;
103155
103201
  totalPop[summaryRow] = p.populationProfile.targetSize;
103156
103202
  popDevPct[summaryRow] = popDev;
103157
- //
103203
+ // Add minority notes
103204
+ scorecard.minority.details['majorityMinority'] = M.getMajorityMinority(s);
103205
+ scorecard.minority.details['vraPreclearance'] = M.getVRASection5(s);
103158
103206
  return scorecard;
103159
103207
  }
103160
103208
  exports.scorePlan = scorePlan;
@@ -103484,7 +103532,7 @@ function doIsComplete(s, bLog = false) {
103484
103532
  if (!bAllAssigned) {
103485
103533
  let unassignedDistrict = s.plan.geoIDsForDistrictID(S.NOT_ASSIGNED);
103486
103534
  unassignedFeatures = Array.from(unassignedDistrict);
103487
- unassignedFeatures = unassignedFeatures.slice(0, S.NUMBER_OF_ITEMS_TO_REPORT);
103535
+ // unassignedFeatures = unassignedFeatures.slice(0, S.NUMBER_OF_ITEMS_TO_REPORT);
103488
103536
  }
103489
103537
  // Do all real districts have at least one feature assigned to them?
103490
103538
  let emptyDistricts = [];
@@ -103688,6 +103736,17 @@ function isEmbedded(districtID, geoIDs, plan, graph) {
103688
103736
  exports.isEmbedded = isEmbedded;
103689
103737
 
103690
103738
 
103739
+ /***/ }),
103740
+
103741
+ /***/ "./static/majority-minority.json":
103742
+ /*!***************************************!*\
103743
+ !*** ./static/majority-minority.json ***!
103744
+ \***************************************/
103745
+ /*! exports provided: AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA, WV, WI, WY, default */
103746
+ /***/ (function(module) {
103747
+
103748
+ module.exports = JSON.parse("{\"AL\":{\"Black\":[7],\"Hispanic\":[],\"Pacific\":[]},\"AK\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"AZ\":{\"Black\":[],\"Hispanic\":[2,4,7],\"Pacific\":[]},\"AR\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"CA\":{\"Black\":[13,37,43],\"Hispanic\":[17,18,20,21,28,31,32,34,35,38,39,43,45,47,51],\"Pacific\":[12,13,14,15,17,18,19,27,34,39,45,47,52]},\"CO\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"CT\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"DE\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"FL\":{\"Black\":[5,20,24],\"Hispanic\":[18,21,25],\"Pacific\":[]},\"GA\":{\"Black\":[2,4,5,13],\"Hispanic\":[],\"Pacific\":[]},\"HI\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[2]},\"ID\":{\"Black\":[],\"Hispanic\":[1],\"Pacific\":[]},\"IL\":{\"Black\":[1,2,7],\"Hispanic\":[4],\"Pacific\":[]},\"IN\":{\"Black\":[7],\"Hispanic\":[],\"Pacific\":[]},\"IA\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"KS\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"KY\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"LA\":{\"Black\":[2],\"Hispanic\":[],\"Pacific\":[]},\"ME\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"MD\":{\"Black\":[4,7],\"Hispanic\":[],\"Pacific\":[]},\"MA\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"MI\":{\"Black\":[13,14],\"Hispanic\":[],\"Pacific\":[]},\"MN\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"MS\":{\"Black\":[2],\"Hispanic\":[],\"Pacific\":[]},\"MO\":{\"Black\":[1,5],\"Hispanic\":[],\"Pacific\":[]},\"MT\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"NE\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"NV\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"NH\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"NJ\":{\"Black\":[10,12],\"Hispanic\":[13],\"Pacific\":[6]},\"NM\":{\"Black\":[],\"Hispanic\":[2,13],\"Pacific\":[]},\"NY\":{\"Black\":[5,8,9,13],\"Hispanic\":[12,16],\"Pacific\":[6,7,10]},\"NC\":{\"Black\":[1,12],\"Hispanic\":[],\"Pacific\":[]},\"ND\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"OH\":{\"Black\":[3,11],\"Hispanic\":[],\"Pacific\":[]},\"OK\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"OR\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"PA\":{\"Black\":[2],\"Hispanic\":[],\"Pacific\":[]},\"RI\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"SC\":{\"Black\":[6],\"Hispanic\":[],\"Pacific\":[]},\"SD\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"TN\":{\"Black\":[9],\"Hispanic\":[],\"Pacific\":[]},\"TX\":{\"Black\":[9,18,33],\"Hispanic\":[15,16,19,20,23,27,28,29,32],\"Pacific\":[]},\"UT\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"VT\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"VA\":{\"Black\":[3],\"Hispanic\":[],\"Pacific\":[]},\"WA\":{\"Black\":[],\"Hispanic\":[3],\"Pacific\":[9]},\"WV\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]},\"WI\":{\"Black\":[4],\"Hispanic\":[],\"Pacific\":[]},\"WY\":{\"Black\":[],\"Hispanic\":[],\"Pacific\":[]}}");
103749
+
103691
103750
  /***/ }),
103692
103751
 
103693
103752
  /***/ "./static/state-reqs.json":
@@ -103701,6 +103760,17 @@ module.exports = JSON.parse("{\"AL\":\"https://www.brennancenter.org/sites/defau
103701
103760
 
103702
103761
  /***/ }),
103703
103762
 
103763
+ /***/ "./static/vra5-preclearance.json":
103764
+ /*!***************************************!*\
103765
+ !*** ./static/vra5-preclearance.json ***!
103766
+ \***************************************/
103767
+ /*! exports provided: AL, AK, AZ, CA, FL, GA, LA, MI, MS, NY, NC, SC, SD, TX, VA, default */
103768
+ /***/ (function(module) {
103769
+
103770
+ module.exports = JSON.parse("{\"AL\":\"all\",\"AK\":\"all\",\"AZ\":\"all\",\"CA\":\"parts\",\"FL\":\"parts\",\"GA\":\"all\",\"LA\":\"all\",\"MI\":\"parts\",\"MS\":\"all\",\"NY\":\"parts\",\"NC\":\"parts\",\"SC\":\"all\",\"SD\":\"parts\",\"TX\":\"all\",\"VA\":\"all\"}");
103771
+
103772
+ /***/ }),
103773
+
103704
103774
  /***/ "./test/_cli.ts":
103705
103775
  /*!**********************!*\
103706
103776
  !*** ./test/_cli.ts ***!