@dra2020/district-analytics 5.6.5 → 5.8.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 +20 -14
- package/dist/cli.js.map +1 -1
- package/dist/district-analytics.js +17 -12
- package/dist/district-analytics.js.map +1 -1
- package/dist/src/results.d.ts +1 -0
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -89884,9 +89884,10 @@ function scoreImpact(rawUE, Vf, Sf, N) {
|
|
|
89884
89884
|
}
|
|
89885
89885
|
}
|
|
89886
89886
|
exports.scoreImpact = scoreImpact;
|
|
89887
|
+
const avgSVError = 0.02;
|
|
89887
89888
|
function isAntimajoritarian(Vf, Sf) {
|
|
89888
|
-
const bDem = ((Vf < 0.5) && (Sf > 0.5)) ? true : false;
|
|
89889
|
-
const bRep = (((1 - Vf) < 0.5) && ((1 - Sf) > 0.5)) ? true : false;
|
|
89889
|
+
const bDem = ((Vf < (0.5 - avgSVError)) && (Sf > 0.5)) ? true : false;
|
|
89890
|
+
const bRep = (((1 - Vf) < (0.5 - avgSVError)) && ((1 - Sf) > 0.5)) ? true : false;
|
|
89890
89891
|
return bDem || bRep;
|
|
89891
89892
|
}
|
|
89892
89893
|
exports.isAntimajoritarian = isAntimajoritarian;
|
|
@@ -103342,6 +103343,7 @@ class Districts {
|
|
|
103342
103343
|
this.statistics[DistrictField.RepPct][summaryRow] = stateRepVote / stateTPVote;
|
|
103343
103344
|
}
|
|
103344
103345
|
if (stateVAPPop > 0) {
|
|
103346
|
+
this.statistics[DistrictField.TotalVAP][summaryRow] = stateVAPPop;
|
|
103345
103347
|
this.statistics[DistrictField.WhitePct][summaryRow] = stateWhitePop / stateVAPPop;
|
|
103346
103348
|
this.statistics[DistrictField.MinorityPct][summaryRow] = stateMinorityPop / stateVAPPop;
|
|
103347
103349
|
this.statistics[DistrictField.BlackPct][summaryRow] = stateBlackPop / stateVAPPop;
|
|
@@ -104226,17 +104228,18 @@ exports.prepareRequirementsChecklist = prepareRequirementsChecklist;
|
|
|
104226
104228
|
exports.sampleDistrictStatistics = {
|
|
104227
104229
|
table: [
|
|
104228
104230
|
// District 0 is the dummy unassigned district
|
|
104229
|
-
|
|
104230
|
-
[
|
|
104231
|
-
[
|
|
104232
|
-
[
|
|
104233
|
-
[
|
|
104234
|
-
[
|
|
104235
|
-
[
|
|
104236
|
-
[
|
|
104237
|
-
[
|
|
104231
|
+
// HACK - Total VAP #'s at the end are just so the same matches the type
|
|
104232
|
+
[0, 0, 0, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
104233
|
+
[1, 653133, -0.0950, 0 /* Green */, 2 /* Red */, 0 /* Green */, 0 /* Green */, 0.4177, 0.5823, 0.8631, 0.1369, 0.0734, 0.0360, 0.0009, 0.0235, 0.0064, 50000],
|
|
104234
|
+
[2, 620961, -0.1396, 0 /* Green */, 2 /* Red */, 2 /* Red */, 0 /* Green */, 0.8820, 0.1180, 0.3129, 0.6871, 0.6169, 0.0391, 0.0013, 0.0310, 0.0099, 50000],
|
|
104235
|
+
[3, 971777, 0.3465, 0 /* Green */, 2 /* Red */, 0 /* Green */, 0 /* Green */, 0.7261, 0.2739, 0.5174, 0.4826, 0.1745, 0.1572, 0.0020, 0.1531, 0.0090, 50000],
|
|
104236
|
+
[4, 863420, 0.1964, 0 /* Green */, 2 /* Red */, 0 /* Green */, 0 /* Green */, 0.8957, 0.1043, 0.1734, 0.8266, 0.6489, 0.1348, 0.0020, 0.0496, 0.0127, 50000],
|
|
104237
|
+
[5, 805029, 0.1155, 0 /* Green */, 2 /* Red */, 0 /* Green */, 1 /* Yellow */, 0.5743, 0.4257, 0.6587, 0.3413, 0.2494, 0.0363, 0.0012, 0.0536, 0.0081, 50000],
|
|
104238
|
+
[6, 824741, 0.1428, 0 /* Green */, 2 /* Red */, 0 /* Green */, 2 /* Red */, 0.5341, 0.4659, 0.7045, 0.2955, 0.1619, 0.0526, 0.0018, 0.0782, 0.0090, 50000],
|
|
104239
|
+
[7, 549714, -0.2383, 0 /* Green */, 0 /* Green */, 0 /* Green */, 0 /* Green */, 0.5025, 0.4975, 0.6906, 0.3094, 0.2468, 0.0319, 0.0013, 0.0258, 0.0111, 50000],
|
|
104240
|
+
[8, 484777, -0.3283, 0 /* Green */, 0 /* Green */, 0 /* Green */, 0 /* Green */, 0.4105, 0.5895, 0.8370, 0.1630, 0.1074, 0.0316, 0.0013, 0.0197, 0.0077, 50000],
|
|
104238
104241
|
// District N+1 is the dummy state-summary district
|
|
104239
|
-
[9, 721694, 0.6748, 0 /* Green */, 2 /* Red */, 2 /* Red */, 2 /* Red */, 0.6293, 0.3707, 0.5722, 0.4278, 0.2925, 0.0729, 0.0015, 0.0618, 0.0093]
|
|
104242
|
+
[9, 721694, 0.6748, 0 /* Green */, 2 /* Red */, 2 /* Red */, 2 /* Red */, 0.6293, 0.3707, 0.5722, 0.4278, 0.2925, 0.0729, 0.0015, 0.0618, 0.0093, 400000]
|
|
104240
104243
|
],
|
|
104241
104244
|
details: {},
|
|
104242
104245
|
datasets: {
|
|
@@ -104270,7 +104273,8 @@ function prepareDistrictStatistics(s, bLog = false) {
|
|
|
104270
104273
|
s.districts.statistics[D.DistrictField.HispanicPct][i],
|
|
104271
104274
|
s.districts.statistics[D.DistrictField.PacificPct][i],
|
|
104272
104275
|
s.districts.statistics[D.DistrictField.AsianPct][i],
|
|
104273
|
-
s.districts.statistics[D.DistrictField.NativePct][i]
|
|
104276
|
+
s.districts.statistics[D.DistrictField.NativePct][i],
|
|
104277
|
+
s.districts.statistics[D.DistrictField.TotalVAP][i]
|
|
104274
104278
|
];
|
|
104275
104279
|
// NOTE - Until we add three-state support top to bottom in Requirements,
|
|
104276
104280
|
// map booleans to tri-states here.
|
|
@@ -104544,9 +104548,11 @@ function scorePlan(s, p, bLog = false, overridesJSON) {
|
|
|
104544
104548
|
// Populate the N+1 summary "district" in district.statistics
|
|
104545
104549
|
let totalPop = s.districts.statistics[D.DistrictField.TotalPop];
|
|
104546
104550
|
let popDevPct = s.districts.statistics[D.DistrictField.PopDevPct];
|
|
104547
|
-
let
|
|
104551
|
+
let totalVAP = s.districts.statistics[D.DistrictField.TotalVAP];
|
|
104552
|
+
const summaryRow = s.districts.numberOfRows() - 1;
|
|
104548
104553
|
totalPop[summaryRow] = p.populationProfile.targetSize;
|
|
104549
104554
|
popDevPct[summaryRow] = popDev;
|
|
104555
|
+
totalVAP[summaryRow] = Math.round(totalVAP[summaryRow] / p.nDistricts);
|
|
104550
104556
|
// Add minority notes
|
|
104551
104557
|
scorecard.minority.details['majorityMinority'] = M.getMajorityMinority(s);
|
|
104552
104558
|
scorecard.minority.details['vraPreclearance'] = M.getVRASection5(s);
|