@dra2020/district-analytics 5.3.3 → 5.5.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 +14 -24
- package/dist/cli.js.map +1 -1
- package/dist/district-analytics.js +4 -20
- package/dist/district-analytics.js.map +1 -1
- package/dist/src/results.d.ts +1 -3
- package/package.json +13 -13
package/dist/cli.js
CHANGED
|
@@ -89430,7 +89430,9 @@ function evalMinorityOpportunity(p, bLog = false) {
|
|
|
89430
89430
|
// Calculate average Democratic win share
|
|
89431
89431
|
const VfArray = p.partisanProfile.vfArray;
|
|
89432
89432
|
const DWins = VfArray.filter(x => x > 0.5);
|
|
89433
|
+
const RWins = VfArray.filter(x => x <= 0.5); // Ties credited to R's
|
|
89433
89434
|
const averageDVf = (DWins.length > 0) ? U.avgArray(DWins) : undefined;
|
|
89435
|
+
const averageRVf = (RWins.length > 0) ? U.avgArray(RWins) : undefined;
|
|
89434
89436
|
// Determine proportional minority districts by demographic (ignore 'White')
|
|
89435
89437
|
const districtsByDemo = calcDistrictsByDemo(p.demographicProfile.stateMfArray.slice(1), p.nDistricts);
|
|
89436
89438
|
// Initialize arrays for results
|
|
@@ -89438,6 +89440,7 @@ function evalMinorityOpportunity(p, bLog = false) {
|
|
|
89438
89440
|
const nDemos = 6 /* Native */ + 1 - offset; // Ditto
|
|
89439
89441
|
const nBuckets = 2; // 37–50% and > 50%
|
|
89440
89442
|
const demosByDistrict = p.demographicProfile.mfArrayByDistrict;
|
|
89443
|
+
// Initialize the demographic buckets
|
|
89441
89444
|
let bucketsByDemo = new Array(nDemos);
|
|
89442
89445
|
for (let j = 0; j < nDemos; j++) {
|
|
89443
89446
|
bucketsByDemo[j] = [0, 0];
|
|
@@ -89459,13 +89462,14 @@ function evalMinorityOpportunity(p, bLog = false) {
|
|
|
89459
89462
|
}
|
|
89460
89463
|
// Sum the # of opportunity districts - ignore total minority
|
|
89461
89464
|
const oD = U.sumArray(opptyByDemo.slice(1));
|
|
89462
|
-
// Sum the # of
|
|
89465
|
+
// Sum the # of proportional districts - ignore total minority
|
|
89463
89466
|
const pD = U.sumArray(districtsByDemo.slice(1));
|
|
89464
89467
|
// Score opportunity
|
|
89465
89468
|
const score = scoreMinority(oD, pD);
|
|
89466
89469
|
let mS = {
|
|
89467
89470
|
report: {
|
|
89468
89471
|
averageDVf: averageDVf,
|
|
89472
|
+
averageRVf: averageRVf,
|
|
89469
89473
|
bucketsByDemographic: bucketsByDemo
|
|
89470
89474
|
},
|
|
89471
89475
|
nProportional: pD,
|
|
@@ -89682,7 +89686,7 @@ const normalize_1 = __webpack_require__(/*! ./normalize */ "./src/normalize.ts")
|
|
|
89682
89686
|
* MM' [mMd] = Mean – median difference using average district v
|
|
89683
89687
|
* LO [LO] = Lopsided outcomes
|
|
89684
89688
|
|
|
89685
|
-
* B% [bias]= the bias calculated as S% – ^S%
|
|
89689
|
+
* B% [bias] = the bias calculated as S% – ^S%
|
|
89686
89690
|
* B$ [bias.score] = the bias score normalized [0–100]
|
|
89687
89691
|
|
|
89688
89692
|
* UE# [unearnedS] = the number of unearned seats (R = positive; D = negative)
|
|
@@ -89728,6 +89732,7 @@ function scorePartisan(Vf, VfArray, options) {
|
|
|
89728
89732
|
const Bs50 = bAlternateMetrics ? estPartisanBias(inferredSVpoints, N) : undefined;
|
|
89729
89733
|
const Bs50f = (!(Bs50 === undefined)) ? U.trim(Bs50 / N) : undefined;
|
|
89730
89734
|
const Bv50f = bAlternateMetrics ? estVotesBias(inferredSVpoints, N) : undefined;
|
|
89735
|
+
const rvPoints = bAlternateMetrics ? keyRVpoints(VfArray) : undefined;
|
|
89731
89736
|
const decl = bAlternateMetrics ? calcDeclination(VfArray) : undefined;
|
|
89732
89737
|
const gSym = bAlternateMetrics ? calcGlobalSymmetry(inferredSVpoints, Bs50f) : undefined;
|
|
89733
89738
|
const EG = bAlternateMetrics ? calcEfficiencyGap(Vf, estSf) : undefined;
|
|
@@ -89778,6 +89783,7 @@ function scorePartisan(Vf, VfArray, options) {
|
|
|
89778
89783
|
biasScoring.bS50 = Bs50f;
|
|
89779
89784
|
biasScoring.bV50 = Bv50f;
|
|
89780
89785
|
biasScoring.decl = decl;
|
|
89786
|
+
biasScoring.rvPoints = rvPoints;
|
|
89781
89787
|
biasScoring.gSym = gSym;
|
|
89782
89788
|
biasScoring.gamma = gamma;
|
|
89783
89789
|
biasScoring.eG = EG;
|
|
@@ -90360,7 +90366,7 @@ exports.estMeanMedianDifference = estMeanMedianDifference;
|
|
|
90360
90366
|
// HELPERS FOR DECLINATION & LOPSIDED OUTCOMES
|
|
90361
90367
|
// Key r(v) points, defined in Fig. 19:
|
|
90362
90368
|
// * VfArray are Democratic seat shares (by convention).
|
|
90363
|
-
// * But the x-axis of r(v) graphs
|
|
90369
|
+
// * But the x-axis of r(v) graphs is Republican seat share.
|
|
90364
90370
|
// * So, you have to invert the D/R axis for Vb; and
|
|
90365
90371
|
// * Invert the D/R probabilities for Va.
|
|
90366
90372
|
function keyRVpoints(VfArray) {
|
|
@@ -90369,7 +90375,7 @@ function keyRVpoints(VfArray) {
|
|
|
90369
90375
|
const Sb = estSeatShare(estS, nDistricts);
|
|
90370
90376
|
// TODO - Understand why the corresponding V to Sb is always @ 0.5.
|
|
90371
90377
|
// John Nagle: "This is the dividing vote for party A vs party B wins defined
|
|
90372
|
-
// by Warrington.My modification just puts fractions of districts to the each side."
|
|
90378
|
+
// by Warrington. My modification just puts fractions of districts to the each side."
|
|
90373
90379
|
const Rb = Sb / 2;
|
|
90374
90380
|
const Ra = (1 + Sb) / 2;
|
|
90375
90381
|
const Vb = 1.0 - (U.sumArray(VfArray.map(v => estSeatProbability(v) * v))) / estS;
|
|
@@ -104130,15 +104136,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
104130
104136
|
result["default"] = mod;
|
|
104131
104137
|
return result;
|
|
104132
104138
|
};
|
|
104133
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
104134
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
104135
|
-
};
|
|
104136
104139
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
104137
104140
|
const U = __importStar(__webpack_require__(/*! ./utils */ "./src/utils.ts"));
|
|
104138
104141
|
const S = __importStar(__webpack_require__(/*! ./settings */ "./src/settings.ts"));
|
|
104139
104142
|
const D = __importStar(__webpack_require__(/*! ./_data */ "./src/_data.ts"));
|
|
104140
104143
|
const analyze_1 = __webpack_require__(/*! ./analyze */ "./src/analyze.ts");
|
|
104141
|
-
const state_reqs_json_1 = __importDefault(__webpack_require__(/*! ../static/state-reqs.json */ "./static/state-reqs.json"));
|
|
104142
104144
|
function prepareRequirementsChecklist(s, bLog = false) {
|
|
104143
104145
|
if (!(s.bPostProcessingDone)) {
|
|
104144
104146
|
doAnalyzePostProcessing(s);
|
|
@@ -104170,10 +104172,9 @@ function prepareRequirementsChecklist(s, bLog = false) {
|
|
|
104170
104172
|
const embeddedDistrictsDetail = U.deepCopy(freeOfHolesTest['details']['embeddedDistricts']) || [];
|
|
104171
104173
|
const populationDeviationDetail = U.deepCopy(equalPopulationTest['details']['deviation']);
|
|
104172
104174
|
const deviationThresholdDetail = U.trim(s.populationDeviationThreshold());
|
|
104173
|
-
const xx = s.state.xx;
|
|
104174
|
-
//
|
|
104175
|
-
const
|
|
104176
|
-
const reqLinkToStateReqs = stateReqsDict[xx];
|
|
104175
|
+
// const xx: string = s.state.xx;
|
|
104176
|
+
// const stateReqsDict: T.Dict = allStateReqs;
|
|
104177
|
+
// const reqLinkToStateReqs: string = stateReqsDict[xx];
|
|
104177
104178
|
// Populate the category
|
|
104178
104179
|
paRequirements = {
|
|
104179
104180
|
score: reqScore,
|
|
@@ -104195,7 +104196,7 @@ function prepareRequirementsChecklist(s, bLog = false) {
|
|
|
104195
104196
|
census: U.deepCopy(s.config['descriptions']['CENSUS']),
|
|
104196
104197
|
},
|
|
104197
104198
|
resources: {
|
|
104198
|
-
|
|
104199
|
+
// stateReqs: reqLinkToStateReqs
|
|
104199
104200
|
}
|
|
104200
104201
|
};
|
|
104201
104202
|
}
|
|
@@ -105076,17 +105077,6 @@ module.exports = JSON.parse("{\"AL\":{\"Black\":[7],\"Hispanic\":[],\"Pacific\":
|
|
|
105076
105077
|
|
|
105077
105078
|
/***/ }),
|
|
105078
105079
|
|
|
105079
|
-
/***/ "./static/state-reqs.json":
|
|
105080
|
-
/*!********************************!*\
|
|
105081
|
-
!*** ./static/state-reqs.json ***!
|
|
105082
|
-
\********************************/
|
|
105083
|
-
/*! 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 */
|
|
105084
|
-
/***/ (function(module) {
|
|
105085
|
-
|
|
105086
|
-
module.exports = JSON.parse("{\"AL\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_01.pdf\",\"AK\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_02.pdf\",\"AZ\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_03.pdf\",\"AR\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_04.pdf\",\"CA\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_05.pdf\",\"CO\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_06.pdf\",\"CT\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_07.pdf\",\"DE\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_08.pdf\",\"FL\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_09.pdf\",\"GA\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_10.pdf\",\"HI\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_11.pdf\",\"ID\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_12.pdf\",\"IL\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_13.pdf\",\"IN\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_14.pdf\",\"IA\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_15.pdf\",\"KS\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_16.pdf\",\"KY\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_17.pdf\",\"LA\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_18.pdf\",\"ME\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_19.pdf\",\"MD\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_20.pdf\",\"MA\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_21.pdf\",\"MI\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_22.pdf\",\"MN\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_23.pdf\",\"MS\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_24.pdf\",\"MO\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_25.pdf\",\"MT\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_26.pdf\",\"NE\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_27.pdf\",\"NV\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_28.pdf\",\"NH\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_29.pdf\",\"NJ\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_30.pdf\",\"NM\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_31.pdf\",\"NY\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_32.pdf\",\"NC\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_33.pdf\",\"ND\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_34.pdf\",\"OH\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_35.pdf\",\"OK\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_36.pdf\",\"OR\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_37.pdf\",\"PA\":\"https://www.brennancenter.org/sites/default/files/publications/2018_05_50States_FINALsinglepages_38.pdf\",\"RI\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_39.pdf\",\"SC\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_40.pdf\",\"SD\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_41.pdf\",\"TN\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_42.pdf\",\"TX\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_43.pdf\",\"UT\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_44.pdf\",\"VT\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_45.pdf\",\"VA\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_46.pdf\",\"WA\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_47.pdf\",\"WV\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_48.pdf\",\"WI\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_49.pdf\",\"WY\":\"https://www.brennancenter.org/sites/default/files/publications/2019_06_50States_FINALsinglepages_50.pdf\"}");
|
|
105087
|
-
|
|
105088
|
-
/***/ }),
|
|
105089
|
-
|
|
105090
105080
|
/***/ "./static/vra5-preclearance.json":
|
|
105091
105081
|
/*!***************************************!*\
|
|
105092
105082
|
!*** ./static/vra5-preclearance.json ***!
|