@dra2020/district-analytics 5.6.4 → 5.7.1
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 +25 -15
- package/dist/cli.js.map +1 -1
- package/dist/district-analytics.js +25 -15
- package/dist/district-analytics.js.map +1 -1
- package/dist/src/results.d.ts +1 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -102855,6 +102855,10 @@ class AnalyticsSession {
|
|
|
102855
102855
|
// Using the the data in the analytics session, calculate all the
|
|
102856
102856
|
// analytics & validations, saving/updating the individual test results.
|
|
102857
102857
|
analyzePlan(bLog = false, overridesJSON) {
|
|
102858
|
+
// Return values:
|
|
102859
|
+
// * true = everything good
|
|
102860
|
+
// * false = should not have been called with empty plan
|
|
102861
|
+
// * exception = exception caught and logged on the console
|
|
102858
102862
|
try {
|
|
102859
102863
|
// Guard against being handed a map w/o any precincts assigned
|
|
102860
102864
|
if (U.isObjectEmpty(this.plan._planByGeoID))
|
|
@@ -102866,9 +102870,10 @@ class AnalyticsSession {
|
|
|
102866
102870
|
this._scorecard = score_1.scorePlan(this, this._profile, bLog, overridesJSON);
|
|
102867
102871
|
results_1.doAnalyzePostProcessing(this, bLog);
|
|
102868
102872
|
}
|
|
102869
|
-
catch (
|
|
102870
|
-
console.log("Exception caught by analyzePlan()");
|
|
102871
|
-
|
|
102873
|
+
catch (e) {
|
|
102874
|
+
console.log("Exception caught by analyzePlan().");
|
|
102875
|
+
console.log(e.message);
|
|
102876
|
+
throw e;
|
|
102872
102877
|
}
|
|
102873
102878
|
return true;
|
|
102874
102879
|
}
|
|
@@ -103337,6 +103342,7 @@ class Districts {
|
|
|
103337
103342
|
this.statistics[DistrictField.RepPct][summaryRow] = stateRepVote / stateTPVote;
|
|
103338
103343
|
}
|
|
103339
103344
|
if (stateVAPPop > 0) {
|
|
103345
|
+
this.statistics[DistrictField.TotalVAP][summaryRow] = stateVAPPop;
|
|
103340
103346
|
this.statistics[DistrictField.WhitePct][summaryRow] = stateWhitePop / stateVAPPop;
|
|
103341
103347
|
this.statistics[DistrictField.MinorityPct][summaryRow] = stateMinorityPop / stateVAPPop;
|
|
103342
103348
|
this.statistics[DistrictField.BlackPct][summaryRow] = stateBlackPop / stateVAPPop;
|
|
@@ -104221,17 +104227,18 @@ exports.prepareRequirementsChecklist = prepareRequirementsChecklist;
|
|
|
104221
104227
|
exports.sampleDistrictStatistics = {
|
|
104222
104228
|
table: [
|
|
104223
104229
|
// District 0 is the dummy unassigned district
|
|
104224
|
-
|
|
104225
|
-
[
|
|
104226
|
-
[
|
|
104227
|
-
[
|
|
104228
|
-
[
|
|
104229
|
-
[
|
|
104230
|
-
[
|
|
104231
|
-
[
|
|
104232
|
-
[
|
|
104230
|
+
// HACK - Total VAP #'s at the end are just so the same matches the type
|
|
104231
|
+
[0, 0, 0, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
104232
|
+
[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],
|
|
104233
|
+
[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],
|
|
104234
|
+
[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],
|
|
104235
|
+
[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],
|
|
104236
|
+
[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],
|
|
104237
|
+
[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],
|
|
104238
|
+
[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],
|
|
104239
|
+
[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],
|
|
104233
104240
|
// District N+1 is the dummy state-summary district
|
|
104234
|
-
[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]
|
|
104241
|
+
[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]
|
|
104235
104242
|
],
|
|
104236
104243
|
details: {},
|
|
104237
104244
|
datasets: {
|
|
@@ -104265,7 +104272,8 @@ function prepareDistrictStatistics(s, bLog = false) {
|
|
|
104265
104272
|
s.districts.statistics[D.DistrictField.HispanicPct][i],
|
|
104266
104273
|
s.districts.statistics[D.DistrictField.PacificPct][i],
|
|
104267
104274
|
s.districts.statistics[D.DistrictField.AsianPct][i],
|
|
104268
|
-
s.districts.statistics[D.DistrictField.NativePct][i]
|
|
104275
|
+
s.districts.statistics[D.DistrictField.NativePct][i],
|
|
104276
|
+
s.districts.statistics[D.DistrictField.TotalVAP][i]
|
|
104269
104277
|
];
|
|
104270
104278
|
// NOTE - Until we add three-state support top to bottom in Requirements,
|
|
104271
104279
|
// map booleans to tri-states here.
|
|
@@ -104539,9 +104547,11 @@ function scorePlan(s, p, bLog = false, overridesJSON) {
|
|
|
104539
104547
|
// Populate the N+1 summary "district" in district.statistics
|
|
104540
104548
|
let totalPop = s.districts.statistics[D.DistrictField.TotalPop];
|
|
104541
104549
|
let popDevPct = s.districts.statistics[D.DistrictField.PopDevPct];
|
|
104542
|
-
let
|
|
104550
|
+
let totalVAP = s.districts.statistics[D.DistrictField.TotalVAP];
|
|
104551
|
+
const summaryRow = s.districts.numberOfRows() - 1;
|
|
104543
104552
|
totalPop[summaryRow] = p.populationProfile.targetSize;
|
|
104544
104553
|
popDevPct[summaryRow] = popDev;
|
|
104554
|
+
totalVAP[summaryRow] = Math.round(totalVAP[summaryRow] / p.nDistricts);
|
|
104545
104555
|
// Add minority notes
|
|
104546
104556
|
scorecard.minority.details['majorityMinority'] = M.getMajorityMinority(s);
|
|
104547
104557
|
scorecard.minority.details['vraPreclearance'] = M.getVRASection5(s);
|