@dra2020/district-analytics 1.0.9 → 2.0.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 +77 -70
- package/dist/cli.js.map +1 -1
- package/dist/district-analytics.js +73 -65
- package/dist/district-analytics.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8962,11 +8962,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
8962
8962
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8963
8963
|
const preprocess_1 = __webpack_require__(/*! ./preprocess */ "./src/preprocess.ts");
|
|
8964
8964
|
const analyze_1 = __webpack_require__(/*! ./analyze */ "./src/analyze.ts");
|
|
8965
|
-
// TODO - DASHBOARD: Delete
|
|
8966
|
-
// import {
|
|
8967
|
-
// doConfigureScales, doAnalyzePostProcessing
|
|
8968
|
-
// doPrepareScorecard, doPrepareTestLog, Scorecard
|
|
8969
|
-
// } from './report'
|
|
8970
8965
|
const results_1 = __webpack_require__(/*! ./results */ "./src/results.ts");
|
|
8971
8966
|
const results_2 = __webpack_require__(/*! ./results */ "./src/results.ts");
|
|
8972
8967
|
const D = __importStar(__webpack_require__(/*! ./_data */ "./src/_data.ts"));
|
|
@@ -8997,7 +8992,7 @@ class AnalyticsSession {
|
|
|
8997
8992
|
// NOTE - Session settings are required:
|
|
8998
8993
|
// - Analytics suites can be defaulted to all with [], but
|
|
8999
8994
|
// - Dataset keys must be explicitly specified with 'dataset'
|
|
9000
|
-
// TODO - Remove this mechanism. Always run everything.
|
|
8995
|
+
// TODO - DASHBOARD: Remove this mechanism. Always run everything.
|
|
9001
8996
|
let defaultSuites = [0 /* Legal */, 1 /* Fair */, 2 /* Best */];
|
|
9002
8997
|
// If the config passed in has no suites = [], use the default suites
|
|
9003
8998
|
if (U.isArrayEmpty(config['suites'])) {
|
|
@@ -9177,10 +9172,10 @@ class Districts {
|
|
|
9177
9172
|
}
|
|
9178
9173
|
// This is the workhorse computational routine!
|
|
9179
9174
|
//
|
|
9180
|
-
// TODO -
|
|
9181
|
-
// TODO -
|
|
9175
|
+
// TODO - OPTIMIZE for getting multiple properties from the same feature?
|
|
9176
|
+
// TODO - OPTIMIZE by only re-calc'ing districts that have changed?
|
|
9182
9177
|
// In this case, special attention to getting county-splits right.
|
|
9183
|
-
// TODO -
|
|
9178
|
+
// TODO - OPTIMIZE by async'ing this?
|
|
9184
9179
|
// TODO - Is there a way to do this programmatically off data? Does it matter?
|
|
9185
9180
|
recalcStatistics(bLog = false) {
|
|
9186
9181
|
// Compute these once per recalc cycle
|
|
@@ -9189,7 +9184,7 @@ class Districts {
|
|
|
9189
9184
|
let planByDistrict = this._session.plan.byDistrictID();
|
|
9190
9185
|
let plan = this._session.plan;
|
|
9191
9186
|
let graph = this._session.graph;
|
|
9192
|
-
//
|
|
9187
|
+
// NOTE - SPLITTING
|
|
9193
9188
|
// Add an extra 0th virtual county bucket for county-district splitting analysis
|
|
9194
9189
|
let nCountyBuckets = this._session.counties.nCounties + 1;
|
|
9195
9190
|
// INITIALIZE STATE VALUES THAT WILL BE ACCUMULATED
|
|
@@ -9215,7 +9210,7 @@ class Districts {
|
|
|
9215
9210
|
// INITIALIZE DISTRICT VALUES THAT WILL BE ACCUMULATED (VS. DERIVED)
|
|
9216
9211
|
let featurePop;
|
|
9217
9212
|
let totalPop = 0;
|
|
9218
|
-
//
|
|
9213
|
+
// NOTE - SPLITTING
|
|
9219
9214
|
let countySplits = U.initArray(nCountyBuckets, 0);
|
|
9220
9215
|
let demVotes = 0;
|
|
9221
9216
|
let repVotes = 0;
|
|
@@ -9246,31 +9241,37 @@ class Districts {
|
|
|
9246
9241
|
// Map from geoID to feature index
|
|
9247
9242
|
let featureID = outerThis._session.features.featureID(geoID);
|
|
9248
9243
|
let f = outerThis._session.features.featureByIndex(featureID);
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9244
|
+
if (f == undefined) {
|
|
9245
|
+
console.log("Skipping undefined feature in district statistics: GEOID =", geoID, "Feature ID =", featureID);
|
|
9246
|
+
}
|
|
9247
|
+
else {
|
|
9248
|
+
// ACCUMULATE VALUES
|
|
9249
|
+
// Total population of each feature
|
|
9250
|
+
// NOTE - This result is used more than once
|
|
9251
|
+
featurePop = outerThis._session.features.fieldForFeature(f, "CENSUS" /* CENSUS */, "Tot" /* TotalPop */);
|
|
9252
|
+
// Total district population
|
|
9253
|
+
totalPop += featurePop;
|
|
9254
|
+
// NOTE - SPLITTING
|
|
9255
|
+
// Total population by counties w/in a district,
|
|
9256
|
+
// except the dummy unassigned district 0
|
|
9257
|
+
if (i > 0)
|
|
9258
|
+
countySplits[outerThis.getCountyIndex(geoID)] += featurePop;
|
|
9259
|
+
// Democratic and Republican vote totals
|
|
9260
|
+
demVotes += outerThis._session.features.fieldForFeature(f, "ELECTION" /* ELECTION */, "D" /* DemVotes */);
|
|
9261
|
+
repVotes += outerThis._session.features.fieldForFeature(f, "ELECTION" /* ELECTION */, "R" /* RepVotes */);
|
|
9262
|
+
// Voting-age demographic breakdowns (or citizen voting-age)
|
|
9263
|
+
totalVAP += outerThis._session.features.fieldForFeature(f, "VAP" /* VAP */, "Tot" /* TotalPop */);
|
|
9264
|
+
whitePop += outerThis._session.features.fieldForFeature(f, "VAP" /* VAP */, "Wh" /* WhitePop */);
|
|
9265
|
+
blackPop += outerThis._session.features.fieldForFeature(f, "VAP" /* VAP */, "BlC" /* BlackPop */);
|
|
9266
|
+
hispanicPop += outerThis._session.features.fieldForFeature(f, "VAP" /* VAP */, "His" /* HispanicPop */);
|
|
9267
|
+
pacificPop += outerThis._session.features.fieldForFeature(f, "VAP" /* VAP */, "PacC" /* PacificPop */);
|
|
9268
|
+
asianPop += outerThis._session.features.fieldForFeature(f, "VAP" /* VAP */, "AsnC" /* AsianPop */);
|
|
9269
|
+
nativePop += outerThis._session.features.fieldForFeature(f, "VAP" /* VAP */, "NatC" /* NativePop */);
|
|
9270
|
+
// 4 - MORE ...
|
|
9271
|
+
}
|
|
9272
9272
|
}
|
|
9273
|
-
|
|
9273
|
+
else
|
|
9274
|
+
console.log("Skipping water-only feature in district statistics:", geoID);
|
|
9274
9275
|
});
|
|
9275
9276
|
// COMPUTE DERIVED VALUES
|
|
9276
9277
|
// Population deviation % and equal population (boolean) by district.
|
|
@@ -9468,6 +9469,8 @@ exports.Features = Features;
|
|
|
9468
9469
|
// f is a direct GeoJSON feature
|
|
9469
9470
|
// p is a geoID
|
|
9470
9471
|
function _getFeatures(f, datasetKey, p) {
|
|
9472
|
+
// Echo parameters for debugging
|
|
9473
|
+
// console.log("f =", f, "k = ", datasetKey, "p =", p);
|
|
9471
9474
|
// Shim to load sample data2.json from disk for command-line scaffolding
|
|
9472
9475
|
if (f.properties && f.properties['datasets']) {
|
|
9473
9476
|
return f.properties['datasets'][datasetKey][p];
|
|
@@ -9554,7 +9557,7 @@ class Plan {
|
|
|
9554
9557
|
// return newPlan;
|
|
9555
9558
|
// }
|
|
9556
9559
|
invertPlan() {
|
|
9557
|
-
//
|
|
9560
|
+
// NOTE - UNASSIGNED
|
|
9558
9561
|
this._planByDistrictID = invertPlan(this._planByGeoID, this._session);
|
|
9559
9562
|
this.districtIDs = U.getNumericObjectKeys(this._planByDistrictID);
|
|
9560
9563
|
}
|
|
@@ -9570,8 +9573,8 @@ function invertPlan(plan, s) {
|
|
|
9570
9573
|
let invertedPlan = {};
|
|
9571
9574
|
// Add a dummy 'unassigned' district
|
|
9572
9575
|
invertedPlan[S.NOT_ASSIGNED] = new Set();
|
|
9573
|
-
//
|
|
9574
|
-
//
|
|
9576
|
+
// NOTE - UNASSIGNED
|
|
9577
|
+
// The feature assignments coming from DRA do not include unassigned ones.
|
|
9575
9578
|
// - In the DRA-calling context, there's an analytics session with a reference
|
|
9576
9579
|
// to the features. Loop over all the features to find the unassigned ones,
|
|
9577
9580
|
// and add them to the dummy unassigned district explicitly.
|
|
@@ -9584,7 +9587,7 @@ function invertPlan(plan, s) {
|
|
|
9584
9587
|
// to the dummy unassigned district 0.
|
|
9585
9588
|
if (!(U.keyExists(geoID, plan)))
|
|
9586
9589
|
invertedPlan[S.NOT_ASSIGNED].add(geoID);
|
|
9587
|
-
//
|
|
9590
|
+
// NOTE - NOT skipping WATER-ONLY features here, because we're
|
|
9588
9591
|
// not skipping them below when they are explicitly assigned in plans. Should
|
|
9589
9592
|
// we skip them in both places?
|
|
9590
9593
|
}
|
|
@@ -9611,7 +9614,13 @@ class Graph {
|
|
|
9611
9614
|
peerNeighbors(node) {
|
|
9612
9615
|
// Get the neighboring geoIDs connected to a geoID
|
|
9613
9616
|
// Ignore the lengths of the shared borders (the values), for now
|
|
9614
|
-
|
|
9617
|
+
// Protect against getting a GEOID that's not in the graph
|
|
9618
|
+
if (U.keyExists(node, this._graph)) {
|
|
9619
|
+
return U.getObjectKeys(this._graph[node]);
|
|
9620
|
+
}
|
|
9621
|
+
else
|
|
9622
|
+
return [];
|
|
9623
|
+
// return U.getObjectKeys(this._graph[node]);
|
|
9615
9624
|
}
|
|
9616
9625
|
}
|
|
9617
9626
|
exports.Graph = Graph;
|
|
@@ -10354,7 +10363,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
10354
10363
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10355
10364
|
const Poly = __importStar(__webpack_require__(/*! @dra2020/poly */ "./node_modules/@dra2020/poly/dist/poly.js"));
|
|
10356
10365
|
// CARTESIAN SHIMS OVER 'POLY' FUNCTIONS
|
|
10357
|
-
// TODO -
|
|
10366
|
+
// TODO - POLY: Confirm Cartesian calculations
|
|
10358
10367
|
function gfArea(poly) {
|
|
10359
10368
|
let area = _polygonArea(poly);
|
|
10360
10369
|
return area;
|
|
@@ -10389,7 +10398,7 @@ function _polygonSimpleArea(p) {
|
|
|
10389
10398
|
// Generalizes the above for MultiPolygons -- cloned from polyArea() in 'poly'
|
|
10390
10399
|
function _polygonArea(poly) {
|
|
10391
10400
|
let polyOptions = { noLatitudeCorrection: true }; // NO-OP?
|
|
10392
|
-
poly = Poly.polyNormalize(poly, polyOptions); // TODO - Discuss w/ Terry
|
|
10401
|
+
poly = Poly.polyNormalize(poly, polyOptions); // TODO - POLY: Discuss w/ Terry
|
|
10393
10402
|
let a = 0;
|
|
10394
10403
|
// A MultiPolygon is a set of polygons
|
|
10395
10404
|
for (let i = 0; poly && i < poly.length; i++) {
|
|
@@ -10402,7 +10411,7 @@ function _polygonArea(poly) {
|
|
|
10402
10411
|
}
|
|
10403
10412
|
return a;
|
|
10404
10413
|
}
|
|
10405
|
-
// TODO -
|
|
10414
|
+
// TODO - POLY: Confirm Cartesian calculations w/ Terry
|
|
10406
10415
|
// The perimeter calculation already just computes cartesian distance if you
|
|
10407
10416
|
// pass in the noLatitudeCorrection flag. You would need to divide by
|
|
10408
10417
|
// Poly.EARTH_RADIUS to go from the returned units of meters to Lat/Lon “units”.
|
|
@@ -10411,7 +10420,7 @@ function gfPerimeter(poly) {
|
|
|
10411
10420
|
return perimeter;
|
|
10412
10421
|
}
|
|
10413
10422
|
exports.gfPerimeter = gfPerimeter;
|
|
10414
|
-
// TODO -
|
|
10423
|
+
// TODO - POLY: Confirm Cartesian calculations w/ Terry
|
|
10415
10424
|
// Cloned from polyPerimeter() in 'poly' and revised to use Cartesian distance
|
|
10416
10425
|
// NOTE: No conversion of degrees to radians!
|
|
10417
10426
|
function _polygonPerimeter(poly) {
|
|
@@ -10435,7 +10444,7 @@ function _distance(x1, y1, x2, y2) {
|
|
|
10435
10444
|
d = Math.sqrt((dLat * dLat) + (dLon * dLon));
|
|
10436
10445
|
return d;
|
|
10437
10446
|
}
|
|
10438
|
-
// TODO -
|
|
10447
|
+
// TODO - POLY: Confirm Cartesian calculations w/ Terry
|
|
10439
10448
|
// As I mentioned, the polyCircle code was already just treating the coordinate
|
|
10440
10449
|
// system as Cartesian. I then did polyFromCircle to convert it to a polygon that
|
|
10441
10450
|
// then could be passed to polyArea in order to take into account the projection.
|
|
@@ -10621,7 +10630,7 @@ function doPreprocessData(s, bLog = false) {
|
|
|
10621
10630
|
doPreprocessElection(s, bLog);
|
|
10622
10631
|
s.bOneTimeProcessingDone = true;
|
|
10623
10632
|
}
|
|
10624
|
-
//
|
|
10633
|
+
// NOTE - UNASSIGNED: Made both the planByGeoID & DistrictID are right
|
|
10625
10634
|
// Invert the plan by district ID
|
|
10626
10635
|
s.plan.invertPlan();
|
|
10627
10636
|
// Create a map of geoIDs to feature IDs
|
|
@@ -10673,7 +10682,7 @@ function doPreprocessCensus(s, bLog = false) {
|
|
|
10673
10682
|
let fipsCodes = U.getObjectKeys(totalByCounty);
|
|
10674
10683
|
// Sort the results
|
|
10675
10684
|
fipsCodes = fipsCodes.sort();
|
|
10676
|
-
//
|
|
10685
|
+
// NOTE - SPLITTING
|
|
10677
10686
|
// Add a dummy county, for county-district splitting analysis
|
|
10678
10687
|
fipsCodes.unshift('000');
|
|
10679
10688
|
// Create the ID-ordinal map
|
|
@@ -10704,7 +10713,7 @@ function doPreprocessCensus(s, bLog = false) {
|
|
|
10704
10713
|
// Loop over the counties
|
|
10705
10714
|
for (let county in fipsCodes) {
|
|
10706
10715
|
let fipsCode = fipsCodes[county];
|
|
10707
|
-
//
|
|
10716
|
+
// NOTE - SPLITTING
|
|
10708
10717
|
// Skip the dummy county
|
|
10709
10718
|
if (fipsCode == '000')
|
|
10710
10719
|
continue;
|
|
@@ -10762,8 +10771,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10762
10771
|
const U = __importStar(__webpack_require__(/*! ./utils */ "./src/utils.ts"));
|
|
10763
10772
|
const S = __importStar(__webpack_require__(/*! ./settings */ "./src/settings.ts"));
|
|
10764
10773
|
const D = __importStar(__webpack_require__(/*! ./_data */ "./src/_data.ts"));
|
|
10765
|
-
// TODO - DASHBOARD: Delete
|
|
10766
|
-
// import { doAnalyzePostProcessing } from './report'
|
|
10767
10774
|
const analyze_1 = __webpack_require__(/*! ./analyze */ "./src/analyze.ts");
|
|
10768
10775
|
const state_reqs_json_1 = __importDefault(__webpack_require__(/*! ../static/state-reqs.json */ "./static/state-reqs.json"));
|
|
10769
10776
|
// Example
|
|
@@ -10814,12 +10821,12 @@ let sampleSplitting = {
|
|
|
10814
10821
|
],
|
|
10815
10822
|
unexpectedAffected: 0.3096,
|
|
10816
10823
|
nSplitVTDs: 12,
|
|
10817
|
-
splitVTDs: []
|
|
10824
|
+
splitVTDs: ["VTD-01", "VTD-02", "VTD-03", "VTD-04", "VTD-05", "VTD-06", "VTD-07", "VTD-08", "VTD-09", "VTD-10", "VTD-11", "VTD-12"]
|
|
10818
10825
|
},
|
|
10819
10826
|
datasets: {},
|
|
10820
10827
|
resources: {}
|
|
10821
10828
|
};
|
|
10822
|
-
// TODO - This category is still being fleshed out.
|
|
10829
|
+
// TODO - PARTISAN: This category is still being fleshed out.
|
|
10823
10830
|
let samplePartisan = {
|
|
10824
10831
|
score: 100,
|
|
10825
10832
|
metrics: {
|
|
@@ -10834,7 +10841,7 @@ let samplePartisan = {
|
|
|
10834
10841
|
planScore: "https://planscore.org/plan.html?20180219T202039.596761160Z"
|
|
10835
10842
|
}
|
|
10836
10843
|
};
|
|
10837
|
-
// TODO - This category is still being fleshed out.
|
|
10844
|
+
// TODO - MINORITY: This category is still being fleshed out.
|
|
10838
10845
|
let sampleMinority = {
|
|
10839
10846
|
score: null,
|
|
10840
10847
|
metrics: {
|
|
@@ -10952,9 +10959,9 @@ function preparePlanAnalytics(s, bLog = false) {
|
|
|
10952
10959
|
// None at this time
|
|
10953
10960
|
},
|
|
10954
10961
|
datasets: {
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
// shapes:
|
|
10962
|
+
// NOTE - DATASETS
|
|
10963
|
+
shapes: U.deepCopy(s.config['descriptions']['SHAPES'])
|
|
10964
|
+
// shapes: "2010 VTD shapes"
|
|
10958
10965
|
},
|
|
10959
10966
|
resources: {
|
|
10960
10967
|
// None at this time
|
|
@@ -11205,7 +11212,7 @@ const polsbyPopperDefn = {
|
|
|
11205
11212
|
externalType: TestType.Number,
|
|
11206
11213
|
suites: [2 /* Best */]
|
|
11207
11214
|
};
|
|
11208
|
-
//
|
|
11215
|
+
// NOTE - SPLITTING
|
|
11209
11216
|
const unexpectedCountySplitsDefn = {
|
|
11210
11217
|
ID: 7 /* UnexpectedCountySplits */,
|
|
11211
11218
|
name: "Unexpected County Splits",
|
|
@@ -11213,7 +11220,7 @@ const unexpectedCountySplitsDefn = {
|
|
|
11213
11220
|
externalType: TestType.Percentage,
|
|
11214
11221
|
suites: [2 /* Best */]
|
|
11215
11222
|
};
|
|
11216
|
-
//
|
|
11223
|
+
// NOTE - SPLITTING
|
|
11217
11224
|
const VTDSplitsDefn = {
|
|
11218
11225
|
ID: 10 /* VTDSplits */,
|
|
11219
11226
|
name: "VTD Splits",
|
|
@@ -11221,7 +11228,7 @@ const VTDSplitsDefn = {
|
|
|
11221
11228
|
externalType: TestType.Number,
|
|
11222
11229
|
suites: [2 /* Best */]
|
|
11223
11230
|
};
|
|
11224
|
-
//
|
|
11231
|
+
// NOTE - SPLITTING
|
|
11225
11232
|
const countySplittingDefn = {
|
|
11226
11233
|
ID: 8 /* CountySplitting */,
|
|
11227
11234
|
name: "County Splitting",
|
|
@@ -11229,7 +11236,7 @@ const countySplittingDefn = {
|
|
|
11229
11236
|
externalType: TestType.Number,
|
|
11230
11237
|
suites: [2 /* Best */]
|
|
11231
11238
|
};
|
|
11232
|
-
//
|
|
11239
|
+
// NOTE - SPLITTING
|
|
11233
11240
|
const districtSplittingDefn = {
|
|
11234
11241
|
ID: 9 /* DistrictSplitting */,
|
|
11235
11242
|
name: "District Splitting",
|
|
@@ -11253,7 +11260,7 @@ const testDefns = {
|
|
|
11253
11260
|
[4 /* PopulationDeviation */]: populationDeviationDefn,
|
|
11254
11261
|
[5 /* Reock */]: reockDefn,
|
|
11255
11262
|
[6 /* PolsbyPopper */]: polsbyPopperDefn,
|
|
11256
|
-
//
|
|
11263
|
+
// NOTE - SPLITTING
|
|
11257
11264
|
[7 /* UnexpectedCountySplits */]: unexpectedCountySplitsDefn,
|
|
11258
11265
|
[10 /* VTDSplits */]: VTDSplitsDefn,
|
|
11259
11266
|
[8 /* CountySplitting */]: countySplittingDefn,
|
|
@@ -11281,7 +11288,7 @@ function doConfigureScales(s) {
|
|
|
11281
11288
|
s.testScales[6 /* PolsbyPopper */] = { scale: [0.10, 0.50] };
|
|
11282
11289
|
const nDistricts = s.state.nDistricts;
|
|
11283
11290
|
const nCounties = s.counties.nCounties;
|
|
11284
|
-
//
|
|
11291
|
+
// NOTE - SPLITTING: Experiment w/ this multiplier. Only allowing the expected
|
|
11285
11292
|
// number of county splits seems too stringent, empirically.
|
|
11286
11293
|
const allowableCountySplitsMultiplier = 1.5;
|
|
11287
11294
|
const nAllowableSplits = Math.min(allowableCountySplitsMultiplier * (nDistricts - 1));
|
|
@@ -11340,7 +11347,7 @@ exports.PRECISION = 4;
|
|
|
11340
11347
|
exports.NORMALIZED_RANGE = 100;
|
|
11341
11348
|
// The dummy district ID for features not assigned districts yet
|
|
11342
11349
|
exports.NOT_ASSIGNED = 0;
|
|
11343
|
-
// TODO -
|
|
11350
|
+
// TODO - DASHBOARD: Discuss w/ Dave
|
|
11344
11351
|
// # of items to report as problematic (e.g., features, districts, etc.)
|
|
11345
11352
|
exports.NUMBER_OF_ITEMS_TO_REPORT = 10;
|
|
11346
11353
|
// The virtual geoID for "neighbors" in other states
|
|
@@ -11387,7 +11394,7 @@ function isOutOfState(geoID) {
|
|
|
11387
11394
|
return geoID == S.OUT_OF_STATE;
|
|
11388
11395
|
}
|
|
11389
11396
|
exports.isOutOfState = isOutOfState;
|
|
11390
|
-
//
|
|
11397
|
+
// NOTE - UNASSIGNED
|
|
11391
11398
|
// Get the districtID to which a geoID is assigned
|
|
11392
11399
|
function getDistrict(plan, geoID) {
|
|
11393
11400
|
// All geoIDs in a state *should be* assigned to a district (including the
|
|
@@ -11445,7 +11452,7 @@ function normalize(rawScore, testScale) {
|
|
|
11445
11452
|
let coercedValue = Math.min(Math.max(rawScore, rangeMin), rangeMax);
|
|
11446
11453
|
// Scale the bounded value w/in the range [0 - (rangeMax - rangeMin)]
|
|
11447
11454
|
let scaledValue = (coercedValue - rangeMin) / (rangeMax - rangeMin);
|
|
11448
|
-
//
|
|
11455
|
+
// NOTE - SPLITTING
|
|
11449
11456
|
// Invert the scaled value if necessary to make bigger = better
|
|
11450
11457
|
if (testScale.bInvertScaled) {
|
|
11451
11458
|
scaledValue = 1.0 - scaledValue;
|
|
@@ -11948,8 +11955,6 @@ const _api_1 = __webpack_require__(/*! ../src/_api */ "./src/_api.ts");
|
|
|
11948
11955
|
const preprocess_1 = __webpack_require__(/*! ../src/preprocess */ "./src/preprocess.ts");
|
|
11949
11956
|
const analyze_1 = __webpack_require__(/*! ../src/analyze */ "./src/analyze.ts");
|
|
11950
11957
|
const results_1 = __webpack_require__(/*! ../src/results */ "./src/results.ts");
|
|
11951
|
-
// TODO - DASHBOARD: Delete
|
|
11952
|
-
// import { doAnalyzePostProcessing } from '../src/report'
|
|
11953
11958
|
const valid_1 = __webpack_require__(/*! ../src/valid */ "./src/valid.ts");
|
|
11954
11959
|
const equal_1 = __webpack_require__(/*! ../src/equal */ "./src/equal.ts");
|
|
11955
11960
|
const compact_1 = __webpack_require__(/*! ../src/compact */ "./src/compact.ts");
|
|
@@ -11961,7 +11966,7 @@ const S = __importStar(__webpack_require__(/*! ../src/settings */ "./src/setting
|
|
|
11961
11966
|
const D = __importStar(__webpack_require__(/*! ../src/_data */ "./src/_data.ts"));
|
|
11962
11967
|
// Simulate DRA unioning district shapes in the background
|
|
11963
11968
|
function addToPoly(poly, polys) {
|
|
11964
|
-
// TODO - Fix 'poly' import, so I don't have to do this workaround.
|
|
11969
|
+
// TODO - POLY: Fix 'poly' import, so I don't have to do this workaround.
|
|
11965
11970
|
// return PC.union(poly, ...polys);
|
|
11966
11971
|
let union = PC.union;
|
|
11967
11972
|
if (union === undefined)
|
|
@@ -12058,18 +12063,20 @@ let bEmpty = argv.empty;
|
|
|
12058
12063
|
let suites = argv.suites;
|
|
12059
12064
|
// Some default dataset keys
|
|
12060
12065
|
let datasetKeys = {
|
|
12066
|
+
SHAPES: "2010_VD",
|
|
12061
12067
|
CENSUS: "D16F",
|
|
12062
12068
|
VAP: "D16T",
|
|
12063
12069
|
ELECTION: "E16GPR"
|
|
12064
12070
|
};
|
|
12065
12071
|
let datasetDescriptions = {
|
|
12072
|
+
SHAPES: "2010 Voting Districts",
|
|
12066
12073
|
CENSUS: "2016 ACS Total Population",
|
|
12067
12074
|
VAP: "2016 ACS Voting Age Population",
|
|
12068
12075
|
ELECTION: "2016 Presidential Election",
|
|
12069
12076
|
};
|
|
12070
12077
|
// Session settings are required:
|
|
12071
12078
|
// - Analytics suites can be defaulted to all with [], but
|
|
12072
|
-
// -
|
|
12079
|
+
// - Datasets must be explicitly specified
|
|
12073
12080
|
let sessionSettings = {
|
|
12074
12081
|
'suites': suites,
|
|
12075
12082
|
'datasets': datasetKeys,
|
|
@@ -12229,7 +12236,7 @@ switch (command) {
|
|
|
12229
12236
|
case 'cohesive': {
|
|
12230
12237
|
preprocess_1.doPreprocessData(s);
|
|
12231
12238
|
analyze_1.doAnalyzeDistricts(s);
|
|
12232
|
-
//
|
|
12239
|
+
// NOTE - SPLITTING
|
|
12233
12240
|
let t1 = cohesive_1.doFindCountiesSplitUnexpectedly(s);
|
|
12234
12241
|
let t2 = cohesive_1.doFindSplitVTDs(s);
|
|
12235
12242
|
let t3 = cohesive_1.doCountySplitting(s);
|