@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.
@@ -643,6 +643,7 @@ class Districts {
643
643
  this.statistics[DistrictField.RepPct][summaryRow] = stateRepVote / stateTPVote;
644
644
  }
645
645
  if (stateVAPPop > 0) {
646
+ this.statistics[DistrictField.TotalVAP][summaryRow] = stateVAPPop;
646
647
  this.statistics[DistrictField.WhitePct][summaryRow] = stateWhitePop / stateVAPPop;
647
648
  this.statistics[DistrictField.MinorityPct][summaryRow] = stateMinorityPop / stateVAPPop;
648
649
  this.statistics[DistrictField.BlackPct][summaryRow] = stateBlackPop / stateVAPPop;
@@ -1551,17 +1552,18 @@ exports.prepareRequirementsChecklist = prepareRequirementsChecklist;
1551
1552
  exports.sampleDistrictStatistics = {
1552
1553
  table: [
1553
1554
  // District 0 is the dummy unassigned district
1554
- [0, 0, 0, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
1555
- [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],
1556
- [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],
1557
- [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],
1558
- [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],
1559
- [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],
1560
- [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],
1561
- [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],
1562
- [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],
1555
+ // HACK - Total VAP #'s at the end are just so the same matches the type
1556
+ [0, 0, 0, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
1557
+ [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],
1558
+ [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],
1559
+ [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],
1560
+ [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],
1561
+ [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],
1562
+ [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],
1563
+ [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],
1564
+ [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],
1563
1565
  // District N+1 is the dummy state-summary district
1564
- [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]
1566
+ [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]
1565
1567
  ],
1566
1568
  details: {},
1567
1569
  datasets: {
@@ -1595,7 +1597,8 @@ function prepareDistrictStatistics(s, bLog = false) {
1595
1597
  s.districts.statistics[D.DistrictField.HispanicPct][i],
1596
1598
  s.districts.statistics[D.DistrictField.PacificPct][i],
1597
1599
  s.districts.statistics[D.DistrictField.AsianPct][i],
1598
- s.districts.statistics[D.DistrictField.NativePct][i]
1600
+ s.districts.statistics[D.DistrictField.NativePct][i],
1601
+ s.districts.statistics[D.DistrictField.TotalVAP][i]
1599
1602
  ];
1600
1603
  // NOTE - Until we add three-state support top to bottom in Requirements,
1601
1604
  // map booleans to tri-states here.
@@ -1869,9 +1872,11 @@ function scorePlan(s, p, bLog = false, overridesJSON) {
1869
1872
  // Populate the N+1 summary "district" in district.statistics
1870
1873
  let totalPop = s.districts.statistics[D.DistrictField.TotalPop];
1871
1874
  let popDevPct = s.districts.statistics[D.DistrictField.PopDevPct];
1872
- let summaryRow = s.districts.numberOfRows() - 1;
1875
+ let totalVAP = s.districts.statistics[D.DistrictField.TotalVAP];
1876
+ const summaryRow = s.districts.numberOfRows() - 1;
1873
1877
  totalPop[summaryRow] = p.populationProfile.targetSize;
1874
1878
  popDevPct[summaryRow] = popDev;
1879
+ totalVAP[summaryRow] = Math.round(totalVAP[summaryRow] / p.nDistricts);
1875
1880
  // Add minority notes
1876
1881
  scorecard.minority.details['majorityMinority'] = M.getMajorityMinority(s);
1877
1882
  scorecard.minority.details['vraPreclearance'] = M.getVRASection5(s);