@dra2020/district-analytics 16.0.2 → 16.1.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020-2021 Dave's Redistricting, LLC.
3
+ Copyright (c) 2020-2022 Dave's Redistricting, LLC.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # District Analytics
2
2
 
3
- Analytics for scoring congressional and legislative district maps.
3
+ This is the shim between the DRA client proper (dra-client) and the DRA analytics code (dra-analytics).
4
4
 
5
5
  ## Build Status
6
6
 
@@ -7,7 +7,7 @@
7
7
  exports["district-analytics"] = factory();
8
8
  else
9
9
  root["district-analytics"] = factory();
10
- })(global, function() {
10
+ })(global, () => {
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ "use strict";
13
13
  /******/ var __webpack_modules__ = ({
@@ -24,7 +24,11 @@ return /******/ (() => { // webpackBootstrap
24
24
  //
25
25
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
26
26
  if (k2 === undefined) k2 = k;
27
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
27
+ var desc = Object.getOwnPropertyDescriptor(m, k);
28
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
29
+ desc = { enumerable: true, get: function() { return m[k]; } };
30
+ }
31
+ Object.defineProperty(o, k2, desc);
28
32
  }) : (function(o, m, k, k2) {
29
33
  if (k2 === undefined) k2 = k;
30
34
  o[k2] = m[k];
@@ -136,7 +140,7 @@ class AnalyticsSession {
136
140
  this._scorecard = legacyScorecardAlt;
137
141
  // Before returning, create a dummy population deviation test, for
138
142
  // doHasEqualPopulations() to use later.This is preserving the old calling sequence.
139
- let test = this.getTest(4 /* PopulationDeviation */);
143
+ let test = this.getTest(4 /* T.Test.PopulationDeviation */);
140
144
  // Get the raw population deviation
141
145
  const popDev = this._scorecard.populationDeviation.raw;
142
146
  // Populate the test entry
@@ -152,7 +156,7 @@ class AnalyticsSession {
152
156
  totalVAP[summaryRow] = Math.round(totalVAP[summaryRow] / this._profile.nDistricts);
153
157
  // Added w/ new scorecard
154
158
  // Use 'roughly' equal population from dra-analytics
155
- let test2 = this.getTest(3 /* EqualPopulation */);
159
+ let test2 = this.getTest(3 /* T.Test.EqualPopulation */);
156
160
  test2['score'] = newScorecard.populationDeviation.roughlyEqual;
157
161
  // END main analytics
158
162
  (0, results_1.doAnalyzePostProcessing)(this, bLog);
@@ -220,7 +224,7 @@ class AnalyticsSession {
220
224
  // NOTE - This assumes that analyzePlan() has been run!
221
225
  getDiscontiguousDistrictFeatures(bLog = false) {
222
226
  // Get the (possibly empty) list of discontiguous district IDs
223
- const contiguousTest = this.getTest(1 /* Contiguous */);
227
+ const contiguousTest = this.getTest(1 /* T.Test.Contiguous */);
224
228
  const discontiguousDistrictIDs = contiguousTest['details']['discontiguousDistricts'] || [];
225
229
  // Convert them into a (possibly empty) list of features
226
230
  let discontiguousDistrictFeatures = { type: 'FeatureCollection', features: [] };
@@ -289,7 +293,11 @@ function isAShape(poly) {
289
293
  //
290
294
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
291
295
  if (k2 === undefined) k2 = k;
292
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
296
+ var desc = Object.getOwnPropertyDescriptor(m, k);
297
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
298
+ desc = { enumerable: true, get: function() { return m[k]; } };
299
+ }
300
+ Object.defineProperty(o, k2, desc);
293
301
  }) : (function(o, m, k, k2) {
294
302
  if (k2 === undefined) k2 = k;
295
303
  o[k2] = m[k];
@@ -475,8 +483,8 @@ class Districts {
475
483
  // Total population of each feature
476
484
  // NOTE - This result is used more than once
477
485
  // 03-27-21
478
- const dkCENSUS = outerThis._session.features._keys["CENSUS" /* CENSUS */];
479
- featurePop = fieldForFeature(f, dkCENSUS, 0 /* TotalPop */);
486
+ const dkCENSUS = outerThis._session.features._keys["CENSUS" /* T.Dataset.CENSUS */];
487
+ featurePop = fieldForFeature(f, dkCENSUS, 0 /* T.FeatureField.TotalPop */);
480
488
  // featurePop = outerThis._session.features.fieldForFeature(f, T.Dataset.CENSUS, T.FeatureField.TotalPop);
481
489
  // Total district population
482
490
  totalPop += featurePop;
@@ -496,11 +504,11 @@ class Districts {
496
504
  // 10-22-2020 - Added Other votes
497
505
  // 10-24-2020 - Added guard against inconsistent election data
498
506
  // 03-27-2021
499
- const dkELECTION = outerThis._session.features._keys["ELECTION" /* ELECTION */];
500
- const featureDem = fieldForFeature(f, dkELECTION, 7 /* DemVotes */);
507
+ const dkELECTION = outerThis._session.features._keys["ELECTION" /* T.Dataset.ELECTION */];
508
+ const featureDem = fieldForFeature(f, dkELECTION, 7 /* T.FeatureField.DemVotes */);
501
509
  // const featureDem = outerThis._session.features.fieldForFeature(f, T.Dataset.ELECTION, T.FeatureField.DemVotes);
502
- const featureRep = fieldForFeature(f, dkELECTION, 8 /* RepVotes */);
503
- const featureTot = fieldForFeature(f, dkELECTION, 9 /* TotalVotes */);
510
+ const featureRep = fieldForFeature(f, dkELECTION, 8 /* T.FeatureField.RepVotes */);
511
+ const featureTot = fieldForFeature(f, dkELECTION, 9 /* T.FeatureField.TotalVotes */);
504
512
  demVotes += featureDem;
505
513
  repVotes += featureRep;
506
514
  totVotes += featureTot;
@@ -514,15 +522,15 @@ class Districts {
514
522
  }
515
523
  // Voting-age demographic breakdowns (or citizen voting-age)
516
524
  // 03-27-21
517
- const dkVAP = outerThis._session.features._keys["VAP" /* VAP */];
518
- totalVAP += fieldForFeature(f, dkVAP, 0 /* TotalPop */);
525
+ const dkVAP = outerThis._session.features._keys["VAP" /* T.Dataset.VAP */];
526
+ totalVAP += fieldForFeature(f, dkVAP, 0 /* T.FeatureField.TotalPop */);
519
527
  // totalVAP += outerThis._session.features.fieldForFeature(f, T.Dataset.VAP, T.FeatureField.TotalPop);
520
- whitePop += fieldForFeature(f, dkVAP, 1 /* WhitePop */);
521
- blackPop += fieldForFeature(f, dkVAP, 2 /* BlackPop */);
522
- hispanicPop += fieldForFeature(f, dkVAP, 3 /* HispanicPop */);
523
- pacificPop += fieldForFeature(f, dkVAP, 5 /* PacificPop */);
524
- asianPop += fieldForFeature(f, dkVAP, 4 /* AsianPop */);
525
- nativePop += fieldForFeature(f, dkVAP, 6 /* NativePop */);
528
+ whitePop += fieldForFeature(f, dkVAP, 1 /* T.FeatureField.WhitePop */);
529
+ blackPop += fieldForFeature(f, dkVAP, 2 /* T.FeatureField.BlackPop */);
530
+ hispanicPop += fieldForFeature(f, dkVAP, 3 /* T.FeatureField.HispanicPop */);
531
+ pacificPop += fieldForFeature(f, dkVAP, 5 /* T.FeatureField.PacificPop */);
532
+ asianPop += fieldForFeature(f, dkVAP, 4 /* T.FeatureField.AsianPop */);
533
+ nativePop += fieldForFeature(f, dkVAP, 6 /* T.FeatureField.NativePop */);
526
534
  }
527
535
  // }
528
536
  // else
@@ -749,30 +757,30 @@ class Districts {
749
757
  if (!(f == undefined)) {
750
758
  // Calculate the Dem two-party vote
751
759
  // 03-27-21
752
- const dkELECTION = outerThis._session.features._keys["ELECTION" /* ELECTION */];
753
- const featureDem = fieldForFeature(f, dkELECTION, 7 /* DemVotes */);
754
- const featureRep = fieldForFeature(f, dkELECTION, 8 /* RepVotes */);
760
+ const dkELECTION = outerThis._session.features._keys["ELECTION" /* T.Dataset.ELECTION */];
761
+ const featureDem = fieldForFeature(f, dkELECTION, 7 /* T.FeatureField.DemVotes */);
762
+ const featureRep = fieldForFeature(f, dkELECTION, 8 /* T.FeatureField.RepVotes */);
755
763
  // const featureRep = outerThis._session.features.fieldForFeature(f, T.Dataset.ELECTION, T.FeatureField.RepVotes);
756
764
  if ((featureDem + featureRep) > 0) {
757
765
  const pctDem = featureDem / (featureDem + featureRep);
758
766
  // Calculate the VAP/CVAP percentages by demographic
759
767
  // 03-27-21
760
- const dkVAP = outerThis._session.features._keys["VAP" /* VAP */];
761
- const totalVAP = fieldForFeature(f, dkVAP, 0 /* TotalPop */);
768
+ const dkVAP = outerThis._session.features._keys["VAP" /* T.Dataset.VAP */];
769
+ const totalVAP = fieldForFeature(f, dkVAP, 0 /* T.FeatureField.TotalPop */);
762
770
  // const totalVAP = outerThis._session.features.fieldForFeature(f, T.Dataset.VAP, T.FeatureField.TotalPop);
763
771
  if (totalVAP > 0) {
764
772
  // Gather all points, for debugging purposes ...
765
- const hispanicVAP = fieldForFeature(f, dkVAP, 3 /* HispanicPop */);
766
- const blackVAP = fieldForFeature(f, dkVAP, 2 /* BlackPop */);
767
- const pacificVAP = fieldForFeature(f, dkVAP, 5 /* PacificPop */);
768
- const asianVAP = fieldForFeature(f, dkVAP, 4 /* AsianPop */);
769
- const nativeVAP = fieldForFeature(f, dkVAP, 6 /* NativePop */);
773
+ const hispanicVAP = fieldForFeature(f, dkVAP, 3 /* T.FeatureField.HispanicPop */);
774
+ const blackVAP = fieldForFeature(f, dkVAP, 2 /* T.FeatureField.BlackPop */);
775
+ const pacificVAP = fieldForFeature(f, dkVAP, 5 /* T.FeatureField.PacificPop */);
776
+ const asianVAP = fieldForFeature(f, dkVAP, 4 /* T.FeatureField.AsianPop */);
777
+ const nativeVAP = fieldForFeature(f, dkVAP, 6 /* T.FeatureField.NativePop */);
770
778
  const pctHispanic = hispanicVAP / totalVAP;
771
779
  const pctBlack = blackVAP / totalVAP;
772
780
  const pctPacific = pacificVAP / totalVAP;
773
781
  const pctAsian = asianVAP / totalVAP;
774
782
  const pctNative = nativeVAP / totalVAP;
775
- const whiteVAP = fieldForFeature(f, dkVAP, 1 /* WhitePop */);
783
+ const whiteVAP = fieldForFeature(f, dkVAP, 1 /* T.FeatureField.WhitePop */);
776
784
  const minorityVAP = totalVAP - whiteVAP;
777
785
  const pctMinority = minorityVAP / totalVAP;
778
786
  let pctComparison = whiteVAP / totalVAP;
@@ -1261,17 +1269,17 @@ exports.doAnalyzeDistricts = doAnalyzeDistricts;
1261
1269
  // NOTE - I could make this table-driven, but I'm thinking that the explicit
1262
1270
  // calls might make chunking for aync easier.
1263
1271
  function doAnalyzePlan(s, bLog = false) {
1264
- s.tests[0 /* Complete */] = (0, valid_1.doIsComplete)(s, bLog);
1265
- s.tests[1 /* Contiguous */] = (0, valid_1.doIsContiguous)(s, bLog);
1266
- s.tests[2 /* FreeOfHoles */] = (0, valid_1.doIsFreeOfHoles)(s, bLog);
1272
+ s.tests[0 /* T.Test.Complete */] = (0, valid_1.doIsComplete)(s, bLog);
1273
+ s.tests[1 /* T.Test.Contiguous */] = (0, valid_1.doIsContiguous)(s, bLog);
1274
+ s.tests[2 /* T.Test.FreeOfHoles */] = (0, valid_1.doIsFreeOfHoles)(s, bLog);
1267
1275
  // NOTE - I can't check whether a population deviation is legal or not, until
1268
1276
  // the raw % is normalized. A zero (0) would mean "too much" / "not legal," for
1269
1277
  // the given type of district (CD vs. LD). The EqualPopulation test is derived
1270
1278
  // from PopulationDeviation, as part of scorecard or test log preparation.
1271
1279
  // Create an empty test entry here though ...
1272
- s.tests[3 /* EqualPopulation */] = s.getTest(3 /* EqualPopulation */);
1273
- s.tests[5 /* UnexpectedCountySplits */] = (0, cohesive_1.doFindCountiesSplitUnexpectedly)(s, bLog);
1274
- s.tests[6 /* VTDSplits */] = (0, cohesive_1.doFindSplitVTDs)(s, bLog);
1280
+ s.tests[3 /* T.Test.EqualPopulation */] = s.getTest(3 /* T.Test.EqualPopulation */);
1281
+ s.tests[5 /* T.Test.UnexpectedCountySplits */] = (0, cohesive_1.doFindCountiesSplitUnexpectedly)(s, bLog);
1282
+ s.tests[6 /* T.Test.VTDSplits */] = (0, cohesive_1.doFindSplitVTDs)(s, bLog);
1275
1283
  // Enable a Test Log and Scorecard to be generated
1276
1284
  s.bPlanAnalyzed = true;
1277
1285
  s.bPostProcessingDone = false;
@@ -1283,7 +1291,7 @@ exports.doAnalyzePlan = doAnalyzePlan;
1283
1291
  // Equal Population to be secondary pass/fail validation.
1284
1292
  //
1285
1293
  function doDeriveSecondaryTests(s, bLog = false) {
1286
- s.tests[3 /* EqualPopulation */] = (0, equal_1.doHasEqualPopulations)(s, bLog);
1294
+ s.tests[3 /* T.Test.EqualPopulation */] = (0, equal_1.doHasEqualPopulations)(s, bLog);
1287
1295
  }
1288
1296
  exports.doDeriveSecondaryTests = doDeriveSecondaryTests;
1289
1297
 
@@ -1302,7 +1310,11 @@ exports.doDeriveSecondaryTests = doDeriveSecondaryTests;
1302
1310
  //
1303
1311
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1304
1312
  if (k2 === undefined) k2 = k;
1305
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1313
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1314
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1315
+ desc = { enumerable: true, get: function() { return m[k]; } };
1316
+ }
1317
+ Object.defineProperty(o, k2, desc);
1306
1318
  }) : (function(o, m, k, k2) {
1307
1319
  if (k2 === undefined) k2 = k;
1308
1320
  o[k2] = m[k];
@@ -1360,7 +1372,7 @@ These counties are split unexpectedly (meaning that they're smaller than a distr
1360
1372
  // - We do the analysis regardless, but
1361
1373
  // - Protect against weird results in the client
1362
1374
  function doFindCountiesSplitUnexpectedly(s, bLog = false) {
1363
- let test = s.getTest(5 /* UnexpectedCountySplits */);
1375
+ let test = s.getTest(5 /* T.Test.UnexpectedCountySplits */);
1364
1376
  // THE THREE VALUES TO DETERMINE FOR A PLAN
1365
1377
  let unexpectedSplits = 0;
1366
1378
  let unexpectedAffected = 0;
@@ -1497,7 +1509,7 @@ function doFindCountiesSplitUnexpectedly(s, bLog = false) {
1497
1509
  exports.doFindCountiesSplitUnexpectedly = doFindCountiesSplitUnexpectedly;
1498
1510
  // NOTE - This function just creates an empty container that dra-client fills in when generating the UI
1499
1511
  function doFindSplitVTDs(s, bLog = false) {
1500
- let test = s.getTest(6 /* VTDSplits */);
1512
+ let test = s.getTest(6 /* T.Test.VTDSplits */);
1501
1513
  let splitVTDs = [];
1502
1514
  test['score'] = splitVTDs.length;
1503
1515
  test['details']['splitVTDs'] = splitVTDs;
@@ -1520,7 +1532,11 @@ exports.doFindSplitVTDs = doFindSplitVTDs;
1520
1532
  //
1521
1533
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1522
1534
  if (k2 === undefined) k2 = k;
1523
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1535
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1536
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1537
+ desc = { enumerable: true, get: function() { return m[k]; } };
1538
+ }
1539
+ Object.defineProperty(o, k2, desc);
1524
1540
  }) : (function(o, m, k, k2) {
1525
1541
  if (k2 === undefined) k2 = k;
1526
1542
  o[k2] = m[k];
@@ -1553,9 +1569,9 @@ function extractDistrictProperties(s, bLog = false) {
1553
1569
  const perimeter = baseclient_1.Poly.polyPerimeterFlat(poly);
1554
1570
  const diameter = baseclient_1.Poly.polyDiameterFlat(poly);
1555
1571
  let props = [0, 0, 0];
1556
- props[0 /* Area */] = area;
1557
- props[1 /* Diameter */] = diameter;
1558
- props[2 /* Perimeter */] = perimeter;
1572
+ props[0 /* T.DistrictShapeProperty.Area */] = area;
1573
+ props[1 /* T.DistrictShapeProperty.Diameter */] = diameter;
1574
+ props[2 /* T.DistrictShapeProperty.Perimeter */] = perimeter;
1559
1575
  s.districts.setGeoProperties(i, props);
1560
1576
  // if (bLog) console.log("District", i, "A =", area, "P =", perimeter, "D =", diameter);
1561
1577
  }
@@ -1617,9 +1633,9 @@ exports.doHasEqualPopulations = void 0;
1617
1633
  // NOTE - This validity check is *derived* and depends on population deviation %
1618
1634
  // being computed (above) and normalized in test log & scorecard generation.
1619
1635
  function doHasEqualPopulations(s, bLog = false) {
1620
- let test = s.getTest(3 /* EqualPopulation */);
1636
+ let test = s.getTest(3 /* T.Test.EqualPopulation */);
1621
1637
  // Get the normalized population deviation %
1622
- let popDevTest = s.getTest(4 /* PopulationDeviation */);
1638
+ let popDevTest = s.getTest(4 /* T.Test.PopulationDeviation */);
1623
1639
  const popDevPct = popDevTest['score'];
1624
1640
  // const popDevNormalized: number = popDevTest['normalizedScore'] as number;
1625
1641
  test['details']['deviation'] = popDevPct;
@@ -1647,7 +1663,11 @@ exports.doHasEqualPopulations = doHasEqualPopulations;
1647
1663
  //
1648
1664
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1649
1665
  if (k2 === undefined) k2 = k;
1650
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1666
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1667
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1668
+ desc = { enumerable: true, get: function() { return m[k]; } };
1669
+ }
1670
+ Object.defineProperty(o, k2, desc);
1651
1671
  }) : (function(o, m, k, k2) {
1652
1672
  if (k2 === undefined) k2 = k;
1653
1673
  o[k2] = m[k];
@@ -1748,7 +1768,11 @@ exports.doAnalyzeRacialPolarization = doAnalyzeRacialPolarization;
1748
1768
  //
1749
1769
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1750
1770
  if (k2 === undefined) k2 = k;
1751
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1771
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1772
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1773
+ desc = { enumerable: true, get: function() { return m[k]; } };
1774
+ }
1775
+ Object.defineProperty(o, k2, desc);
1752
1776
  }) : (function(o, m, k, k2) {
1753
1777
  if (k2 === undefined) k2 = k;
1754
1778
  o[k2] = m[k];
@@ -1824,8 +1848,8 @@ function doPreprocessCensus(s, bLog = false) {
1824
1848
  // Skip water-only features
1825
1849
  if (!(U.isWaterOnly(geoID))) {
1826
1850
  // 03-27-21
1827
- const dk = s.features._keys["CENSUS" /* CENSUS */];
1828
- let value = D.fieldForFeature(f, dk, 0 /* TotalPop */);
1851
+ const dk = s.features._keys["CENSUS" /* T.Dataset.CENSUS */];
1852
+ let value = D.fieldForFeature(f, dk, 0 /* T.FeatureField.TotalPop */);
1829
1853
  // let value: number = s.features.fieldForFeature(f, T.Dataset.CENSUS, T.FeatureField.TotalPop);
1830
1854
  // Sum total population across the state
1831
1855
  s.state.totalPop += value;
@@ -1945,7 +1969,11 @@ function doPreprocessCensus(s, bLog = false) {
1945
1969
  //
1946
1970
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1947
1971
  if (k2 === undefined) k2 = k;
1948
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1972
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1973
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1974
+ desc = { enumerable: true, get: function() { return m[k]; } };
1975
+ }
1976
+ Object.defineProperty(o, k2, desc);
1949
1977
  }) : (function(o, m, k, k2) {
1950
1978
  if (k2 === undefined) k2 = k;
1951
1979
  o[k2] = m[k];
@@ -1973,10 +2001,10 @@ function prepareRequirementsChecklist(s, bLog = false) {
1973
2001
  // REQUIREMENTS CATEGORY
1974
2002
  let paRequirements;
1975
2003
  {
1976
- const completeTest = s.getTest(0 /* Complete */);
1977
- const contiguousTest = s.getTest(1 /* Contiguous */);
1978
- const freeOfHolesTest = s.getTest(2 /* FreeOfHoles */);
1979
- const equalPopulationTest = s.getTest(3 /* EqualPopulation */);
2004
+ const completeTest = s.getTest(0 /* T.Test.Complete */);
2005
+ const contiguousTest = s.getTest(1 /* T.Test.Contiguous */);
2006
+ const freeOfHolesTest = s.getTest(2 /* T.Test.FreeOfHoles */);
2007
+ const equalPopulationTest = s.getTest(3 /* T.Test.EqualPopulation */);
1980
2008
  // Combine individual checks into an overall score
1981
2009
  const completeMetric = completeTest['score'];
1982
2010
  const contiguousMetric = contiguousTest['score'];
@@ -2091,7 +2119,7 @@ exports.prepareDistrictStatistics = prepareDistrictStatistics;
2091
2119
  function doAnalyzePostProcessing(s, bLog = false) {
2092
2120
  // Just populate the normalized population deviation score in the test
2093
2121
  const scorecard = s._scorecard;
2094
- let popDev = s.getTest(4 /* PopulationDeviation */);
2122
+ let popDev = s.getTest(4 /* T.Test.PopulationDeviation */);
2095
2123
  popDev['normalizedScore'] = scorecard.populationDeviation.normalized;
2096
2124
  const datasets = {
2097
2125
  shapes: U.deepCopy(s.config['descriptions']['SHAPES']),
@@ -2103,7 +2131,7 @@ function doAnalyzePostProcessing(s, bLog = false) {
2103
2131
  scorecard.minority.details['vap'] = datasets.vap;
2104
2132
  scorecard.details['shapes'] = datasets.shapes;
2105
2133
  scorecard.details['census'] = datasets.census;
2106
- const simpleSplits = s.getTest(5 /* UnexpectedCountySplits */);
2134
+ const simpleSplits = s.getTest(5 /* T.Test.UnexpectedCountySplits */);
2107
2135
  scorecard.splitting.details['unexpectedAffected'] = simpleSplits['score'];
2108
2136
  scorecard.splitting.details['nSplits'] = simpleSplits['details']['nSplits'];
2109
2137
  scorecard.splitting.details['countiesSplitUnexpectedly'] = U.deepCopy(simpleSplits['details']['countiesSplitUnexpectedly']);
@@ -2139,7 +2167,11 @@ exports.doAnalyzePostProcessing = doAnalyzePostProcessing;
2139
2167
  //
2140
2168
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2141
2169
  if (k2 === undefined) k2 = k;
2142
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2170
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2171
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2172
+ desc = { enumerable: true, get: function() { return m[k]; } };
2173
+ }
2174
+ Object.defineProperty(o, k2, desc);
2143
2175
  }) : (function(o, m, k, k2) {
2144
2176
  if (k2 === undefined) k2 = k;
2145
2177
  o[k2] = m[k];
@@ -2236,9 +2268,9 @@ function makeArrayOfGeoProps(s, bLog = false) {
2236
2268
  let districtProps = s.districts.getGeoProperties(districtID);
2237
2269
  // Guard against no shape and no properties
2238
2270
  if (districtProps) {
2239
- let a = U.trim(districtProps[0 /* Area */], KEEP_DECIMALS);
2240
- let p = U.trim(districtProps[2 /* Perimeter */], KEEP_DECIMALS);
2241
- let d = U.trim(districtProps[1 /* Diameter */], KEEP_DECIMALS);
2271
+ let a = U.trim(districtProps[0 /* T.DistrictShapeProperty.Area */], KEEP_DECIMALS);
2272
+ let p = U.trim(districtProps[2 /* T.DistrictShapeProperty.Perimeter */], KEEP_DECIMALS);
2273
+ let d = U.trim(districtProps[1 /* T.DistrictShapeProperty.Diameter */], KEEP_DECIMALS);
2242
2274
  // Save each triple
2243
2275
  geometryByDistrict.push({ area: a, perimeter: p, diameter: d });
2244
2276
  }
@@ -2472,17 +2504,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
2472
2504
  exports.fieldFromFeatureField = void 0;
2473
2505
  function fieldFromFeatureField(ds, ff) {
2474
2506
  switch (ff) {
2475
- case 0 /* TotalPop */: return "Tot";
2476
- case 1 /* WhitePop */: return "Wh";
2477
- case 2 /* BlackPop */: return ds.endsWith("NH") ? "Bl" : "BlC";
2478
- case 3 /* HispanicPop */: return "His";
2479
- case 4 /* AsianPop */: return ds.endsWith("NH") ? "Asn" : "AsnC";
2480
- case 5 /* PacificPop */: return ds.endsWith("NH") ? "Pac" : "PacC";
2481
- case 6 /* NativePop */: return ds.endsWith("NH") ? "Nat" : "NatC";
2482
- case 7 /* DemVotes */: return "D";
2483
- case 8 /* RepVotes */: return "R";
2507
+ case 0 /* FeatureField.TotalPop */: return "Tot";
2508
+ case 1 /* FeatureField.WhitePop */: return "Wh";
2509
+ case 2 /* FeatureField.BlackPop */: return ds.endsWith("NH") ? "Bl" : "BlC";
2510
+ case 3 /* FeatureField.HispanicPop */: return "His";
2511
+ case 4 /* FeatureField.AsianPop */: return ds.endsWith("NH") ? "Asn" : "AsnC";
2512
+ case 5 /* FeatureField.PacificPop */: return ds.endsWith("NH") ? "Pac" : "PacC";
2513
+ case 6 /* FeatureField.NativePop */: return ds.endsWith("NH") ? "Nat" : "NatC";
2514
+ case 7 /* FeatureField.DemVotes */: return "D";
2515
+ case 8 /* FeatureField.RepVotes */: return "R";
2484
2516
  // NOTE: "Other" is implied as Tot - D - R
2485
- case 9 /* TotalVotes */: return "Tot";
2517
+ case 9 /* FeatureField.TotalVotes */: return "Tot";
2486
2518
  }
2487
2519
  }
2488
2520
  exports.fieldFromFeatureField = fieldFromFeatureField;
@@ -2502,7 +2534,11 @@ exports.fieldFromFeatureField = fieldFromFeatureField;
2502
2534
  //
2503
2535
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2504
2536
  if (k2 === undefined) k2 = k;
2505
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2537
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2538
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2539
+ desc = { enumerable: true, get: function() { return m[k]; } };
2540
+ }
2541
+ Object.defineProperty(o, k2, desc);
2506
2542
  }) : (function(o, m, k, k2) {
2507
2543
  if (k2 === undefined) k2 = k;
2508
2544
  o[k2] = m[k];
@@ -2564,7 +2600,7 @@ function isWaterOnly(geoID, s) {
2564
2600
  if (s) {
2565
2601
  // If called with a session, get the feature ...
2566
2602
  const featureID = s.features.featureID(geoID);
2567
- const f = s.features.featureByIndex(featureID);
2603
+ const f /* T.GeoFeature */ = s.features.featureByIndex(featureID);
2568
2604
  // ... and also check the 'ALAND' property
2569
2605
  const bNoLand = ((f.properties['ALAND10'] !== undefined) && (f.properties['ALAND10'] == 0)) ? true : false;
2570
2606
  return bNoLand;
@@ -2575,10 +2611,10 @@ function isWaterOnly(geoID, s) {
2575
2611
  exports.isWaterOnly = isWaterOnly;
2576
2612
  function isUninhabited(geoID, s) {
2577
2613
  const featureID = s.features.featureID(geoID);
2578
- const f = s.features.featureByIndex(featureID);
2614
+ const f /* T.GeoFeature */ = s.features.featureByIndex(featureID);
2579
2615
  // 03-27-21
2580
- const dk = s.features._keys["CENSUS" /* CENSUS */];
2581
- const totalPop = (0, _data_1.fieldForFeature)(f, dk, 0 /* TotalPop */);
2616
+ const dk = s.features._keys["CENSUS" /* T.Dataset.CENSUS */];
2617
+ const totalPop = (0, _data_1.fieldForFeature)(f, dk, 0 /* T.FeatureField.TotalPop */);
2582
2618
  // const totalPop = s.features.fieldForFeature(f, T.Dataset.CENSUS, T.FeatureField.TotalPop);
2583
2619
  let bUninhabited = (totalPop > 0) ? false : true;
2584
2620
  // HACK for Kentucky's atypical data, so the official map shows as complete
@@ -2768,7 +2804,11 @@ exports.depthof = depthof;
2768
2804
  //
2769
2805
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2770
2806
  if (k2 === undefined) k2 = k;
2771
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2807
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2808
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2809
+ desc = { enumerable: true, get: function() { return m[k]; } };
2810
+ }
2811
+ Object.defineProperty(o, k2, desc);
2772
2812
  }) : (function(o, m, k, k2) {
2773
2813
  if (k2 === undefined) k2 = k;
2774
2814
  o[k2] = m[k];
@@ -2794,7 +2834,7 @@ const S = __importStar(__webpack_require__(/*! ./settings */ "./src/settings.ts"
2794
2834
  // at least one geo assigned to them?
2795
2835
  //
2796
2836
  function doIsComplete(s, bLog = false) {
2797
- let test = s.getTest(0 /* Complete */);
2837
+ let test = s.getTest(0 /* T.Test.Complete */);
2798
2838
  // Get the by-district results, including the dummy unassigned district,
2799
2839
  // but ignoring the N+1 summary district
2800
2840
  let bNotEmptyByDistrict = s.districts.table.bNotEmpty;
@@ -2878,7 +2918,7 @@ exports.doIsComplete = doIsComplete;
2878
2918
  // To test this, load the NC 2010 map 'SAMPLE-BG-map-discontiguous.csv'.
2879
2919
  //
2880
2920
  function doIsContiguous(s, bLog = false) {
2881
- let test = s.getTest(1 /* Contiguous */);
2921
+ let test = s.getTest(1 /* T.Test.Contiguous */);
2882
2922
  // Get the contiguity of each district. Ignore dummy unassigned district
2883
2923
  // and the N+1 summary district.
2884
2924
  let bContiguousByDistrict = s.districts.table.bContiguous;
@@ -2916,7 +2956,7 @@ exports.doIsContiguous = doIsContiguous;
2916
2956
  // Buncombe County (37021), is a donut hole w/in District 3.
2917
2957
  //
2918
2958
  function doIsFreeOfHoles(s, bLog = false) {
2919
- let test = s.getTest(2 /* FreeOfHoles */);
2959
+ let test = s.getTest(2 /* T.Test.FreeOfHoles */);
2920
2960
  // Initialize values
2921
2961
  let bFreeOfHoles = true;
2922
2962
  let embeddedDistricts = [];