@dra2020/district-analytics 7.1.5 → 7.1.6
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 +18 -12
- package/dist/cli.js.map +1 -1
- package/dist/district-analytics.js +17 -11
- package/dist/district-analytics.js.map +1 -1
- package/dist/src/_data.d.ts +2 -2
- package/dist/src/geofeature.d.ts +0 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -103018,7 +103018,8 @@ class Districts {
|
|
|
103018
103018
|
let featureID = outerThis._session.features.featureID(geoID);
|
|
103019
103019
|
let f = outerThis._session.features.featureByIndex(featureID);
|
|
103020
103020
|
if (f == undefined) {
|
|
103021
|
-
|
|
103021
|
+
if (bLog)
|
|
103022
|
+
console.log("Skipping undefined feature in district statistics: GEOID =", geoID, "Feature ID =", featureID);
|
|
103022
103023
|
}
|
|
103023
103024
|
else {
|
|
103024
103025
|
// ACCUMULATE VALUES
|
|
@@ -103045,8 +103046,10 @@ class Districts {
|
|
|
103045
103046
|
// 4 - MORE ...
|
|
103046
103047
|
}
|
|
103047
103048
|
}
|
|
103048
|
-
else
|
|
103049
|
-
|
|
103049
|
+
else {
|
|
103050
|
+
if (bLog)
|
|
103051
|
+
console.log("Skipping water-only feature in district statistics:", geoID);
|
|
103052
|
+
}
|
|
103050
103053
|
});
|
|
103051
103054
|
// COMPUTE DERIVED VALUES
|
|
103052
103055
|
// Population deviation % and equal population (boolean) by district.
|
|
@@ -103191,8 +103194,10 @@ class Districts {
|
|
|
103191
103194
|
this.statistics[DistrictField.AsianPct][summaryRow] = stateAsianPop / stateVAPPop;
|
|
103192
103195
|
this.statistics[DistrictField.NativePct][summaryRow] = stateNativePop / stateVAPPop;
|
|
103193
103196
|
}
|
|
103194
|
-
|
|
103195
|
-
|
|
103197
|
+
if (bLog) {
|
|
103198
|
+
console.log(`${nMissingDataset} features with missing datasets.`);
|
|
103199
|
+
console.log(`${nMissingProperty} features with missing properties.`);
|
|
103200
|
+
}
|
|
103196
103201
|
}
|
|
103197
103202
|
// NOTE - I did not roll these into district statistics, because creating the
|
|
103198
103203
|
// district shapes themselves is the big district-by-district activity, these
|
|
@@ -103345,8 +103350,8 @@ class Plan {
|
|
|
103345
103350
|
// }
|
|
103346
103351
|
// return newPlan;
|
|
103347
103352
|
// }
|
|
103348
|
-
invertPlan() {
|
|
103349
|
-
this._planByDistrictID = invertPlan(this._planByGeoID, this._session);
|
|
103353
|
+
invertPlan(bLog = false) {
|
|
103354
|
+
this._planByDistrictID = invertPlan(this._planByGeoID, this._session, bLog);
|
|
103350
103355
|
this.districtIDs = U.getNumericObjectKeys(this._planByDistrictID);
|
|
103351
103356
|
}
|
|
103352
103357
|
initializeDistrict(i) { this._planByDistrictID[i] = new Set(); }
|
|
@@ -103357,7 +103362,7 @@ class Plan {
|
|
|
103357
103362
|
}
|
|
103358
103363
|
exports.Plan = Plan;
|
|
103359
103364
|
// Invert a feature assignment structure to sets of ids by district
|
|
103360
|
-
function invertPlan(plan, s) {
|
|
103365
|
+
function invertPlan(plan, s, bLog = false) {
|
|
103361
103366
|
let invertedPlan = {};
|
|
103362
103367
|
// Add a dummy 'unassigned' district
|
|
103363
103368
|
invertedPlan[S.NOT_ASSIGNED] = new Set();
|
|
@@ -103387,7 +103392,7 @@ function invertPlan(plan, s) {
|
|
|
103387
103392
|
}
|
|
103388
103393
|
// Add the geoID to the districtID's set
|
|
103389
103394
|
invertedPlan[districtID].add(geoID);
|
|
103390
|
-
if (U.isWaterOnly(geoID))
|
|
103395
|
+
if (U.isWaterOnly(geoID) && bLog)
|
|
103391
103396
|
console.log("Water-only feature still in plan!", geoID);
|
|
103392
103397
|
}
|
|
103393
103398
|
return invertedPlan;
|
|
@@ -103871,7 +103876,7 @@ function doPreprocessData(s, bLog = false) {
|
|
|
103871
103876
|
s.bOneTimeProcessingDone = true;
|
|
103872
103877
|
}
|
|
103873
103878
|
// Invert the plan by district ID
|
|
103874
|
-
s.plan.invertPlan();
|
|
103879
|
+
s.plan.invertPlan(bLog);
|
|
103875
103880
|
// Create a map of geoIDs to feature IDs
|
|
103876
103881
|
s.features.mapGeoIDsToFeatureIDs();
|
|
103877
103882
|
}
|
|
@@ -103911,7 +103916,8 @@ function doPreprocessCensus(s, bLog = false) {
|
|
|
103911
103916
|
totalByCounty[countyFIPS] += value;
|
|
103912
103917
|
}
|
|
103913
103918
|
else {
|
|
103914
|
-
|
|
103919
|
+
if (bLog)
|
|
103920
|
+
console.log("Skipping water-only feature in Census preprocessing:", geoID);
|
|
103915
103921
|
}
|
|
103916
103922
|
}
|
|
103917
103923
|
// NOTE - The above could be replaced, if I got totals on county.geojson.
|
|
@@ -105156,7 +105162,7 @@ let sessionSettings = {
|
|
|
105156
105162
|
let bLog = argv.verbose;
|
|
105157
105163
|
// Invert the plan, so you can create the district shapes for the SessionRequest.
|
|
105158
105164
|
// NOTE - The plan here is complete (all features assigned).
|
|
105159
|
-
let planByDistrictID = D.invertPlan(planByGeoID);
|
|
105165
|
+
let planByDistrictID = D.invertPlan(planByGeoID, undefined, bLog);
|
|
105160
105166
|
// SIMULATE THE HOST
|
|
105161
105167
|
// Create district shapes & extract properties (area, diameter, perimeter)
|
|
105162
105168
|
// Index the shapes by geoID
|