@dra2020/district-analytics 5.6.3 → 5.7.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 +25 -14
- package/dist/cli.js.map +1 -1
- package/dist/district-analytics.js +25 -14
- 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,7 +102855,14 @@ 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 {
|
|
102863
|
+
// Guard against being handed a map w/o any precincts assigned
|
|
102864
|
+
if (U.isObjectEmpty(this.plan._planByGeoID))
|
|
102865
|
+
return false;
|
|
102859
102866
|
preprocess_1.doPreprocessData(this, bLog);
|
|
102860
102867
|
analyze_1.doAnalyzeDistricts(this, bLog);
|
|
102861
102868
|
analyze_1.doAnalyzePlan(this, bLog);
|
|
@@ -102863,9 +102870,10 @@ class AnalyticsSession {
|
|
|
102863
102870
|
this._scorecard = score_1.scorePlan(this, this._profile, bLog, overridesJSON);
|
|
102864
102871
|
results_1.doAnalyzePostProcessing(this, bLog);
|
|
102865
102872
|
}
|
|
102866
|
-
catch (
|
|
102867
|
-
console.log("Exception caught by analyzePlan()");
|
|
102868
|
-
|
|
102873
|
+
catch (e) {
|
|
102874
|
+
console.log("Exception caught by analyzePlan().");
|
|
102875
|
+
console.log(e.message);
|
|
102876
|
+
throw e;
|
|
102869
102877
|
}
|
|
102870
102878
|
return true;
|
|
102871
102879
|
}
|
|
@@ -103334,6 +103342,7 @@ class Districts {
|
|
|
103334
103342
|
this.statistics[DistrictField.RepPct][summaryRow] = stateRepVote / stateTPVote;
|
|
103335
103343
|
}
|
|
103336
103344
|
if (stateVAPPop > 0) {
|
|
103345
|
+
this.statistics[DistrictField.TotalVAP][summaryRow] = stateVAPPop;
|
|
103337
103346
|
this.statistics[DistrictField.WhitePct][summaryRow] = stateWhitePop / stateVAPPop;
|
|
103338
103347
|
this.statistics[DistrictField.MinorityPct][summaryRow] = stateMinorityPop / stateVAPPop;
|
|
103339
103348
|
this.statistics[DistrictField.BlackPct][summaryRow] = stateBlackPop / stateVAPPop;
|
|
@@ -104218,17 +104227,18 @@ exports.prepareRequirementsChecklist = prepareRequirementsChecklist;
|
|
|
104218
104227
|
exports.sampleDistrictStatistics = {
|
|
104219
104228
|
table: [
|
|
104220
104229
|
// District 0 is the dummy unassigned district
|
|
104221
|
-
|
|
104222
|
-
[
|
|
104223
|
-
[
|
|
104224
|
-
[
|
|
104225
|
-
[
|
|
104226
|
-
[
|
|
104227
|
-
[
|
|
104228
|
-
[
|
|
104229
|
-
[
|
|
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],
|
|
104230
104240
|
// District N+1 is the dummy state-summary district
|
|
104231
|
-
[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]
|
|
104232
104242
|
],
|
|
104233
104243
|
details: {},
|
|
104234
104244
|
datasets: {
|
|
@@ -104262,7 +104272,8 @@ function prepareDistrictStatistics(s, bLog = false) {
|
|
|
104262
104272
|
s.districts.statistics[D.DistrictField.HispanicPct][i],
|
|
104263
104273
|
s.districts.statistics[D.DistrictField.PacificPct][i],
|
|
104264
104274
|
s.districts.statistics[D.DistrictField.AsianPct][i],
|
|
104265
|
-
s.districts.statistics[D.DistrictField.NativePct][i]
|
|
104275
|
+
s.districts.statistics[D.DistrictField.NativePct][i],
|
|
104276
|
+
s.districts.statistics[D.DistrictField.TotalVAP][i]
|
|
104266
104277
|
];
|
|
104267
104278
|
// NOTE - Until we add three-state support top to bottom in Requirements,
|
|
104268
104279
|
// map booleans to tri-states here.
|