@dra2020/district-analytics 8.2.5 → 8.2.8
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 +20 -8
- package/dist/cli.js.map +1 -1
- package/dist/district-analytics.js +20 -8
- package/dist/district-analytics.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -281998,10 +281998,11 @@ function extractDistrictProperties(s, bLog = false) {
|
|
|
281998
281998
|
}
|
|
281999
281999
|
exports.extractDistrictProperties = extractDistrictProperties;
|
|
282000
282000
|
function isAShape(poly) {
|
|
282001
|
-
|
|
282002
|
-
|
|
282003
|
-
|
|
282004
|
-
|
|
282001
|
+
if (poly == null)
|
|
282002
|
+
return false;
|
|
282003
|
+
if (Poly.polyNull(poly))
|
|
282004
|
+
return false;
|
|
282005
|
+
return poly.geometry && poly.geometry.coordinates && !U.isArrayEmpty(poly.geometry.coordinates);
|
|
282005
282006
|
}
|
|
282006
282007
|
// SCORE KIWYSI COMPACTNESS
|
|
282007
282008
|
function scoreKIWYSICompactness(s, bLog = false) {
|
|
@@ -282091,8 +282092,12 @@ function doHasEqualPopulations(s, bLog = false) {
|
|
|
282091
282092
|
let popDevTest = s.getTest(4 /* PopulationDeviation */);
|
|
282092
282093
|
const popDevPct = popDevTest['score'];
|
|
282093
282094
|
const popDevNormalized = popDevTest['normalizedScore'];
|
|
282095
|
+
// 09-19-2020 - Added to catch edge case of only one non-empty district
|
|
282096
|
+
const p = s._profile;
|
|
282097
|
+
const totPopByDistrict = p.populationProfile.totalPopByDistrict.filter(x => x > 0);
|
|
282098
|
+
const bTwoOrMoreDistricts = (totPopByDistrict.length > 1) ? true : false;
|
|
282094
282099
|
// Populate the test entry
|
|
282095
|
-
if (popDevNormalized > 0) {
|
|
282100
|
+
if (bTwoOrMoreDistricts && (popDevNormalized > 0)) {
|
|
282096
282101
|
test['score'] = true;
|
|
282097
282102
|
}
|
|
282098
282103
|
else {
|
|
@@ -282766,9 +282771,16 @@ function scorePlan(s, p, bLog = false, overridesJSON) {
|
|
|
282766
282771
|
// Add minority notes
|
|
282767
282772
|
scorecard.minority.details['majorityMinority'] = M.getMajorityMinority(s);
|
|
282768
282773
|
scorecard.minority.details['vraPreclearance'] = M.getVRASection5(s);
|
|
282769
|
-
|
|
282770
|
-
|
|
282771
|
-
|
|
282774
|
+
try {
|
|
282775
|
+
// Add KIWYSI compactness score
|
|
282776
|
+
const kiwysiScore = C.scoreKIWYSICompactness(s, bLog);
|
|
282777
|
+
scorecard.compactness.details['kiwysi'] = kiwysiScore;
|
|
282778
|
+
}
|
|
282779
|
+
catch (e) {
|
|
282780
|
+
console.log("Exception caught scoring KIWYSI compactness.");
|
|
282781
|
+
console.log(e.message);
|
|
282782
|
+
// throw e;
|
|
282783
|
+
}
|
|
282772
282784
|
return scorecard;
|
|
282773
282785
|
}
|
|
282774
282786
|
exports.scorePlan = scorePlan;
|