@dra2020/district-analytics 1.0.3 → 1.0.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/.prettierrc +5 -0
- package/dist/_api.d.ts +27 -0
- package/dist/_data.d.ts +130 -0
- package/dist/analyze.d.ts +4 -0
- package/dist/cli.js +12041 -0
- package/dist/cli.js.map +1 -0
- package/dist/cohesive.d.ts +4 -0
- package/dist/compact.d.ts +5 -0
- package/dist/constants.d.ts +6 -0
- package/dist/district-analytics.js.map +1 -0
- package/dist/equal.d.ts +4 -0
- package/dist/geofeature.d.ts +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/minority.d.ts +3 -0
- package/dist/political.d.ts +8 -0
- package/dist/preprocess.d.ts +2 -0
- package/dist/report.d.ts +15 -0
- package/dist/settings.d.ts +5 -0
- package/dist/test/_cli.d.ts +5 -0
- package/dist/types.d.ts +110 -0
- package/dist/utils.d.ts +28 -0
- package/dist/valid.d.ts +8 -0
- package/jestconfig.json +14 -0
- package/main.js +4 -0
- package/package.json +4 -9
- package/src/_api.ts +120 -0
- package/src/_data.ts +572 -0
- package/src/analyze.ts +92 -0
- package/src/cohesive.ts +156 -0
- package/src/compact.ts +208 -0
- package/src/constants.ts +371 -0
- package/src/equal.ts +75 -0
- package/src/geofeature.ts +138 -0
- package/src/index.ts +6 -0
- package/src/minority.ts +70 -0
- package/src/political.ts +114 -0
- package/src/preprocess.ts +132 -0
- package/src/report.ts +997 -0
- package/src/settings.ts +20 -0
- package/src/types.ts +185 -0
- package/src/utils.ts +245 -0
- package/src/valid.ts +275 -0
- package/tsconfig.json +25 -0
- package/tslint.json +3 -0
- package/types/polygon-clipping/index.d.ts +1 -0
- package/webpack.config.js +73 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as T from './types';
|
|
2
|
+
import { AnalyticsSession } from './_api';
|
|
3
|
+
export declare function doReock(s: AnalyticsSession, bLog?: boolean): T.TestEntry;
|
|
4
|
+
export declare function doPolsbyPopper(s: AnalyticsSession, bLog?: boolean): T.TestEntry;
|
|
5
|
+
export declare function extractDistrictProperties(s: AnalyticsSession, bLog?: boolean): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const StateXXToName: any;
|
|
2
|
+
export declare const StateRequirements: any;
|
|
3
|
+
export declare const MinorityDemographicDefns: any;
|
|
4
|
+
export declare const VRASection5Preclearance: any;
|
|
5
|
+
export declare const MajorityMinorityDistricts: any;
|
|
6
|
+
export declare const StateMinorityContacts: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack://district-analytics/webpack/universalModuleDefinition","webpack://district-analytics/webpack/bootstrap","webpack://district-analytics/./src/_api.ts","webpack://district-analytics/./src/_data.ts","webpack://district-analytics/./src/analyze.ts","webpack://district-analytics/./src/cohesive.ts","webpack://district-analytics/./src/compact.ts","webpack://district-analytics/./src/equal.ts","webpack://district-analytics/./src/geofeature.ts","webpack://district-analytics/./src/index.ts","webpack://district-analytics/./src/minority.ts","webpack://district-analytics/./src/political.ts","webpack://district-analytics/./src/preprocess.ts","webpack://district-analytics/./src/report.ts","webpack://district-analytics/./src/settings.ts","webpack://district-analytics/./src/types.ts","webpack://district-analytics/./src/utils.ts","webpack://district-analytics/./src/valid.ts","webpack://district-analytics/external \"@dra2020/poly\"","webpack://district-analytics/external \"@dra2020/util\"","webpack://district-analytics/external \"assert\""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA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ACtC,MAAM;yBACP;qBACF;iBACF;aACF;YACD,kEAAkE;YAClE,eAAe;YACf,IAAI,CAAC,SAAS,EAAE;gBACd,MAAM;aACP;SACF;KAEF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AApED,gCAoEC;AAED,oBAAoB;AACpB,yEAAyE;AACzE,mFAAmF;AACnF,yCAAyC;AACzC,6EAA6E;AAC7E,+EAA+E;AAC/E,oFAAoF;AACpF,yBAAyB;;;;;;;;;;;;AClRzB,0C;;;;;;;;;;;ACAA,0C;;;;;;;;;;;ACAA,mC","file":"district-analytics.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"district-analytics\"] = factory();\n\telse\n\t\troot[\"district-analytics\"] = factory();\n})(global, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","//\n// THE NODE PACKAGE API\n//\n\nimport { doPreprocessData } from './preprocess'\nimport { doAnalyzePlan, doAnalyzeDistricts } from './analyze'\nimport {\n doConfigureScales, doAnalyzePostProcessing, doPrepareScorecard,\n doPrepareTestLog, Scorecard\n} from './report'\n\nimport * as D from './_data';\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nexport class AnalyticsSession {\n title: string;\n legislativeDistricts: boolean;\n config: T.Dict = {};\n\n bOneTimeProcessingDone = false;\n bPlanAnalyzed = false;\n bPostProcessingDone = false;\n testScales = {} as T.TestScales;\n tests = {} as T.TestEntries;\n scorecard = {} as Scorecard;\n\n state: D.State;\n counties: D.Counties;\n graph: D.Graph;\n features: D.Features;\n plan: D.Plan;\n districts: D.Districts;\n\n constructor(SessionRequest: T.SessionRequest) {\n this.title = SessionRequest['title'];\n this.legislativeDistricts = SessionRequest['legislativeDistricts'];\n this.config = this.processConfig(SessionRequest['config'])\n\n this.state = new D.State(this, SessionRequest['stateXX'], SessionRequest['nDistricts']);\n this.counties = new D.Counties(this, SessionRequest['counties']);\n this.graph = new D.Graph(this, SessionRequest['graph']);\n this.features = new D.Features(this, SessionRequest['data'], this.config['datasets']);\n this.plan = new D.Plan(this, SessionRequest['plan']);\n this.districts = new D.Districts(this, SessionRequest['districtShapes']);\n\n // NOTE: I've pulled these out of the individual analytics to here. Eventually,\n // we could want them to passed into an analytics session as data, along with\n // everything else. For now, this keeps branching out of the main code.\n doConfigureScales(this);\n }\n processConfig(config: T.Dict): T.Dict {\n // NOTE - Session settings are required:\n // - Analytics suites can be defaulted to all with [], but\n // - Dataset keys must be explicitly specified with 'dataset'\n\n let defaultSuites = [T.Suite.Legal, T.Suite.Fair, T.Suite.Best];\n\n // If the config passed in has no suites = [], use the default suites\n if (U.isArrayEmpty(config['suites'])) {\n config['suites'] = defaultSuites;\n }\n\n // Default the Census & redistricting cycle to 2010\n if (!(U.keyExists('cycle', config))) config['cycle'] = 2010;\n\n return config;\n }\n\n // Using the the data in the analytics session, calculate all the\n // analytics & validations, saving/updating the individual test results.\n analyzePlan(bLog: boolean = false): boolean {\n try {\n doPreprocessData(this);\n doAnalyzeDistricts(this, bLog);\n doAnalyzePlan(this, bLog);\n doAnalyzePostProcessing(this);\n }\n catch {\n return false;\n }\n\n return true;\n }\n\n // Get an individual test, so you can drive UI with the results.\n getTest(testID: T.Test): T.TestEntry {\n // Get the existing test entries\n // T.Test is a numeric enum, so convert the string keys to numbers\n let testValues = U.getNumericObjectKeys(this.tests);\n\n // If there's no entry for this test, create & initialize one\n if (!(testValues.includes(testID))) {\n this.tests[testID] = {} as T.TestEntry;\n this.tests[testID]['score'] = undefined;\n this.tests[testID]['details'] = {};\n }\n\n // Return a pointer to the the test entry for this test\n return this.tests[testID];\n }\n\n // Prepare a scorecard for rendering\n // NOTE - This assumes that analyzePlan() has been run!\n prepareScorecard(): any {\n return doPrepareScorecard(this);\n }\n\n // Prepare test results for rendering\n // NOTE - This assumes that analyzePlan() has been run!\n prepareTestLog(): any {\n return doPrepareTestLog(this);\n }\n\n populationDeviationThreshold(): number {\n return 1 - this.testScales[T.Test.PopulationDeviation]['testScale'][0];\n }\n}\n\n","//\n// DATA ABSTRACTION LAYER\n//\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport { AnalyticsSession } from './_api';\nimport { isConnected, isEmbedded } from './valid';\nimport { extractDistrictProperties } from './compact';\nimport { fptpWin } from './political'\n\n\n// DISTRICT STATISTICS\n\n// Indexes for statistics fields in Districts\n// NOTE - Not a const, so the number can be determined dynamically\nexport enum DistrictField {\n TotalPop, // Display\n PopDevPct, // Display\n bEqualPop, // Display\n bNotEmpty, // Display\n bContiguous, // Display\n bNotEmbedded, // Display\n CountySplits,\n DemVotes,\n RepVotes,\n TwoPartyVote, // Two-party total ()= Dem + Rep) not all votes!\n DemPct, // Display (also the \"VPI,\" by convention\")\n RepPct, // Display\n DemSeat,\n TotalVAP, // VAP or CVAP ...\n MinorityPop, // Derived\n WhitePop,\n BlackPop,\n HispanicPop,\n PacificPop,\n AsianPop,\n NativePop,\n WhitePct, // Display\n MinorityPct, // Display\n BlackPct, // Display\n HispanicPct, // Display\n PacificPct, // Display\n AsianPct, // Display\n NativePct // Display\n\n // 1 - MORE ...\n}\n\n// The fields to display in a District Statistics pane\nexport const DisplayFields = [\n DistrictField.TotalPop,\n DistrictField.PopDevPct,\n DistrictField.bEqualPop,\n DistrictField.bNotEmpty,\n DistrictField.bContiguous,\n DistrictField.bNotEmbedded,\n DistrictField.DemPct,\n DistrictField.WhitePct,\n DistrictField.MinorityPct,\n DistrictField.BlackPct,\n DistrictField.HispanicPct,\n DistrictField.PacificPct,\n DistrictField.AsianPct,\n DistrictField.NativePct\n];\n\nexport class Districts {\n _session: AnalyticsSession;\n\n _shapes: T.GeoFeatureCollection;\n _geoProperties = {} as T.DistrictProperties;\n\n statistics: any[][];\n\n constructor(s: AnalyticsSession, ds: T.GeoFeatureCollection) {\n this._session = s;\n\n this._shapes = ds;\n this.statistics = this.initStatistics();\n }\n getShape(i: number): T.GeoFeature { return this._shapes.features[i]; }\n getGeoProperties(i: number): any { return this._geoProperties[i]; }\n setGeoProperties(i: number, p: T.DistrictShapeProperties): void { this._geoProperties[i] = p; }\n\n numberOfColumns(): number { return U.countEnumValues(DistrictField); }\n // +1 for dummy unassigned 0 \"district\" and +1 for N+1 summary \"district\" for\n // state-level values. Real districts are 1–N.\n numberOfRows(): number { return this._session.state.nDistricts + 2; }\n numberOfWorkingDistricts(): number { return this._session.state.nDistricts + 1; }\n\n // This is the core statistics 2D matrix:\n // Fields on the outside, districts on the inside\n initStatistics(): any[][] {\n let nRows = this.numberOfRows();\n let nCols = this.numberOfColumns();\n\n let outer = U.initArray(nCols, undefined);\n\n for (let i = 0; i < nCols; i++) {\n outer[i] = U.initArray(nRows, null);\n }\n\n return outer;\n }\n\n // This is the workhorse computational routine!\n //\n // TODO - Optimize for getting multiple properties from the same feature?\n // TODO - Optimize by only re-calc'ing districts that have changed?\n // In this case, special attention to getting county-splits right.\n // TODO - Optimize by asyn'ing this?\n // TODO - Is there a way to do this programmatically off data? Does it matter?\n recalcStatistics(bLog: boolean = false): void {\n // Compute these once per recalc cycle\n let targetSize = this._session.state.totalPop / this._session.state.nDistricts;\n let deviationThreshold = this._session.populationDeviationThreshold();\n let planByDistrict = this._session.plan.byDistrictID();\n let plan = this._session.plan;\n let graph = this._session.graph;\n\n // INITIALIZE STATE VALUES THAT WILL BE ACCUMULATED\n\n let stateTPVote = 0;\n let stateDemVote = 0;\n let stateRepVote = 0;\n\n let stateVAPPop = 0;\n let stateWhitePop = 0;\n let stateMinorityPop = 0;\n let stateBlackPop = 0;\n let stateHispanicPop = 0;\n let statePacificPop = 0;\n let stateAsianPop = 0;\n let stateNativePop = 0;\n\n // NOTE - These plan-level booleans are set in their respective analytics:\n // - Equal population (bEqualPop)\n // - Complete (bNotEmpty)\n // - Contiguos (bContiguous)\n // - Free of holes (bNotEmbedded)\n\n // 2 - MORE ...\n\n // Loop over the districts (including the dummy unassigned one)\n for (let i = 0; i < this.numberOfWorkingDistricts(); i++) {\n\n // INITIALIZE DISTRICT VALUES THAT WILL BE ACCUMULATED (VS. DERIVED)\n\n let featurePop: number;\n let totalPop: number = 0;\n\n let countySplits: number[] = U.initArray(this._session.counties.nCounties, 0)\n\n let demVotes: number = 0;\n let repVotes: number = 0;\n\n let totalVAP: number = 0;\n let whitePop: number = 0;\n let blackPop: number = 0;\n let hispanicPop: number = 0;\n let pacificPop: number = 0;\n let asianPop: number = 0;\n let nativePop: number = 0;\n\n // 3 - MORE ...\n\n // HACK - Because \"this\" gets ghosted inside the forEach loop below\n let outerThis = this;\n\n // Get the geoIDs assigned to it ...\n let geoIDs = this._session.plan.geoIDsForDistrictID(i);\n\n // ... loop over them creating district-by-district statistics \n geoIDs.forEach(function (geoID: string): void {\n // Map from geoID to feature index\n let featureID = outerThis._session.features.featureID(geoID);\n let f: T.GeoFeature = outerThis._session.features.featureByIndex(featureID);\n\n // ACCUMULATE VALUES\n\n // Total population of each feature (used more than once)\n featurePop = outerThis._session.features.fieldForFeature(f, Dataset.CENSUS, FeatureField.TotalPop);\n\n // Total district population\n totalPop += featurePop;\n\n // Total population by counties w/in a district\n countySplits[outerThis.getCountyIndex(geoID)] += featurePop;\n\n // Democratic and Republican vote totals\n demVotes += outerThis._session.features.fieldForFeature(f, Dataset.ELECTION, FeatureField.DemVotes);\n repVotes += outerThis._session.features.fieldForFeature(f, Dataset.ELECTION, FeatureField.RepVotes);\n\n // Voting-age demographic breakdowns (or citizen voting-age)\n totalVAP += outerThis._session.features.fieldForFeature(f, Dataset.VAP, FeatureField.TotalPop);\n whitePop += outerThis._session.features.fieldForFeature(f, Dataset.VAP, FeatureField.WhitePop);\n blackPop += outerThis._session.features.fieldForFeature(f, Dataset.VAP, FeatureField.BlackPop);\n hispanicPop += outerThis._session.features.fieldForFeature(f, Dataset.VAP, FeatureField.HispanicPop);\n pacificPop += outerThis._session.features.fieldForFeature(f, Dataset.VAP, FeatureField.PacificPop);\n asianPop += outerThis._session.features.fieldForFeature(f, Dataset.VAP, FeatureField.AsianPop);\n nativePop += outerThis._session.features.fieldForFeature(f, Dataset.VAP, FeatureField.NativePop);\n\n // 4 - MORE ...\n });\n\n // COMPUTE DERIVED VALUES\n\n // Population deviation % and equal population (boolean) by district.\n // Leave the values null for the dummy unassigned district.\n let popDevPct = null;\n let bEqualPop = null;\n if (i > 0) {\n popDevPct = (totalPop - targetSize) / targetSize;\n bEqualPop = (popDevPct <= deviationThreshold);\n }\n\n // Total two-party (not total total!) votes, Democratic and Republican vote\n // shares, and Democratic first-past-the-post win (= 1) or loss (= 0).\n let totVotes: number;\n let demPct: number | null = null;\n let repPct: number | null = null;\n let DemSeat: number | null = null;\n\n totVotes = demVotes + repVotes;\n if (totVotes > 0) {\n demPct = demVotes / totVotes;\n repPct = repVotes / totVotes;\n DemSeat = fptpWin(demPct);\n }\n\n // Total minority VAP\n let minorityPop = totalVAP - whitePop\n\n // Voting-age demographic proportions (or citizen voting-age)\n let whitePct: number | null = null;\n let minorityPct: number | null = null;\n let blackPct: number | null = null;\n let hispanicPct: number | null = null;\n let pacificPct: number | null = null;\n let asianPct: number | null = null;\n let nativePct: number | null = null;\n\n if (totalVAP > 0) {\n whitePct = whitePop / totalVAP;\n minorityPct = minorityPop / totalVAP;\n blackPct = blackPop / totalVAP;\n hispanicPct = hispanicPop / totalVAP;\n pacificPct = pacificPop / totalVAP;\n asianPct = asianPop / totalVAP;\n nativePct = nativePop / totalVAP;\n }\n\n // 5 - MORE ...\n\n // COMPUTE DISTRICT-LEVEL VALUES\n\n // Validations\n let bNotEmpty = (!U.isSetEmpty(geoIDs));\n let bContiguous = null;\n let bNotEmbedded = null;\n // Leave the values null for the dummy unassigned district,\n // and districts that are empty.\n if (i > 0) {\n if (bNotEmpty) {\n bContiguous = isConnected(geoIDs, graph);\n bNotEmbedded = (!isEmbedded(i, planByDistrict[i], plan, graph));\n }\n }\n\n // 6 - MORE ...\n\n // UPDATE THE DISTRICT STATISTICS\n\n this.statistics[DistrictField.bNotEmpty][i] = bNotEmpty;\n this.statistics[DistrictField.bContiguous][i] = bContiguous;\n this.statistics[DistrictField.bNotEmbedded][i] = bNotEmbedded;\n\n this.statistics[DistrictField.TotalPop][i] = totalPop;\n this.statistics[DistrictField.PopDevPct][i] = popDevPct;\n this.statistics[DistrictField.bEqualPop][i] = bEqualPop;\n\n this.statistics[DistrictField.CountySplits][i] = countySplits;\n\n this.statistics[DistrictField.DemVotes][i] = demVotes;\n this.statistics[DistrictField.RepVotes][i] = repVotes;\n this.statistics[DistrictField.TwoPartyVote][i] = totVotes;\n this.statistics[DistrictField.DemPct][i] = demPct;\n this.statistics[DistrictField.RepPct][i] = repPct;\n this.statistics[DistrictField.DemSeat][i] = DemSeat;\n\n this.statistics[DistrictField.WhitePop][i] = whitePop;\n this.statistics[DistrictField.MinorityPop][i] = minorityPop;\n this.statistics[DistrictField.BlackPop][i] = blackPop;\n this.statistics[DistrictField.HispanicPop][i] = hispanicPop;\n this.statistics[DistrictField.PacificPop][i] = pacificPop;\n this.statistics[DistrictField.AsianPop][i] = asianPop;\n this.statistics[DistrictField.NativePop][i] = nativePop;\n\n this.statistics[DistrictField.TotalVAP][i] = totalVAP;\n this.statistics[DistrictField.WhitePct][i] = whitePct;\n this.statistics[DistrictField.MinorityPct][i] = minorityPct;\n this.statistics[DistrictField.BlackPct][i] = blackPct;\n this.statistics[DistrictField.HispanicPct][i] = hispanicPct;\n this.statistics[DistrictField.PacificPct][i] = pacificPct;\n this.statistics[DistrictField.AsianPct][i] = asianPct;\n this.statistics[DistrictField.NativePct][i] = nativePct;\n\n // 7 - MORE ...\n\n // ACCUMULATE STATE STATISTICS FROM DISTRICT TOTALS\n\n stateTPVote += totVotes;\n stateDemVote += demVotes;\n stateRepVote += repVotes;\n\n stateVAPPop += totalVAP;\n stateWhitePop += whitePop;\n stateMinorityPop += minorityPop\n stateBlackPop += blackPop;\n stateHispanicPop += hispanicPop;\n statePacificPop += pacificPop;\n stateAsianPop += asianPop;\n stateNativePop += nativePop;\n }\n\n // UPDATE STATE STATISTICS\n let summaryRow = this.numberOfRows() - 1;\n\n if (stateTPVote > 0) {\n this.statistics[DistrictField.DemPct][summaryRow] = stateDemVote / stateTPVote;\n this.statistics[DistrictField.RepPct][summaryRow] = stateRepVote / stateTPVote;\n }\n\n if (stateVAPPop > 0) {\n this.statistics[DistrictField.WhitePct][summaryRow] = stateWhitePop / stateVAPPop;\n this.statistics[DistrictField.MinorityPct][summaryRow] = stateMinorityPop / stateVAPPop;\n this.statistics[DistrictField.BlackPct][summaryRow] = stateBlackPop / stateVAPPop;\n this.statistics[DistrictField.HispanicPct][summaryRow] = stateHispanicPop / stateVAPPop;\n this.statistics[DistrictField.PacificPct][summaryRow] = statePacificPop / stateVAPPop;\n this.statistics[DistrictField.AsianPct][summaryRow] = stateAsianPop / stateVAPPop;\n this.statistics[DistrictField.NativePct][summaryRow] = stateNativePop / stateVAPPop;\n }\n }\n // NOTE - I did not roll these into district statistics, because creating the\n // district shapes themselves is the big district-by-district activity, these\n // calc's already work, and I'm not going to expose these values. Wrapping\n // the underlying function and exposing it here to illustrate the parallelism\n // with recalcStatistics(). These are called in tandem by doAnalyzeDistricts().\n extractDistrictShapeProperties(bLog: boolean = false): void {\n extractDistrictProperties(this._session, bLog)\n }\n getCountyIndex(geoID: string): number {\n let countyGeoID = U.parseGeoID(geoID)['county'] as string;\n let countyFIPS = U.getFIPSFromCountyGeoID(countyGeoID);\n let countyIndex = this._session.counties.indexFromFIPS(countyFIPS);\n\n return countyIndex;\n }\n}\n\n\n// CLASSES, ETC. FOR FEATURE & COUNTY DATA\n\n// Types of datasets by feature\nexport const enum Dataset {\n CENSUS = \"CENSUS\",\n VAP = \"VAP\",\n ELECTION = \"ELECTION\"\n}\n\nexport type DatasetKeys = {\n CENSUS: string; // A total population Census dataset\n VAP: string; // A voting age (or citizen voting age) dataset\n ELECTION: string; // An election dataset\n}\n\nexport const DatasetDescriptions: any = {\n D16F: \"2016 ACS Total Population\",\n D16T: \"2016 ACS Voting Age Population\",\n E16GPR: \"2016 Presidential Election\"\n\n // TODO - What other potential datasets?\n}\n\n// Identifiers of fields for each feature in the datasets\nexport const enum FeatureField {\n TotalPop = \"Tot\",\n WhitePop = \"Wh\",\n BlackPop = \"BlC\",\n HispanicPop = \"His\",\n AsianPop = \"AsnC\",\n PacificPop = \"PacC\",\n NativePop = \"NatC\",\n DemVotes = \"D\",\n RepVotes = \"R\",\n TotalVotes = \"Tot\"\n}\n\n// Wrap data by feature, to abstract the specifics of the internal structure\nexport class Features {\n _session: AnalyticsSession;\n\n _data: T.GeoFeatureCollection;\n _keys: DatasetKeys;\n\n _featureIDs = {} as T.FeaturesByGeoID;\n\n constructor(s: AnalyticsSession, data: T.GeoFeatureCollection, keys: DatasetKeys) {\n this._session = s;\n\n this._data = data;\n this._keys = keys;\n }\n nFeatures(): number { return this._data.features.length; }\n featureByIndex(i: number): T.GeoFeature { return this._data.features[i]; }\n geoIDForFeature(f: any): string { return f.properties['GEOID']; }\n fieldForFeature(f: any, dt: Dataset, fk: string): any {\n let dk: string = this._keys[dt];\n\n return _getFeatures(f, dk, fk);\n }\n resetDataset(d: Dataset, k: string): void {\n this._keys[d] = k;\n // TODO - Does anything need to be recalc'd now when a dataset is changed?\n }\n mapGeoIDsToFeatureIDs(): void {\n for (let i: number = 0; i < this._session.features.nFeatures(); i++) {\n let f: T.GeoFeature = this._session.features.featureByIndex(i);\n let geoID: string = this._session.features.geoIDForFeature(f);\n\n this._featureIDs[geoID] = i;\n }\n }\n featureID(i: string): number { return this._featureIDs[i]; }\n}\n\n// NOTE - This accessor is cloned from fGetW() in dra-client/restrict.ts\n// f is a direct GeoJSON feature\n// p is a geoID\nfunction _getFeatures(f: any, datasetKey: string, p: string): any {\n // Shim to load sample data2.json from disk for command-line scaffolding\n if (f.properties && f.properties['datasets']) {\n return f.properties['datasets'][datasetKey][p];\n }\n\n // NOTE - The fGetW() code from dra-client below here ...\n\n // Direct property?\n if (f.properties && f.properties[p] !== undefined)\n return f.properties[p];\n\n // Joined property?\n let a: any[] = _fGetJoined(f);\n if (a) {\n for (let i: number = 0; i < a.length; i++) {\n let o: any = a[i];\n if (!datasetKey) {\n if (o[p] !== undefined)\n return o[p];\n }\n else {\n if (o['datasets'] && o['datasets'][datasetKey])\n if (o['datasets'][datasetKey][p])\n return o['datasets'][datasetKey][p];\n }\n }\n }\n return undefined;\n}\n\nfunction _fGetJoined(f: any): any[] {\n return (f.properties && f.properties.joined) ? f.properties.joined : undefined;\n}\n\n// Wrap data by county, to abstract the specifics of the internal structure\nexport class Counties {\n _session: AnalyticsSession;\n\n _data: T.GeoFeatureCollection;\n _countyNameLookup: T.FIPSCodeToCountyNameMap;\n\n nCounties: number;\n index = {} as T.FIPSToOrdinalMap;\n\n constructor(s: AnalyticsSession, data: T.GeoFeatureCollection) {\n this._session = s;\n\n this._data = data;\n this.nCounties = this._data.features.length;\n this._countyNameLookup = {};\n }\n // nCounties(): number { return this._data.features.length; }\n countyByIndex(i: number): T.GeoFeature { return this._data.features[i]; }\n propertyForCounty(f: any, pk: string): any { return f.properties[pk]; }\n mapFIPSToName(fips: string, name: string): void { this._countyNameLookup[fips] = name; }\n nameFromFIPS(fips: string): string { return this._countyNameLookup[fips]; }\n indexFromFIPS(fips: string): number { return this.index[fips]; }\n}\n\n// CLASSES TO ORGANIZE AND/OR ABSTRACT OTHER DATA\n\nexport class State {\n _session: AnalyticsSession;\n\n xx: string;\n nDistricts: number;\n totalPop = 0;\n tooBigFIPS = [] as string[];\n tooBigName = [] as string[];\n expectedSplits = 0;\n expectedAffected = 0;\n\n constructor(s: AnalyticsSession, xx: string, n: number) {\n this._session = s;\n\n this.xx = xx;\n this.nDistricts = n;\n }\n}\n\nexport class Plan {\n _session: AnalyticsSession;\n\n // TODO - Do these need to be updated, when the plan changes?\n _planByGeoID: T.PlanByGeoID;\n _planByDistrictID: T.PlanByDistrictID;\n\n districtIDs: number[];\n\n constructor(s: AnalyticsSession, p: T.PlanByGeoID) {\n this._session = s;\n\n this._planByGeoID = p;\n this._planByDistrictID = {} as T.PlanByDistrictID;\n\n this.districtIDs = []; // Set when the plan in inverted\n }\n invertPlan(): void {\n this._planByDistrictID = U.invertPlan(this._planByGeoID);\n this.districtIDs = U.getNumericObjectKeys(this._planByDistrictID);\n }\n initializeDistrict(i: number): void { this._planByDistrictID[i] = new Set(); }\n\n byGeoID(): T.PlanByGeoID { return this._planByGeoID; }\n byDistrictID(): T.PlanByDistrictID { return this._planByDistrictID; }\n districtForGeoID(i: string): number { return this._planByGeoID[i]; }\n geoIDsForDistrictID(i: number): Set<string> { return this._planByDistrictID[i]; }\n}\n\nexport class Graph {\n _session: AnalyticsSession;\n\n _graph: T.ContiguityGraph;\n\n constructor(s: AnalyticsSession, graph: T.ContiguityGraph) {\n this._session = s;\n\n this._graph = graph;\n }\n // TODO - Rework this, when we support MIXED MAPS.\n peerNeighbors(node: string): string[] {\n // Get the neighboring geoIDs connected to a geoID\n // Ignore the lengths of the shared borders (the values), for now\n\n return U.getObjectKeys(this._graph[node]);\n }\n}\n\n\n","//\n// ANALYZE A PLAN\n//\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport { AnalyticsSession } from './_api';\n\nimport { doIsComplete, doIsContiguous, doIsFreeOfHoles } from './valid'\nimport { doPopulationDeviation, doHasEqualPopulations } from './equal';\nimport { doReock, doPolsbyPopper, extractDistrictProperties } from './compact';\nimport { doCountySplits, doPlanComplexity } from './cohesive';\nimport {\n doSeatsBias, doVotesBias,\n doResponsiveness, doResponsiveDistricts, doEfficiencyGap\n} from './political';\nimport { doMajorityMinorityDistricts } from './minority'\n\n// Compile district-level info for plan/map-level analytics\nexport function doAnalyzeDistricts(s: AnalyticsSession, bLog: boolean = false): void {\n s.districts.recalcStatistics(bLog);\n s.districts.extractDistrictShapeProperties(bLog);\n}\n\n// TODO - I could make this table-driven, but I'm thinking that the explicit\n// calls might make chunking for aync easier.\n// Calculate the analytics & validations and cache the results\n// NOTE - doAnalyzePlan() depends on doAnalyzeDistricts() having run first.\nexport function doAnalyzePlan(s: AnalyticsSession, bLog: boolean = false): void {\n // Get the requested suites, and only execute those tests\n let requestedSuites = s.config['suites'];\n\n // Tests in the \"Legal\" suite, i.e., pass/ fail constraints\n if (requestedSuites.includes(T.Suite.Legal)) {\n s.tests[T.Test.Complete] = doIsComplete(s);\n\n s.tests[T.Test.Contiguous] = doIsContiguous(s);\n\n s.tests[T.Test.FreeOfHoles] = doIsFreeOfHoles(s);\n\n s.tests[T.Test.PopulationDeviation] = doPopulationDeviation(s);\n\n // NOTE - I can't check whether a population deviation is legal or not, until\n // the raw % is normalized. A zero (0) would mean \"too much\" / \"not legal,\" for\n // the given type of district (CD vs. LD). The EqualPopulation test is derived\n // from PopulationDeviation, as part of scorecard or test log preparation.\n\n // Create an empty test entry here though ...\n s.tests[T.Test.EqualPopulation] = s.getTest(T.Test.EqualPopulation) as T.TestEntry;\n }\n\n // Tests in the \"Fair\" suite\n if (requestedSuites.includes(T.Suite.Fair)) {\n s.tests[T.Test.SeatsBias] = doSeatsBias(s);\n\n s.tests[T.Test.VotesBias] = doVotesBias(s);\n\n s.tests[T.Test.Responsiveness] = doResponsiveness(s);\n\n s.tests[T.Test.ResponsiveDistricts] = doResponsiveDistricts(s);\n\n s.tests[T.Test.EfficiencyGap] = doEfficiencyGap(s);\n\n s.tests[T.Test.MajorityMinorityDistricts] = doMajorityMinorityDistricts(s);\n }\n\n // Tests in the \"Best\" suite, i.e., criteria for better/worse\n if (requestedSuites.includes(T.Suite.Best)) {\n s.tests[T.Test.Reock] = doReock(s, bLog);\n s.tests[T.Test.PolsbyPopper] = doPolsbyPopper(s, bLog);\n\n s.tests[T.Test.CountySplits] = doCountySplits(s);\n\n s.tests[T.Test.Complexity] = doPlanComplexity(s);\n }\n\n // Enable a Test Log and Scorecard to be generated\n s.bPlanAnalyzed = true;\n s.bPostProcessingDone = false;\n}\n\n// Derive secondary analytics that are based on primary tests.\n// This concept allows Population Deviation to be a primary numeric test and\n// Equal Population to be secondary pass/fail validation.\n//\n// NOTE - Should this be conditionalized on the test suites requested? \n// Those are encapsulated in reports.ts right now, so not doing that.\nexport function doDeriveSecondaryTests(s: AnalyticsSession): void {\n s.tests[T.Test.EqualPopulation] = doHasEqualPopulations(s);\n}\n","//\n// \"COHESIVE\" - We're naming this category which is about county splitting.\n//\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport * as D from './_data'\nimport { AnalyticsSession } from './_api';\n\n\nexport function doCountySplits(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.CountySplits) as T.TestEntry;\n\n // THE THREE VALUES TO DETERMINE FOR A PLAN\n let unexpectedSplits: number = 0;\n let unexpectedAffected: number = 0;\n let countiesSplitUnexpectedly = [];\n\n // FIRST, ANALYZE THE COUNTY SPLITING FOR THE PLAN\n\n // Pivot census totals into county-district \"splits\"\n let countiesByDistrict = s.districts.statistics[D.DistrictField.CountySplits];\n // countiesByDistrict = countiesByDistrict.slice(1, -1);\n\n // Find the single-county districts, i.e., districts NOT split across counties.\n // Ignore the dummy unassigned 0 and N+1 summary \"districts.\"\n let singleCountyDistricts = [];\n for (let d = 1; d <= s.state.nDistricts; d++) {\n // See if there's only one county partition\n let nCountiesInDistrict = 0;\n for (let c = 0; c < s.counties.nCounties; c++) {\n if (countiesByDistrict[d][c] > 0) {\n nCountiesInDistrict += 1;\n if (nCountiesInDistrict > 1) {\n break;\n }\n }\n }\n // If so, save the district\n if (nCountiesInDistrict == 1) {\n singleCountyDistricts.push(d);\n }\n }\n\n // Process the splits/partitions in the plan:\n // - Count the total # of partitions,\n // - Find the counties split across districts, and\n // - Accumulate the number people affected (except when single-county districts)\n let nPartitionsOverall: number = 0;\n let splitCounties = new Set(); // The counties that are split across districts\n let totalAffected: number = 0; // The total population affected by those splits\n\n for (let c = 0; c < s.counties.nCounties; c++) {\n let nCountyParts = 0;\n let subtotal = 0;\n\n for (let d = 1; d <= s.state.nDistricts; d++) {\n if (countiesByDistrict[d][c] > 0) {\n nPartitionsOverall += 1;\n nCountyParts += 1;\n if (!(U.arrayContains(singleCountyDistricts, d))) {\n subtotal += countiesByDistrict[d][c];\n }\n }\n }\n if (nCountyParts > 1) {\n splitCounties.add(c);\n totalAffected += subtotal;\n }\n }\n\n // Convert county ordinals to FIPS codes\n let splitCountiesFIPS = U.getSelectObjectKeys(s.counties.index, [...splitCounties]);\n\n // THEN TAKE ACCOUNT OF THE COUNTY SPLITTING THAT IS EXPECTED (REQUIRED)\n\n // Compute the total number of splits this way, in case any counties are split\n // more than once. I.e., it's not just len(all_counties_split).\n let nSplits = nPartitionsOverall - s.counties.nCounties;\n\n // Determine the number of *unexpected* splits. NOTE: Prevent negative numbers,\n // in case you have a plan the *doesn't* split counties that would have to be\n // split due to their size.\n unexpectedSplits = Math.max(0, nSplits - s.state.expectedSplits);\n\n // Subtract off the total population that *has* to be affected by splits,\n // because their counties are too big. NOTE: Again, prevent negative numbers, \n // in case you have a plan the *doesn't* split counties that would have to be\n // split due to their size.\n unexpectedAffected = U.trim(Math.max(0, totalAffected - s.state.expectedAffected) / s.state.totalPop);\n\n // Find the counties that are split *unexpectedly*. From all the counties that\n // are split, remove those that *have* to be split, because they are bigger than\n // a district.\n let countiesSplitUnexpectedlyFIPS = [];\n for (let fips of splitCountiesFIPS) {\n if (!(U.arrayContains(s.state.tooBigFIPS, fips))) {\n countiesSplitUnexpectedlyFIPS.push(fips);\n }\n }\n\n // ... and convert the FIPS codes to county names.\n for (let fips of countiesSplitUnexpectedlyFIPS) {\n countiesSplitUnexpectedly.push(s.counties.nameFromFIPS(fips));\n }\n countiesSplitUnexpectedly = countiesSplitUnexpectedly.sort();\n\n // Cache the results in the test\n test['score'] = unexpectedAffected; // TODO - Use Moon's complexity metric here\n test['details'] = {\n 'unexpectedSplits': unexpectedSplits,\n 'unexpectedAffected': unexpectedAffected,\n 'countiesSplitUnexpectedly': countiesSplitUnexpectedly\n };\n\n return test;\n}\n\n\n// 2 - THE COMPLEXITY ANALYTIC NEEDS THE FOLLOWING DATA:\n//\n// If a map is already in simplified (mixed) form, the complexity analytic needs\n// two pieces of data:\n// - The counts of features by summary level--i.e., the numbers of counties, tracts,\n// block groups, and blocks in a state; and\n// - The map -- So it can count the features by summary level in the map,\n// as well as the number of BG’s that are split.\n//\n// TODO - Where would the state counts come from? Preprocessed and passed in, or\n// done in a one-time initialization call (which would require a full set of\n// block geo_id's for the state).\n//\n// However, if a map is not yet (fully) simplified, then determining the\n// complexity of a map also requires a preprocessed summary level hierarchy, so\n// you can get the child features (e.g., tracts) of a parent feature (e.g.,\n// a county).\n//\n// NOTE - I have script for producing this hierarchy which we could repurpose.\n//\n// TODO - For mixed map processing--specfically to find the neighbors of a feature\n// that are actually in the map (as opposed to just neighbors at the same\n// summary level in the static graph)--you need a special hierarchy that\n// distinguishes between the 'interior' and 'edge children of a feature.\n//\n// NOTE - The script noted above does this.\n\nexport function doPlanComplexity(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.Complexity) as T.TestEntry;\n\n console.log(\"TODO - Calculating plan complexity ...\");\n\n return test;\n}\n\n","//\n// COMPACT\n//\n\nimport { gfArea, gfPerimeter, gfDiameter } from './geofeature';\n\nimport * as T from './types';\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport { AnalyticsSession } from './_api';\n\n// Measures of compactness compare district shapes to various ideally compact\n// benchmarks, such as circles. All else equal, more compact districts are better.\n// \n// There are four popular measures of compactness. They either focus on how\n// dispersed or how indented a shapes are.\n//\n// These first two measures are the most important:\n// \n// Reock is the primary measure of the dispersion of district shapes, calculated\n// as “the area of the district to the area of the minimum spanning circle that\n// can enclose the district.”\n//\n// R = A / A(Minimum Bounding Circle)\n// R = A / (π * (D / 2)^2)\n//\n// R = 4A / πD^2\n//\n// where A is the area of the district and D is the diameter of the minimum\n// bounding circle.\n//\n// Polsby-Popper is the primary measure of the indendentation of district shapes,\n// calculated as the “the ratio of the area of the district to the area of a circle\n// whose circumference is equal to the perimeter of the district.”\n//\n// PP = A / A(C)\n//\n// where C is that circle. In other words:\n//\n// P = 2πRc and A(C) = π(P / 2π)^2\n//\n// where P is the perimeter of the district and Rc is the radius of the circle.\n//\n// Hence, the measure simplifies to:\n//\n// PP = 4π * (A / P^2)\n// \n// I propose that we use these two, normalize them, and weight equally to determine\n// our compactness value.\n// \n// These second two measures may be used to complement the primary ones above:\n// \n// Convex Hull is a secondary measure of the dispersion of district shapes, calculated\n// as “the ratio of the district area to the area of the minimum convex bounding\n// polygon (also known as a convex hull) enclosing the district.”\n//\n// CH = A / A(Convex Hull)\n// \n// where a convex hull is the minimum perimeter that encloses all points in a shape,\n// basically the shortest unstretched rubber band that fits around the shape.\n//\n// Schwartzberg is a secondary measure of the degree of indentation of district\n// shapes, calculated as “the ratio of the perimeter of the district to the circumference\n// of a circle whose area is equal to the area of the district.”\n//\n// S = 1 / (P / C)\n//\n// where P is the perimeter of the district and C is the circumference of the circle.\n// The radius of the circle is:\n//\n// Rc = SQRT(A / π)\n//\n// So, the circumference of the circle is:\n//\n// C = 2πRc or C = 2π * SQRT(A / π)\n//\n// Hence:\n//\n// S = 1 (P / 2π * SQRT(A / π))\n//\n// S = (2π * SQRT(A / π)) / P\n//\n// All these measures produce values between 0 and 1, with 0 being the least compact\n// and 1 being the most compact. Sometimes these values are multiplied by 100 to\n// give values between 0 and 100.\n// \n// For each measure, the compactness of a set of Congressional districts is the\n// average of that measure for all the districts.\n//\n\n// Calculate Reock compactness:\n// reock = (4 * a) / (math.pi * d**2)\n// NOTE - Depends on extractDistrictProperties running first\nexport function doReock(s: AnalyticsSession, bLog: boolean = false): T.TestEntry {\n let test = s.getTest(T.Test.Reock) as T.TestEntry;\n\n // Calculate Reock scores by district\n let scores: number[] = [];\n\n for (let districtID = 1; districtID <= s.state.nDistricts; districtID++) {\n let districtProps = s.districts.getGeoProperties(districtID);\n let a = districtProps[T.DistrictShapeProperty.Area];\n let d = districtProps[T.DistrictShapeProperty.Diameter];\n\n let reock = (4 * a) / (Math.PI * d ** 2);\n\n // Save each district score\n scores.push(reock);\n\n // Echo the results by district\n if (bLog) console.log(\"Reock for district\", districtID, \"=\", reock);\n }\n\n // Populate the test entry\n let averageReock = U.avgArray(scores);\n\n test['score'] = U.trim(averageReock);\n test['details'] = {}; // TODO - Any details?\n\n return test;\n}\n\n// Calculate Polsby-Popper compactness measures:\n// polsby_popper = (4 * math.pi) * (a / p**2)\n// NOTE - Depends on extractDistrictProperties running first\nexport function doPolsbyPopper(s: AnalyticsSession, bLog: boolean = false): T.TestEntry {\n let test = s.getTest(T.Test.PolsbyPopper) as T.TestEntry;\n\n // Calculate Polsby-Popper scores by district\n let scores: number[] = [];\n\n for (let districtID = 1; districtID <= s.state.nDistricts; districtID++) {\n let districtProps = s.districts.getGeoProperties(districtID);\n let a = districtProps[T.DistrictShapeProperty.Area];\n let p = districtProps[T.DistrictShapeProperty.Perimeter];\n\n let polsbyPopper = (4 * Math.PI) * (a / p ** 2);\n\n // Save each district score\n scores.push(polsbyPopper);\n\n // Echo the results by district\n if (bLog) console.log(\"Polsby-Popper for district\", districtID, \"=\", polsbyPopper);\n }\n\n // Populate the test entry\n let averagePolsbyPopper = U.avgArray(scores);\n\n test['score'] = U.trim(averagePolsbyPopper);\n test['details'] = {}; // TODO - Any details?\n\n return test;\n}\n\n\n// HELPER TO EXTRACT PROPERTIES OF DISTRICT SHAPES\n\nexport function extractDistrictProperties(s: AnalyticsSession, bLog: boolean = false): void {\n for (let i = 1; i <= s.state.nDistricts; i++) {\n let j = i - 1; // TODO - Terry: How do you get away w/o this?!?\n let poly = s.districts.getShape(j);\n\n // TODO - Bundle these calls?\n let area: number = gfArea(poly);\n let perimeter: number = gfPerimeter(poly);\n let diameter: number = gfDiameter(poly);\n\n let props: T.DistrictShapeProperties = [0, 0, 0]; // TODO - Terry?!?\n props[T.DistrictShapeProperty.Area] = area;\n props[T.DistrictShapeProperty.Diameter] = diameter;\n props[T.DistrictShapeProperty.Perimeter] = perimeter;\n\n s.districts.setGeoProperties(i, props);\n\n if (bLog) console.log(\"District\", i, \"A =\", area, \"P =\", perimeter, \"D =\", diameter);\n }\n}\n\n\n// SAVE THESE NOTES, IN CASE WE NEED TO REWORK HOW WE PERFORM THESE CALCS.\n// THEY REFLECT HOW I DID THEM IN PYTHON.\n//\n// THE COMPACTNESS ANALYTICS NEED THE FOLLOWING DATA,\n// IN ADDITION TO THE MAP (IDEALLY, GEO_IDS INDEXED BY DISTRICT_ID)\n//\n// Shapes by geo_id\n//\n// If we need/want to speed compactness calculations up, we'll need\n// to calculate the perimeters and diameters (and areas) of districts implicitly,\n// which will require identifying district boundaries initially and updating\n// them incrementally as districts are (re)assigned.\n//\n// A district's boundary info is the set/list of features that constitute the\n// district's border along with each boundary feature's neighbors. Hence, this\n// requires a contiguity graph with the lengths of shared edges between features\n// precomputed.\n//\n// NOTE - I can write up (if not implement) the logic for determining what shapes\n// constitute a district's boundary. There are a few nuances.\n//\n// If we have to optimize like this when we generalize to mixed maps, the\n// determination of \"neighbors in the map\" and the length of shared borders\n// (for determining a district perimeters) becomes more complicated and dynamic.\n//\n// NOTE - Again, I can write up (if not implement) the logic for both of these.\n// They are a bit tricky and require special preprocessing of the summary level\n// hierarchy (which I also have a script for that we can repurpose).\n","//\n// EQUAL POPULATION\n//\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport * as D from './_data'\nimport { AnalyticsSession } from './_api';\n\n\nexport function doPopulationDeviation(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.PopulationDeviation) as T.TestEntry;\n\n // Compute the min, max, and average district populations,\n // excluding the dummy 'unassigned' 0 and N+1 summary \"districts.\"\n let totPopByDistrict = s.districts.statistics[D.DistrictField.TotalPop];\n totPopByDistrict = totPopByDistrict.slice(1, -1);\n\n let min = U.minArray(totPopByDistrict);\n let max = U.maxArray(totPopByDistrict);\n let total = U.sumArray(totPopByDistrict);\n\n // Calculate the raw population deviation.\n // The target size is the average population.\n let avg = total / s.state.nDistricts;\n let popDev = (max - min) / avg;\n\n // Round the raw value to the desired level of precision\n popDev = U.trim(popDev);\n\n // Populate the test entry\n test['score'] = popDev;\n test['details'] = { 'maxDeviation': max - min };\n\n // Populate the N+1 summary \"district\" in district.statistics\n let totalPop = s.districts.statistics[D.DistrictField.TotalPop];\n let popDevPct = s.districts.statistics[D.DistrictField.PopDevPct];\n let summaryRow = s.districts.numberOfRows() - 1;\n\n totalPop[summaryRow] = avg; // aka \"target size\"\n popDevPct[summaryRow] = popDev;\n\n return test;\n}\n\n// NOTE - This validity check is *derived* and depends on population deviation %\n// being computed (above) and normalized in test log & scorecard generation.\nexport function doHasEqualPopulations(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.EqualPopulation) as T.TestEntry;\n\n // Get the normalized population deviation %\n let popDevTest = s.getTest(T.Test.PopulationDeviation);\n let popDevPct = popDevTest['score'] as number;\n let popDevNormalized: number = popDevTest['normalizedScore'] as number;\n\n // Populate the test entry\n if (popDevNormalized > 0) {\n test['score'] = true;\n }\n else {\n test['score'] = false;\n }\n test['details']['deviation'] = popDevPct;\n test['details']['thresholds'] = popDevTest['details']['scale'];\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bEqualPop = s.districts.statistics[D.DistrictField.bEqualPop];\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bEqualPop[summaryRow] = test['score'];\n\n return test;\n}\n","//\n// GEO-FEATURES UTILITIES\n//\n\nimport * as Poly from '@dra2020/poly';\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\n\n// CARTESIAN SHIMS OVER 'POLY' FUNCTIONS\n\n// TODO - Terry: Confirm Cartesian calculations\nexport function gfArea(poly: any): number {\n let area: number = _polygonArea(poly);\n\n // let polyOptions = { noLatitudeCorrection: false } DELETE\n // let area: number = Poly.polyArea(poly, polyOptions);\n\n return area;\n}\n\n// Algorithm for the area of a simple/single planar polygon:\n// https://algorithmtutor.com/Computational-Geometry/Area-of-a-polygon-given-a-set-of-points/\n// https://mathopenref.com/coordpolygonarea2.html\n//\n// function polygonArea(X, Y, numPoints) \n// { \n// area = 0; // Accumulates area in the loop\n// j = numPoints-1; // The last vertex is the 'previous' one to the first\n\n// for (i=0; i<numPoints; i++)\n// { area = area + (X[j]+X[i]) * (Y[j]-Y[i]); \n// j = i; //j is previous vertex to i\n// }\n// return area/2;\n// }\n\n// Reimplemented to use polygons vs. X & Y vectors\nfunction _polygonSimpleArea(p: any): number {\n let area = 0; // Accumulates area in the loop\n let n = p.length;\n let j = n - 1; // The last vertex is the 'previous' one to the first\n\n for (let i = 0; i < n; i++) {\n area = area + (p[j][0] + p[i][0]) * (p[j][1] - p[i][1]);\n // area = area + (X[j] + X[i]) * (Y[j] - Y[i]);\n j = i; // j is previous vertex to i\n }\n return Math.abs(area / 2);\n}\n\n// Generalizes the above for MultiPolygons -- cloned from polyArea() in 'poly'\nfunction _polygonArea(poly: any): number {\n let polyOptions = { noLatitudeCorrection: true } // NO-OP?\n poly = Poly.polyNormalize(poly, polyOptions); // TODO - Discuss w/ Terry\n\n let a: number = 0;\n\n // A MultiPolygon is a set of polygons\n for (let i: number = 0; poly && i < poly.length; i++) {\n // A single polygon is an exterior ring with interior holes. Holes are subtracted.\n let p = poly[i];\n for (let j: number = 0; j < p.length; j++) {\n let sp = p[j];\n a += _polygonSimpleArea(sp) * (j == 0 ? 1 : -1);\n }\n }\n\n return a;\n}\n\n// TODO - Terry: Confirm Cartesian calculations\n// The perimeter calculation already just computes cartesian distance if you\n// pass in the noLatitudeCorrection flag. You would need to divide by \n// Poly.EARTH_RADIUS to go from the returned units of meters to Lat/Lon “units”.\n\nexport function gfPerimeter(poly: any): number {\n let perimeter: number = _polygonPerimeter(poly);\n // let polyOptions = { noLatitudeCorrection: true } // Cartesian distance\n // let perimeter: number = Poly.polyPerimeter(poly, polyOptions); DELETE\n\n return perimeter;\n // return perimeter / Poly.EARTH_RADIUS; DELETE\n}\n\n// TODO - Terry: Confirm Cartesian calculations\n// Cloned from polyPerimeter() in 'poly' and revised to use Cartesian distance\n// NOTE: No conversion of degrees to radians!\nfunction _polygonPerimeter(poly: any): number {\n let polyOptions = { noLatitudeCorrection: true } // Cartesian distance\n poly = Poly.polyNormalize(poly, polyOptions);\n\n let perimeter: number = 0;\n for (let i: number = 0; poly && i < poly.length; i++) {\n // Ignore holes so only look at first polyline\n let p: any = poly[i][0];\n for (let j: number = 0; j < p.length - 1; j++)\n perimeter += _distance(p[j][0], p[j][1], p[j + 1][0], p[j + 1][1]);\n // perimeter += haversine(p[j][0], p[j][1], p[j + 1][0], p[j + 1][1], options); DELETE\n\n if (p.length > 2 && (p[0][0] != p[p.length - 1][0] || p[0][1] != p[p.length - 1][1]))\n perimeter += _distance(p[0][0], p[0][1], p[p.length - 1][0], p[p.length - 1][1]);\n // perimeter += haversine(p[0][0], p[0][1], p[p.length - 1][0], p[p.length - 1][1], options); DELETE\n }\n\n return perimeter;\n}\n\nfunction _distance(x1: number, y1: number, x2: number, y2: number): number {\n let dLat = y2 - y1;\n let dLon = x2 - x1;\n let d: number;\n\n d = Math.sqrt((dLat * dLat) + (dLon * dLon));\n\n return d;\n}\n\n// TODO - Terry: Confirm Cartesian calculations\n// As I mentioned, the polyCircle code was already just treating the coordinate\n// system as Cartesian. I then did polyFromCircle to convert it to a polygon that\n// then could be passed to polyArea in order to take into account the projection.\n// If instead, you compute area directly from the circle as PI R squared, then\n// you should have your cartesian circular area.\n\nexport function gfDiameter(poly: any): number {\n let polyOptions = { noLatitudeCorrection: true } // NO-OP\n\n let circle = Poly.polyToCircle(poly, polyOptions) as Poly.Circle;\n // let circleArea: number = Poly.polyArea(Poly.polyFromCircle(circle, undefined, polyOptions), polyOptions);\n // let circleRadius: number = Math.sqrt(circleArea / Math.PI);\n // let diameter: number = circleRadius * 2; DELETE\n let diameter: number = circle.r * 2;\n\n return diameter;\n}\n","//\n// THE DISTRICT-ANALYTICS NODE PACKAGE API\n//\n\nexport * from './_api';\nexport * from './types';\n","//\n// PROTECTS MINORITIES\n//\n\nimport * as T from './types'\nimport * as C from './constants'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport { AnalyticsSession } from './_api';\n\n// TODO - This definition is wrong. Need to fix it.\n//\n// MINORITY-PROTECTION ANALYTICS NEED THE FOLLOWING DATA:\n//\n// The TOTAL, WHITE, BLACK, and HISPANIC counts from the Census, aggregated by\n// district. We *might* also ultimately need TOTAL18, WHITE18, BLACK18, and\n// HISPANIC18 counts by feature for these analytics.\n//\n// The minority population of a feature will probably be calculated as everyone\n// exceot non-Hispanic Whites:\n//\n// MINORITY = TOTAL - (WHITE - HISPANIC)\n//\n// That could be calculated as part of preprocessing the Census data, or it\n// could be computed on the fly. Since it's derived data and the formula might\n// change, it's probably best to compute it on the fly.\n//\n// In addition to the Census extract, these analytics need:\n// - The # of districts in the map, for determining minority proportionality\n// - Minorities as a % of the total population; possibly the voting age share\n//\n// TODO - Is the # of districts passed as a parameter or inferred from the # in\n// the map?\n// TODO - Is minority share preprocessed once and passed as a parameter or\n// computed in a initialization routine?\n\n\nexport function doMajorityMinorityDistricts(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.MajorityMinorityDistricts) as T.TestEntry;\n\n console.log(\"TODO - Calculating # of majority-minority districts ...\");\n\n return test;\n}\n\n// SAVE THESE NOTES, IN CASE WE NEED TO REWORK HOW WE DO PERFORM THESE CALCS.\n// THEY REFLECT HOW I/ALEC DID THESE IN PYTHON.\n//\n// MINORITY-PROTECTION ANALYTICS WILL NEED THE FOLLOWING DATA,\n// IN ADDITION TO THE MAP (IDEALLY, GEO_IDS INDEXED BY DISTRICT_ID)\n//\n// Census data by geo_id - { total population | white | black | hispanic }\n//\n// The minority population of a feature will probably be calculated as the # of\n// non-White Hispanics:\n//\n// MINORITY = TOTAL - (WHITE - HISPANIC)\n//\n// That could be calculated as part of preprocessing the Census data, or it\n// could be computed on the fly.\n//\n// And probably:\n// 'districts' - The # of districts for determining minority proportionality.\n// 'minority_share' - Minorities as a % of the total population\n//\n// TODO - Is the # of districts passed as a parameter or inferred from the # in\n// the map?\n// TODO - Is minority share preprocessed once and passed as a parameter or\n// computed in a initialization routine?\n","//\n// FAIR/PROPORTIONAL\n//\n\nimport { strict as assert } from 'assert';\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport * as D from './_data'\nimport { AnalyticsSession } from './_api';\n\n// Partisan analytics need the following data:\n//\n// An \"election model\" by geo_id, where each item has 4 pieces of data:\n//\n// { geo_id, Democratic votes, Republican votes, Total votes }\n//\n// NOTE: D + R <= Total, because there could be third-party or write-in votes.\n//\n// An election model can simply represent one election, e.g., President 2012,\n// or combine multiple elections in some fashion. An election model is used to\n// computer a single index of the likely partisan weight / lean / preference\n// for the districts in a plan. An election model and the associated index go\n// hand in hand. So much so that the index frequently stands in as the name for\n// both, e.g., Cook's PVI is one example, Nagle's 7s, Hofeller's Formula, NDRC's\n// DPI.\n//\n// I'm labelling this general concept a \"Voter Preference Index (VPI),\" a\n// conscious +1 letter play on Cook's \"PVI\" acronymn.\n\n\n// MEASURING BIAS & RESPONSIVENESS (NAGLE'S METHOD)\n\nexport function doSeatsBias(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.SeatsBias) as T.TestEntry;\n\n console.log(\"TODO - Calculating seats bias ...\");\n\n return test;\n}\n\nexport function doVotesBias(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.VotesBias) as T.TestEntry;\n\n console.log(\"TODO - Calculating votes bias ...\");\n\n return test;\n}\n\nexport function doResponsiveness(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.Responsiveness) as T.TestEntry;\n\n console.log(\"TODO - Calculating responsiveness ...\");\n\n return test;\n}\n\nexport function doResponsiveDistricts(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.ResponsiveDistricts) as T.TestEntry;\n\n console.log(\"TODO - Calculating # of responsive districts ...\");\n\n return test;\n}\n\n\n// OTHER MEASURES OF PARTISAN BIAS\n\n// TODO - This formula might need to be inverted for D vs. R +/-\n// TODO - Normalize the results.\nexport function doEfficiencyGap(s: AnalyticsSession): T.TestEntry {\n console.log(\"TODO - Calculating the efficiency gap ...\");\n let test = s.getTest(T.Test.EfficiencyGap) as T.TestEntry;\n\n // Get partisan statistics by districts.\n // Use Democratic votes, seats, and shares by convention.\n let DVotes = s.districts.statistics[D.DistrictField.DemVotes];\n let DSeats = s.districts.statistics[D.DistrictField.DemSeat];\n let TPVotes = s.districts.statistics[D.DistrictField.TwoPartyVote];\n\n // Exclude the dummy unassigned '0' and N+1 summary \"districts\"\n DVotes = DVotes.slice(1, -1);\n DSeats = DSeats.slice(1, -1);\n TPVotes = TPVotes.slice(1, -1);\n\n // Calculate D vote share & D seat share\n let DVoteShare = U.sumArray(DVotes) / U.sumArray(TPVotes);\n let DSeatShare = U.sumArray(DSeats) / s.state.nDistricts;\n\n // Finally, calculate the Efficiency Gap\n let efficiencyGap = (DSeatShare - 0.5) - (2.0 * (DVoteShare - 0.5));\n\n // Round the raw value to the desired level of precision\n efficiencyGap = U.trim(efficiencyGap);\n\n // Populate the test entry\n test['score'] = efficiencyGap;\n // test['normalizedScore'] = 0; /* TODO - Normalize the raw score */\n test['details'] = {}; /* TODO - Add details, if any */\n\n return test;\n}\n\n\n// HELPERS\n\nexport function fptpWin(demPct: number): number {\n // Vote shares should be fractions in the range [0.0 – 1.0]\n assert((demPct <= 1.0) && (demPct >= 0.));\n\n return ((demPct > 0.5) ? 1 : 0);\n}\n","//\n// PREPROCESS DATA\n//\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport * as D from './_data'\nimport { AnalyticsSession } from './_api';\n\n\n// NOTE - Do preprocessing separately, so the constructor returns quickly.\nexport function doPreprocessData(s: AnalyticsSession): void {\n // If necessary, do one-time preprocessing\n if (!s.bOneTimeProcessingDone) {\n doPreprocessCountyFeatures(s);\n doPreprocessCensus(s);\n doPreprocessElection(s);\n s.bOneTimeProcessingDone = true;\n }\n\n // Invert the plan by district ID\n s.plan.invertPlan();\n\n // Create a map of geoIDs to feature IDs\n s.features.mapGeoIDsToFeatureIDs();\n}\n\n// CREATE A FIPS CODE TO COUNTY NAME LOOKUP\n\nfunction doPreprocessCountyFeatures(s: AnalyticsSession): void {\n for (let i: number = 0; i < s.counties.nCounties; i++) {\n\n let county = s.counties.countyByIndex(i);\n\n let fips = s.counties.propertyForCounty(county, 'COUNTYFP');\n let name = s.counties.propertyForCounty(county, 'NAME');\n\n s.counties.mapFIPSToName(fips, name);\n }\n}\n\n\n// ANALYZE THE CENSUS BY COUNTY\n\nfunction doPreprocessCensus(s: AnalyticsSession): void {\n // The county-splitting analytic needs the following info, using NC as an example:\n // '_stateTotal' = The total state population, e.g., 9,535,483 for NC's 2010 Census\n // 'totalByCounty' = The total population by county FIPS code\n\n let totalByCounty: T.GeoIDTotal = {};\n\n // NOTE - This works w/o GEOIDs, because you're looping over all features.\n for (let i: number = 0; i < s.features.nFeatures(); i++) {\n let f: T.GeoFeature = s.features.featureByIndex(i);\n let geoID: string = s.features.geoIDForFeature(f);\n let value: number = s.features.fieldForFeature(f, D.Dataset.CENSUS, D.FeatureField.TotalPop);\n\n // Sum total population across the state\n s.state.totalPop += value;\n\n // Get the county FIPS code for the feature\n let county = U.parseGeoID(geoID)['county'] as string;\n let countyFIPS = U.getFIPSFromCountyGeoID(county);\n // If a subtotal for the county doesn't exist, initialize one\n if (!(U.keyExists(countyFIPS, totalByCounty))) {\n totalByCounty[countyFIPS] = 0;\n }\n // Sum total population by county\n totalByCounty[countyFIPS] += value;\n }\n // NOTE - The above could be replaced, if I got totals on county.geojson.\n\n // 'target_size': 733499, # calc as total / districts\n let targetSize = Math.round(s.state.totalPop / s.state.nDistricts);\n\n // Find counties that are bigger than the target district size.\n // 'too_big' = The counties that are bigger than a district, e.g., ['Mecklenburg', 'Wake']\n // 'too_big_fips' = Their FIPS codes, e.g., ['119', '183']\n // 'expected_splits' = The # of counties that are bigger than a single district, e.g., 2\n // 'expected_affected' = The # of people whose district must be split, e.g., 353,623\n\n let tooBigFIPS = [];\n let tooBigName = [];\n let expectedSplits = 0;\n let expectedAffected = 0;\n\n // Create a FIPS code-ordinal map\n // Get the county FIPS codes\n let fipsCodes = U.getObjectKeys(totalByCounty);\n // Sort the results\n fipsCodes = fipsCodes.sort();\n // Create the ID-ordinal map\n for (let i in fipsCodes) {\n s.counties.index[fipsCodes[i]] = Number(i);\n }\n\n // Loop over the counties\n for (let county in fipsCodes) {\n let fipsCode = fipsCodes[county];\n let countyAffected = 0;\n\n // Find the number of required splits, assuming target district size.\n let rawQuotient = totalByCounty[fipsCode] / (targetSize + 1);\n let remainder = rawQuotient % 1;\n let quotient = rawQuotient - remainder;\n let countySplits = quotient;\n\n if (countySplits > 0) {\n countyAffected = totalByCounty[fipsCode] % targetSize;\n tooBigFIPS.push(fipsCode);\n tooBigName.push(s.counties.nameFromFIPS(fipsCode));\n }\n\n expectedSplits += countySplits;\n expectedAffected += countyAffected;\n }\n\n s.state.tooBigFIPS = tooBigFIPS;\n s.state.tooBigName = tooBigName;\n s.state.expectedSplits = expectedSplits;\n s.state.expectedAffected = expectedAffected;\n}\n\n\n// PREPROCESS ELECTION RESULTS\n\nfunction doPreprocessElection(s: AnalyticsSession): void {\n console.log(\"TODO - Preprocessing election data ...\");\n}\n\n","//\n// GENERATE REPORTS\n// - A test log: a simple enumeration of all analytics & validations w/ raw results\n// - A scorecard: a structured subset of analytics & validations w/ normalized\n// results, cateories, and an overall score\n// \n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport * as D from './_data'\nimport { AnalyticsSession } from './_api';\nimport { doDeriveSecondaryTests } from './analyze';\n\n\n// TEST META-DATA\n\nenum TestType {\n PassFail,\n Percentage,\n Number\n}\n\nconst completeDefn: T.Dict = {\n ID: T.Test.Complete,\n name: \"Complete\",\n normalize: false,\n externalType: TestType.PassFail,\n detailsFn: doPrepareCompleteDetails,\n suites: [T.Suite.Legal]\n};\n\nconst contiguousDefn: T.Dict = {\n ID: T.Test.Contiguous,\n name: \"Contiguous\",\n normalize: false,\n externalType: TestType.PassFail,\n detailsFn: doPrepareContiguousDetails,\n suites: [T.Suite.Legal]\n};\n\nconst freeOfHolesDefn: T.Dict = {\n ID: T.Test.FreeOfHoles,\n name: \"Free of Holes\",\n normalize: false,\n externalType: TestType.PassFail,\n detailsFn: doPrepareFreeOfHolesDetails,\n suites: [T.Suite.Legal]\n};\n\nconst equalPopulationDefn: T.Dict = {\n ID: T.Test.EqualPopulation,\n name: \"Equal Population\",\n normalize: false,\n externalType: TestType.PassFail,\n detailsFn: doPrepareEqualPopulationDetails,\n suites: [T.Suite.Legal]\n};\n\nconst populationDeviationDefn: T.Dict = {\n ID: T.Test.PopulationDeviation,\n name: \"Population Deviation\",\n normalize: true,\n externalType: TestType.Percentage,\n detailsFn: doPreparePopulationDeviationDetails,\n suites: [T.Suite.Legal, T.Suite.Best] // Both so EqualPopulation can be assessed\n};\n\nconst reockDefn: T.Dict = {\n ID: T.Test.Reock,\n name: \"Reock\",\n normalize: true,\n externalType: TestType.Number,\n detailsFn: doPrepareReockDetails,\n suites: [T.Suite.Best]\n};\n\nconst polsbyPopperDefn: T.Dict = {\n ID: T.Test.PolsbyPopper,\n name: \"Polsby-Popper\",\n normalize: true,\n externalType: TestType.Number,\n detailsFn: doPreparePolsbyPopperDetails,\n suites: [T.Suite.Best]\n};\n\nconst countySplitsDefn: T.Dict = {\n ID: T.Test.CountySplits,\n name: \"County splits\",\n trailer: \"of the population had their county split unexpectedly.\",\n normalize: true, // TODO - Normalize this for real\n externalType: TestType.Percentage,\n detailsFn: doPrepareCountySplitDetails,\n suites: [T.Suite.Best]\n};\n\nconst efficiencyGapDefn: T.Dict = {\n ID: T.Test.EfficiencyGap,\n name: \"Efficiency Gap\",\n normalize: false, // TODO - Normalize this!\n externalType: TestType.Percentage,\n detailsFn: doPrepareEfficiencyGapDetails,\n suites: [T.Suite.Fair]\n};\n\n// A structure to hold test definitions\ntype TestDefns = {\n [category: number]: any;\n}\n\n// All the tests that have been defined (can be reported on)\nconst testDefns = {\n [T.Test.Complete]: completeDefn,\n [T.Test.Contiguous]: contiguousDefn,\n [T.Test.FreeOfHoles]: freeOfHolesDefn,\n [T.Test.EqualPopulation]: equalPopulationDefn,\n [T.Test.PopulationDeviation]: populationDeviationDefn,\n [T.Test.Reock]: reockDefn,\n [T.Test.PolsbyPopper]: polsbyPopperDefn,\n [T.Test.CountySplits]: countySplitsDefn,\n [T.Test.EfficiencyGap]: efficiencyGapDefn\n\n /* TODO - More tests ... */\n} as TestDefns;\n\n\n// SCORECARD\n\n// The notion of a scorecard is:\n// - A subset of analytics & validations\n// - Normalized, if numeric\n// - Organized into several dimensions/categories\n// - With combined category scores, and\n// - Those combined into an overall score\n\n// A scorecard\nexport type Scorecard = {\n [category: number]: ScorecardCategoryEntry;\n}\n\ntype ScorecardCategoryEntry = {\n catName: string;\n catScore?: number | boolean;\n catTests: T.TestEntries;\n}\n\n// A scorecard definition\ntype ScorecardDefn = {\n [category: number]: any;\n}\n\n// Scorecard category definitions\n\nconst validCategory = {\n catName: \"Valid\",\n catTests: [\n { testID: T.Test.Complete },\n { testID: T.Test.Contiguous },\n { testID: T.Test.FreeOfHoles },\n { testID: T.Test.EqualPopulation }\n ],\n catNumeric: false,\n catWeight: undefined,\n catPrepareFn: doPrepareValidSection\n};\n\nconst fairCategory = {\n catName: \"Fair\",\n catTests: [\n {\n testID: T.Test.EfficiencyGap,\n testWeight: 100\n }\n ],\n catNumeric: true,\n catWeight: undefined,\n catPrepareFn: doPrepareFairSection\n};\n\n// TODO - Decide on the relative weights of these tests!\n// NOTE: 'testWeights' are simply relative, i.e., each normalized score is\n// multiplied by the associated 'testWeight', and the sum of those is divided\n// by the total weight. Weights don't have to add to 100.\nconst bestCategory = {\n catName: \"Best\",\n catTests: [\n {\n testID: T.Test.PopulationDeviation,\n testWeight: 10\n },\n {\n testID: T.Test.Reock,\n testWeight: 25\n },\n {\n testID: T.Test.PolsbyPopper,\n testWeight: 25\n },\n {\n testID: T.Test.CountySplits,\n testWeight: 50\n }\n ],\n catNumeric: true,\n catWeight: undefined,\n catPrepareFn: doPrepareBestSection\n};\n\n\n// The overall scorecard definition\n\nconst scorecardDefn = {\n [T.Suite.Legal]: validCategory,\n // TODO - NIY\n // [T.Suite.Fair]: fairCategory,\n [T.Suite.Best]: bestCategory\n} as ScorecardDefn;\n\n\n// NORMALIZE RAW ANALYTICS\n// Raw numeric analytics, such as population deviation, compactness, etc. are\n// normalized as part of creating a scorecard, so the code to normalize results\n// is encapsulated here.\n\n// Configure scale parameters for normalizing each raw test result\n// This needs to be separate from the scorecard configuration info above,\n// because some scales need access to the analytics session object.\nexport function doConfigureScales(s: AnalyticsSession): void {\n // Scale defn for PopulationDeviation\n const CDLimit = 0.75 / 100; // Deviation threshold for CD's\n const LDLimit = 10.00 / 100; // Deviation threshold for LD's\n\n const CDGoodEnough = 0.20 / 100;\n const LDGoodEnough = (CDGoodEnough / CDLimit) * LDLimit;\n const scale = (s.legislativeDistricts) ? [1.0 - LDLimit, 1.0 - LDGoodEnough] : [1.0 - CDLimit, 1.0 - CDGoodEnough];\n // const scale = [1.0 - CDLimit, 1.0 - CDGoodEnough];\n\n s.testScales[T.Test.PopulationDeviation] = { testScale: scale, testInvertp: true };\n\n s.testScales[T.Test.Reock] = { testScale: [0.25, 0.50], testInvertp: false };\n s.testScales[T.Test.PolsbyPopper] = { testScale: [0.10, 0.50], testInvertp: false };\n\n const SPLITLimit = 0.1; // TODO - Just a placeholder default maximum (10%)\n s.testScales[T.Test.CountySplits] = { testScale: [1.0 - SPLITLimit, 1.0], testInvertp: true };\n\n // TODO - More analytics ...\n}\n\n// Postprocess analytics - Normalize numeric results and derive secondary tests.\n// Do this after analytics have been run and before preparing a test log or scorecard. \nexport function doAnalyzePostProcessing(s: AnalyticsSession): void {\n // Normalize the raw scores for all the numerics tests\n let testResults = U.getNumericObjectKeys(testDefns);\n\n for (let testID of testResults) {\n if (testDefns[testID]['normalize']) {\n let testResult = s.getTest(testID) as T.TestEntry;\n\n let rawScore = testResult['score'] as number;\n let normalizedScore: number;\n let { testScale, testInvertp } = s.testScales[testID];\n\n normalizedScore = U.normalize(rawScore, testScale, testInvertp);\n testResult['normalizedScore'] = normalizedScore;\n\n // Add the scale used to normalize the raw score to the details\n testResult['details']['scale'] = testScale;\n }\n }\n\n // Derive secondary tests\n doDeriveSecondaryTests(s);\n\n // Toggle the semaphore, so postprocessing isn't for both the testlog & scorecard\n s.bPostProcessingDone = true;\n}\n\n// Prepare a structured but unformatted scorecard, from the test results\nfunction doGenerateScorecard(s: AnalyticsSession): Scorecard {\n if (!(s.bPostProcessingDone)) {\n doAnalyzePostProcessing(s);\n }\n\n // Create a new scorecard\n let scorecard = {} as Scorecard;\n\n // Filter the defined scorecard categories by the requested test suites\n let categories = U.getNumericObjectKeys(scorecardDefn);\n let suitesRequested = s.config['suites'];\n categories = categories.filter(x => suitesRequested.includes(x));\n\n // ... and initialize each one in the new scorecard\n for (let c of categories) {\n scorecard[c] = {} as ScorecardCategoryEntry;\n scorecard[c]['catName'] = scorecardDefn[c]['catName'];\n scorecard[c]['catTests'] = {} as T.TestEntries;\n // scorecard[c]['catScore'] = undefined;\n }\n\n // For each scorecard category\n for (let c of categories) {\n // Grab the scorecard category definition\n let { catName, catTests, catNumeric } = scorecardDefn[c];\n\n let numericCategoryScore = 0;\n let totalWeight = 0;\n let booleanCategoryScore = true;\n\n // Process the results for each test result in the category\n for (let testDefn of catTests) {\n // Get the config info for the test\n let testID = testDefn['testID'];\n // ... and the actual test result\n let testResult = s.getTest(testID) as T.TestEntry;\n\n // Create a new test entry for the scorecard\n let testReport = U.deepCopy(testResult);\n // Add the name\n testReport['name'] = testDefns[testID]['name'];\n\n if (catNumeric) {\n // Normalize raw numeric scores ... moved to FIRST PASS above\n\n // Accumulate a category score\n let normalizedScore = testReport['normalizedScore'];\n numericCategoryScore += normalizedScore * testDefn['testWeight'];\n totalWeight += testDefn['testWeight'];\n }\n else {\n // AND together pass/fail tests into a category score\n if (!testReport['score']) {\n booleanCategoryScore = false;\n }\n }\n scorecard[c]['catTests'][testID] = testReport;\n }\n\n // Set the category score\n if (catNumeric) {\n scorecard[c]['catScore'] = Math.round(numericCategoryScore / totalWeight);\n }\n else {\n scorecard[c]['catScore'] = booleanCategoryScore;\n }\n }\n // TODO - Compute an overall score from the category weights\n\n return scorecard;\n}\n\n// Prepare a formatted scorecard suitable for rendering\nexport function doPrepareScorecard(s: AnalyticsSession): any {\n // Initialize the output format\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n // If the plan as already been analyzed, prepare a scorecard\n if (s.bPlanAnalyzed) {\n // Create and cache a new, unformatted scorecard\n s.scorecard = doGenerateScorecard(s);\n\n // Create a scorecard header\n blocks.push({ variant: 'h4', text: `Analysis` });\n\n // Report district statistics\n blocks.push({ variant: 'h5', text: `Individual Districts` });\n let districtStatisticsText = doPrepareDistrictStatistics(s);\n blocks.push(...districtStatisticsText);\n\n // Prepare each scorecard category\n blocks.push({ variant: 'h5', text: `Overall Plan` });\n let categories = U.getNumericObjectKeys(s.scorecard);\n for (let c of categories) {\n let sectionPrepareFn = scorecardDefn[c]['catPrepareFn'];\n let sectionText = sectionPrepareFn(s, c);\n blocks.push(...sectionText);\n }\n\n // Report what datasets were used\n let c = s.config['datasets'][D.Dataset.CENSUS];\n let v = s.config['datasets'][D.Dataset.VAP];\n let e = s.config['datasets'][D.Dataset.ELECTION];\n\n blocks.push({ variant: 'body1', text: `Using datasets:` });\n blocks.push({ variant: 'body1', text: `* ${c}: ${D.DatasetDescriptions[c]}` });\n blocks.push({ variant: 'body1', text: `* ${v}: ${D.DatasetDescriptions[v]}` });\n blocks.push({ variant: 'body1', text: `* ${e}: ${D.DatasetDescriptions[e]}` });\n }\n // Otherwise, return a blank scorecard\n\n // TODO - What dra-client returns from renderAnalyzeCore()\n // return <STV.StaticTextView text={ text } />;\n return text;\n}\n\nfunction doPrepareDistrictStatistics(s: AnalyticsSession): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n blocks.push({ variant: 'beginTable' });\n blocks.push({ variant: 'row', cells: ['ID', 'Total', 'Δ%', 'OK?', '*', 'Dem', 'Rep', 'White', 'Minority', 'Black', 'Hispanic', 'Pacific', 'Asian', 'Native'] });\n\n for (let d = 0; d < s.districts.numberOfRows(); d++) {\n let tot = s.districts.statistics[D.DistrictField.TotalPop][d];\n if (tot == 0)\n blocks.push({ variant: 'row', cells: [String(d), '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-'] });\n else {\n tot = Math.round(tot);\n let dev = fractionToPercentage(s.districts.statistics[D.DistrictField.PopDevPct][d]);\n let bEq = true; // TODO - Set based on population threshold\n let bC = s.districts.statistics[D.DistrictField.bContiguous][d]\n && s.districts.statistics[D.DistrictField.bNotEmbedded][d];\n let dPct = fractionToPercentage(s.districts.statistics[D.DistrictField.DemPct][d]);\n let rPct = fractionToPercentage(s.districts.statistics[D.DistrictField.RepPct][d]);\n let wPct = fractionToPercentage(s.districts.statistics[D.DistrictField.WhitePct][d]);\n let mPct = fractionToPercentage(s.districts.statistics[D.DistrictField.MinorityPct][d]);\n let bPct = fractionToPercentage(s.districts.statistics[D.DistrictField.BlackPct][d]);\n let hPct = fractionToPercentage(s.districts.statistics[D.DistrictField.HispanicPct][d]);\n let pPct = fractionToPercentage(s.districts.statistics[D.DistrictField.PacificPct][d]);\n let aPct = fractionToPercentage(s.districts.statistics[D.DistrictField.AsianPct][d]);\n let nPct = fractionToPercentage(s.districts.statistics[D.DistrictField.NativePct][d]);\n\n let id: string;\n if (d == 0) id = \"??\";\n else if (d == (s.districts.numberOfRows() - 1)) id = \" \";\n else id = String(d);\n\n blocks.push({\n variant: 'row',\n cells: [\n `${id}`,\n `${formatInteger(tot)}`,\n `${formatPercentage(dev)}%`,\n `${pfBoolToString(bEq)}`,\n `${pfBoolToString(bC)}`,\n `${formatPercentage(dPct)}%`,\n `${formatPercentage(rPct)}%`,\n `${formatPercentage(wPct)}%`,\n `${formatPercentage(mPct)}%`,\n `${formatPercentage(bPct)}%`,\n `${formatPercentage(hPct)}%`,\n `${formatPercentage(pPct)}%`,\n `${formatPercentage(aPct)}%`,\n `${formatPercentage(nPct)}%`]\n });\n }\n }\n blocks.push({ variant: 'endTable' });\n\n return blocks;\n}\n\n// TEST LOG\n\n// Prepare formatted test results for rendering\nexport function doPrepareTestLog(s: AnalyticsSession): any {\n // Initialize the output format\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n // If the plan as already been analyzed, prepare a test log\n if (s.bPlanAnalyzed) {\n if (!(s.bPostProcessingDone)) {\n doAnalyzePostProcessing(s);\n }\n\n // Create a test log header\n blocks.push({ variant: 'h4', text: `Test Log` });\n\n let testResults = U.getNumericObjectKeys(testDefns);\n let suitesRequested = new Set(s.config['suites']);\n\n for (let testID of testResults) {\n // Filter the defined tests by the requested test suites\n let inSuites: number[] = testDefns[testID]['suites'];\n if (!(U.isArrayEmpty(inSuites.filter(x => suitesRequested.has(x))))) {\n // Get the test result\n let testResult = s.getTest(testID) as T.TestEntry;\n // Prepare the text for it, and append it to the output\n let testText = prepareTestEntry(testID, testResult);\n blocks.push(...testText);\n }\n }\n }\n // Otherwise, return a blank test log\n\n // TODO - What dra-client returns from renderAnalyzeCore()\n // return <STV.StaticTextView text={ text } />;\n return text;\n}\n\nfunction prepareTestEntry(testID: number, testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n let testName = testDefns[testID]['name'];\n let testNameTrailer: string = \"\";\n if (U.keyExists('trailer', testDefns[testID])) {\n testNameTrailer = testDefns[testID]['trailer'];\n }\n let testType = testDefns[testID]['externalType'];\n let bNormalize = testDefns[testID]['normalize'];\n let detailsFn = testDefns[testID]['detailsFn'];\n let detailsText = detailsFn(testResult);\n let score: number | boolean | undefined; // NOTE - Won't be undefined here\n let normalizedScore: number;\n let scoreText: string;\n\n // Get the score ...\n score = testResult['score'];\n\n // ... and format it for rendering\n switch (testType) {\n case TestType.PassFail: {\n scoreText = pfBoolToString(score as boolean);\n blocks.push({ variant: 'body1', text: `${testName}: ${scoreText} ${testNameTrailer}` });\n break;\n }\n case TestType.Percentage: {\n score = fractionToPercentage(score as number);\n if (bNormalize) {\n normalizedScore = testResult['normalizedScore'] as number;\n blocks.push({ variant: 'body1', text: `${testName}: ${normalizedScore} / 100 : ${formatPercentage(score)}% ${testNameTrailer}` });\n }\n else {\n blocks.push({ variant: 'body1', text: `${testName}: ${formatPercentage(score)}% ${testNameTrailer}` });\n }\n break;\n }\n case TestType.Number: {\n if (bNormalize) {\n normalizedScore = testResult['normalizedScore'] as number;\n blocks.push({ variant: 'body1', text: `${testName}: ${normalizedScore} / 100 : ${formatNumber(score as number)} ${testNameTrailer}` });\n }\n else {\n blocks.push({ variant: 'body1', text: `${testName}: ${formatNumber(score as number)} ${testNameTrailer}` });\n }\n break;\n }\n default: {\n // Unknown test type\n throw new RangeError();\n }\n }\n\n // Add the details text\n blocks.push(...detailsText);\n\n return blocks;\n}\n\n\n// FORMATTERS FOR TEST DETAILS\n\nfunction doPrepareCompleteDetails(testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n if (!U.isObjectEmpty(testResult['details'])) {\n let unassignedText = \"\";\n let emptyText = \"\";\n let missingText = \"\";\n\n if (U.keyExists('unassignedFeatures', testResult['details'])) {\n let unassignedFeatures = testResult['details']['unassignedFeatures'];\n\n let unassignedList = prepareListItems(unassignedFeatures);\n let unassignedTextTemplates: string[] = [\n `GEOID ${unassignedList} is not assigned to a district.`,\n `GEOIDs ${unassignedList} are not assigned to districts.`,\n `Several GEOIDs are not assigned to districts, including ${unassignedList}.`\n ];\n unassignedText = prepareListText(unassignedFeatures, unassignedTextTemplates);\n }\n\n if (U.keyExists('emptyDistricts', testResult['details'])) {\n let emptyDistricts = testResult['details']['emptyDistricts'];\n\n let emptyList = prepareListItems(emptyDistricts);\n let emptyTextTemplates: string[] = [\n `District ${emptyList} is empty.`,\n `Districts ${emptyList} are empty.`,\n `Several districts are empty, including ${emptyList}.`\n ];\n emptyText = prepareListText(emptyDistricts, emptyTextTemplates);\n }\n\n if (U.keyExists('missingDistricts', testResult['details'])) {\n missingText = `Not enough districts have been defined. `;\n }\n\n let detailsText = \" \" + unassignedText + emptyText + missingText;\n blocks.push({ variant: 'body1', text: detailsText });\n }\n\n return blocks;\n}\n\nfunction doPrepareContiguousDetails(testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n if (!U.isObjectEmpty(testResult['details'])) {\n let discontiguousDistricts = testResult['details']['discontiguousDistricts'];\n\n let discontiguousList = prepareListItems(discontiguousDistricts);\n let discontiguousTextTemplates: string[] = [\n `District ${discontiguousList} is not contiguous.`,\n `Districts ${discontiguousList} are not contiguous.`,\n `Several districts are not contiguous, including ${discontiguousList}.`\n ];\n let detailsText = prepareListText(discontiguousDistricts, discontiguousTextTemplates);\n\n blocks.push({ variant: 'body1', text: detailsText });\n }\n\n return blocks;\n}\n\nfunction doPrepareFreeOfHolesDetails(testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n if (!U.isObjectEmpty(testResult['details'])) {\n let embeddedDistricts = testResult['details']['embeddedDistricts'];\n\n let embeddedList = prepareListItems(embeddedDistricts);\n let embeddedTextTemplates: string[] = [\n `District ${embeddedList} is fully embedded within another district.`,\n `Both districts ${embeddedList} are fully embedded within other districts.`,\n `Several districts are fully embedded within other districts, including ${embeddedList}.`\n ];\n let detailsText = prepareListText(embeddedDistricts, embeddedTextTemplates);\n\n blocks.push({ variant: 'body1', text: detailsText });\n }\n\n return blocks;\n}\n\nfunction doPrepareEqualPopulationDetails(testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n if (!U.isObjectEmpty(testResult['details'])) {\n let popDevPct = fractionToPercentage(testResult['details']['deviation']);\n let thresholdPct = fractionToPercentage(1.0 - testResult['details']['thresholds'][0]);\n\n let detailsText = '';\n if (!(testResult['score'])) {\n detailsText = `The ${formatPercentage(popDevPct)}% population deviation is greater than the ${formatPercentage(thresholdPct)}% threshold tolerated by courts.`;\n }\n blocks.push({ variant: 'body1', text: detailsText });\n }\n\n return blocks;\n}\n\nfunction doPreparePopulationDeviationDetails(testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n let n = Math.round(testResult['details']['maxDeviation']);\n let term: string = \"people\";\n if (n == 1) {\n term = \"person\";\n }\n blocks.push({ variant: 'body1', text: `The maximum population deviation between districts is ${formatInteger(n)} ${term}.` });\n\n return blocks;\n}\n\nfunction doPrepareReockDetails(testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n // TODO - No details implemented yet\n\n return blocks;\n}\n\nfunction doPreparePolsbyPopperDetails(testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n // TODO - No details implemented yet\n\n return blocks;\n}\n\nfunction doPrepareEfficiencyGapDetails(testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n // TODO - Not yet implemented\n\n return blocks;\n}\n\nfunction doPrepareCountySplitDetails(testResult: T.TestEntry): any {\n let text: any = { data: [] };\n let blocks: any = text.data;\n\n let unexpectedAffected = fractionToPercentage(testResult['details']['unexpectedAffected']);\n let affectedText = `affecting ${formatPercentage(unexpectedAffected)}% of the total population.`;\n\n let countiesSplitUnexpectedly = testResult['details']['countiesSplitUnexpectedly'];\n let nCountiesSplitUnexpectedly = countiesSplitUnexpectedly.length;\n let nUnexpectedSplits = testResult['details']['unexpectedSplits'];\n let splitList = prepareListItems(countiesSplitUnexpectedly);\n let splitTextTemplates: string[] = [\n `${splitList} county is split unexpectedly, `,\n `${splitList} counties are split unexpectedly, `,\n // `These ${formatInteger(nCountiesSplitUnexpectedly)} counties are split unexpectedly--${splitList}--`\n `${splitList} counties are split unexpectedly ${formatInteger(nUnexpectedSplits)} times, `\n\n ];\n let detailsText = prepareListText(countiesSplitUnexpectedly, splitTextTemplates) + affectedText;\n\n blocks.push({ variant: 'body1', text: detailsText });\n\n return blocks;\n}\n\n\n// FORMATTERS FOR CATEGORIES\n\n// This function parses & formats the 'Valid' section of a scorecard.\nfunction doPrepareValidSection(s: AnalyticsSession, c: number): any {\n // Get the category meta data\n let { catName, catScore, catTests } = s.scorecard[c];\n let testReport: T.TestEntry;\n\n // Initialize the section text\n let text: any = { data: [] };\n let blocks: any = text.data;\n let testText: any;\n\n // Section header\n let stringScore = pfBoolToString(catScore as boolean);\n blocks.push({ variant: 'h6', text: `${catName}: ${stringScore}` });\n\n // Complete\n testReport = catTests[T.Test.Complete];\n testText = prepareTestEntry(T.Test.Complete, testReport);\n blocks.push(...testText);\n\n // Contiguous\n testReport = catTests[T.Test.Contiguous];\n testText = prepareTestEntry(T.Test.Contiguous, testReport);\n blocks.push(...testText);\n\n // Free of holes (no embedded districts)\n testReport = catTests[T.Test.FreeOfHoles];\n testText = prepareTestEntry(T.Test.FreeOfHoles, testReport);\n blocks.push(...testText);\n\n // Equal population (w/in the appropriate legal threshold)\n testReport = catTests[T.Test.EqualPopulation];\n testText = prepareTestEntry(T.Test.EqualPopulation, testReport);\n blocks.push(...testText);\n\n return blocks;\n}\n\n// TODO - NIY\n// This function parses & formats the 'Fair' section of a scorecard.\nfunction doPrepareFairSection(s: AnalyticsSession, c: number): any {\n // Get the category meta data\n let { catName, catScore, catTests } = s.scorecard[c];\n let testReport: T.TestEntry;\n\n // Initialize the section text\n let text: any = { data: [] };\n let blocks: any = text.data;\n let testText: any;\n\n // Section header\n blocks.push({ variant: 'h6', text: `${catName}: ${catScore}` });\n\n // TODO - Flesh this out\n // There's only one test: Population Deviation.\n // testReport = catTests[T.Test.PopulationDeviation];\n // testText = prepareTestEntry(T.Test.PopulationDeviation, testReport);\n // blocks.push(...testText);\n\n return blocks;\n}\n\n// This function parses & formats the 'Best' section of a scorecard.\nfunction doPrepareBestSection(s: AnalyticsSession, c: number): any {\n // Get the category meta data\n let { catName, catScore, catTests } = s.scorecard[c];\n let testReport: T.TestEntry;\n\n // Initialize the section text\n let text: any = { data: [] };\n let blocks: any = text.data;\n let testText: any;\n\n // Section header\n blocks.push({ variant: 'h6', text: `${catName}: ${catScore}` });\n\n // Population deviation\n testReport = catTests[T.Test.PopulationDeviation];\n testText = prepareTestEntry(T.Test.PopulationDeviation, testReport);\n blocks.push(...testText);\n\n // Compactness\n testReport = catTests[T.Test.Reock];\n let normalizedReock = testReport['normalizedScore'] as number;\n let reockTestText = prepareTestEntry(T.Test.Reock, testReport);\n\n testReport = catTests[T.Test.PolsbyPopper];\n let normalizedPolsbyPopper = testReport['normalizedScore'] as number;\n let polsbyPopperTestText = prepareTestEntry(T.Test.PolsbyPopper, testReport);\n\n let compactnessScore = (normalizedReock + normalizedPolsbyPopper) / 2;\n blocks.push({ variant: 'body1', text: `Compactness: ${compactnessScore} / 100` });\n\n blocks.push(...reockTestText);\n blocks.push(...polsbyPopperTestText);\n\n // County splits\n testReport = catTests[T.Test.CountySplits];\n testText = prepareTestEntry(T.Test.CountySplits, testReport);\n blocks.push(...testText);\n\n return blocks;\n}\n\n// FORMATTING HELPERS\n\n// Convert a boolean representing Pass/Fail to a string\nfunction pfBoolToString(score: boolean): string {\n if (score) {\n return \"Yes\";\n }\n else {\n return \"No\";\n }\n}\n\nfunction fractionToPercentage(f: number): number {\n return f * 100;\n}\n\nfunction formatNumber(n: number): string {\n let p = S.PRECISION;\n\n return n.toLocaleString('en-US', { minimumFractionDigits: p, maximumFractionDigits: p });\n}\n\nfunction formatPercentage(n: number): string {\n let p = (S.PRECISION / 2);\n\n return n.toLocaleString('en-US', { minimumFractionDigits: p, maximumFractionDigits: p });\n}\n\nfunction formatInteger(i: number): string {\n return new Intl.NumberFormat().format(i);\n}\n\n// Prepare the items in a list for rendering\nfunction prepareListItems(list: any[]): string {\n let nItems = list.length;\n let listStr: string;\n\n switch (nItems) {\n case 1: {\n listStr = list[0];\n break;\n }\n case 2: {\n listStr = list[0] + \" and \" + list[1];\n break;\n }\n default: {\n let listWithCommas = list.join(', ');\n let lastCommaIndex = listWithCommas.length - ((list[list.length - 1].length) + 1);\n let beforeAnd = listWithCommas.substr(0, lastCommaIndex);\n let afterAnd = listWithCommas.substr(lastCommaIndex + 1);\n listStr = beforeAnd + \" and \" + afterAnd;\n break;\n }\n }\n return listStr;\n}\n\n// Pick the rendering text for the appropriate list length\nfunction prepareListText(list: any[], listTemplates: string[]): string {\n let nItems = list.length;\n switch (nItems) {\n case 1: {\n return listTemplates[0];\n break;\n }\n case 2: {\n return listTemplates[1];\n break;\n }\n default: {\n return listTemplates[2];\n break;\n }\n }\n}\n\n\n/* COMMAND-LINE TESTS\n\nnode main.js scorecard -v -x NC -n 13 -p ~/src/district-analytics/data/SAMPLE-BG-map.csv -d ~/src/district-analytics/data/SAMPLE-BG-data2.json -s ~/src/district-analytics/data/SAMPLE-BG-shapes.geojson -g ~/src/district-analytics/data/SAMPLE-BG-graph.json -c ~/src/district-analytics/data/SAMPLE-COUNTY.geojson\nnode --inspect --inspect-brk main.js scorecard -v -x NC -n 13 -p ~/src/district-analytics/data/SAMPLE-BG-map.csv -d ~/src/district-analytics/data/SAMPLE-BG-data2.json -s ~/src/district-analytics/data/SAMPLE-BG-shapes.geojson -g ~/src/district-analytics/data/SAMPLE-BG-graph.json -c ~/src/district-analytics/data/SAMPLE-COUNTY.geojson\n\n-or-\n\n./main.js scorecard -v -x NC -n 13 -p ../data/SAMPLE-BG-map.csv -d ../data/SAMPLE-BG-data2.json -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -c ../data/SAMPLE-COUNTY.geojson\n./main.js --inspect --inspect-brk scorecard -v -x NC -n 13 -p ../data/SAMPLE-BG-map.csv -d ../data/SAMPLE-BG-data2.json -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -c ../data/SAMPLE-COUNTY.geojson\n\nThese calls work at the project directory, using samples in the data/ directory:\n\n./main.js testlog -v -x NC -n 13 -p ../data/SAMPLE-BG-map.csv -d ../data/SAMPLE-BG-data2.json -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -c ../data/SAMPLE-COUNTY.geojson\n\nTODO - Fix this\n./main.js testlog -v -x NC -n 13 -p ../data/SAMPLE-BG-map-missing.csv -d ../data/SAMPLE-BG-data2.json -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -c ../data/SAMPLE-COUNTY.geojson\n./main.js scorecard -v -x NC-n 13 -p ../data/SAMPLE-BG-map-missing.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n./main.js testlog -v -x NC -n 13 -p ../data/SAMPLE-BG-map-unassigned.csv -d ../data/SAMPLE-BG-data2.json -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -c ../data/SAMPLE-COUNTY.geojson\n./main.js scorecard -v -x NC -n 13 -p ../data/SAMPLE-BG-map-unassigned.csv -d ../data/SAMPLE-BG-data2.json -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -c ../data/SAMPLE-COUNTY.geojson\n\nTODO - HERE\n\n./main.js -v -x NC testlog -p ../data/SAMPLE-BG-map.csv -d ../data/SAMPLE-BG-data2.json -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -c ../data/SAMPLE-COUNTY.geojson --empty\n./main.js -v -x NC scorecard -p ../data/SAMPLE-BG-map.csv -d ../data/SAMPLE-BG-data2.json -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -c ../data/SAMPLE-COUNTY.geojson --empty\n\nTODO\n\n./main.js testlog -n 13 -p ../data/SAMPLE-BG-map-discontiguous.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n./main.js scorecard -n 13 -p ../data/SAMPLE-BG-map-discontiguous.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n./main.js testlog -n 13 -p ../data/SAMPLE-BG-map-hole.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n./main.js scorecard -n 13 -p ../data/SAMPLE-BG-map-hole.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n\nnode --inspect --inspect-brk main.js scorecard -v -n 13 -p ../data/SAMPLE-BG-map.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\nnode main.js scorecard -v -n 13 -p ../data/SAMPLE-BG-map.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n\nThese calls test NC block-level data stored in my ~/data/redistricting-data/2010/compact/sample directory:\n\nnode --inspect --inspect-brk main.js scorecard -v -n 13 -p ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-map.csv -c ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-census.csv -s ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-shapes.geojson -g ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-graph.json -e ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-election.csv -f ~/data/redistricting-data/2010/compact/sample/SAMPLE-FIPS-county-name-map.csv\nnode --inspect --inspect-brk main.js scorecard -v -n 13 -p ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-map.csv -c ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-census.csv -s ~/data/redistricting-data/2010/compact/sample/tl_2018_37_tabblock10.json -g ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-graph.json -e ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-election.csv -f ~/data/redistricting-data/2010/compact/sample/SAMPLE-FIPS-county-name-map.csv\n\nnode main.js scorecard -v -n 13 -p ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-map.csv -c ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-census.csv -s ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-shapes.geojson -g ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-graph.json -e ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-election.csv -f ~/data/redistricting-data/2010/compact/sample/SAMPLE-FIPS-county-name-map.csv\nnode main.js scorecard -v -n 13 -p ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-map.csv -c ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-census.csv -s ~/data/redistricting-data/2010/compact/sample/tl_2018_37_tabblock10.json -g ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-graph.json -e ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-election.csv -f ~/data/redistricting-data/2010/compact/sample/SAMPLE-FIPS-county-name-map.csv\n\n\n\n*/\n\n/* TODO - DELETE\n\nThese calls work at the project directory, using samples in the data/ directory:\n\n./main.js testlog -n 13 -p ../data/SAMPLE-BG-map.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n./main.js scorecard -n 13 -p ../data/SAMPLE-BG-map.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n./main.js testlog -n 13 -p ../data/SAMPLE-BG-map-missing.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n./main.js scorecard -n 13 -p ../data/SAMPLE-BG-map-missing.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n./main.js testlog -n 13 -p ../data/SAMPLE-BG-map-unassigned.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n./main.js scorecard -n 13 -p ../data/SAMPLE-BG-map-unassigned.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n./main.js testlog -n 13 -p ../data/SAMPLE-BG-map.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv --empty\n./main.js scorecard -n 13 -p ../data/SAMPLE-BG-map.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv --empty\n\n./main.js testlog -n 13 -p ../data/SAMPLE-BG-map-discontiguous.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n./main.js scorecard -n 13 -p ../data/SAMPLE-BG-map-discontiguous.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n./main.js testlog -n 13 -p ../data/SAMPLE-BG-map-hole.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n./main.js scorecard -n 13 -p ../data/SAMPLE-BG-map-hole.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n\nnode --inspect --inspect-brk main.js scorecard -v -n 13 -p ../data/SAMPLE-BG-map.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\nnode main.js scorecard -v -n 13 -p ../data/SAMPLE-BG-map.csv -c ../data/SAMPLE-BG-census.csv -s ../data/SAMPLE-BG-shapes.geojson -g ../data/SAMPLE-BG-graph.json -e ../data/SAMPLE-BG-election.csv -f ../data/SAMPLE-FIPS-county-name-map.csv\n\n\nThese calls test NC block-level data stored in my ~/data/redistricting-data/2010/compact/sample directory:\n\nnode --inspect --inspect-brk main.js scorecard -v -n 13 -p ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-map.csv -c ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-census.csv -s ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-shapes.geojson -g ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-graph.json -e ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-election.csv -f ~/data/redistricting-data/2010/compact/sample/SAMPLE-FIPS-county-name-map.csv\nnode --inspect --inspect-brk main.js scorecard -v -n 13 -p ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-map.csv -c ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-census.csv -s ~/data/redistricting-data/2010/compact/sample/tl_2018_37_tabblock10.json -g ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-graph.json -e ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-election.csv -f ~/data/redistricting-data/2010/compact/sample/SAMPLE-FIPS-county-name-map.csv\n\nnode main.js scorecard -v -n 13 -p ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-map.csv -c ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-census.csv -s ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-shapes.geojson -g ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-graph.json -e ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-election.csv -f ~/data/redistricting-data/2010/compact/sample/SAMPLE-FIPS-county-name-map.csv\nnode main.js scorecard -v -n 13 -p ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-map.csv -c ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-census.csv -s ~/data/redistricting-data/2010/compact/sample/tl_2018_37_tabblock10.json -g ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-graph.json -e ~/data/redistricting-data/2010/compact/sample/SAMPLE-BLOCK-election.csv -f ~/data/redistricting-data/2010/compact/sample/SAMPLE-FIPS-county-name-map.csv\n\n*/\n","//\n// GLOBAL CONSTANTS\n//\n\n// Keep four decimal places for fractions [0–1], i.e.,\n// keep two decimal places for %'s [0–100].\nexport const PRECISION: number = 4;\n\n// Normalized scores [0-100]\nexport const NORMALIZED_RANGE: number = 100;\n\n// The dummy district ID for features not assigned districts yet\nexport const NOT_ASSIGNED: number = 0;\n\n// TODO - Discuss w/ Dave & Terry\n// # of items to report as problematic (e.g., features, districts, etc.)\nexport const NUMBER_OF_ITEMS_TO_REPORT: number = 10;\n\n// The virtual geoID for \"neighbors\" in other states\nexport const OUT_OF_STATE: string = \"OUT_OF_STATE\";\n","//\n// TYPE DEFINITIONS\n//\n\nimport * as geojson from 'geojson';\n\n// CONFIGURATION TYPES\n\n// Sets of analytics, to enable them to be turned on/off by the host.\nexport const enum Suite {\n Legal,\n Fair,\n Best\n} // as in \"best fair map\"\n\n// INPUT DATA TYPES\n\n// The SessionRequest specifies an analytics session\nexport type SessionRequest = {\n title: string;\n stateXX: string;\n nDistricts: number;\n legislativeDistricts: boolean;\n plan: PlanByGeoID;\n data: GeoFeatureCollection;\n districtShapes: GeoFeatureCollection;\n districtProperties: DistrictProperties;\n graph: ContiguityGraph;\n countyNameLookup: FIPSCodeToCountyNameMap;\n counties: GeoFeatureCollection;\n config: {}\n}\n\n// A Plan is a dict of geoID-districtID pairs indexed by geoID\nexport type PlanByGeoID = {\n [geoID: string]: number;\n}\n\n// A inverted Plan is a dict of districtID's with associated sets of geoID's\nexport type PlanByDistrictID = {\n // TODO - Terry, why does this constructor need a <T> type specification?\n [districtID: number]: Set<string>;\n}\n\n// A map of geoIDs to feature IDs\nexport type FeaturesByGeoID = {\n [geoID: string]: number;\n}\n\n// The FIPS-codes-to-county-name map for a state\nexport type FIPSCodeToCountyNameMap = {\n [FIPSCode: string]: string;\n}\n\n// The FIPS to array ordinal map \nexport type FIPSToOrdinalMap = {\n [FIPSCode: string]: number;\n}\n\n// Shapes - following the declarations in dra-client/redistrictdata.ts\nexport type GeoFeature = geojson.Feature;\nexport type GeoFeatureArray = GeoFeature[];\nexport type GeoFeatureCollection = geojson.FeatureCollection;\nexport interface GeoFeatureMap {\n [geoID: string]: GeoFeature;\n}\n\n\n// Contiguity graph\n// - For each geoID, there's a dictionary of neighbors, and the value for each\n// neighbor geoID key is the \"weight\" of that connection.\n// - A simple connectivity matrix used a weight of 1.0. However, the \"weight\"\n// can be overloaded with some other information, like the length of the shared\n// border.\nexport type ContiguityGraph = {\n [geoID: string]: Neighbors;\n}\n\nexport type Neighbors = {\n [geoID: string]: number;\n}\n\n// An election (model) captures three actual or composite vote totals:\n// DEM votes, REP votes, and TOTal votes, where DEM + REP <= TOT, because\n// of third-party candidates and write-in votes. IOW, the two-party vote is\n// DEM + REP.\nexport type VoteTriple = [number, number, number];\n\n// An index for accessing a vote triple\nexport const enum VoteType {\n Democratic,\n Republican,\n Total\n}\n\n// CONFIGURATION TYPES\n\n// Scale config values for an individual test\nexport type TestScale = {\n testScale: Array<number>,\n testInvertp: boolean\n}\n\n// The scales for all the analytics & validations\n// Presently assigned as part of session initialization\n// Use the Tests enum below as the test index\nexport type TestScales = {\n [test: number]: TestScale;\n}\n\n\n// RETURN TYPES\n\nexport type TestEntry = {\n score?: number | boolean; // Specific to the test\n details: Dict; // Additional details\n normalizedScore?: number; // Normalized to [0–100] for graded tests\n}\n\n// District WIP captures a district-level result, indexed by districtID\nexport type DistrictWIP = {\n [districtID: number]: any;\n}\n\n// TODO - Revise this ...\n// Analytics & validations\nexport const enum Test {\n Complete,\n Contiguous,\n FreeOfHoles,\n EqualPopulation, // This is the legal/not legal assessment of the population \n PopulationDeviation, // deviation % (when legal, less is still better).\n Reock,\n PolsbyPopper,\n CountySplits,\n Complexity,\n SeatsBias,\n VotesBias,\n Responsiveness,\n ResponsiveDistricts,\n EfficiencyGap,\n MajorityMinorityDistricts\n}\n\n// The analytics & validation entries for a plan\n// Use the Tests enum above as the test index\nexport type TestEntries = {\n [test: number]: TestEntry;\n}\n\n// DistrictProperties holds properties of district shapes, indexed by districtID\nexport type DistrictProperties = {\n [districtID: number]: any;\n}\n\n// For compactness calculations, we need 3 properties of each district shape:\nexport type DistrictShapeProperties = [number, number, number];\n\n// An index for accessing properties extracted from a district shape\nexport const enum DistrictShapeProperty {\n Area,\n Diameter,\n Perimeter\n}\n\n// HELPER TYPES\n\nexport type GeoIDParts = {\n state?: string;\n county?: string;\n tract?: string;\n bg?: string;\n block?: string;\n}\n\nexport type GeoIDTotal = {\n [geoID: string]: number;\n}\n\n// GENERIC TYPES\n\nexport type Dict = { [key: string]: any };\n\n\n// END\n","//\n// UTILITIES\n//\n\nimport * as T from './types'\nimport * as S from './settings';\n\n// PLAN HELPERS\n\n// Is a \"neighbor\" in state?\nexport function isInState(geoID: string): boolean {\n return geoID != S.OUT_OF_STATE;\n}\n\n// Is a \"neighbor\" out of state?\nexport function isOutOfState(geoID: string): boolean {\n return geoID == S.OUT_OF_STATE;\n}\n\n// Get the districtID to which a geoID is assigned\nexport function getDistrict(plan: T.PlanByGeoID, geoID: string): number | undefined {\n // All geoIDs in a state *should be* assigned to a district (including the\n // dummy \"unassigned\" district), but \"water-only\" features are sometimes missing\n // from a map. This is also a guard against a bug in which a geoID has no district.\n if (keyExists(geoID, plan)) {\n return plan[geoID];\n }\n else {\n return undefined;\n }\n}\n\n// Invert a feature assignment structure to sets of ids by district\n// NOTE - This is here vs. _data.ts, so it can also be used in cli.ts\nexport function invertPlan(plan: T.PlanByGeoID): T.PlanByDistrictID {\n let invertedPlan = {} as T.PlanByDistrictID;\n\n // Add a dummy 'unassigned' district\n invertedPlan[S.NOT_ASSIGNED] = new Set();\n\n for (let geoID in plan) {\n let districtID = plan[geoID];\n\n // Make sure the set for the districtID exists\n if (!(objectContains(invertedPlan, districtID))) {\n invertedPlan[districtID] = new Set();\n }\n\n // Add the geoID to the districtID's set\n invertedPlan[districtID].add(geoID);\n }\n\n return invertedPlan;\n}\n\n// WORKING WITH GEOIDS\n\nexport function parseGeoID(geoID: string): T.GeoIDParts {\n let parts: T.GeoIDParts = {};\n\n parts['state'] = geoID.substring(0, 2);\n parts['county'] = geoID.substring(0, 5);\n\n let l: number = geoID.length;\n\n if (l >= 11) {\n parts['tract'] = geoID.substring(0, 11);\n }\n\n if (l >= 12) {\n parts['bg'] = geoID.substring(0, 12);\n }\n\n if (l == 15) {\n parts['block'] = geoID;\n }\n\n return parts;\n}\n\nexport function getFIPSFromCountyGeoID(geoID: string): string {\n return geoID.substring(2, 5);\n}\n\n\n// NORMALIZING RESULTS\n\n// Convert a raw score [0-1] into a normalized score [0-100]\nexport function normalize(rawScore: number, scale: Array<number>, invertp: boolean = false): number {\n // Invert the axis if necessary to make bigger = better\n if (invertp) {\n rawScore = 1.0 - rawScore;\n }\n\n // Coerce the value to be w/in the given range\n let rangeMin: number = scale[0];\n let rangeMax: number = scale[1];\n let coercedValue = Math.min(Math.max(rawScore, rangeMin), rangeMax);\n\n // Scale the bounded value w/in the range [0 - (rangeMax - rangeMin)]\n let scaledValue = (coercedValue - rangeMin) / (rangeMax - rangeMin);\n\n // Finally, make the range [0-100]\n return Math.round(scaledValue * S.NORMALIZED_RANGE);\n}\n\n// Round a fractional number [0-1] to the desired level of PRECISION.\nexport function trim(fullFraction: number): number {\n let shiftPlaces = 10 ** S.PRECISION;\n\n return Math.round(fullFraction * shiftPlaces) / shiftPlaces;\n}\n\n// ARRAY HELPERS\n\nexport function sumArray(arr: number[]): number {\n return arr.reduce((a, b) => a + b, 0);\n}\n\nexport function avgArray(arr: number[]): number {\n return (arr.reduce((a, b) => a + b, 0)) / arr.length;\n}\n\nexport function minArray(arr: number[]): number {\n return Math.min(...arr);\n}\n\nexport function maxArray(arr: number[]): number {\n return Math.max(...arr);\n}\n\nexport function initArray(n: number, value: any): any[] {\n return Array.from(Array(n), () => value);\n}\n\nexport function andArray(arr: boolean[]): boolean {\n return arr.reduce(function (a, b) { return a && b; }, true);\n}\n\n// WORKING WITH OBJECT KEYS/PROPERTIES\n\n// TODO - Terry, is this copesetic?\n// Does an object have a key/property?\nexport function keyExists(k: string, o: object): boolean {\n return k in o;\n}\n\n// TODO - Terry, can these three be combined into a generic isEmpty() check?\n// Does an object (dict) have any keys/properties?\nexport function isObjectEmpty(o: object): boolean {\n return Object.keys(o).length === 0\n}\n// Does a Set have any members?\nexport function isSetEmpty(s: any): boolean {\n return s.size === 0\n}\n// Does an array hold any items?\nexport function isArrayEmpty(a: any[]): boolean {\n if (a === undefined || a.length == 0) {\n // array empty or does not exist\n return true;\n }\n else {\n return false;\n }\n}\n\n// Get the keys for an object\nexport function getObjectKeys(o: object): string[] {\n return Object.keys(o);\n}\n\n// TODO - Convert getNumericObjectKeys() idiom to for..of where possible\nexport function getNumericObjectKeys(o: object): number[] {\n return Object.keys(o).map(Number);\n}\n\nexport function getSelectObjectKeys(o: T.Dict, v: any[]): string[] {\n let selectKeys: string[] = [];\n\n Object.keys(o).forEach(key => {\n if (arrayContains(v, o[key])) {\n selectKeys.push(key);\n }\n });\n\n return selectKeys;\n}\n\nexport function arrayContains(a: any[], item: any): boolean {\n return a.some(x => x === item);\n}\n\nexport function objectContains(o: object, key: any): boolean {\n return (key in o);\n}\n\n\n// ENUM HELPERS\n\n// Source: https://stackoverflow.com/questions/38034673/determine-the-number-of-enum-elements-typescript\nexport function countEnumValues(enumName: any): number {\n let count = 0\n for (let item in enumName) {\n if (isNaN(Number(item))) count++\n }\n return count\n}\n\n// COPYING - Copied from dra-client/util.ts\n\nexport function shallowCopy(src: any): any {\n if (Array.isArray(src))\n return src.slice();\n else if (typeof src === 'object') {\n let dst: any = {};\n for (var p in src) if (src.hasOwnProperty(p))\n dst[p] = src[p];\n return dst;\n }\n else\n return src;\n}\n\nexport function deepCopy(src: any): any {\n if (Array.isArray(src)) {\n let dst: any[] = [];\n\n for (let i: number = 0; i < src.length; i++)\n dst.push(deepCopy(src[i]));\n return dst;\n }\n else if (typeof src === 'object') {\n let dst: any = {};\n for (var p in src) if (src.hasOwnProperty(p))\n dst[p] = deepCopy(src[p]);\n return dst;\n }\n else\n return src;\n}\n\n\n// TODO - Terry: What is this the simple explanation of what this thing is doing?\nexport { depthof } from '@dra2020/util';\n","//\n// MAP/PLAN VALIDATIONS\n//\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport * as D from './_data'\nimport { AnalyticsSession } from './_api';\n\n//\n// COMPLETE - Are all geo's assigned to a district, and do all districts have\n// at least one geo assigned to them?\n//\n\nexport function doIsComplete(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.Complete) as T.TestEntry;\n\n let bAllAssigned = true;\n let bNoneEmpty = true;\n\n let unassignedFeatures: string[] = [];\n let emptyDistricts: number[] = [];\n\n // Get the by district results, including the dummy unassigned district,\n // but ignoring the N+1 summary district\n let bNotEmptyByDistrict = s.districts.statistics[D.DistrictField.bNotEmpty];\n bNotEmptyByDistrict = bNotEmptyByDistrict.slice(0, -1);\n\n // Are all features assigned to districts?\n // Check the dummy district that holds any unassigned features.\n bAllAssigned = (!bNotEmptyByDistrict[S.NOT_ASSIGNED]);\n if (!bAllAssigned) {\n let unassignedDistrict = s.plan.geoIDsForDistrictID(S.NOT_ASSIGNED);\n unassignedFeatures = Array.from(unassignedDistrict);\n unassignedFeatures = unassignedFeatures.slice(0, S.NUMBER_OF_ITEMS_TO_REPORT);\n }\n\n // Do all real districts have at least one feature assigned to them?\n bNoneEmpty = U.andArray(bNotEmptyByDistrict.slice(1));\n\n // Case 1 - One or more districts are missing:\n // The # of enumerated districts minus the dummy NOT_ASSIGNED one should\n // equal the number apportioned districts. This guards against a district\n // not being included in a map that is imported.\n //\n // TODO - I'm no longer checking for this, but DRA should!\n\n // Case 2 - Or a district is explicitly named but empty:\n // Note, this can happen if a district is created, and then all features\n // are removed from it (in DRA).\n\n // Populate the test entry\n test['score'] = bAllAssigned && bNoneEmpty;\n if (!bAllAssigned) {\n test['details']['unassignedFeatures'] = unassignedFeatures;\n }\n\n if (!bNoneEmpty) {\n test['details']['emptyDistricts'] = emptyDistricts;\n }\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bNotEmpty = s.districts.statistics[D.DistrictField.bNotEmpty];\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bNotEmpty[summaryRow] = test['score'];\n\n return test;\n}\n\n//\n// CONTIGUOUS - Is each district in a plan fully connected?\n//\n// NOTE - To check \"operational contiguity,\" we need to use a graph, i.e.,\n// we can't rely on just the geometric contiguity of shapes in a shapefile.\n//\n// To test this, load the NC 2010 map 'SAMPLE-BG-map-discontiguous.csv'.\n//\n\nexport function doIsContiguous(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.Contiguous) as T.TestEntry;\n\n // Get the contiguity of each district. Ignore dummy unassigned district\n // and the N+1 summary district.\n let bContiguousByDistrict = s.districts.statistics[D.DistrictField.bContiguous];\n bContiguousByDistrict = bContiguousByDistrict.slice(1, -1);\n\n // If any real districts aren't contiguous, mark the plan as not contiguous\n let bMapContiguous = U.andArray(bContiguousByDistrict);\n\n // If the map is not contiguous, log the offending districts.\n let discontiguousDistricts: number[] = [];\n let districtID = 1;\n bContiguousByDistrict.forEach(function (bDistrictContiguous: boolean): void {\n if (!bDistrictContiguous) discontiguousDistricts.push(districtID);\n districtID += 1;\n });\n\n // Populate the test entry\n test['score'] = bMapContiguous;\n if (!bMapContiguous) {\n test['details'] = { 'discontiguousDistricts': discontiguousDistricts };\n }\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bContiguous = s.districts.statistics[D.DistrictField.bContiguous];\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bContiguous[summaryRow] = test['score'];\n\n return test;\n}\n\n// Are the features in a district fully connected?\nexport function isConnected(districtGeos: Set<string>, graph: D.Graph): boolean {\n // export function isConnected(districtGeos: Set<string>, graph: T.ContiguityGraph): boolean {\n // TODO - Terry, why does this constructor need a <T> type specification?\n let visited = new Set<string>();\n let toProcess: string[] = [];\n\n // Start processing with the first geoID in the district\n let iter = districtGeos.values();\n toProcess.push(iter.next().value);\n\n // While there are geoIDs in the district that haven't been processed\n while (toProcess.length > 0) {\n // Grab a geoID and process it\n let node = toProcess.pop() as string;\n visited.add(node);\n\n // Get its actual, in-state neighbors\n let actualNeighbors = graph.peerNeighbors(node).filter(x => U.isInState(x));\n\n // Add neighbors to visit, if they're in the same district Y haven't already been visited\n let neighborsToVisit = actualNeighbors.filter(x => districtGeos.has(x) && (!visited.has(x)));\n // TODO - Terry, is this the quickest/best way to do this?\n toProcess.push(...neighborsToVisit);\n }\n\n // Stop when you've visited all the geoIDs in the district\n return visited.size == districtGeos.size;\n}\n\n\n//\n// FREE OF HOLES - Are any districts fully embedded w/in another district?\n//\n// A district is NOT a \"donut hole\" district:\n// - If any neighbor is 'OUT_OF_STATE'; or\n// - If there are 2 or more neighboring districts.\n//\n// To test this, load the NC 2010 map 'SAMPLE-BG-map-hole.csv'. District 1,\n// Buncombe County (37021), is a donut hole w/in District 3.\n//\n// TODO - Optimize this to take advantage of district boundary info, if/when\n// we cache one to optimize compactness.\n//\n\nexport function doIsFreeOfHoles(s: AnalyticsSession): T.TestEntry {\n let test = s.getTest(T.Test.FreeOfHoles) as T.TestEntry;\n\n // Initialize values\n let bFreeOfHoles = true;\n let embeddedDistricts: number[] = [];\n\n // Get the embeddedness of each district. Ignore dummy unassigned district\n // and the N+1 summary district.\n let bNotEmbeddedByDistrict = s.districts.statistics[D.DistrictField.bNotEmbedded];\n bNotEmbeddedByDistrict = bNotEmbeddedByDistrict.slice(1, -1);\n\n let districtID = 1;\n bNotEmbeddedByDistrict.forEach(function (bDistrictNotEmbedded: boolean): void {\n if (!bDistrictNotEmbedded) {\n embeddedDistricts.push(districtID);\n bFreeOfHoles = false;\n }\n districtID += 1;\n });\n\n // Populate the test entry\n test['score'] = bFreeOfHoles;\n if (!bFreeOfHoles) {\n test['details'] = { 'embeddedDistricts': embeddedDistricts };\n }\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bNotEmbedded = s.districts.statistics[D.DistrictField.bNotEmbedded];\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bNotEmbedded[summaryRow] = test['score'];\n\n return test;\n}\n\n// Test whether one district is embedded w/in any other.\nexport function isEmbedded(districtID: number, geoIDs: Set<string>, plan: D.Plan, graph: D.Graph): boolean {\n // TODO - Make \"features\" = \"geoIDs.\" These aren't \"features\" proper, just\n // identifier strings.\n let features = geoIDs;\n let planByGeo = plan.byGeoID();\n\n // Assume the district is embedded\n let bEmbedded = true;\n // Keep track of the neighoring districts\n let neighboringDistricts = new Set();\n\n // TODO - Use just the boundary features, when available\n // Get the features for the real district\n let featuresToCheck = Array.from(features);\n\n // If the district has features, check whether it is embedded\n if (!(U.isArrayEmpty(featuresToCheck))) {\n // For each feature that needs to be checked (see above)\n for (let feature of featuresToCheck) {\n // Get its neighbors (including the virtual \"out of state\" ones)\n let neighbors = graph.peerNeighbors(feature);\n\n for (let neighbor of neighbors) {\n if (U.isOutOfState(neighbor)) {\n bEmbedded = false;\n // No need to check any more neighbors\n break;\n }\n else {\n let neighboringDistrict = U.getDistrict(planByGeo, neighbor);\n\n // Assume that a missing district assignment (= None) means that the\n // feature is \"water-only\" AND part of the state border (vs. internal)\n // and, therefore, not in the plan/map.\n\n if (neighboringDistrict == undefined) {\n bEmbedded = false;\n // No need to check any more neighbors\n break;\n }\n else {\n // TODO - Since we're checking *all* features in a district right\n // now, not just boundary features and neighbors in other districts,\n // prune out the current district. If/when we optimize compactness\n // to cache district boundaries (as before in my Python implementation),\n // we won't have to guard adding \"neighboring\" districts in this way.\n if (neighboringDistrict != districtID) {\n neighboringDistricts.add(neighboringDistrict);\n }\n\n if (neighboringDistricts.size > 1) {\n bEmbedded = false;\n // No need to check any more neighbors\n break;\n }\n }\n }\n }\n // If a district is not embedded, there's no need to check anymore\n // border geos.\n if (!bEmbedded) {\n break;\n }\n }\n\n }\n\n return bEmbedded;\n}\n\n// TODO - MIXED MAPS\n// - When we generalize to mixed maps, the determination of \"neighbors in\n// the map\" -- which is the core function in determining connectedness -- becomes\n// *much* more complicated and dynamic.\n// - I can write up (if not implement) the logic for this. It is a bit tricky\n// and requires special preprocessing of the summary level hierarchy (which I\n// also have a script for that we can repurpose) to distinguish between 'interior'\n// and 'edge' children.\n","module.exports = require(\"@dra2020/poly\");","module.exports = require(\"@dra2020/util\");","module.exports = require(\"assert\");"],"sourceRoot":""}
|
package/dist/equal.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as T from './types';
|
|
2
|
+
import { AnalyticsSession } from './_api';
|
|
3
|
+
export declare function doSeatsBias(s: AnalyticsSession): T.TestEntry;
|
|
4
|
+
export declare function doVotesBias(s: AnalyticsSession): T.TestEntry;
|
|
5
|
+
export declare function doResponsiveness(s: AnalyticsSession): T.TestEntry;
|
|
6
|
+
export declare function doResponsiveDistricts(s: AnalyticsSession): T.TestEntry;
|
|
7
|
+
export declare function doEfficiencyGap(s: AnalyticsSession): T.TestEntry;
|
|
8
|
+
export declare function fptpWin(demPct: number): number;
|
package/dist/report.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as T from './types';
|
|
2
|
+
import { AnalyticsSession } from './_api';
|
|
3
|
+
export declare type Scorecard = {
|
|
4
|
+
[category: number]: ScorecardCategoryEntry;
|
|
5
|
+
};
|
|
6
|
+
declare type ScorecardCategoryEntry = {
|
|
7
|
+
catName: string;
|
|
8
|
+
catScore?: number | boolean;
|
|
9
|
+
catTests: T.TestEntries;
|
|
10
|
+
};
|
|
11
|
+
export declare function doConfigureScales(s: AnalyticsSession): void;
|
|
12
|
+
export declare function doAnalyzePostProcessing(s: AnalyticsSession): void;
|
|
13
|
+
export declare function doPrepareScorecard(s: AnalyticsSession): any;
|
|
14
|
+
export declare function doPrepareTestLog(s: AnalyticsSession): any;
|
|
15
|
+
export {};
|