@dra2020/district-analytics 14.0.1 → 14.1.2

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.
@@ -106,9 +106,15 @@ class AnalyticsSession {
106
106
  return false;
107
107
  (0, preprocess_1.doPreprocessData)(this, bLog);
108
108
  (0, analyze_1.doAnalyzeDistricts)(this, bLog);
109
+ // This does a little stuff that didn't get factored out into dra-score and then dra-analytics
109
110
  (0, analyze_1.doAnalyzePlan)(this, bLog);
111
+ // The main analytics are next
112
+ // Run legacy analytics
110
113
  this._profile = (0, score_1.profilePlan)(this, bLog);
111
114
  this._scorecard = (0, score_1.scorePlan)(this, this._profile, bLog, overridesJSON);
115
+ // TODO: Run new analytics
116
+ // TODO: Compare the new & legacy scorecards
117
+ // TODO: Set a scorecard
112
118
  (0, results_1.doAnalyzePostProcessing)(this, bLog);
113
119
  }
114
120
  catch (e) {
@@ -238,7 +244,8 @@ const dra_analytics_1 = __webpack_require__(/*! @dra2020/dra-analytics */ "@dra2
238
244
  const U = __importStar(__webpack_require__(/*! ./utils */ "./src/utils.ts"));
239
245
  const S = __importStar(__webpack_require__(/*! ./settings */ "./src/settings.ts"));
240
246
  const compact_1 = __webpack_require__(/*! ./compact */ "./src/compact.ts");
241
- const political_1 = __webpack_require__(/*! ./political */ "./src/political.ts");
247
+ const dra_analytics_2 = __webpack_require__(/*! @dra2020/dra-analytics */ "@dra2020/dra-analytics");
248
+ // import { fptpWin } from './political'
242
249
  // DEBUG COUNTERS
243
250
  let nMissingDataset = 0;
244
251
  let nMissingProperty = 0;
@@ -472,7 +479,7 @@ class Districts {
472
479
  demPct = demVotes / totVotes;
473
480
  repPct = repVotes / totVotes;
474
481
  othPct = othVotes / totVotes;
475
- DemSeat = (0, political_1.fptpWin)(demPct);
482
+ DemSeat = dra_analytics_2.Partisan.fptpWin(demPct);
476
483
  }
477
484
  // Total minority VAP
478
485
  let minorityPop = totalVAP - whitePop;
@@ -1463,7 +1470,7 @@ function scoreKIWYSICompactness(s, bLog = false) {
1463
1470
  goodShapes.features.push(f);
1464
1471
  }
1465
1472
  }
1466
- const scores = dra_analytics_1.Compactness.scoreShapes(goodShapes, 0 /* Revised */);
1473
+ const scores = dra_analytics_1.Compactness.kiwysiScoreShapes(goodShapes, 0 /* Revised */);
1467
1474
  // Round & invert the scores here at the source vs. later on, higher up.
1468
1475
  // Raw KIWYSI scores will be 1–100 with smaller better, so map to 1–100 bigger better.
1469
1476
  return scores.map(n => 100 - Math.round(n) + 1);
@@ -1566,7 +1573,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1566
1573
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1567
1574
  };
1568
1575
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1569
- exports.uncertaintyOfMembership = exports.effectiveSplits = exports.inferSelectedMinority = exports.fieldForFeature = exports.geoIDForFeature = void 0;
1576
+ exports.uncertaintyOfMembership = exports.effectiveSplits = exports.avgSVError = exports.isAntimajoritarian = exports.ratePartisanBias = exports.inferSelectedMinority = exports.fieldForFeature = exports.geoIDForFeature = void 0;
1570
1577
  __exportStar(__webpack_require__(/*! ./_api */ "./src/_api.ts"), exports);
1571
1578
  var _data_1 = __webpack_require__(/*! ./_data */ "./src/_data.ts");
1572
1579
  Object.defineProperty(exports, "geoIDForFeature", ({ enumerable: true, get: function () { return _data_1.geoIDForFeature; } }));
@@ -1577,6 +1584,9 @@ __exportStar(__webpack_require__(/*! ./types */ "./src/types.ts"), exports);
1577
1584
  __exportStar(__webpack_require__(/*! ./utils */ "./src/utils.ts"), exports);
1578
1585
  // Re-export RPV types and COI splitting functions
1579
1586
  const dra_analytics_1 = __webpack_require__(/*! @dra2020/dra-analytics */ "@dra2020/dra-analytics");
1587
+ exports.ratePartisanBias = dra_analytics_1.Rate.ratePartisanBias;
1588
+ exports.isAntimajoritarian = dra_analytics_1.Rate.isAntimajoritarian;
1589
+ exports.avgSVError = dra_analytics_1.Rate.avgSVError;
1580
1590
  exports.effectiveSplits = dra_analytics_1.Splitting.effectiveSplits;
1581
1591
  exports.uncertaintyOfMembership = dra_analytics_1.Splitting.uncertaintyOfMembership;
1582
1592
 
@@ -1639,28 +1649,6 @@ exports.doAnalyzeRacialPolarization = doAnalyzeRacialPolarization;
1639
1649
  // 11-18-2020 - Moved RPV to racial-voting package.
1640
1650
 
1641
1651
 
1642
- /***/ }),
1643
-
1644
- /***/ "./src/political.ts":
1645
- /*!**************************!*\
1646
- !*** ./src/political.ts ***!
1647
- \**************************/
1648
- /***/ ((__unused_webpack_module, exports) => {
1649
-
1650
-
1651
- //
1652
- // FAIR/PROPORTIONAL
1653
- //
1654
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1655
- exports.fptpWin = void 0;
1656
- function fptpWin(demPct) {
1657
- // Vote shares should be fractions in the range [0.0 – 1.0]
1658
- //assert((demPct <= 1.0) && (demPct >= 0.0));
1659
- return ((demPct > 0.5) ? 1 : 0);
1660
- }
1661
- exports.fptpWin = fptpWin;
1662
-
1663
-
1664
1652
  /***/ }),
1665
1653
 
1666
1654
  /***/ "./src/preprocess.ts":