@dra2020/district-analytics 16.1.3 → 16.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/district-analytics.js +28 -133
- package/dist/district-analytics.js.map +1 -1
- package/dist/src/types.d.ts +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"district-analytics.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;ACVA,EAAE;AACF,uBAAuB;AACvB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,2FAA2C;AAC3C,oGAAqD;AAErD,oFAAgD;AAChD,2EAA8D;AAC9D,qEAAyF;AACzF,2EAA2E;AAC3E,2EAAwG;AACxG,8EAAyD;AAEzD,6EAA6B;AAC7B,mFAAgC;AAGhC,6EAA6B;AAE7B,kDAAkD;AAClD,MAAa,gBAAgB;IAsB3B,YAAY,cAAgC;QAnB5C,yBAAoB,GAAY,KAAK,CAAC,CAAE,OAAO;QAC/C,WAAM,GAAW,EAAE,CAAC;QAEpB,2BAAsB,GAAY,KAAK,CAAC;QACxC,kBAAa,GAAY,KAAK,CAAC;QAC/B,wBAAmB,GAAY,KAAK,CAAC;QACrC,UAAK,GAAG,EAAmB,CAAC;QAe1B,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAE1D,iCAAiC;QACjC,yCAAyC;QACzC,iDAAiD;QACjD,2BAA2B;QAC3B,+EAA+E;QAE/E,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC;YAC3E,IAAI,CAAC,oBAAoB,GAAG,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AAI,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,0BAA0B;IAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;IAC7B,IAAI,CAAC,YAAY,EACjB,CAAC;QACC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC;IAC/D,CAAC;IAED,6DAA6D;IAC7D,IAAI,YAAY,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC;IAClD,IAAI,UAAU,GAAG,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAEhD,YAAY,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAEzC,OAAO,IAAI,CAAC;AACd,CAAC;AAtCD,0CAsCC;;;;;;;;;;;AC/MD;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://district-analytics/webpack/universalModuleDefinition","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/index.ts","webpack://district-analytics/./src/minority.ts","webpack://district-analytics/./src/preprocess.ts","webpack://district-analytics/./src/results.ts","webpack://district-analytics/./src/score.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 commonjs \"@dra2020/baseclient\"","webpack://district-analytics/external commonjs \"@dra2020/dra-analytics\"","webpack://district-analytics/external commonjs \"@dra2020/dra-types\"","webpack://district-analytics/webpack/bootstrap","webpack://district-analytics/webpack/before-startup","webpack://district-analytics/webpack/startup","webpack://district-analytics/webpack/after-startup"],"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, () => {\nreturn ","//\n// THE NODE PACKAGE API\n//\n\nimport { Poly } from '@dra2020/baseclient';\nimport { Rate, Types } from '@dra2020/dra-analytics';\n\nimport { doPreprocessData } from './preprocess';\nimport { doAnalyzePlan, doAnalyzeDistricts } from './analyze';\nimport { profilePlan, computeMetrics, rateKeyDimensions, thunkScorecard } from './score';\nimport { doAnalyzePostProcessing, RequirementsChecklist } from './results';\nimport { DistrictStatistics, prepareDistrictStatistics, prepareRequirementsChecklist } from './results';\nimport { doAnalyzeRacialPolarization } from './minority';\n\nimport * as D from './_data';\nimport * as M from './minority';\nimport * as T from './types';\nimport * as L from './legacy-types';\nimport * as U from './utils';\n\n// MMD - Extended for optional # reps per district\nexport class AnalyticsSession\n{\n title: string;\n legislativeDistricts: boolean = false; // 2020\n config: T.Dict = {};\n\n bOneTimeProcessingDone: boolean = false;\n bPlanAnalyzed: boolean = false;\n bPostProcessingDone: boolean = false;\n tests = {} as T.TestEntries;\n\n _profile?: L.Profile;\n _scorecard?: L.Scorecard;\n\n state: D.State;\n counties: D.Counties;\n graph: D.GraphClass;\n features: D.Features;\n plan: D.Plan;\n districts: D.Districts;\n repsByDistrict?: number[]; // MMD\n\n constructor(SessionRequest: T.SessionRequest)\n {\n this.title = SessionRequest['title'];\n this.config = this.processConfig(SessionRequest['config'])\n\n // 2020 - Set the CD / LD toggle:\n // * If 2020, use the PlanType, if given.\n // * If 2010, use the legacy LD toggle, if given.\n // * Otherwise assume CD's.\n // * Use the LD population deviation threshold for districts that are not CD's.\n\n if ((this.config.cycle == 2020) && (SessionRequest['planType'] !== undefined))\n this.legislativeDistricts = (SessionRequest['planType'] != 'congress');\n else if ((this.config.cycle == 2010) && (SessionRequest['legislativeDistricts'] !== undefined))\n this.legislativeDistricts = SessionRequest['legislativeDistricts'];\n\n // MMD - Validate & handle optional # reps per district\n const repsByDistrict = SessionRequest['repsByDistrict'];\n const nDistricts = SessionRequest['nDistricts'];\n if (repsByDistrict !== undefined)\n {\n if (repsByDistrict.length != nDistricts) throw new Error(\"Mismatched #'s of districts passed to AnalyticsSession constructor!\");\n if (repsByDistrict.includes(0)) throw new Error(\"Zero reps for a district passed to AnalyticsSession constructor!\");\n // Assume a positive integer # of reps per district\n\n this.repsByDistrict = repsByDistrict;\n }\n\n this.state = new D.State(this, SessionRequest['stateXX'], nDistricts);\n this.counties = new D.Counties(this, SessionRequest['counties']);\n this.graph = new D.GraphClass(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 processConfig(config: T.Dict): T.Dict\n {\n // Default the Census & redistricting cycle to 2010\n if (!(U.keyExists('cycle', config)))\n {\n config['cycle'] = 2010;\n\n // DEBUG\n console.log(\"Cycle was not set explicitly on the session request.\");\n }\n // DEBUG - Turned off 03/05/21\n // console.log(\"Cycle = \", config['cycle']);\n // console.log(\"Shapes = \", config['datasets'][T.Dataset.SHAPES], \": \", config['descriptions']['SHAPES']);\n\n return config;\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, overridesJSON?: any): boolean\n {\n // Return values:\n // * true = everything good\n // * false = should not have been called with empty plan\n // * exception = exception caught and logged on the console\n try\n {\n // Guard against being handed a map w/o any precincts assigned\n if (U.isObjectEmpty(this.plan._planByGeoID)) return false;\n\n doPreprocessData(this, bLog);\n doAnalyzeDistricts(this, bLog);\n\n // This does a little stuff that didn't get factored out into dra-score and then dra-analytics\n doAnalyzePlan(this, bLog);\n\n // THE MAIN ANALYTICS\n\n // Even though we don't save the profile (as I thought we would),\n // we allow it to be exported, so keep generating it, and use it\n // to gather the inputs to new analytics (as well as the legacy).\n this._profile = profilePlan(this, bLog);\n\n let legacyScorecardAlt = {} as L.Scorecard;\n let newScorecard = {} as Types.Scorecard;\n\n // Construct a new/alternate scorecard\n\n newScorecard = computeMetrics(this._profile, this.getGoodShapes(), bLog); // w/o ratings\n newScorecard = rateKeyDimensions(newScorecard, this._profile, bLog); // w/ ratings\n legacyScorecardAlt = thunkScorecard(newScorecard, bLog);\n\n // Add minority notes\n legacyScorecardAlt.minority.details['majorityMinority'] = M.getMajorityMinority(this);\n legacyScorecardAlt.minority.details['vraPreclearance'] = M.getVRASection5(this);\n\n this._scorecard = legacyScorecardAlt;\n\n // Before returning, create a dummy population deviation test, for \n // doHasEqualPopulations() to use later.This is preserving the old calling sequence.\n let test = this.getTest(T.Test.PopulationDeviation) as T.TestEntry;\n\n // Get the raw population deviation\n const popDev = this._scorecard.populationDeviation.raw;\n\n // Populate the test entry\n test['score'] = popDev;\n test['details'] = { 'maxDeviation': this._scorecard.populationDeviation.notes['maxDeviation'] };\n\n // Populate the N+1 summary \"district\" in district.statistics\n let totalPop = this.districts.table.totalPop;\n let popDevPct = this.districts.table.popDevPct;\n let totalVAP = this.districts.table.totalVAP;\n\n const summaryRow = this.districts.numberOfRows() - 1;\n totalPop[summaryRow] = this._profile.population.targetSize; // MMD - This is generalized when the profile is created.\n popDevPct[summaryRow] = popDev;\n totalVAP[summaryRow] = Math.round(totalVAP[summaryRow] / this._profile.nDistricts);\n\n // Added w/ new scorecard\n // Use 'roughly' equal population from dra-analytics\n let test2 = this.getTest(T.Test.EqualPopulation) as T.TestEntry;\n test2['score'] = newScorecard.populationDeviation.roughlyEqual;\n\n // END main analytics\n\n doAnalyzePostProcessing(this, bLog);\n }\n catch (e)\n {\n console.log(\"Exception caught by analyzePlan().\");\n console.log((<Error>e).message);\n throw e;\n }\n\n return true;\n }\n getGoodShapes(): T.GeoFeatureCollection\n {\n const rawShapes = this.districts.getDistrictShapes();\n\n // Filter the real shapes & throw everything else away\n let goodShapes = {} as T.GeoFeatureCollection;\n goodShapes['type'] = \"FeatureCollection\";\n goodShapes['features'] = [] as T.GeoFeatureArray;\n\n for (let i = 0; i < rawShapes.features.length; i++)\n {\n const shape: any = rawShapes.features[i];\n\n if (isAShape(shape))\n {\n const d = Poly.polyDescribe(shape);\n\n let f: any = {\n type: 'Feature',\n properties: {districtID: `${i + 1}`},\n geometry: {\n type: (d.npoly > 1) ? 'MultiPolygon' : 'Polygon',\n coordinates: shape.geometry.coordinates\n }\n };\n goodShapes.features.push(f);\n }\n }\n\n return goodShapes;\n }\n\n // 11-03-2020 - Added for racially polarized voting analysis\n // NOTE - This assumes that analyzePlan() has been run!\n analyzeRacialPolarization(districtID: number, groups: Types.MinorityFilter, bLog: boolean = false): Types.RPVAnalysis | undefined\n {\n return doAnalyzeRacialPolarization(this, districtID, groups, bLog);\n }\n\n // NOTE - This assumes that analyzePlan() has been run!\n getDistrictStatistics(bLog: boolean = false): DistrictStatistics\n {\n return prepareDistrictStatistics(this, bLog);\n }\n getPlanProfile(bLog: boolean = false): L.Profile\n {\n return this._profile as L.Profile;\n }\n getPlanScorecard(bLog: boolean = false): L.Scorecard\n {\n return this._scorecard as L.Scorecard;\n }\n getRatings(bLog: boolean = false): T.Ratings\n {\n const scorecard = this._scorecard as L.Scorecard;\n\n const r: T.Ratings = {\n proportionality: scorecard.partisan.bias.score,\n competitiveness: scorecard.partisan.responsiveness.score,\n minorityRights: scorecard.minority.score,\n compactness: scorecard.compactness.score,\n splitting: scorecard.splitting.score\n }\n\n return r;\n }\n // NOTE - This assumes that analyzePlan() has been run!\n getRequirementsChecklist(bLog: boolean = false): RequirementsChecklist\n {\n return prepareRequirementsChecklist(this, bLog);\n }\n // NOTE - This assumes that analyzePlan() has been run!\n getDiscontiguousDistrictFeatures(bLog: boolean = false): T.GeoFeatureCollection\n {\n // Get the (possibly empty) list of discontiguous district IDs\n const contiguousTest = this.getTest(T.Test.Contiguous) as T.TestEntry;\n const discontiguousDistrictIDs: number[] = contiguousTest['details']['discontiguousDistricts'] || [];\n\n // Convert them into a (possibly empty) list of features\n let discontiguousDistrictFeatures: T.GeoFeatureCollection = { type: 'FeatureCollection', features: [] };\n if (!(U.isArrayEmpty(discontiguousDistrictIDs)))\n {\n for (let id of discontiguousDistrictIDs)\n {\n let poly = this.districts.getDistrictShapeByID(id);\n\n if (poly)\n {\n // If a district has a shape & it is not contiguous, by definition,\n // it will be a Multipolygon, i.e., it will have multiple pieces, some\n // possibly embedded w/in other districts. Get & add all the pieces.\n\n const districtParts: T.GeoFeatureCollection = Poly.polyParts(poly);\n discontiguousDistrictFeatures.features.push(...districtParts.features);\n // discontiguousDistrictFeatures.features.push(poly);\n }\n }\n }\n\n return discontiguousDistrictFeatures;\n }\n // Comments clipped from dra-client geodistrict.ts.\n // Discontiguous polygons are:\n // 1. All polygons in a multi-polygon; and\n // 2. All holes in a otherwise cohesive polygon.\n // Note that all non-cohesive features are always simple polygons.\n\n\n // HELPERS USED INTERNALLY\n\n // Get an individual test, so you can drive UI with the results.\n getTest(testID: T.Test): T.TestEntry\n {\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 {\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 // NOTE - Not sure why this has to be up here ...\n populationDeviationThreshold(): number\n {\n const threshold = Rate.popdevThreshold(this.legislativeDistricts);\n\n return threshold;\n }\n}\n\nfunction isAShape(poly: any): boolean\n{\n if (poly == null) return false;\n if (Poly.polyNull(poly)) return false;\n return poly.geometry && poly.geometry.coordinates && !U.isArrayEmpty(poly.geometry.coordinates);\n}\n","//\n// DATA ABSTRACTION LAYER\n//\n\nimport { Graph, Minority, Types } from '@dra2020/dra-analytics';\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport { AnalyticsSession } from './_api';\nimport { extractDistrictProperties } from './compact';\nimport { Partisan } from '@dra2020/dra-analytics';\n\n\n// DEBUG COUNTERS\nlet nMissingDataset: number = 0;\nlet nMissingProperty: number = 0;\n\n\n// DISTRICT STATISTICS\n\n// Each property represents a column in the district statistics table, and\n// each holds an array of values for the districts.\nexport type TransposedTable = {\n totalPop: number[]; // Display\n popDevPct: number[]; // Display\n bEqualPop: boolean[]; // Display\n bNotEmpty: boolean[]; // Display\n bContiguous: boolean[]; // Display\n bNotEmbedded: boolean[]; // Display\n countySplits: number[][];\n demVotes: number[];\n repVotes: number[];\n otherVotes: number[];\n demPct: number[]; // Display (also the \"VPI,\" by convention\")\n repPct: number[]; // Display\n otherPct: number[]; // Display\n demSeat: number[];\n totalVAP: number[]; // VAP or CVAP ...\n minorityPop: number[]; // Derived\n whitePop: number[];\n blackPop: number[];\n hispanicPop: number[];\n pacificPop: number[];\n asianPop: number[];\n nativePop: number[];\n whitePct: number[]; // Display\n minorityPct: number[]; // Display\n blackPct: number[]; // Display\n hispanicPct: number[]; // Display\n pacificPct: number[]; // Display\n asianPct: number[]; // Display\n nativePct: number[]; // Display\n}\n\nexport class Districts\n{\n _session: AnalyticsSession;\n\n _shapes: T.GeoFeatureCollection;\n _geoProperties = {} as T.DistrictProperties;\n\n table: TransposedTable;\n\n constructor(s: AnalyticsSession, ds: T.GeoFeatureCollection)\n {\n this._session = s;\n\n this._shapes = ds;\n this.table = this.initTable();\n }\n getDistrictShapes(): T.GeoFeatureCollection\n {\n return this._shapes;\n }\n getDistrictShapeByID(id: number): T.GeoFeature | undefined\n {\n // NOTE - Find the district shape by ID (not index)\n // return this._shapes.features[id]; \n for (let f of this._shapes.features)\n {\n if (f.properties && (f.properties.id == id))\n {\n return f;\n }\n }\n return undefined;\n }\n getGeoProperties(i: number): any\n {\n // Make sure the district shape exists & has geo properties\n if (i in this._geoProperties) return this._geoProperties[i];\n else return null;\n }\n setGeoProperties(i: number, p: T.DistrictShapeProperties): void { this._geoProperties[i] = p; }\n\n // +1 for dummy unassigned 0 \"district\" and +1 for N+1 summary \"district\" for state-level values. \n // 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 initTable(): TransposedTable\n {\n let nRows = this.numberOfRows(); // # of districts plus unassigned & summary\n\n const t: TransposedTable = {\n totalPop: U.initArray(nRows, null),\n popDevPct: U.initArray(nRows, null),\n bEqualPop: U.initArray(nRows, null),\n bNotEmpty: U.initArray(nRows, null),\n bContiguous: U.initArray(nRows, null),\n bNotEmbedded: U.initArray(nRows, null),\n countySplits: U.initArray(nRows, null),\n demVotes: U.initArray(nRows, null),\n repVotes: U.initArray(nRows, null),\n otherVotes: U.initArray(nRows, null),\n demPct: U.initArray(nRows, null),\n repPct: U.initArray(nRows, null),\n otherPct: U.initArray(nRows, null),\n demSeat: U.initArray(nRows, null),\n totalVAP: U.initArray(nRows, null),\n minorityPop: U.initArray(nRows, null),\n whitePop: U.initArray(nRows, null),\n blackPop: U.initArray(nRows, null),\n hispanicPop: U.initArray(nRows, null),\n pacificPop: U.initArray(nRows, null),\n asianPop: U.initArray(nRows, null),\n nativePop: U.initArray(nRows, null),\n whitePct: U.initArray(nRows, null),\n minorityPct: U.initArray(nRows, null),\n blackPct: U.initArray(nRows, null),\n hispanicPct: U.initArray(nRows, null),\n pacificPct: U.initArray(nRows, null),\n asianPct: U.initArray(nRows, null),\n nativePct: U.initArray(nRows, null) \n }\n\n return t;\n }\n\n // MMD - Generalized district statistics for MMD's\n // This is the workhorse computational routine!\n recalcStatistics(bLog: boolean = false): void\n {\n // Initialize debug counters\n nMissingDataset = 0;\n nMissingProperty = 0;\n\n // MMD - Generalized targetSize\n // Compute these once per recalc cycle\n const nDistricts = this._session.state.nDistricts;\n const repsByDistrict = this._session.repsByDistrict;\n const nReps = this._session.state.nReps;\n const stateTotal = this._session.state.totalPop;\n const targetSize = this._session.state.targetSize;\n // const targetSize = Math.round(this._session.state.totalPop / this._session.state.nDistricts);\n const deviationThreshold = this._session.populationDeviationThreshold();\n // let planByDistrict = this._session.plan.byDistrictID();\n const plan = this._session.plan;\n const graph = this._session.graph;\n\n // Add an extra 0th virtual county bucket for county-district splitting analysis \n let nCountyBuckets = this._session.counties.nCounties + 1;\n\n // INITIALIZE STATE VALUES THAT WILL BE ACCUMULATED\n\n // 10-22-2020 - Added Other votes\n let stateDemVote = 0;\n let stateRepVote = 0;\n let stateOthVote = 0;\n let stateTotVote = 0;\n // let stateTPVote = 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 // - Contiguous (bContiguous)\n // - Free of holes (bNotEmbedded)\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(nCountyBuckets, 0);\n\n // 10-22-2020 - Added Other votes\n let demVotes: number = 0;\n let repVotes: number = 0;\n let othVotes: number = 0;\n let totVotes: 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 // NOTE - Only report explicitly found validity issues\n let bNotEmpty = false;\n let bContiguous = true;\n let bNotEmbedded = true;\n let bEqualPop = true;\n\n // HACK - Because \"this\" gets ghosted inside the forEach loop below\n let outerThis = this;\n\n // Default the pop dev % for the dummy Unassigned district to 0%.\n // Default the pop dev % for real (1–N) but empty districts to 100%.\n let popDevPct = (i > 0) ? (targetSize / targetSize) : 0 / targetSize;\n\n // Get the geoIDs assigned to the district\n // Guard against empty districts\n let geoIDs = this._session.plan.geoIDsForDistrictID(i);\n if (geoIDs && (geoIDs.size > 0))\n {\n bNotEmpty = true;\n\n // ... loop over the geoIDs creating district-by-district statistics \n geoIDs.forEach(function (geoID: string): void\n {\n // 01-04-22 -- Removed water-only guard\n // // Skip water-only features\n // if (!(U.isWaterOnly(geoID)))\n // {\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 if (f == undefined)\n {\n if (bLog) console.log(\"Statistics: Skipping undefined feature in district statistics: GEOID =\", geoID, \"Feature ID =\", featureID);\n }\n else\n {\n // ACCUMULATE VALUES\n\n // Total population of each feature\n // NOTE - This result is used more than once\n // 03-27-21\n const dkCENSUS: string = outerThis._session.features._keys[T.Dataset.CENSUS];\n featurePop = fieldForFeature(f, dkCENSUS, T.FeatureField.TotalPop);\n // featurePop = outerThis._session.features.fieldForFeature(f, T.Dataset.CENSUS, T.FeatureField.TotalPop);\n\n // Total district population\n totalPop += featurePop;\n\n // Ignore features when the county is unrecognized\n const countyFIPS = U.parseGeoID(geoID)['county'] as string;\n if (U.keyExists(countyFIPS, outerThis._session.counties.index))\n {\n // Total population by counties w/in a district,\n // except the dummy unassigned district 0\n if (i > 0) countySplits[outerThis.getCountyIndex(geoID)] += featurePop;\n }\n else\n {\n if (bLog) console.log(\"Statistics: County not recognized:\", geoID);\n }\n\n // Democratic and Republican vote totals\n // 10-22-2020 - Added Other votes\n // 10-24-2020 - Added guard against inconsistent election data\n // 03-27-2021\n const dkELECTION: string = outerThis._session.features._keys[T.Dataset.ELECTION];\n const featureDem = fieldForFeature(f, dkELECTION, T.FeatureField.DemVotes);\n // const featureDem = outerThis._session.features.fieldForFeature(f, T.Dataset.ELECTION, T.FeatureField.DemVotes);\n const featureRep = fieldForFeature(f, dkELECTION, T.FeatureField.RepVotes);\n const featureTot = fieldForFeature(f, dkELECTION, T.FeatureField.TotalVotes);\n\n demVotes += featureDem;\n repVotes += featureRep;\n totVotes += featureTot;\n\n // NOTE: Unless you grab the values above before accumulating them,\n // you can't accumulate othVotes for districts. You must calculate\n // them by implication later.\n\n if (bLog)\n {\n const bBadElection = (featureDem + featureRep > featureTot) ? true : false;\n if (bBadElection) console.log(\"Statistics: Inconsistent election data for precinct:\", geoID, featureDem, featureRep, featureTot);\n }\n\n // Voting-age demographic breakdowns (or citizen voting-age)\n // 03-27-21\n const dkVAP: string = outerThis._session.features._keys[T.Dataset.VAP];\n totalVAP += fieldForFeature(f, dkVAP, T.FeatureField.TotalPop);\n // totalVAP += outerThis._session.features.fieldForFeature(f, T.Dataset.VAP, T.FeatureField.TotalPop);\n whitePop += fieldForFeature(f, dkVAP, T.FeatureField.WhitePop);\n blackPop += fieldForFeature(f, dkVAP, T.FeatureField.BlackPop);\n hispanicPop += fieldForFeature(f, dkVAP, T.FeatureField.HispanicPop);\n pacificPop += fieldForFeature(f, dkVAP, T.FeatureField.PacificPop);\n asianPop += fieldForFeature(f, dkVAP, T.FeatureField.AsianPop);\n nativePop += fieldForFeature(f, dkVAP, T.FeatureField.NativePop);\n }\n // }\n // else\n // {\n // if (bLog) console.log(\"Statistics: Skipping water-only feature in district statistics:\", geoID);\n // }\n });\n\n // COMPUTE DERIVED VALUES\n\n // MMD - Generalized the per-district population deviations's for MMD's with variable #'s of reps per district.\n // - The real districts are indexed 1–N.\n // - But the # reps per district are indexed from zero.\n // Population deviation % and equal population (boolean) by district.\n if (i > 0)\n {\n if (totalPop > 0)\n {\n const n = (repsByDistrict) ? repsByDistrict[i-1] : 1; // MMD - # of reps for the district\n popDevPct = (totalPop - (n * targetSize)) / (n * targetSize); // MMD\n // popDevPct = (totalPop - targetSize) / targetSize;\n bEqualPop = (Math.abs(popDevPct) <= deviationThreshold);\n }\n }\n\n // 10-22-2020 - Added Other votes. Revised from two-party to include Other.\n // let totVotes: number; <<< Now being accumulated by district\n let demPct: number = 0;\n let repPct: number = 0;\n let othPct: number = 0;\n let DemSeat: number = 0;\n\n // totVotes now being accumulated by district\n if (totVotes > 0)\n {\n // 10-24-2020 - Added guard against inconsistent election data.\n const bBadElection = (demVotes + repVotes > totVotes) ? true : false;\n if (bBadElection && bLog) console.log(\"Statistics: Inconsistent election data for district:\", i, demVotes, repVotes, totVotes);\n if (bBadElection) totVotes = demVotes + repVotes; // HACK to guard against bad election data!\n\n othVotes = totVotes - demVotes - repVotes;\n\n demPct = demVotes / totVotes;\n repPct = repVotes / totVotes;\n othPct = othVotes / totVotes;\n\n DemSeat = Partisan.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 = 0;\n let minorityPct: number = 0;\n let blackPct: number = 0;\n let hispanicPct: number = 0;\n let pacificPct: number = 0;\n let asianPct: number = 0;\n let nativePct: number = 0;\n\n if (totalVAP > 0)\n {\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 // COMPUTE DISTRICT-LEVEL VALUES\n\n // Validations\n\n // Leave the default values for the dummy unassigned district,\n // and districts that are empty.\n if ((i > 0) && bNotEmpty)\n {\n // GRAPH - 10/05/2020 - Using dra-graph instead.\n // bContiguous = isConnected(geoIDs, graph);\n // bNotEmbedded = (!isEmbedded(i, planByDistrict[i], plan, graph));\n\n // GRAPH - 10/05/2020 - Using dra-graph.\n const features = geoIDs;\n const nakedGraph = graph._graph;\n const nakedPlan = plan._planByGeoID;\n\n bContiguous = Graph.isConnected(features, nakedGraph, bLog);\n bNotEmbedded = (!Graph.isEmbedded(i, features, nakedPlan, nakedGraph, bLog));\n }\n\n { // UPDATE THE DISTRICT STATISTICS\n\n // NOTE - These are set below for both non-empty & empty districts:\n // * bNotEmpty;\n // * bContiguous;\n // * bNotEmbedded;\n // * totalPop;\n // * bEqualPop;\n\n this.table.popDevPct[i] = popDevPct;\n\n this.table.demVotes[i] = demVotes;\n this.table.repVotes[i] = repVotes;\n this.table.otherVotes[i] = othVotes;\n this.table.demPct[i] = demPct;\n this.table.repPct[i] = repPct;\n this.table.otherPct[i] = othPct;\n this.table.demSeat[i] = DemSeat;\n\n this.table.whitePop[i] = whitePop;\n this.table.minorityPop[i] = minorityPop;\n this.table.blackPop[i] = blackPop;\n this.table.hispanicPop[i] = hispanicPop;\n this.table.pacificPop[i] = pacificPop;\n this.table.asianPop[i] = asianPop;\n this.table.nativePop[i] = nativePop;\n\n this.table.totalVAP[i] = totalVAP;\n this.table.whitePct[i] = whitePct;\n this.table.minorityPct[i] = minorityPct;\n this.table.blackPct[i] = blackPct;\n this.table.hispanicPct[i] = hispanicPct;\n this.table.pacificPct[i] = pacificPct;\n this.table.asianPct[i] = asianPct;\n this.table.nativePct[i] = nativePct;\n }\n\n { // ACCUMULATE STATE STATISTICS FROM DISTRICT TOTALS\n\n // 10-22-2020 - Added Other votes\n stateTotVote += totVotes;\n // stateTPVote += totVotes;\n stateDemVote += demVotes;\n stateRepVote += repVotes;\n stateOthVote += othVotes;\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 else\n { // If a district is empty, zero these results (vs. null)\n this.table.popDevPct[i] = popDevPct;\n\n this.table.demVotes[i] = 0;\n this.table.repVotes[i] = 0;\n this.table.otherVotes[i] = 0;\n this.table.demPct[i] = 0;\n this.table.repPct[i] = 0;\n this.table.otherPct[i] = 0;\n this.table.demSeat[i] = 0;\n\n this.table.whitePop[i] = 0;\n this.table.minorityPop[i] = 0;\n this.table.blackPop[i] = 0;\n this.table.hispanicPop[i] = 0;\n this.table.pacificPop[i] = 0;\n this.table.asianPop[i] = 0;\n this.table.nativePop[i] = 0;\n\n this.table.totalVAP[i] = 0;\n this.table.whitePct[i] = 0;\n this.table.minorityPct[i] = 0;\n this.table.blackPct[i] = 0;\n this.table.hispanicPct[i] = 0;\n this.table.pacificPct[i] = 0;\n this.table.asianPct[i] = 0;\n this.table.nativePct[i] = 0;\n }\n\n { // UPDATE THESE DISTRICT STATISTICS, EVEN WHEN THEY ARE EMPTY\n this.table.totalPop[i] = totalPop;\n\n this.table.bNotEmpty[i] = bNotEmpty;\n this.table.bContiguous[i] = bContiguous;\n this.table.bNotEmbedded[i] = bNotEmbedded;\n this.table.bEqualPop[i] = bEqualPop;\n\n this.table.countySplits[i] = countySplits;\n }\n }\n\n // UPDATE STATE STATISTICS\n let summaryRow = this.numberOfRows() - 1;\n\n // 10-22-2020 - Added Other votes\n if (stateTotVote > 0)\n {\n this.table.demVotes[summaryRow] = stateDemVote;\n this.table.repVotes[summaryRow] = stateRepVote;\n\n this.table.demPct[summaryRow] = stateDemVote / stateTotVote;\n this.table.repPct[summaryRow] = stateRepVote / stateTotVote;\n this.table.otherPct[summaryRow] = stateOthVote / stateTotVote;\n }\n\n if (stateVAPPop > 0)\n {\n this.table.totalVAP[summaryRow] = stateVAPPop;\n this.table.whitePct[summaryRow] = stateWhitePop / stateVAPPop;\n this.table.minorityPct[summaryRow] = stateMinorityPop / stateVAPPop;\n this.table.blackPct[summaryRow] = stateBlackPop / stateVAPPop;\n this.table.hispanicPct[summaryRow] = stateHispanicPop / stateVAPPop;\n this.table.pacificPct[summaryRow] = statePacificPop / stateVAPPop;\n this.table.asianPct[summaryRow] = stateAsianPop / stateVAPPop;\n this.table.nativePct[summaryRow] = stateNativePop / stateVAPPop;\n }\n if (bLog)\n {\n console.log(`Statistics: ${nMissingDataset} features with missing datasets.`);\n console.log(`Statistics: ${nMissingProperty} features with missing properties.`);\n }\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 {\n extractDistrictProperties(this._session, bLog)\n }\n getCountyIndex(geoID: string): number\n {\n let countyFIPS = U.parseGeoID(geoID)['county'] as string;\n let countyIndex = this._session.counties.indexFromFIPS(countyFIPS);\n\n return countyIndex;\n }\n\n // 11-03-2020 - Added for racially polarized voting analysis\n extractVotesByDemographic(districtID: number, groups: Types.MinorityFilter, bLog: boolean = false): Types.DemographicVotingByFeature | undefined\n {\n let ids: string[] = [];\n let comparisonPts: Types.dictPoint[] = []; // Either White -or- (1 – <selected minority>) i.e., White++\n let hispanicPts: Types.dictPoint[] = [];\n let blackPts: Types.dictPoint[] = [];\n let pacificPts: Types.dictPoint[] = [];\n let asianPts: Types.dictPoint[] = [];\n let nativePts: Types.dictPoint[] = [];\n let minorityPts: Types.dictPoint[] = [];\n\n // let dataDump: any[] = []; // For testing\n\n // Gather [demographic %, D %] points for the selected district ID\n let i = districtID;\n\n // HACK - For comparing a minority group to everyone else (vs. just White),\n // infer the *single* minority group that has been selected.\n const selectedMinority: string = inferSelectedMinority(groups);\n\n // HACK - Because \"this\" gets ghosted inside the forEach loop below\n let outerThis = this;\n\n // Get the geoIDs assigned to the district\n // Guard against empty districts\n let geoIDs = this._session.plan.geoIDsForDistrictID(i);\n if (geoIDs && (geoIDs.size > 0))\n {\n // ... loop over the geoIDs collecting the points for ecological regression\n geoIDs.forEach(function (geoID: string): void\n {\n // Skip water-only features\n if (!(U.isWaterOnly(geoID)))\n {\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 if (!(f == undefined))\n {\n // Calculate the Dem two-party vote\n // 03-27-21\n const dkELECTION: string = outerThis._session.features._keys[T.Dataset.ELECTION];\n const featureDem = fieldForFeature(f, dkELECTION, T.FeatureField.DemVotes);\n const featureRep = fieldForFeature(f, dkELECTION, T.FeatureField.RepVotes);\n // const featureRep = outerThis._session.features.fieldForFeature(f, T.Dataset.ELECTION, T.FeatureField.RepVotes);\n\n if ((featureDem + featureRep) > 0)\n {\n const pctDem = featureDem / (featureDem + featureRep);\n\n // Calculate the VAP/CVAP percentages by demographic\n // 03-27-21\n const dkVAP: string = outerThis._session.features._keys[T.Dataset.VAP];\n const totalVAP = fieldForFeature(f, dkVAP, T.FeatureField.TotalPop);\n // const totalVAP = outerThis._session.features.fieldForFeature(f, T.Dataset.VAP, T.FeatureField.TotalPop);\n\n if (totalVAP > 0)\n {\n // Gather all points, for debugging purposes ...\n const hispanicVAP = fieldForFeature(f, dkVAP, T.FeatureField.HispanicPop);\n const blackVAP = fieldForFeature(f, dkVAP, T.FeatureField.BlackPop);\n const pacificVAP = fieldForFeature(f, dkVAP, T.FeatureField.PacificPop);\n const asianVAP = fieldForFeature(f, dkVAP, T.FeatureField.AsianPop);\n const nativeVAP = fieldForFeature(f, dkVAP, T.FeatureField.NativePop);\n\n const pctHispanic = hispanicVAP / totalVAP;\n const pctBlack = blackVAP / totalVAP;\n const pctPacific = pacificVAP / totalVAP;\n const pctAsian = asianVAP / totalVAP;\n const pctNative = nativeVAP / totalVAP;\n\n const whiteVAP = fieldForFeature(f, dkVAP, T.FeatureField.WhitePop);\n const minorityVAP = totalVAP - whiteVAP;\n const pctMinority = minorityVAP / totalVAP;\n\n let pctComparison = whiteVAP / totalVAP;\n if (groups.invertSelection)\n {\n switch (selectedMinority)\n {\n case 'Hispanic': {\n pctComparison = (totalVAP - hispanicVAP) / totalVAP;\n break;\n }\n case 'Black': {\n pctComparison = (totalVAP - blackVAP) / totalVAP;\n break;\n }\n case 'Pacific': {\n pctComparison = (totalVAP - pacificVAP) / totalVAP;\n break;\n }\n case 'Asian': {\n pctComparison = (totalVAP - asianVAP) / totalVAP;\n break;\n }\n case 'Native': {\n pctComparison = (totalVAP - nativeVAP) / totalVAP;\n break;\n }\n case 'Minority': {\n pctComparison = (totalVAP - minorityVAP) / totalVAP;\n break;\n }\n default: {\n console.log(\"Selected minority not recognized!\");\n break;\n }\n }\n }\n\n ids.push(geoID);\n comparisonPts.push({x: pctComparison, y: pctDem}); // White -or- (1 – <selected minority>)\n hispanicPts.push({x: pctHispanic, y: pctDem});\n blackPts.push({x: pctBlack, y: pctDem});\n pacificPts.push({x: pctPacific, y: pctDem});\n asianPts.push({x: pctAsian, y: pctDem});\n nativePts.push({x: pctNative, y: pctDem});\n minorityPts.push({x: pctMinority, y: pctDem});\n\n /* Dump test data based on config switch\n const s: AnalyticsSession = outerThis._session;\n const bDump = (('dump' in s.config) && s.config.dump) ? true : false;\n if (bDump)\n {\n const row: number[] = [pctWhite, pctMinority, pctBlack, pctHispanic, pctPacific, pctAsian, pctNative, pctDem];\n dataDump.push(row);\n }\n */\n }\n else\n {\n if (bLog) console.log(\"RPV: Total VAP not > 0.\")\n }\n }\n else\n {\n if (bLog) console.log(\"RPV: D + R not > 0.\")\n }\n }\n }\n });\n\n // ... but only keep points for the demographics that are going to be analyzed\n // dataDump = [];\n\n return {\n ids: ids,\n comparison: comparisonPts,\n minority: groups.minority ? minorityPts : [],\n black: groups.black ? blackPts : [],\n hispanic: groups.hispanic ? hispanicPts : [],\n pacific: groups.pacific ? pacificPts : [],\n asian: groups.asian ? asianPts : [],\n native: groups.native ? nativePts : []\n }\n }\n\n // If a district is empty\n return undefined;\n }\n}\n\nexport function inferSelectedMinority(groups: Types.MinorityFilter): string\n{\n if (groups.hispanic) return 'Hispanic';\n if (groups.black) return 'Black';\n if (groups.pacific) return 'Pacific';\n if (groups.asian) return 'Asian';\n if (groups.native) return 'Native';\n if (groups.minority) return 'Minority';\n\n return 'No minority selected!';\n}\n\n// CLASSES, ETC. FOR FEATURE & COUNTY DATA\n\n// Wrap data by feature, to abstract the specifics of the internal structure\nexport class Features\n{\n _session: AnalyticsSession;\n\n _data: T.GeoFeatureCollection;\n _keys: T.DatasetKeys;\n\n _featureIDs = {} as T.FeaturesByGeoID;\n\n constructor(s: AnalyticsSession, data: T.GeoFeatureCollection, keys: T.DatasetKeys)\n {\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 /* 03/27/21 - Moved to top-level & exported:\n geoIDForFeature(f: any): string\n {\n // 12-02-2020 - Switched to using ids vs. geoids per Terry\n if (f.properties && f.properties['id'])\n {\n return f.properties['id'];\n // GEOIDs will be one of these properties\n // const value = f.properties['GEOID10'] || f.properties['GEOID20'] || f.properties['GEOID'];\n\n // return value;\n }\n else\n {\n console.log(\"This feature does not have an id property:\", f);\n throw \"Feature with no id property.\";\n }\n }\n fieldForFeature(f: any, dt: T.Dataset, fk: string): any\n {\n const dk: string = this._keys[dt];\n\n let result = undefined;\n\n // 07-31-2020 - Fix to post-process PVI into the expected election composite format.\n if (dk === 'P16GPR')\n {\n // 10-27-2020 - Enabling a 'Tot' result for PVI, now that we're reporting 'Other'\n switch (fk)\n {\n case 'D': {\n result = (_getFeatures(f, dk, 'D12') + _getFeatures(f, dk, 'D16')) / 2;\n break;\n }\n case 'R': {\n result = (_getFeatures(f, dk, 'R12') + _getFeatures(f, dk, 'R16')) / 2;\n break;\n }\n case 'Tot': {\n result = (_getFeatures(f, dk, 'D12') + _getFeatures(f, dk, 'D16') + _getFeatures(f, dk, 'R12') + _getFeatures(f, dk, 'R16')) / 2;\n break;\n }\n default: {\n console.log(\"Field not recognized.\");\n break;\n }\n }\n // result = (_getFeatures(f, dk, (fk === 'D' ? 'D12' : 'R12')) + _getFeatures(f, dk, (fk === 'D' ? 'D16' : 'R16'))) / 2;\n }\n else\n result = _getFeatures(f, dk, fk);\n\n return result;\n }\n */\n resetDataset(d: T.Dataset, k: string): void\n {\n this._keys[d] = k;\n // NOTE - RECALC: Does anything need to be recalc'd now when a dataset is changed?\n }\n mapGeoIDsToFeatureIDs(): void\n {\n for (let i: number = 0; i < this._session.features.nFeatures(); i++)\n {\n let f: T.GeoFeature = this._session.features.featureByIndex(i);\n // 03-27-21\n let geoID: string = geoIDForFeature(f);\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\nexport function geoIDForFeature(f: any): string\n{\n // 12-02-2020 - Switched to using ids vs. geoids per Terry\n if (f.properties && f.properties['id'])\n {\n return f.properties['id'];\n // GEOIDs will be one of these properties\n // const value = f.properties['GEOID10'] || f.properties['GEOID20'] || f.properties['GEOID'];\n\n // return value;\n }\n else\n {\n console.log(\"This feature does not have an id property:\", f);\n throw \"Feature with no id property.\";\n }\n}\n\nexport function fieldForFeature(f: any, dk: string /* dt: T.Dataset */, ff: T.FeatureField): any\n{\n // const dk: string = this._keys[dt];\n\n const fk: string = T.fieldFromFeatureField(dk, ff);\n let result = undefined;\n\n // 07-31-2020 - Fix to post-process PVI into the expected election composite format.\n if (dk === 'P16GPR')\n {\n // 10-27-2020 - Enabling a 'Tot' result for PVI, now that we're reporting 'Other'\n switch (fk)\n {\n case 'D': {\n result = (_getFeatures(f, dk, 'D12') + _getFeatures(f, dk, 'D16')) / 2;\n break;\n }\n case 'R': {\n result = (_getFeatures(f, dk, 'R12') + _getFeatures(f, dk, 'R16')) / 2;\n break;\n }\n case 'Tot': {\n result = (_getFeatures(f, dk, 'D12') + _getFeatures(f, dk, 'D16') + _getFeatures(f, dk, 'R12') + _getFeatures(f, dk, 'R16')) / 2;\n break;\n }\n default: {\n console.log(\"Field not recognized.\");\n break;\n }\n }\n // result = (_getFeatures(f, dk, (fk === 'D' ? 'D12' : 'R12')) + _getFeatures(f, dk, (fk === 'D' ? 'D16' : 'R16'))) / 2;\n }\n else if (dk === 'P20GPR')\n {\n switch (fk)\n {\n case 'D': {\n result = (_getFeatures(f, 'E16GPR', 'D') + _getFeatures(f, 'E20GPR', 'D')) / 2;\n break;\n }\n case 'R': {\n result = (_getFeatures(f, 'E16GPR', 'R') + _getFeatures(f, 'E20GPR', 'R')) / 2;\n break;\n }\n case 'Tot': {\n result = (_getFeatures(f, 'E16GPR', 'D') + _getFeatures(f, 'E20GPR', 'D') + _getFeatures(f, 'E16GPR', 'R') + _getFeatures(f, 'E20GPR', 'R')) / 2;\n break;\n }\n default: {\n console.log(\"Field not recognized.\");\n break;\n }\n }\n }\n else\n result = _getFeatures(f, dk, fk);\n\n return result;\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\n\nfunction _getFeatures(f: any, datasetKey: string, p: string): number\n{\n if (! f.properties) return 0;\n if (f.properties.getDatasetField) return f.properties.getDatasetField(f, datasetKey, p);\n if (! f.properties.datasets) return 0;\n if (datasetKey && !f.properties.datasets[datasetKey]) return 0;\n let n = datasetKey ? f.properties.datasets[datasetKey][p] : f.properties[p];\n return !n || isNaN(n) ? 0 : n;\n}\n/* 01-04-22 -- Replaced with the above\nfunction _getFeatures(f: any, datasetKey: string, p: string): any\n{\n // Shim to load sample data2.json from disk for command-line scaffolding\n if (f.properties && f.properties['datasets'])\n {\n if (!f.properties['datasets'][datasetKey])\n {\n // Feature is missing the dataset\n nMissingDataset += 1;\n // console.log(`${nMissingDataset}: Data ${datasetKey} missing for feature ${f} Returning zero.`);\n\n return 0;\n }\n\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 {\n return f.properties[p];\n }\n\n // Joined property?\n let a: any[] = _fGetJoined(f);\n if (a)\n {\n for (let i: number = 0; i < a.length; i++)\n {\n let o: any = a[i];\n if (!datasetKey)\n {\n if (o[p] !== undefined)\n {\n return o[p];\n }\n }\n else\n {\n if (o['datasets'] && o['datasets'][datasetKey])\n {\n let v = (o['datasets'][datasetKey][p]);\n if ((!(v == null)) && (!(v == undefined)))\n {\n return o['datasets'][datasetKey][p];\n }\n }\n }\n }\n }\n\n // Feature is missing the property\n nMissingProperty += 1;\n // console.log(`${nMissingProperty}: ${p} value undefined for ${f.properties['GEOID10']}. Returning zero.`);\n\n return 0;\n // return undefined;\n}\n*/\n\nfunction _fGetJoined(f: any): any[]\n{\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{\n _session: AnalyticsSession;\n\n _data: T.GeoFeatureCollection;\n _countyNameLookup: T.FIPSCodeToCountyNameMap = {};\n\n nCounties: number;\n index = {} as T.FIPSToOrdinalMap;\n fips = {} as T.OrdinalToFIPSlMap;\n totalPopulation: number[] = [];\n\n constructor(s: AnalyticsSession, data: T.GeoFeatureCollection)\n {\n this._session = s;\n\n this._data = data;\n this.nCounties = this._data.features.length;\n }\n countyByIndex(i: number): T.GeoFeature { return this._data.features[i]; }\n // 10-16-21 - Analyze view crashing because county names were undefined in the lookup table.\n // Property had changed from 'NAME' to 'name' for *some* states.\n propertyForCounty(f: any, pk: string): any \n { \n return f.properties[pk] ? f.properties[pk] : f.properties[pk.toLowerCase()]; \n }\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\n// MMD - Extended this for # of reps\nexport class State\n{\n _session: AnalyticsSession;\n\n xx: string;\n nDistricts: number;\n nReps: number;\n totalPop: number = 0;\n targetSize: number = 0; // HACK - Will get set by doPreprocessCensus()\n tooBigFIPS = [] as string[];\n tooBigName = [] as string[];\n singleCountyDistrictMax = 0;\n expectedSplits = 0;\n expectedAffected = 0;\n\n constructor(s: AnalyticsSession, xx: string, n: number)\n {\n this._session = s;\n\n this.xx = xx;\n this.nDistricts = n;\n\n this.nReps = (s.repsByDistrict) ? s.repsByDistrict.reduce((a, b) => a + b, 0) : this.nDistricts; // MMD\n }\n}\n\nexport class Plan\n{\n _session: AnalyticsSession;\n\n // NOTE - RECALC: 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 {\n this._session = s;\n\n\n this._planByGeoID = p;\n this._planByDistrictID = {} as T.PlanByDistrictID;\n\n this.districtIDs = []; // Set when the plan in inverted\n }\n // NOTE - DON'T remove water-only features from the plan, as they may be required\n // for contiguity. Just skip them in aggregating district statistics.\n //\n // removeWaterOnlyFeatures(plan: T.PlanByGeoID): T.PlanByGeoID {\n // let newPlan = {} as T.PlanByGeoID;\n\n // for (let geoID in plan) {\n // // Remove water-only features\n // if (!(U.isWaterOnly(geoID))) {\n // newPlan[geoID] = plan[geoID];\n // }\n // else {\n // console.log(\"Removing water-only feature\", geoID);\n // }\n // }\n\n // return newPlan;\n // }\n invertPlan(bLog: boolean = false): void\n {\n this._planByDistrictID = invertPlan(this._planByGeoID, this._session, bLog);\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\n// Invert a feature assignment structure to sets of ids by district\nexport function invertPlan(plan: T.PlanByGeoID, s?: AnalyticsSession, bLog: boolean = false): T.PlanByDistrictID\n{\n let invertedPlan = {} as T.PlanByDistrictID;\n\n // Add a dummy 'unassigned' district\n invertedPlan[S.NOT_ASSIGNED] = new Set();\n\n // The feature assignments coming from DRA do not include unassigned ones.\n // - In the DRA-calling context, there's an analytics session with a reference\n // to the features. Loop over all the features to find the unassigned ones,\n // and add them to the dummy unassigned district explicitly.\n // - In the CLI-calling context, there's no session (yet) but the plan is complete.\n if (!(s == undefined))\n {\n for (let i: number = 0; i < s.features.nFeatures(); i++)\n {\n let f: T.GeoFeature = s.features.featureByIndex(i);\n // 03-27-21\n let geoID: string = geoIDForFeature(f);\n // let geoID: string = s.features.geoIDForFeature(f);\n\n // If the feature is NOT explicitly assigned to a district, add the geoID\n // to the dummy unassigned district 0.\n if (!(U.keyExists(geoID, plan))) invertedPlan[S.NOT_ASSIGNED].add(geoID);\n\n // NOTE - NOT skipping WATER-ONLY features here, because we're\n // not skipping them below when they are explicitly assigned in plans. Should\n // we skip them in both places?\n }\n }\n\n for (let geoID in plan)\n {\n let districtID = plan[geoID];\n\n // Make sure the set for the districtID exists\n if (!(U.objectContains(invertedPlan, districtID)))\n {\n invertedPlan[districtID] = new Set();\n }\n\n // Add the geoID to the districtID's set\n invertedPlan[districtID].add(geoID);\n\n if (U.isWaterOnly(geoID) && bLog) console.log(\"Invert plan: Water-only feature still in plan!\", geoID);\n }\n\n return invertedPlan;\n}\n\nexport class GraphClass\n{\n _session: AnalyticsSession;\n\n _graph: T.ContiguityGraph;\n\n constructor(s: AnalyticsSession, graph: T.ContiguityGraph)\n {\n this._session = s;\n\n this._graph = graph;\n }\n peerNeighbors(node: string): string[]\n {\n // Get the neighboring geoIDs connected to a geoID\n // Ignore the lengths of the shared borders (the values), for now\n\n // Protect against getting a GEOID that's not in the graph\n if (U.keyExists(node, this._graph))\n {\n // Handle both unweighted & weighted neighbors\n let n = this._graph[node];\n let l = (n instanceof Array) ? n : U.getObjectKeys(n);\n\n return l;\n\n // return U.getObjectKeys(this._graph[node]);\n }\n else return [];\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 { AnalyticsSession } from './_api';\n\nimport { doIsComplete, doIsContiguous, doIsFreeOfHoles } from './valid'\nimport { doHasEqualPopulations } from './equal';\n\nimport { doFindCountiesSplitUnexpectedly, doFindSplitVTDs } from './cohesive';\n\n// Compile district-level info for plan/map-level analytics\nexport function doAnalyzeDistricts(s: AnalyticsSession, bLog: boolean = false): void\n{\n s.districts.recalcStatistics(bLog);\n s.districts.extractDistrictShapeProperties(bLog);\n}\n\n// Calculate the analytics & validations and cache the results\n// NOTE - doAnalyzePlan() depends on doAnalyzeDistricts() having run first.\n// NOTE - I could make this table-driven, but I'm thinking that the explicit\n// calls might make chunking for aync easier.\nexport function doAnalyzePlan(s: AnalyticsSession, bLog: boolean = false): void\n{\n s.tests[T.Test.Complete] = doIsComplete(s, bLog);\n s.tests[T.Test.Contiguous] = doIsContiguous(s, bLog);\n s.tests[T.Test.FreeOfHoles] = doIsFreeOfHoles(s, bLog);\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 s.tests[T.Test.UnexpectedCountySplits] = doFindCountiesSplitUnexpectedly(s, bLog);\n s.tests[T.Test.VTDSplits] = doFindSplitVTDs(s, bLog);\n\n // Enable a Test Log and Scorecard to be generated\n s.bPlanAnalyzed = true;\n s.bPostProcessingDone = false;\n}\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//\nexport function doDeriveSecondaryTests(s: AnalyticsSession, bLog: boolean = false): void\n{\n s.tests[T.Test.EqualPopulation] = doHasEqualPopulations(s, bLog);\n}\n","//\n// SPLITTING\n//\n\nimport * as T from './types'\nimport * as U from './utils';\n\nimport { AnalyticsSession } from './_api';\n\n\n// The main county-district splitting code is in the dra-analytics package.\n\n\n// ANALYZE SIMPLE COUNTY & VTD SPLITTING\n\n/*\n \nSample results for NC 2016 dongressional plan\n________________________________________________________________________________\n \nState: NC\nCensus: 2010\nTotal population: 9,535,483\nNumber of districts: 13\nTarget district size: 733,499\nNumber of counties: 100\n \nEqual Population: 11.24% deviation\nCompactness: None\nProportionality: 27.67% gap\nCohesiveness: 11 unexpected splits, affecting 27.14% of the total population\n \nThese counties are split unexpectedly (meaning that they're smaller than a district):\n \n • Bladen\n • Buncombe\n • Catawba\n • Cumberland\n • Durham\n • Guilford\n • Iredell\n • Johnston\n • Pitt\n • Rowan\n • Wilson\n \n*/\n\n// 10-23-21 - This analysis *assumes* that a map is complete (or nearly so).\n// - We do the analysis regardless, but\n// - Protect against weird results in the client\nexport function doFindCountiesSplitUnexpectedly(s: AnalyticsSession, bLog: boolean = false): T.TestEntry\n{\n let test = s.getTest(T.Test.UnexpectedCountySplits) 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 SPLITTING FOR THE PLAN\n\n // Get the county-district pivot (\"splits\")\n let countiesByDistrict = s.districts.table.countySplits;\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 {\n // See if there's only one county partition\n // Ignore the dummy unassigned 0 \"county.\"\n let nCountiesInDistrict = 0;\n for (let c = 1; c <= s.counties.nCounties; c++)\n {\n // Guard against empty district\n if (countiesByDistrict[d])\n {\n if (countiesByDistrict[d][c] > 0)\n {\n nCountiesInDistrict += 1;\n if (nCountiesInDistrict > 1)\n {\n break;\n }\n }\n }\n }\n // If so, save the district\n if (nCountiesInDistrict == 1)\n {\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 // 07-17-21 - For enumerating # of times each split county is split\n let countyIndexesWithSplits: number[][] = [];\n\n // Ignore the dummy unassigned 0 \"county.\"\n for (let c = 1; c <= s.counties.nCounties; c++)\n {\n let nCountyParts = 0;\n let subtotal = 0;\n\n // Ignore the dummy unassigned 0 and N+1 summary \"districts.\"\n for (let d = 1; d <= s.state.nDistricts; d++)\n {\n // Guard against empty district\n if (countiesByDistrict[d])\n {\n if (countiesByDistrict[d][c] > 0)\n {\n nPartitionsOverall += 1;\n nCountyParts += 1;\n if (!(U.arrayContains(singleCountyDistricts, d)))\n {\n subtotal += countiesByDistrict[d][c];\n }\n }\n }\n }\n if (nCountyParts > 1)\n {\n splitCounties.add(c);\n totalAffected += subtotal;\n\n // 07-17-21 - Enumerate # of times each split county is split\n countyIndexesWithSplits.push([c, nCountyParts - 1]);\n }\n }\n\n // 07-17-21 - Enumerate # of times each split county is split\n let splitCountiesWithSplits: string[] = [];\n\n countyIndexesWithSplits.forEach(pair =>\n {\n const index: number = pair[0];\n const splits: number = pair[1];\n\n // Convert 1–N indices to FIPS codes\n const fips: string = s.counties.fips[index];\n\n if (fips) \n {\n // Convert FIPS codes to names\n const name: string = s.counties.nameFromFIPS(fips);\n\n // Combine # of splits with names\n if (name)\n {\n const text: string = `${name} (${splits})`;\n splitCountiesWithSplits.push(text);\n }\n }\n });\n // Sort by name\n splitCountiesWithSplits.sort();\n\n // End\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 {\n if (!(U.arrayContains(s.state.tooBigFIPS, fips)))\n {\n countiesSplitUnexpectedlyFIPS.push(fips);\n }\n }\n\n // ... and convert the FIPS codes to county names.\n for (let fips of countiesSplitUnexpectedlyFIPS)\n {\n const name = s.counties.nameFromFIPS(fips);\n\n // 07-06-20 - Guard in case the FIPS code isn't in the county name lookup\n if (name)\n countiesSplitUnexpectedly.push(name);\n else\n {\n if (bLog) console.log(\"County is not in the FIPS-to-name lookup table: \", fips);\n }\n }\n countiesSplitUnexpectedly = countiesSplitUnexpectedly.sort();\n\n\n test['score'] = U.trim(unexpectedAffected);\n test['details']['nSplits'] = nSplits;\n test['details']['unexpectedSplits'] = unexpectedSplits;\n test['details']['countiesSplitUnexpectedly'] = countiesSplitUnexpectedly;\n\n // 02-23-21 - Added single-county district details\n test['details']['expectedSplits'] = s.state.expectedSplits;\n test['details']['tooBigName'] = s.state.tooBigName;\n test['details']['singleCountyDistrictMax'] = s.state.singleCountyDistrictMax;\n test['details']['nCountiesSplit'] = splitCountiesFIPS.length;\n test['details']['nSingleCountyDistricts'] = singleCountyDistricts.length;\n\n // 07-17-21 - Enumerate # of times each split county is split\n test['details']['countiesWithSplits'] = splitCountiesWithSplits;\n\n return test;\n}\n\n// NOTE - This function just creates an empty container that dra-client fills in when generating the UI\nexport function doFindSplitVTDs(s: AnalyticsSession, bLog: boolean = false): T.TestEntry\n{\n let test = s.getTest(T.Test.VTDSplits) as T.TestEntry;\n\n let splitVTDs: string[] = [];\n\n test['score'] = splitVTDs.length;\n test['details']['splitVTDs'] = splitVTDs;\n\n return test;\n}\n\n","//\n// COMPACT\n//\n\nimport { Poly } from '@dra2020/baseclient';\n\nimport * as T from './types';\nimport * as U from './utils';\n\nimport { AnalyticsSession } from './_api';\n\n\n// The main compactness code is in the dra-analytics package.\n\n// HELPER TO EXTRACT PROPERTIES OF DISTRICT SHAPES\nexport function extractDistrictProperties(s: AnalyticsSession, bLog: boolean = false): void\n{\n // NOTE - I am assuming that district IDs are integers 1–N\n for (let i = 1; i <= s.state.nDistricts; i++)\n {\n const poly: any = s.districts.getDistrictShapeByID(i);\n\n // Guard against no shape for empty districts AND null shapes\n if (isAShape(poly))\n {\n const area: number = Poly.polyAreaFlat(poly);\n const perimeter: number = Poly.polyPerimeterFlat(poly);\n const diameter: number = Poly.polyDiameterFlat(poly);\n\n let props: T.DistrictShapeProperties = [0, 0, 0];\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\nfunction isAShape(poly: any): boolean\n{\n if (poly == null) return false;\n if (Poly.polyNull(poly)) return false;\n return poly.geometry && poly.geometry.coordinates && !U.isArrayEmpty(poly.geometry.coordinates);\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 { AnalyticsSession } from './_api';\n\n\n// MMD - This generalizes for variable #'s of reps per district.\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, bLog: boolean = false): T.TestEntry\n{\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 const popDevPct: number = popDevTest['score'] as number;\n // const popDevNormalized: number = popDevTest['normalizedScore'] as number;\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.table.bEqualPop;\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bEqualPop[summaryRow] = test['score'] as boolean;\n\n return test;\n}\n","//\n// THE DISTRICT-ANALYTICS NODE PACKAGE API\n//\n\nexport * from './_api';\nexport { geoIDForFeature, fieldForFeature, inferSelectedMinority } from './_data';\nexport * from './results';\nexport * from './types';\nexport\n{\n Profile, Scorecard, SplittingScorecard, Measurement\n} from './legacy-types';\nexport * from './utils';\n\n\n// Re-export RPV types and COI splitting functions\n\nimport { Minority, Partisan, Rate, Splitting, Types } from '@dra2020/dra-analytics';\n\n// See the Typescript pre-3.8 hack described here:\n// https://stackoverflow.com/questions/54953960/typescript-errors-when-importing-a-not-exported-type-even-though-it-is-export\nexport type MinorityFilter = Types.MinorityFilter;\nexport type Point = Types.dictPoint;\nexport type DemographicVotingByFeature = Types.DemographicVotingByFeature;\nexport type RPVFactor = Types.RPVFactor;\nexport type RPVAnalysis = Types.RPVAnalysis;\n\nexport const estSeatProbability = Partisan.estSeatProbability;\n\nexport const ratePartisanBias = Rate.ratePartisanBias;\nexport const normalizePartisanBias = Rate.normalizePartisanBias;\nexport const isAntimajoritarian = Rate.isAntimajoritarian;\nexport const avgSVError = Partisan.avgSVError;\n\nexport const effectiveSplits = Splitting.effectiveSplits;\nexport const uncertaintyOfMembership = Splitting.uncertaintyOfMembership;","//\n// PROTECTS MINORITIES\n//\n\nimport { Minority, Types } from '@dra2020/dra-analytics';\n\nimport * as T from './types'\nimport { AnalyticsSession } from './_api';\n\nimport majorityMinority from '../static/majority-minority.json';\nimport vraSection5 from '../static/vra5-preclearance.json';\n\n// TODO - Update/revise this, when the update comes out in September:\n// Sources for majority-minority info:\n// - https://en.wikipedia.org/wiki/List_of_majority-minority_United_States_congressional_districts\n// - http://www.ncsl.org/Portals/1/Documents/Redistricting/Redistricting_2010.pdf (PP. 80–84)\n// - https://www.justice.gov/crt/jurisdictions-previously-covered-section-5\n\n\nexport function getMajorityMinority(s: AnalyticsSession): T.Dict\n{\n const xx: string = s.state.xx;\n\n const mMDict: T.Dict = majorityMinority;\n const stateMM: T.Dict = mMDict[xx];\n\n return stateMM;\n}\n\nexport function getVRASection5(s: AnalyticsSession): string\n{\n const xx: string = s.state.xx;\n\n const vraPreDict: T.Dict = vraSection5;\n const stateVRAPre: string = vraPreDict[xx];\n\n return stateVRAPre;\n}\n\n// RPV - pulled into a separate component 11-17-2020\nexport function doAnalyzeRacialPolarization(s: AnalyticsSession, districtID: number, groups: Types.MinorityFilter, bLog: boolean = false): Types.RPVAnalysis | undefined\n{\n // Make sure that a minority is specified\n if (!(groups.black || groups.hispanic || groups.pacific || groups.asian || groups.native || groups.minority)) return undefined;\n\n const points = s.districts.extractVotesByDemographic(districtID, groups, bLog);\n\n // Make sure the district is not empty & there are enough points\n if (points === undefined) return undefined;\n if (points.comparison === undefined) return undefined;\n if (points.comparison.length <= 10) return undefined;\n\n return Minority.analyzeRacialVoting(points, districtID, groups);\n}\n\n// RPV is in the dra-analytics package.\n","//\n// PREPROCESS DATA\n//\n\nimport * as T from './types'\nimport * as U from './utils';\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, bLog: boolean = false): void\n{\n // If necessary, do one-time preprocessing\n if (!s.bOneTimeProcessingDone)\n {\n doPreprocessCountyFeatures(s, bLog);\n doPreprocessCensus(s, bLog);\n // doPreprocessElection(s, bLog);\n s.bOneTimeProcessingDone = true;\n }\n\n // Invert the plan by district ID\n s.plan.invertPlan(bLog);\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, bLog: boolean = false): void\n{\n let fipsCodes = [];\n\n // CREATE A MAP OF FIPS CODES TO NAMES\n\n for (let i: number = 0; i < s.counties.nCounties; i++)\n {\n\n let county = s.counties.countyByIndex(i);\n\n let fips = s.counties.propertyForCounty(county, 'COUNTYFP');\n fipsCodes.push(fips);\n\n let name = s.counties.propertyForCounty(county, 'NAME');\n\n s.counties.mapFIPSToName(fips, name);\n }\n\n // CREATE A FIPS CODE-ORDINAL MAP\n\n // Sort the FIPS codes in the county shapes\n fipsCodes = fipsCodes.sort();\n\n // Add a dummy county, for county-district splitting analysis.\n fipsCodes.unshift('000');\n // NOTE - This was added for the legacy SPLITTING implementation.\n\n // Create the ID-ordinal map\n for (let i in fipsCodes)\n {\n s.counties.index[fipsCodes[i]] = Number(i);\n\n // 07-17-21 - For enumerating # of times each split county is split\n s.counties.fips[Number(i)] = fipsCodes[i];\n } \n}\n\n\n// ANALYZE THE CENSUS BY COUNTY\n\nfunction doPreprocessCensus(s: AnalyticsSession, bLog: boolean = false): void\n{\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 // SUM TOTAL POPULATION BY COUNTY\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 {\n let f: T.GeoFeature = s.features.featureByIndex(i);\n // 03-27-21\n let geoID: string = D.geoIDForFeature(f);\n // let geoID: string = s.features.geoIDForFeature(f);\n // Skip water-only features\n if (!(U.isWaterOnly(geoID)))\n {\n // 03-27-21\n const dk: string = s.features._keys[T.Dataset.CENSUS];\n let value: number = D.fieldForFeature(f, dk, T.FeatureField.TotalPop);\n // let value: number = s.features.fieldForFeature(f, T.Dataset.CENSUS, T.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 countyFIPS = U.parseGeoID(geoID)['county'] as string;\n\n // Ignore features when the county is unrecognized\n if (U.keyExists(countyFIPS, s.counties.index))\n {\n // If a subtotal for the county doesn't exist, initialize one\n if (!(U.keyExists(countyFIPS, totalByCounty)))\n {\n totalByCounty[countyFIPS] = 0;\n }\n // Sum total population by county\n totalByCounty[countyFIPS] += value;\n }\n else\n {\n if (bLog) console.log(\"County not recognized:\", geoID);\n }\n }\n else\n {\n if (bLog) console.log(\"Skipping water-only feature in Census preprocessing:\", geoID);\n }\n }\n // NOTE - The above could be replaced, if I got totals on county.geojson.\n\n\n /* Moved this to doPreprocessCountyFeatures() - 09-14-2020 to fix VA county mismatch bug\n // CREATE A FIPS CODE-ORDINAL MAP\n\n // Get the county FIPS codes\n let fipsCodes = U.getObjectKeys(totalByCounty);\n // Sort the results\n fipsCodes = fipsCodes.sort();\n\n // NOTE - This was added for the legacy SPLITTING implementation.\n // Add a dummy county, for county-district splitting analysis.\n fipsCodes.unshift('000');\n\n // Create the ID-ordinal map\n for (let i in fipsCodes)\n {\n s.counties.index[fipsCodes[i]] = Number(i);\n }\n */\n\n // MAKE AN ARRAY OF TOTAL POPULATIONS BY COUNTY INDEX\n\n // Add an extra 0th virtual county bucket for county-district splitting analysis \n let nCountyBuckets = s.counties.nCounties + 1;\n let countyTotals: number[] = U.initArray(nCountyBuckets, 0);\n\n for (let fipsCode in totalByCounty)\n {\n let i = s.counties.indexFromFIPS(fipsCode);\n\n countyTotals[i] = totalByCounty[fipsCode];\n }\n\n s.counties.totalPopulation = countyTotals;\n\n // MMD - Rationalized calculation of target size *per rep*\n s.state.targetSize = s.state.totalPop / s.state.nReps;\n\n // ANALYZE THE COUNTIES\n\n // MMD - This \"these counties must be split\" analysis does NOT generalize to heterogenous MMD.\n // 'target_size': 733499, # calc as total / districts\n const targetSize = s.state.targetSize;\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 singleCountyDistrictMax = 0;\n let expectedSplits = 0;\n let expectedAffected = 0;\n\n // Get the county FIPS codes\n let fipsCodes = U.getObjectKeys(s.counties.index);\n\n // Loop over the counties\n for (let county in fipsCodes)\n {\n let fipsCode = fipsCodes[county];\n\n // Skip the dummy county\n if (fipsCode == '000') continue;\n\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 {\n countyAffected = totalByCounty[fipsCode] % targetSize;\n tooBigFIPS.push(fipsCode);\n tooBigName.push(s.counties.nameFromFIPS(fipsCode));\n singleCountyDistrictMax += countySplits;\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 s.state.singleCountyDistrictMax = singleCountyDistrictMax;\n}\n\n\n// PREPROCESS ELECTION RESULTS\n\n// function doPreprocessElection(s: AnalyticsSession, bLog: boolean = false): void\n// {\n// if (bLog) console.log(\"Preprocessing election data ...\");\n// }\n\n","//\n// TEMPLATES FOR UNFORMATTED ANALYTICS RESULTS\n// \n\nimport * as Score from './legacy-types';\n\nimport * as T from './types';\nimport * as U from './utils';\n\nimport { AnalyticsSession } from './_api';\nimport { doDeriveSecondaryTests } from './analyze';\n\n\nexport type RequirementsChecklist = {\n score: boolean; // T.TriState;\n metrics: {\n complete: boolean; // T.TriState;\n contiguous: boolean; // T.TriState;\n freeOfHoles: boolean; // T.TriState;\n equalPopulation: boolean; // T.TriState;\n };\n details: {\n unassignedFeatures: string[]; // A possibly empty list of GEOIDs\n emptyDistricts: number[]; // A possibly empty list of district IDs\n discontiguousDistricts: number[]; // Ditto\n embeddedDistricts: number[]; // Ditto\n populationDeviation: number; // A fraction [0.0 – 1.0] to represent as a %\n deviationThreshold: number; // A fraction [0.0 – 1.0] to represent as a % \n };\n datasets: T.Datasets;\n resources: {\n // stateReqs: string;\n };\n};\n\nexport function prepareRequirementsChecklist(s: AnalyticsSession, bLog: boolean = false): RequirementsChecklist\n{\n if (!(s.bPostProcessingDone))\n {\n doAnalyzePostProcessing(s);\n }\n\n // REQUIREMENTS CATEGORY\n let paRequirements: RequirementsChecklist;\n\n {\n const completeTest = s.getTest(T.Test.Complete) as T.TestEntry;\n const contiguousTest = s.getTest(T.Test.Contiguous) as T.TestEntry;\n const freeOfHolesTest = s.getTest(T.Test.FreeOfHoles) as T.TestEntry;\n const equalPopulationTest = s.getTest(T.Test.EqualPopulation) as T.TestEntry;\n\n // Combine individual checks into an overall score\n\n const completeMetric = completeTest['score'] as boolean;\n const contiguousMetric = contiguousTest['score'] as boolean;\n const freeOfHolesMetric = freeOfHolesTest['score'] as boolean;\n const equalPopulationMetric = equalPopulationTest['score'] as boolean;\n const reqScore: boolean = completeMetric && contiguousMetric && freeOfHolesMetric && equalPopulationMetric;\n\n /* T.TriState\n // NOTE - Until we add three-state support top to bottom in\n // requirements/validations, map booleans to tri-states here.\n const completeMetric = U.mapBooleanToTriState(completeTest['score'] as boolean);\n const contiguousMetric = U.mapBooleanToTriState(contiguousTest['score'] as boolean);\n const freeOfHolesMetric = U.mapBooleanToTriState(freeOfHolesTest['score'] as boolean);\n const equalPopulationMetric = U.mapBooleanToTriState(equalPopulationTest['score'] as boolean);\n\n let reqScore: T.TriState = T.TriState.Green;\n const checks = [completeMetric, contiguousMetric, freeOfHolesMetric, equalPopulationMetric];\n if (checks.includes(T.TriState.Yellow)) reqScore = T.TriState.Yellow;\n if (checks.includes(T.TriState.Red)) reqScore = T.TriState.Red;\n */\n\n // Get values to support details entries\n const unassignedFeaturesDetail = U.deepCopy(completeTest['details']['unassignedFeatures']) || [];\n const emptyDistrictsDetail = U.deepCopy(completeTest['details']['emptyDistricts']) || [];\n const discontiguousDistrictsDetail = U.deepCopy(contiguousTest['details']['discontiguousDistricts']) || [];\n const embeddedDistrictsDetail = U.deepCopy(freeOfHolesTest['details']['embeddedDistricts']) || [];\n\n const populationDeviationDetail = U.deepCopy(equalPopulationTest['details']['deviation']);\n const deviationThresholdDetail = U.trim(s.populationDeviationThreshold());\n \n // const xx: string = s.state.xx;\n // const stateReqsDict: T.Dict = allStateReqs;\n // const reqLinkToStateReqs: string = stateReqsDict[xx];\n\n // Populate the category\n paRequirements = {\n score: reqScore,\n metrics: {\n complete: completeMetric,\n contiguous: contiguousMetric,\n freeOfHoles: freeOfHolesMetric,\n equalPopulation: equalPopulationMetric\n },\n details: {\n unassignedFeatures: unassignedFeaturesDetail,\n emptyDistricts: emptyDistrictsDetail,\n discontiguousDistricts: discontiguousDistrictsDetail,\n embeddedDistricts: embeddedDistrictsDetail,\n populationDeviation: populationDeviationDetail,\n deviationThreshold: deviationThresholdDetail\n },\n datasets: {\n census: U.deepCopy(s.config['descriptions']['CENSUS']),\n },\n resources: {\n // stateReqs: reqLinkToStateReqs\n }\n }\n }\n\n return paRequirements;\n}\n\n// DISTRICT STATISTICS\n\nexport type DistrictRow = {\n districtID: number;\n totalPop: number;\n popDevPct: number;\n bEqualPop: boolean;\n bNotEmpty: boolean;\n bContiguous: boolean;\n bNotEmbedded: boolean;\n demPct: number;\n repPct: number;\n othPct: number;\n totalVAP: number;\n whitePct: number;\n minorityPct: number;\n blackPct: number;\n hispanicPct: number;\n pacificPct: number;\n asianPct: number;\n nativePct: number;\n};\n\nexport type DistrictStatistics = {\n table: DistrictRow[];\n details: {}; // None at this time\n datasets: T.Datasets;\n resources: {}; // None at this time\n}\n\n// Create a DistrictStatistics instance, deep copying the underlying values.\nexport function prepareDistrictStatistics(s: AnalyticsSession, bLog: boolean = false): DistrictStatistics\n{\n if (!(s.bPostProcessingDone))\n {\n doAnalyzePostProcessing(s);\n }\n\n // Transpose the rows & columns, so rows are districts.\n let dsTable: DistrictRow[] = [];\n for (let i = 0; i < s.districts.numberOfRows(); i++)\n {\n const rawRow: DistrictRow = {\n districtID: i,\n totalPop: s.districts.table.totalPop[i],\n popDevPct: s.districts.table.popDevPct[i],\n bEqualPop: s.districts.table.bEqualPop[i],\n bNotEmpty: s.districts.table.bNotEmpty[i],\n bContiguous: s.districts.table.bContiguous[i],\n bNotEmbedded: s.districts.table.bNotEmbedded[i],\n demPct: s.districts.table.demPct[i],\n repPct: s.districts.table.repPct[i],\n othPct: s.districts.table.otherPct[i],\n whitePct: s.districts.table.whitePct[i],\n totalVAP: s.districts.table.totalVAP[i],\n minorityPct: s.districts.table.minorityPct[i],\n blackPct: s.districts.table.blackPct[i],\n hispanicPct: s.districts.table.hispanicPct[i],\n pacificPct: s.districts.table.pacificPct[i],\n asianPct: s.districts.table.asianPct[i],\n nativePct: s.districts.table.nativePct[i]\n };\n\n const readyRow: DistrictRow = U.deepCopy(rawRow);\n dsTable.push(readyRow);\n }\n\n const dsDetails = {\n // None at this time\n };\n\n const dsDatasets: T.Datasets = {\n shapes: U.deepCopy(s.config['descriptions']['SHAPES']), // 2020\n census: U.deepCopy(s.config['descriptions']['CENSUS']),\n vap: U.deepCopy(s.config['descriptions']['VAP']),\n election: U.deepCopy(s.config['descriptions']['ELECTION'])\n }\n\n const dsResources = {\n // None at this time\n };\n\n const ds: DistrictStatistics = {\n table: dsTable,\n details: dsDetails,\n datasets: dsDatasets,\n resources: dsResources\n };\n\n return ds;\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, bLog: boolean = false): void\n{\n // Just populate the normalized population deviation score in the test\n const scorecard = s._scorecard as Score.Scorecard;\n let popDev = s.getTest(T.Test.PopulationDeviation) as T.TestEntry;\n popDev['normalizedScore'] = scorecard.populationDeviation.normalized;\n\n const datasets: T.Datasets = {\n shapes: U.deepCopy(s.config['descriptions']['SHAPES']), // 2020\n census: U.deepCopy(s.config['descriptions']['CENSUS']),\n vap: U.deepCopy(s.config['descriptions']['VAP']),\n election: U.deepCopy(s.config['descriptions']['ELECTION'])\n }\n scorecard.partisan.details['election'] = datasets.election;\n scorecard.minority.details['vap'] = datasets.vap;\n scorecard.details['shapes'] = datasets.shapes;\n scorecard.details['census'] = datasets.census;\n\n const simpleSplits = s.getTest(T.Test.UnexpectedCountySplits) as T.TestEntry;\n scorecard.splitting.details['unexpectedAffected'] = simpleSplits['score'];\n scorecard.splitting.details['nSplits'] = simpleSplits['details']['nSplits'];\n scorecard.splitting.details['countiesSplitUnexpectedly'] = U.deepCopy(simpleSplits['details']['countiesSplitUnexpectedly']);\n\n // 02-23-21 - Added single-county district details\n scorecard.splitting.details['nTooBigCounties'] = simpleSplits['details']['expectedSplits'];\n scorecard.splitting.details['tooBigName'] = simpleSplits['details']['tooBigName'];\n scorecard.splitting.details['nCountiesSplit'] = simpleSplits['details']['nCountiesSplit'];\n scorecard.splitting.details['nSingleCountyDistricts'] = simpleSplits['details']['nSingleCountyDistricts'];\n scorecard.splitting.details['singleCountyDistrictMax'] = simpleSplits['details']['singleCountyDistrictMax'];\n\n // 07-17-21 - Enumerate # of times each split county is split\n scorecard.splitting.details['countiesWithSplits'] = simpleSplits['details']['countiesWithSplits'];\n\n // NOTE - Add split precincts in dra-client directly\n\n // Derive secondary tests\n // Note - The only secondary test is 'roughly equal population (true/false)\n doDeriveSecondaryTests(s, bLog);\n\n // Toggle the semaphore, so postprocessing isn't for both the testlog & scorecard\n s.bPostProcessingDone = true;\n}\n\n","//\n// SCORING\n// \n\nimport * as L from './legacy-types';\n\nimport * as T from './types';\nimport * as U from './utils';\nimport { AnalyticsSession } from './_api';\n\nimport { Compactness, Equal, Minority, Partisan, Rate, Splitting, Types, Utils } from '@dra2020/dra-analytics';\n\n\n// PROFILE A PLAN\n\nconst KEEP_DECIMALS: number = 6;\n\n// MMD - Added # reps per district to the profile\nexport function profilePlan(s: AnalyticsSession, bLog: boolean = false): L.Profile\n{\n const state: string = s.state.xx;\n const planName: string = s.title;\n const nDistricts: number = s.state.nDistricts;\n const nReps: number = s.state.nReps; // MMD\n const nCounties: number = s.counties.nCounties;\n\n const targetSize = Math.round(s.state.totalPop / nReps); // MMD\n // const targetSize: number = Math.round(s.state.totalPop / nDistricts);\n const popByDistrict: number[] = U.deepCopy(s.districts.table.totalPop.slice(1, -1)) as number[];\n\n const geoPropsByDistrict: L.GeoProperties[] = makeArrayOfGeoProps(s, bLog);\n\n const splits: number[][] = makeNakedCxD(s);\n\n const summaryRow: number = s.districts.numberOfRows() - 1;\n\n // 10-22-2020 - Converted Dem + Rep + Other = Total to two-party vote shares for analytics.\n const demVote: number = s.districts.table.demVotes[summaryRow];\n const repVote: number = s.districts.table.repVotes[summaryRow];\n\n const statewideVf: number = U.trim(demVote / (demVote + repVote), KEEP_DECIMALS);\n\n let vpiArray: number[] = [];\n const demVotes: number[] = U.deepCopy(s.districts.table.demVotes.slice(1, -1)) as number[];\n const repVotes: number[] = U.deepCopy(s.districts.table.repVotes.slice(1, -1)) as number[];\n\n for (let districtID = 1; districtID <= nDistricts; districtID++)\n {\n const D = demVotes[districtID - 1];\n const R = repVotes[districtID - 1];\n const T = D + R;\n const v = (T > 0) ? U.trim(D / T, KEEP_DECIMALS) : 0;\n vpiArray.push(v);\n }\n\n const statewideDemographics: L.Demographics = getStatewideDemographics(s);\n const demographicsByDistrict: L.Demographics[] = getDemographicsByDistrict(s);\n\n // MMD - Extended the profile for # reps per district\n const profile: L.Profile = {\n state: state,\n name: planName,\n nDistricts: nDistricts,\n repsByDistrict: s.repsByDistrict, // MMD\n nCounties: nCounties,\n bStateLeg: s.legislativeDistricts, // TODO - 2020\n population: {\n byDistrict: popByDistrict,\n targetSize: targetSize\n },\n shapes: geoPropsByDistrict,\n counties: splits,\n partisanship: {\n statewide: statewideVf,\n byDistrict: vpiArray\n },\n demographics: {\n statewide: statewideDemographics,\n byDistrict: demographicsByDistrict\n }\n }\n\n return profile;\n}\n\n// NOTE - The CxD splits structure from _data.ts includes dummy districts for\n// unassigned precincts & state summary and an extra 0 county. But dra-score takes\n// a simple 1–D x 1–C splits array (zero-based, of course).\nfunction makeNakedCxD(s: AnalyticsSession, bLog: boolean = false): number[][]\n{\n const adornedCxD: number[][] = s.districts.table.countySplits;\n let CxD: number[][] = [];\n\n // Remove the unassigned & total dummy \"districts\"\n for (let districtID = 1; districtID <= s.state.nDistricts; districtID++)\n {\n const splits = U.deepCopy(adornedCxD[districtID].slice(1));\n\n CxD.push(splits);\n }\n\n return CxD;\n}\n\nfunction makeArrayOfGeoProps(s: AnalyticsSession, bLog: boolean = false): L.GeoProperties[]\n{\n let geometryByDistrict: L.GeoProperties[] = [];\n\n for (let districtID = 1; districtID <= s.state.nDistricts; districtID++)\n {\n let districtProps = s.districts.getGeoProperties(districtID);\n // Guard against no shape and no properties\n if (districtProps)\n {\n let a = U.trim(districtProps[T.DistrictShapeProperty.Area], KEEP_DECIMALS);\n let p = U.trim(districtProps[T.DistrictShapeProperty.Perimeter], KEEP_DECIMALS);\n let d = U.trim(districtProps[T.DistrictShapeProperty.Diameter], KEEP_DECIMALS);\n\n // Save each triple\n geometryByDistrict.push({ area: a, perimeter: p, diameter: d });\n }\n }\n\n return geometryByDistrict;\n}\n\nfunction getDemographicsByDistrict(s: AnalyticsSession, bLog: boolean = false): L.Demographics[]\n{\n let demographicsArray: L.Demographics[] = [];\n\n // Remove the unassigned & total dummy \"districts\"\n for (let districtID = 1; districtID <= s.state.nDistricts; districtID++)\n {\n const districtDemographics: L.Demographics = {\n white: U.trim(s.districts.table.whitePct[districtID], KEEP_DECIMALS),\n minority: U.trim(s.districts.table.minorityPct[districtID], KEEP_DECIMALS),\n black: U.trim(s.districts.table.blackPct[districtID], KEEP_DECIMALS),\n hispanic: U.trim(s.districts.table.hispanicPct[districtID], KEEP_DECIMALS),\n pacific: U.trim(s.districts.table.pacificPct[districtID], KEEP_DECIMALS),\n asian: U.trim(s.districts.table.asianPct[districtID], KEEP_DECIMALS),\n native: U.trim(s.districts.table.nativePct[districtID], KEEP_DECIMALS)\n };\n\n demographicsArray.push(districtDemographics);\n }\n\n return demographicsArray;\n}\n\nexport function getStatewideDemographics(s: AnalyticsSession, bLog: boolean = false): L.Demographics\n{\n const summaryRow = s.districts.numberOfRows() - 1;\n\n const demographics: L.Demographics = {\n white: U.trim(s.districts.table.whitePct[summaryRow], KEEP_DECIMALS),\n minority: U.trim(s.districts.table.minorityPct[summaryRow], KEEP_DECIMALS),\n black: U.trim(s.districts.table.blackPct[summaryRow], KEEP_DECIMALS),\n hispanic: U.trim(s.districts.table.hispanicPct[summaryRow], KEEP_DECIMALS),\n pacific: U.trim(s.districts.table.pacificPct[summaryRow], KEEP_DECIMALS),\n asian: U.trim(s.districts.table.asianPct[summaryRow], KEEP_DECIMALS),\n native: U.trim(s.districts.table.nativePct[summaryRow], KEEP_DECIMALS)\n };\n\n return demographics;\n}\n\n\n// SCORE A PLAN using dra-analytics\n\nexport function computeMetrics(p: L.Profile, districtShapes: T.GeoFeatureCollection, bLog: boolean = false): Types.Scorecard\n{\n if (bLog) console.log(\"Computing metrics ...\");\n\n const bLegislative = p.bStateLeg;\n\n // Calculate bias & responsiveness metrics ...\n const byDistrictVf = p.partisanship.byDistrict;\n const statewideVf = p.partisanship.statewide;\n let _pS = Partisan.makePartisanScorecard(statewideVf, byDistrictVf, bLog);\n\n // Calculate minority representation metrics ...\n const statewideDemos = p.demographics.statewide;\n const byDistrictDemos = p.demographics.byDistrict;\n let _mS = Minority.makeMinorityScorecard(statewideDemos, byDistrictDemos, bLog);\n\n // Calculate compactness metrics ...\n let _cS = Compactness.makeCompactnessScorecard(districtShapes, bLog);\n\n // Calculate county-district splitting metrics ...\n const CxD = p.counties;\n const _sS = Splitting.makeSplittingScorecard(CxD, bLog);\n\n // MMD - Add # reps per district to call\n // Calculate population deviation-related metrics ...\n const totPopByDistrict = p.population.byDistrict;\n const targetSize = p.population.targetSize;\n const repsByDistrict = p.repsByDistrict;\n const _pdS = Equal.makePopulationScorecard(totPopByDistrict, targetSize, bLegislative, repsByDistrict, bLog);\n\n const details: Types.Dict = {};\n\n // Assemble the pieces into new scorecard\n const scorecard: Types.Scorecard = {\n partisan: _pS,\n minority: _mS,\n compactness: _cS,\n splitting: _sS,\n populationDeviation: _pdS,\n details: details,\n scratchpad: {} // Hack to pass legacy values between processing steps\n }\n\n return scorecard;\n}\n\nexport function rateKeyDimensions(scorecard: Types.Scorecard, p: L.Profile, bLog: boolean = false): Types.Scorecard\n{\n if (bLog) console.log(\"Rating key dimensions ...\");\n const bLegislative = p.bStateLeg;\n\n // Rate proportionality\n const statewideVf = p.partisanship.statewide;\n const Sf = scorecard.partisan.bias.estSf;\n scorecard.partisan.bias.score = Rate.rateProportionality(scorecard.partisan.bias.deviation, statewideVf, Sf);\n\n // Rate competititveness\n scorecard.partisan.responsiveness.score = Rate.rateCompetitiveness(scorecard.partisan.responsiveness.cDf);\n\n // Rate minority representation\n const rawOd = scorecard.minority.opportunityDistricts; \n const pOd = scorecard.minority.proportionalOpportunities;\n const rawCd = scorecard.minority.coalitionDistricts;\n const pCd = scorecard.minority.proportionalCoalitions;\n scorecard.minority.score = Rate.rateMinorityRepresentation(rawOd, pOd, rawCd, pCd);\n\n // Rate compactness\n const avgReock = scorecard.compactness.avgReock;\n const avgPolsby = scorecard.compactness.avgPolsby;\n const reockRating = Rate.rateReock(avgReock);\n const polsbyRating = Rate.ratePolsby(avgPolsby);\n scorecard.compactness.score = Rate.rateCompactness(reockRating, polsbyRating);\n\n // Rate county- & district-splitting\n const rawCountySplitting = scorecard.splitting.county;\n const rawDistrictSplitting = scorecard.splitting.district;\n const nCounties = p.nCounties;\n const nDistricts = p.nDistricts;\n const countyRating = Rate.rateCountySplitting(rawCountySplitting, nCounties, nDistricts);\n const districtRating = Rate.rateDistrictSplitting(rawDistrictSplitting, nCounties, nDistricts);\n scorecard.splitting.score = Rate.rateSplitting(countyRating, districtRating);\n\n // Rate population deviation\n const rawDeviation = scorecard.populationDeviation.deviation;\n scorecard.populationDeviation.score = Rate.ratePopulationDeviation(rawDeviation, bLegislative);\n\n // Squirrel away normalized compactness & splitting ratings for the legacy scorecard\n const keep: Types.Dict = {\n reockScore: reockRating,\n polsbyScore: polsbyRating,\n countyScore: countyRating,\n districtScore: districtRating\n };\n scorecard.scratchpad = keep;\n\n return scorecard;\n}\n\nexport function thunkScorecard(newScorecard: Types.Scorecard, bLog: boolean = false): L.Scorecard \n{\n if (bLog) console.log(\"Thunking new scorecard into legacy structure ...\");\n\n const scratchpad = newScorecard.scratchpad as Types.Dict;\n\n // Partisan scorecard\n const pS: L.PartisanScorecard = U.deepCopy(newScorecard.partisan) as L.PartisanScorecard;\n\n // EXPERIMENTAL\n const lPropAlt = newScorecard.partisan.experimental.lProp;\n if (lPropAlt) pS.details['lProp'] = lPropAlt;\n\n const lUE = newScorecard.partisan.experimental.lUE;\n if (lUE) pS.details['lUE'] = lUE;\n\n // Minority scorecard\n const mS: L.MinorityScorecard = U.deepCopy(newScorecard.minority) as L.MinorityScorecard;\n\n // Compactness scorecard\n const reockM: L.Measurement = {\n raw: newScorecard.compactness.avgReock,\n normalized: scratchpad.reockScore,\n notes: {}\n };\n const polsbyM: L.Measurement = {\n raw: newScorecard.compactness.avgPolsby,\n normalized: scratchpad.polsbyScore,\n notes: {}\n };\n let cS: L.CompactnessScorecard = {\n score: newScorecard.compactness.score as number,\n reock: reockM,\n polsby: polsbyM,\n details: U.deepCopy(newScorecard.compactness.details)\n };\n // Relocate byDistrict compactness #'s\n cS.details.byDistrict = U.deepCopy(newScorecard.compactness.byDistrict);\n // Add KIWYSI compactness score\n cS.details['kiwysi'] = newScorecard.compactness.avgKWIWYSI;\n\n // Splitting scorecard\n const countyM: L.Measurement = {\n raw: newScorecard.splitting.county,\n normalized: scratchpad.countyScore,\n notes: {}\n };\n const districtM: L.Measurement = {\n raw: newScorecard.splitting.district,\n normalized: scratchpad.districtScore,\n notes: {}\n };\n const sS: L.SplittingScorecard = {\n score: newScorecard.splitting.score as number,\n county: countyM,\n district: districtM,\n details: U.deepCopy(newScorecard.splitting.details)\n };\n\n // Population (equality) scorecard\n const pdM: L.Measurement = {\n raw: newScorecard.populationDeviation.deviation,\n normalized: newScorecard.populationDeviation.score as number,\n notes: newScorecard.populationDeviation.notes\n };\n const pdS: L.PopulationScorecard = pdM;\n\n const scorecard: L.Scorecard = {\n partisan: pS,\n minority: mS,\n compactness: cS,\n splitting: sS,\n populationDeviation: pdS,\n details: newScorecard.details\n }\n\n return scorecard;\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// The dummy district ID for features not assigned districts yet\nexport const NOT_ASSIGNED: number = 0;\n\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","//\n// TYPE DEFINITIONS\n//\n\nimport * as geojson from 'geojson';\nimport * as DT from '@dra2020/dra-types';\n\n// INPUT DATA TYPES\n\n// MMD - Extended for optional # reps per district\n// The SessionRequest specifies an analytics session\nexport type SessionRequest = {\n title: string;\n stateXX: string;\n nDistricts: number;\n repsByDistrict?: number[], // MMD\n planType?: DT.PlanType; // 2020\n legislativeDistricts?: boolean; // 2020\n plan: PlanByGeoID;\n data: GeoFeatureCollection;\n districtShapes: GeoFeatureCollection;\n // districtProperties: DistrictProperties; REMOVED 07-07-20 - not used\n graph: ContiguityGraph;\n counties: GeoFeatureCollection;\n config: {}\n}\n\n// 08-13-2020 - Moved from _data.ts\nexport const enum Dataset\n{\n SHAPES = \"SHAPES\",\n CENSUS = \"CENSUS\",\n VAP = \"VAP\",\n ELECTION = \"ELECTION\"\n}\n\n// 08-13-2020 - Moved from _data.ts\nexport type DatasetKeys = {\n SHAPES: string; // A shapefile\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\n// 08-13-2020 - Moved from _data.ts\n// Identifiers of fields for each feature in the datasets\nexport const enum FeatureField\n{\n TotalPop,\n WhitePop,\n BlackPop,\n HispanicPop,\n AsianPop,\n PacificPop,\n NativePop,\n DemVotes,\n RepVotes,\n // NOTE: \"Other\" is implied as Tot - D - R\n TotalVotes,\n}\n\nexport function fieldFromFeatureField(ds: string, ff: FeatureField): string\n{\n switch (ff)\n {\n case FeatureField.TotalPop: return \"Tot\";\n case FeatureField.WhitePop: return \"Wh\";\n case FeatureField.BlackPop: return ds.endsWith(\"NH\") ? \"Bl\" : \"BlC\";\n case FeatureField.HispanicPop: return \"His\";\n case FeatureField.AsianPop: return ds.endsWith(\"NH\") ? \"Asn\" : \"AsnC\";\n case FeatureField.PacificPop: return ds.endsWith(\"NH\") ? \"Pac\" : \"PacC\";\n case FeatureField.NativePop: return ds.endsWith(\"NH\") ? \"Nat\" : \"NatC\";\n case FeatureField.DemVotes: return \"D\";\n case FeatureField.RepVotes: return \"R\";\n // NOTE: \"Other\" is implied as Tot - D - R\n case FeatureField.TotalVotes: return \"Tot\";\n }\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 [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// 07-17-21 - For enumerating # of times each split county is split\nexport type OrdinalToFIPSlMap = {\n [index: number]: string;\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{\n [geoID: string]: GeoFeature;\n}\n\n// Contiguity graph -- For each geoID, there's either:\n// a) a (new) unweighted list of neighbors; or\n// b) an (old) dictionary of neighbors, where the value for each\n// neighbor geoID key is the the length of the shared border.\nexport type ContiguityGraph = {\n [geoID: string]: UnweightedNeighbors | WeightedNeighbors;\n}\n\nexport type WeightedNeighbors = {\n [geoID: string]: number;\n}\n\nexport type UnweightedNeighbors = string[];\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// Analytics & validations\nexport const enum Test\n{\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 UnexpectedCountySplits,\n VTDSplits\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{\n Area,\n Diameter,\n Perimeter\n}\n\n// HELPER TYPES\n\nexport type GeoIDParts = {\n vfeature?: boolean;\n state: string;\n county: string;\n rest: string;\n // NOTE - Removing until needed\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// TYPES FOR RESULTS\n\n// For associating datasets with notes in a category\nexport type Datasets = {\n shapes?: string; // A shapefile\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 type Ratings = {\n proportionality: number;\n competitiveness: number;\n minorityRights: number;\n compactness: number;\n splitting: number;\n}\n\n","//\n// UTILITIES\n//\n\nimport * as DT from '@dra2020/dra-types';\n\nimport { AnalyticsSession } from './_api';\nimport { fieldForFeature } from './_data';\n\nimport * as T from './types'\nimport * as S from './settings';\n\n\n// PLAN HELPERS\n\n// Get the districtID to which a geoID is assigned\nexport function getDistrict(plan: T.PlanByGeoID, geoID: string): number | undefined\n{\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 {\n return plan[geoID];\n }\n else\n {\n return undefined;\n }\n}\n\n\n// WORKING WITH GEOIDS\n\nexport function parseGeoID(geoID: string): T.GeoIDParts\n{\n let bVfeature = false;\n // Rewrite vfeature GEOIDs to enable lexical parsing of higher-level parts\n // if (geoID.indexOf('vfeature') >= 0)\n if (DT.isVfeature(geoID))\n {\n bVfeature = true;\n geoID = DT.vgeoidToGeoid(geoID);\n }\n\n const parts: T.GeoIDParts = {\n vfeature: bVfeature,\n state: geoID.substring(0, 2),\n county: geoID.substring(2, 5),\n rest: geoID.slice(5)\n }\n\n return parts;\n}\n\n// 08-13-2020 - Enhanced completeness checking.\nexport function isWaterOnly(geoID: string, s?: AnalyticsSession): boolean\n{\n const waterOnlySignature = 'ZZZZZZ';\n\n if (geoID.indexOf(waterOnlySignature) >= 0) return true;\n\n if (s)\n {\n // If called with a session, get the feature ...\n const featureID = s.features.featureID(geoID);\n const f: any /* T.GeoFeature */ = s.features.featureByIndex(featureID);\n \n // ... and also check the 'ALAND' property\n const bNoLand = ((f.properties['ALAND10'] !== undefined) && (f.properties['ALAND10'] == 0)) ? true : false;\n\n return bNoLand;\n }\n else\n return false;\n}\n\nexport function isUninhabited(geoID: string, s: AnalyticsSession): boolean\n{\n const featureID = s.features.featureID(geoID);\n const f: any /* T.GeoFeature */ = s.features.featureByIndex(featureID);\n\n // 03-27-21\n const dk: string = s.features._keys[T.Dataset.CENSUS];\n const totalPop = fieldForFeature(f, dk, T.FeatureField.TotalPop); \n // const totalPop = s.features.fieldForFeature(f, T.Dataset.CENSUS, T.FeatureField.TotalPop);\n let bUninhabited: boolean = (totalPop > 0) ? false : true;\n\n // HACK for Kentucky's atypical data, so the official map shows as complete\n const geoIDparts = parseGeoID(geoID);\n if (geoIDparts.state == '21') // KY\n {\n if ((f.properties['POPULATION'] !== undefined) && (f.properties['POPULATION'] == 0))\n bUninhabited = true;\n }\n \n return bUninhabited;\n}\n\n// Round a fractional number [0-1] to the desired level of PRECISION.\nexport function trim(fullFraction: number, digits: number | undefined = undefined): number\n{\n if (digits == 0)\n {\n return Math.round(fullFraction);\n }\n else\n {\n let shiftPlaces = 10 ** (digits || S.PRECISION);\n\n return Math.round(fullFraction * shiftPlaces) / shiftPlaces;\n }\n}\n\n// ARRAY HELPERS\n\nexport function sumArray(arr: number[]): number\n{\n return arr.reduce((a, b) => a + b, 0);\n}\n\nexport function avgArray(arr: number[]): number\n{\n return (arr.reduce((a, b) => a + b, 0)) / arr.length;\n}\n\nexport function minArray(arr: number[]): number\n{\n return Math.min(...arr);\n}\n\nexport function maxArray(arr: number[]): number\n{\n return Math.max(...arr);\n}\n\nexport function initArray(n: number, value: any): any[]\n{\n return Array.from(Array(n), () => value);\n}\n\nexport function andArray(arr: boolean[]): boolean\n{\n return arr.reduce(function (a, b) { return a && b; }, true);\n}\n\n// WORKING WITH OBJECT KEYS/PROPERTIES\n\n// Does an object have a key/property?\nexport function keyExists(k: string, o: object): boolean\n{\n return k in o;\n}\n\n// Does an object (dict) have any keys/properties?\nexport function isObjectEmpty(o: object): boolean\n{\n return Object.keys(o).length === 0\n}\n// Does a Set have any members?\nexport function isSetEmpty(s: any): boolean\n{\n return s.size === 0\n}\n// Does an array hold any items?\nexport function isArrayEmpty(a: any[]): boolean\n{\n if (a === undefined || a.length == 0)\n {\n // array empty or does not exist\n return true;\n }\n else\n {\n return false;\n }\n}\n\n// Get the keys for an object\nexport function getObjectKeys(o: object): string[]\n{\n return Object.keys(o);\n}\n\nexport function getNumericObjectKeys(o: object): number[]\n{\n return Object.keys(o).map(Number);\n}\n\nexport function getSelectObjectKeys(o: T.Dict, v: any[]): string[]\n{\n let selectKeys: string[] = [];\n\n Object.keys(o).forEach(key =>\n {\n if (arrayContains(v, o[key]))\n {\n selectKeys.push(key);\n }\n });\n\n return selectKeys;\n}\n\nexport function arrayContains(a: any[], item: any): boolean\n{\n return a.some(x => x === item);\n}\n\nexport function objectContains(o: object, key: any): boolean\n{\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{\n let count = 0\n for (let item in enumName)\n {\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{\n if (Array.isArray(src))\n return src.slice();\n else if (typeof src === 'object')\n {\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{\n if (Array.isArray(src))\n {\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 {\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\nexport function depthof(a: any): number\n{\n if (a === null || a === undefined) return 1;\n\n switch (typeof a)\n {\n default: return 1;\n case 'number': return 1;\n case 'boolean': return 1;\n case 'string': return 1;\n\n case 'object':\n {\n let d: number = 0;\n if (Array.isArray(a))\n return a.length > 0 ? (1 + depthof(a[0])) : 2; // still return 2 for empty array\n else if (Buffer && Buffer.isBuffer(a))\n return 2;\n else if (a.hasOwnProperty === undefined)\n return 1;\n else\n {\n for (var key in a) if (a.hasOwnProperty(key))\n return 1 + depthof(a[key]);\n return 2; // or 2 for empty object\n }\n }\n }\n}\n\n","//\n// MAP/PLAN VALIDATIONS\n//\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\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, bLog: boolean = false): T.TestEntry\n{\n let test = s.getTest(T.Test.Complete) as T.TestEntry;\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.table.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 let unassignedFeatures: string[] = [];\n let bAllAssigned: boolean = (!bNotEmptyByDistrict[S.NOT_ASSIGNED]);\n let bAllNonWaterOnlyAssigned: boolean = bAllAssigned ? true : false;\n\n if (!bAllAssigned)\n {\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 // 08-13-2020 - Enhanced completeness checking.\n // Are any of the unassigned features not water-only -or- inhabited?\n // Check the official congressional maps for CT, KY, IL, and MI.\n bAllNonWaterOnlyAssigned = !unassignedFeatures.some(function (geoID)\n {\n if (U.isWaterOnly(geoID, s))\n {\n if (bLog) console.log(\"Unassigned water-only feature ignored in completeness check: \", geoID);\n return false;\n }\n if (U.isUninhabited(geoID, s))\n {\n if (bLog) console.log(\"Uninhabited feature ignored in completeness check: \", geoID);\n return false;\n }\n \n // Not water-only and inhabited\n return true;\n }); \n }\n\n // Do all real districts have at least one feature assigned to them?\n let emptyDistricts: number[] = [];\n let bNoneEmpty: boolean = true;\n bNotEmptyByDistrict = bNotEmptyByDistrict.slice(1);\n\n let districtID = 1;\n bNotEmptyByDistrict.forEach(function (bNotEmpty: boolean): void\n {\n if (!bNotEmpty)\n {\n bNoneEmpty = false;\n emptyDistricts.push(districtID);\n }\n districtID += 1;\n });\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 // NOTE - 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 // 08-13-2020 - Revised completeness check:\n // A plan is complete if:\n // * All inhabited, not water-only districts are assigned to districts. \n // * No districts are empty, i.e., each has one or more geos assigned to them.\n // Note: We're not checking (in _data.ts) whether those geos are water-only\n // or have any population, but that's a real edge case.\n\n test['score'] = bAllNonWaterOnlyAssigned && bNoneEmpty;\n // test['score'] = bAllAssigned && bNoneEmpty;\n if (!bAllAssigned)\n {\n test['details']['unassignedFeatures'] = unassignedFeatures;\n }\n\n if (!bNoneEmpty)\n {\n test['details']['emptyDistricts'] = emptyDistricts;\n }\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bNotEmpty = s.districts.table.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, bLog: boolean = false): T.TestEntry\n{\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.table.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: boolean = 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 {\n if (!bDistrictContiguous) discontiguousDistricts.push(districtID);\n districtID += 1;\n });\n\n // Populate the test entry\n test['score'] = bMapContiguous;\n if (!bMapContiguous)\n {\n test['details'] = { 'discontiguousDistricts': discontiguousDistricts };\n }\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bContiguous = s.districts.table.bContiguous;\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bContiguous[summaryRow] = test['score'];\n\n return test;\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\nexport function doIsFreeOfHoles(s: AnalyticsSession, bLog: boolean = false): T.TestEntry\n{\n let test = s.getTest(T.Test.FreeOfHoles) as T.TestEntry;\n\n // Initialize values\n let bFreeOfHoles: boolean = 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.table.bNotEmbedded;\n bNotEmbeddedByDistrict = bNotEmbeddedByDistrict.slice(1, -1);\n\n let districtID = 1;\n bNotEmbeddedByDistrict.forEach(function (bDistrictNotEmbedded: boolean): void\n {\n if (!bDistrictNotEmbedded)\n {\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 {\n test['details'] = { 'embeddedDistricts': embeddedDistricts };\n }\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bNotEmbedded = s.districts.table.bNotEmbedded;\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bNotEmbedded[summaryRow] = test['score'];\n\n return test;\n}\n","module.exports = require(\"@dra2020/baseclient\");","module.exports = require(\"@dra2020/dra-analytics\");","module.exports = require(\"@dra2020/dra-types\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/index.ts\");\n",""],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"district-analytics.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;ACVA,EAAE;AACF,uBAAuB;AACvB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,2FAA2C;AAC3C,oGAAqD;AAErD,oFAAgD;AAChD,2EAA8D;AAC9D,qEAAyF;AACzF,2EAA2E;AAC3E,2EAAwG;AACxG,8EAAyD;AAEzD,6EAA6B;AAC7B,mFAAgC;AAGhC,6EAA6B;AAE7B,kDAAkD;AAClD,MAAa,gBAAgB;IAsB3B,YAAY,cAAgC;QAnB5C,yBAAoB,GAAY,KAAK,CAAC,CAAE,OAAO;QAC/C,WAAM,GAAW,EAAE,CAAC;QAEpB,2BAAsB,GAAY,KAAK,CAAC;QACxC,kBAAa,GAAY,KAAK,CAAC;QAC/B,wBAAmB,GAAY,KAAK,CAAC;QACrC,UAAK,GAAG,EAAmB,CAAC;QAe1B,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAE1D,iCAAiC;QACjC,yCAAyC;QACzC,iDAAiD;QACjD,2BAA2B;QAC3B,+EAA+E;QAE/E,IAAI,CAAC,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AAoB,EACzB,CAAC;YACC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACnC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;QACD,UAAU,IAAI,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,0BAA0B;IAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;IAC7B,IAAI,CAAC,YAAY,EACjB,CAAC;QACC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC;IAC/D,CAAC;IAED,6DAA6D;IAC7D,IAAI,YAAY,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC;IAClD,IAAI,UAAU,GAAG,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAEhD,YAAY,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAEzC,OAAO,IAAI,CAAC;AACd,CAAC;AAtCD,0CAsCC;;;;;;;;;;;AC/MD;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://district-analytics/webpack/universalModuleDefinition","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/index.ts","webpack://district-analytics/./src/minority.ts","webpack://district-analytics/./src/preprocess.ts","webpack://district-analytics/./src/results.ts","webpack://district-analytics/./src/score.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 commonjs \"@dra2020/baseclient\"","webpack://district-analytics/external commonjs \"@dra2020/dra-analytics\"","webpack://district-analytics/external commonjs \"@dra2020/dra-types\"","webpack://district-analytics/webpack/bootstrap","webpack://district-analytics/webpack/before-startup","webpack://district-analytics/webpack/startup","webpack://district-analytics/webpack/after-startup"],"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, () => {\nreturn ","//\n// THE NODE PACKAGE API\n//\n\nimport { Poly } from '@dra2020/baseclient';\nimport { Rate, Types } from '@dra2020/dra-analytics';\n\nimport { doPreprocessData } from './preprocess';\nimport { doAnalyzePlan, doAnalyzeDistricts } from './analyze';\nimport { profilePlan, computeMetrics, rateKeyDimensions, thunkScorecard } from './score';\nimport { doAnalyzePostProcessing, RequirementsChecklist } from './results';\nimport { DistrictStatistics, prepareDistrictStatistics, prepareRequirementsChecklist } from './results';\nimport { doAnalyzeRacialPolarization } from './minority';\n\nimport * as D from './_data';\nimport * as M from './minority';\nimport * as T from './types';\nimport * as L from './legacy-types';\nimport * as U from './utils';\n\n// MMD - Extended for optional # reps per district\nexport class AnalyticsSession\n{\n title: string;\n legislativeDistricts: boolean = false; // 2020\n config: T.Dict = {};\n\n bOneTimeProcessingDone: boolean = false;\n bPlanAnalyzed: boolean = false;\n bPostProcessingDone: boolean = false;\n tests = {} as T.TestEntries;\n\n _profile?: L.Profile;\n _scorecard?: L.Scorecard;\n\n state: D.State;\n counties: D.Counties;\n graph: D.GraphClass;\n features: D.Features;\n plan: D.Plan;\n districts: D.Districts;\n repsByDistrict?: number[]; // MMD\n\n constructor(SessionRequest: T.SessionRequest)\n {\n this.title = SessionRequest['title'];\n this.config = this.processConfig(SessionRequest['config'])\n\n // 2020 - Set the CD / LD toggle:\n // * If 2020, use the PlanType, if given.\n // * If 2010, use the legacy LD toggle, if given.\n // * Otherwise assume CD's.\n // * Use the LD population deviation threshold for districts that are not CD's.\n\n if ((this.config.cycle == 2020) && (SessionRequest['planType'] !== undefined))\n this.legislativeDistricts = (SessionRequest['planType'] != 'congress');\n else if ((this.config.cycle == 2010) && (SessionRequest['legislativeDistricts'] !== undefined))\n this.legislativeDistricts = SessionRequest['legislativeDistricts'];\n\n // MMD - Validate & handle optional # reps per district\n const repsByDistrict = SessionRequest['repsByDistrict'];\n const nDistricts = SessionRequest['nDistricts'];\n if (repsByDistrict !== undefined)\n {\n if (repsByDistrict.length != nDistricts) throw new Error(\"Mismatched #'s of districts passed to AnalyticsSession constructor!\");\n if (repsByDistrict.includes(0)) throw new Error(\"Zero reps for a district passed to AnalyticsSession constructor!\");\n // Assume a positive integer # of reps per district\n\n this.repsByDistrict = repsByDistrict;\n }\n\n this.state = new D.State(this, SessionRequest['stateXX'], nDistricts);\n this.counties = new D.Counties(this, SessionRequest['counties']);\n this.graph = new D.GraphClass(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 processConfig(config: T.Dict): T.Dict\n {\n // Default the Census & redistricting cycle to 2010\n if (!(U.keyExists('cycle', config)))\n {\n config['cycle'] = 2010;\n\n // DEBUG\n console.log(\"Cycle was not set explicitly on the session request.\");\n }\n // DEBUG - Turned off 03/05/21\n // console.log(\"Cycle = \", config['cycle']);\n // console.log(\"Shapes = \", config['datasets'][T.Dataset.SHAPES], \": \", config['descriptions']['SHAPES']);\n\n return config;\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, overridesJSON?: any): boolean\n {\n // Return values:\n // * true = everything good\n // * false = should not have been called with empty plan\n // * exception = exception caught and logged on the console\n try\n {\n // Guard against being handed a map w/o any precincts assigned\n if (U.isObjectEmpty(this.plan._planByGeoID)) return false;\n\n doPreprocessData(this, bLog);\n doAnalyzeDistricts(this, bLog);\n\n // This does a little stuff that didn't get factored out into dra-score and then dra-analytics\n doAnalyzePlan(this, bLog);\n\n // THE MAIN ANALYTICS\n\n // Even though we don't save the profile (as I thought we would),\n // we allow it to be exported, so keep generating it, and use it\n // to gather the inputs to new analytics (as well as the legacy).\n this._profile = profilePlan(this, bLog);\n\n let legacyScorecardAlt = {} as L.Scorecard;\n let newScorecard = {} as Types.Scorecard;\n\n // Construct a new/alternate scorecard\n\n newScorecard = computeMetrics(this._profile, this.getGoodShapes(), bLog); // w/o ratings\n newScorecard = rateKeyDimensions(newScorecard, this._profile, bLog); // w/ ratings\n legacyScorecardAlt = thunkScorecard(newScorecard, bLog);\n\n // Add minority notes\n legacyScorecardAlt.minority.details['majorityMinority'] = M.getMajorityMinority(this);\n legacyScorecardAlt.minority.details['vraPreclearance'] = M.getVRASection5(this);\n\n this._scorecard = legacyScorecardAlt;\n\n // Before returning, create a dummy population deviation test, for \n // doHasEqualPopulations() to use later.This is preserving the old calling sequence.\n let test = this.getTest(T.Test.PopulationDeviation) as T.TestEntry;\n\n // Get the raw population deviation\n const popDev = this._scorecard.populationDeviation.raw;\n\n // Populate the test entry\n test['score'] = popDev;\n test['details'] = { 'maxDeviation': this._scorecard.populationDeviation.notes['maxDeviation'] };\n\n // Populate the N+1 summary \"district\" in district.statistics\n let totalPop = this.districts.table.totalPop;\n let popDevPct = this.districts.table.popDevPct;\n let totalVAP = this.districts.table.totalVAP;\n\n const summaryRow = this.districts.numberOfRows() - 1;\n totalPop[summaryRow] = this._profile.population.targetSize; // MMD - This is generalized when the profile is created.\n popDevPct[summaryRow] = popDev;\n totalVAP[summaryRow] = Math.round(totalVAP[summaryRow] / this._profile.nDistricts);\n\n // Added w/ new scorecard\n // Use 'roughly' equal population from dra-analytics\n let test2 = this.getTest(T.Test.EqualPopulation) as T.TestEntry;\n test2['score'] = newScorecard.populationDeviation.roughlyEqual;\n\n // END main analytics\n\n doAnalyzePostProcessing(this, bLog);\n }\n catch (e)\n {\n console.log(\"Exception caught by analyzePlan().\");\n console.log((<Error>e).message);\n throw e;\n }\n\n return true;\n }\n getGoodShapes(): T.GeoFeatureCollection\n {\n const rawShapes = this.districts.getDistrictShapes();\n\n // Filter the real shapes & throw everything else away\n let goodShapes = {} as T.GeoFeatureCollection;\n goodShapes['type'] = \"FeatureCollection\";\n goodShapes['features'] = [] as T.GeoFeatureArray;\n\n for (let i = 0; i < rawShapes.features.length; i++)\n {\n const shape: any = rawShapes.features[i];\n\n if (isAShape(shape))\n {\n const d = Poly.polyDescribe(shape);\n\n let f: any = {\n type: 'Feature',\n properties: {districtID: `${i + 1}`},\n geometry: {\n type: (d.npoly > 1) ? 'MultiPolygon' : 'Polygon',\n coordinates: shape.geometry.coordinates\n }\n };\n goodShapes.features.push(f);\n }\n }\n\n return goodShapes;\n }\n\n // 11-03-2020 - Added for racially polarized voting analysis\n // NOTE - This assumes that analyzePlan() has been run!\n analyzeRacialPolarization(districtID: number, groups: Types.MinorityFilter, bLog: boolean = false): Types.RPVAnalysis | undefined\n {\n return doAnalyzeRacialPolarization(this, districtID, groups, bLog);\n }\n\n // NOTE - This assumes that analyzePlan() has been run!\n getDistrictStatistics(bLog: boolean = false): DistrictStatistics\n {\n return prepareDistrictStatistics(this, bLog);\n }\n getPlanProfile(bLog: boolean = false): L.Profile\n {\n return this._profile as L.Profile;\n }\n getPlanScorecard(bLog: boolean = false): L.Scorecard\n {\n return this._scorecard as L.Scorecard;\n }\n getRatings(bLog: boolean = false): T.Ratings\n {\n const scorecard = this._scorecard as L.Scorecard;\n\n const r: T.Ratings = {\n proportionality: scorecard.partisan.bias.score,\n competitiveness: scorecard.partisan.responsiveness.score,\n minorityRights: scorecard.minority.score,\n compactness: scorecard.compactness.score,\n splitting: scorecard.splitting.score\n }\n\n return r;\n }\n // NOTE - This assumes that analyzePlan() has been run!\n getRequirementsChecklist(bLog: boolean = false): RequirementsChecklist\n {\n return prepareRequirementsChecklist(this, bLog);\n }\n // NOTE - This assumes that analyzePlan() has been run!\n getDiscontiguousDistrictFeatures(bLog: boolean = false): T.GeoFeatureCollection\n {\n // Get the (possibly empty) list of discontiguous district IDs\n const contiguousTest = this.getTest(T.Test.Contiguous) as T.TestEntry;\n const discontiguousDistrictIDs: number[] = contiguousTest['details']['discontiguousDistricts'] || [];\n\n // Convert them into a (possibly empty) list of features\n let discontiguousDistrictFeatures: T.GeoFeatureCollection = { type: 'FeatureCollection', features: [] };\n if (!(U.isArrayEmpty(discontiguousDistrictIDs)))\n {\n for (let id of discontiguousDistrictIDs)\n {\n let poly = this.districts.getDistrictShapeByID(id);\n\n if (poly)\n {\n // If a district has a shape & it is not contiguous, by definition,\n // it will be a Multipolygon, i.e., it will have multiple pieces, some\n // possibly embedded w/in other districts. Get & add all the pieces.\n\n const districtParts: T.GeoFeatureCollection = Poly.polyParts(poly);\n discontiguousDistrictFeatures.features.push(...districtParts.features);\n // discontiguousDistrictFeatures.features.push(poly);\n }\n }\n }\n\n return discontiguousDistrictFeatures;\n }\n // Comments clipped from dra-client geodistrict.ts.\n // Discontiguous polygons are:\n // 1. All polygons in a multi-polygon; and\n // 2. All holes in a otherwise cohesive polygon.\n // Note that all non-cohesive features are always simple polygons.\n\n\n // HELPERS USED INTERNALLY\n\n // Get an individual test, so you can drive UI with the results.\n getTest(testID: T.Test): T.TestEntry\n {\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 {\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 // NOTE - Not sure why this has to be up here ...\n populationDeviationThreshold(): number\n {\n const threshold = Rate.popdevThreshold(this.legislativeDistricts);\n\n return threshold;\n }\n}\n\nfunction isAShape(poly: any): boolean\n{\n if (poly == null) return false;\n if (Poly.polyNull(poly)) return false;\n return poly.geometry && poly.geometry.coordinates && !U.isArrayEmpty(poly.geometry.coordinates);\n}\n","//\n// DATA ABSTRACTION LAYER\n//\n\nimport { Graph, Minority, Types } from '@dra2020/dra-analytics';\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\n\nimport { AnalyticsSession } from './_api';\nimport { extractDistrictProperties } from './compact';\nimport { Partisan } from '@dra2020/dra-analytics';\n\n\n// DEBUG COUNTERS\nlet nMissingDataset: number = 0;\nlet nMissingProperty: number = 0;\n\n\n// DISTRICT STATISTICS\n\n// Each property represents a column in the district statistics table, and\n// each holds an array of values for the districts.\nexport type TransposedTable = {\n totalPop: number[]; // Display\n popDevPct: number[]; // Display\n bEqualPop: boolean[]; // Display\n bNotEmpty: boolean[]; // Display\n bContiguous: boolean[]; // Display\n bNotEmbedded: boolean[]; // Display\n countySplits: number[][];\n demVotes: number[];\n repVotes: number[];\n otherVotes: number[];\n demPct: number[]; // Display (also the \"VPI,\" by convention\")\n repPct: number[]; // Display\n otherPct: number[]; // Display\n demSeat: number[];\n totalVAP: number[]; // VAP or CVAP ...\n minorityPop: number[]; // Derived\n whitePop: number[];\n blackPop: number[];\n hispanicPop: number[];\n pacificPop: number[];\n asianPop: number[];\n nativePop: number[];\n whitePct: number[]; // Display\n minorityPct: number[]; // Display\n blackPct: number[]; // Display\n hispanicPct: number[]; // Display\n pacificPct: number[]; // Display\n asianPct: number[]; // Display\n nativePct: number[]; // Display\n}\n\nexport class Districts\n{\n _session: AnalyticsSession;\n\n _shapes: T.GeoFeatureCollection;\n _geoProperties = {} as T.DistrictProperties;\n\n table: TransposedTable;\n\n constructor(s: AnalyticsSession, ds: T.GeoFeatureCollection)\n {\n this._session = s;\n\n this._shapes = ds;\n this.table = this.initTable();\n }\n getDistrictShapes(): T.GeoFeatureCollection\n {\n return this._shapes;\n }\n getDistrictShapeByID(id: number): T.GeoFeature | undefined\n {\n // NOTE - Find the district shape by ID (not index)\n // return this._shapes.features[id]; \n for (let f of this._shapes.features)\n {\n if (f.properties && (f.properties.id == id))\n {\n return f;\n }\n }\n return undefined;\n }\n getGeoProperties(i: number): any\n {\n // Make sure the district shape exists & has geo properties\n if (i in this._geoProperties) return this._geoProperties[i];\n else return null;\n }\n setGeoProperties(i: number, p: T.DistrictShapeProperties): void { this._geoProperties[i] = p; }\n\n // +1 for dummy unassigned 0 \"district\" and +1 for N+1 summary \"district\" for state-level values. \n // 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 initTable(): TransposedTable\n {\n let nRows = this.numberOfRows(); // # of districts plus unassigned & summary\n\n const t: TransposedTable = {\n totalPop: U.initArray(nRows, null),\n popDevPct: U.initArray(nRows, null),\n bEqualPop: U.initArray(nRows, null),\n bNotEmpty: U.initArray(nRows, null),\n bContiguous: U.initArray(nRows, null),\n bNotEmbedded: U.initArray(nRows, null),\n countySplits: U.initArray(nRows, null),\n demVotes: U.initArray(nRows, null),\n repVotes: U.initArray(nRows, null),\n otherVotes: U.initArray(nRows, null),\n demPct: U.initArray(nRows, null),\n repPct: U.initArray(nRows, null),\n otherPct: U.initArray(nRows, null),\n demSeat: U.initArray(nRows, null),\n totalVAP: U.initArray(nRows, null),\n minorityPop: U.initArray(nRows, null),\n whitePop: U.initArray(nRows, null),\n blackPop: U.initArray(nRows, null),\n hispanicPop: U.initArray(nRows, null),\n pacificPop: U.initArray(nRows, null),\n asianPop: U.initArray(nRows, null),\n nativePop: U.initArray(nRows, null),\n whitePct: U.initArray(nRows, null),\n minorityPct: U.initArray(nRows, null),\n blackPct: U.initArray(nRows, null),\n hispanicPct: U.initArray(nRows, null),\n pacificPct: U.initArray(nRows, null),\n asianPct: U.initArray(nRows, null),\n nativePct: U.initArray(nRows, null) \n }\n\n return t;\n }\n\n // MMD - Generalized district statistics for MMD's\n // This is the workhorse computational routine!\n recalcStatistics(bLog: boolean = false): void\n {\n // Initialize debug counters\n nMissingDataset = 0;\n nMissingProperty = 0;\n\n // MMD - Generalized targetSize\n // Compute these once per recalc cycle\n const nDistricts = this._session.state.nDistricts;\n const repsByDistrict = this._session.repsByDistrict;\n const nReps = this._session.state.nReps;\n const stateTotal = this._session.state.totalPop;\n const targetSize = this._session.state.targetSize;\n // const targetSize = Math.round(this._session.state.totalPop / this._session.state.nDistricts);\n const deviationThreshold = this._session.populationDeviationThreshold();\n // let planByDistrict = this._session.plan.byDistrictID();\n const plan = this._session.plan;\n const graph = this._session.graph;\n\n // Add an extra 0th virtual county bucket for county-district splitting analysis \n let nCountyBuckets = this._session.counties.nCounties + 1;\n\n // INITIALIZE STATE VALUES THAT WILL BE ACCUMULATED\n\n // 10-22-2020 - Added Other votes\n let stateDemVote = 0;\n let stateRepVote = 0;\n let stateOthVote = 0;\n let stateTotVote = 0;\n // let stateTPVote = 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 // - Contiguous (bContiguous)\n // - Free of holes (bNotEmbedded)\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(nCountyBuckets, 0);\n\n // 10-22-2020 - Added Other votes\n let demVotes: number = 0;\n let repVotes: number = 0;\n let othVotes: number = 0;\n let totVotes: 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 // NOTE - Only report explicitly found validity issues\n let bNotEmpty = false;\n let bContiguous = true;\n let bNotEmbedded = true;\n let bEqualPop = true;\n\n // HACK - Because \"this\" gets ghosted inside the forEach loop below\n let outerThis = this;\n\n // Default the pop dev % for the dummy Unassigned district to 0%.\n // Default the pop dev % for real (1–N) but empty districts to 100%.\n let popDevPct = (i > 0) ? (targetSize / targetSize) : 0 / targetSize;\n\n // Get the geoIDs assigned to the district\n // Guard against empty districts\n let geoIDs = this._session.plan.geoIDsForDistrictID(i);\n if (geoIDs && (geoIDs.size > 0))\n {\n bNotEmpty = true;\n\n // ... loop over the geoIDs creating district-by-district statistics \n geoIDs.forEach(function (geoID: string): void\n {\n // 01-04-22 -- Removed water-only guard\n // // Skip water-only features\n // if (!(U.isWaterOnly(geoID)))\n // {\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 if (f == undefined)\n {\n if (bLog) console.log(\"Statistics: Skipping undefined feature in district statistics: GEOID =\", geoID, \"Feature ID =\", featureID);\n }\n else\n {\n // ACCUMULATE VALUES\n\n // Total population of each feature\n // NOTE - This result is used more than once\n // 03-27-21\n const dkCENSUS: string = outerThis._session.features._keys[T.Dataset.CENSUS];\n featurePop = fieldForFeature(f, dkCENSUS, T.FeatureField.TotalPop);\n // featurePop = outerThis._session.features.fieldForFeature(f, T.Dataset.CENSUS, T.FeatureField.TotalPop);\n\n // Total district population\n totalPop += featurePop;\n\n // Ignore features when the county is unrecognized\n const countyFIPS = U.parseGeoID(geoID)['county'] as string;\n if (U.keyExists(countyFIPS, outerThis._session.counties.index))\n {\n // Total population by counties w/in a district,\n // except the dummy unassigned district 0\n if (i > 0) countySplits[outerThis.getCountyIndex(geoID)] += featurePop;\n }\n else\n {\n if (bLog) console.log(\"Statistics: County not recognized:\", geoID);\n }\n\n // Democratic and Republican vote totals\n // 10-22-2020 - Added Other votes\n // 10-24-2020 - Added guard against inconsistent election data\n // 03-27-2021\n const dkELECTION: string = outerThis._session.features._keys[T.Dataset.ELECTION];\n const featureDem = fieldForFeature(f, dkELECTION, T.FeatureField.DemVotes);\n // const featureDem = outerThis._session.features.fieldForFeature(f, T.Dataset.ELECTION, T.FeatureField.DemVotes);\n const featureRep = fieldForFeature(f, dkELECTION, T.FeatureField.RepVotes);\n const featureTot = fieldForFeature(f, dkELECTION, T.FeatureField.TotalVotes);\n\n demVotes += featureDem;\n repVotes += featureRep;\n totVotes += featureTot;\n\n // NOTE: Unless you grab the values above before accumulating them,\n // you can't accumulate othVotes for districts. You must calculate\n // them by implication later.\n\n if (bLog)\n {\n const bBadElection = (featureDem + featureRep > featureTot) ? true : false;\n if (bBadElection) console.log(\"Statistics: Inconsistent election data for precinct:\", geoID, featureDem, featureRep, featureTot);\n }\n\n // Voting-age demographic breakdowns (or citizen voting-age)\n // 03-27-21\n const dkVAP: string = outerThis._session.features._keys[T.Dataset.VAP];\n totalVAP += fieldForFeature(f, dkVAP, T.FeatureField.TotalPop);\n // totalVAP += outerThis._session.features.fieldForFeature(f, T.Dataset.VAP, T.FeatureField.TotalPop);\n whitePop += fieldForFeature(f, dkVAP, T.FeatureField.WhitePop);\n blackPop += fieldForFeature(f, dkVAP, T.FeatureField.BlackPop);\n hispanicPop += fieldForFeature(f, dkVAP, T.FeatureField.HispanicPop);\n pacificPop += fieldForFeature(f, dkVAP, T.FeatureField.PacificPop);\n asianPop += fieldForFeature(f, dkVAP, T.FeatureField.AsianPop);\n nativePop += fieldForFeature(f, dkVAP, T.FeatureField.NativePop);\n }\n // }\n // else\n // {\n // if (bLog) console.log(\"Statistics: Skipping water-only feature in district statistics:\", geoID);\n // }\n });\n console.log(`totalVAP: ${totalVAP}, whitePop: ${whitePop}, blackPop: ${blackPop}`);\n\n // COMPUTE DERIVED VALUES\n\n // MMD - Generalized the per-district population deviations's for MMD's with variable #'s of reps per district.\n // - The real districts are indexed 1–N.\n // - But the # reps per district are indexed from zero.\n // Population deviation % and equal population (boolean) by district.\n if (i > 0)\n {\n if (totalPop > 0)\n {\n const n = (repsByDistrict) ? repsByDistrict[i-1] : 1; // MMD - # of reps for the district\n popDevPct = (totalPop - (n * targetSize)) / (n * targetSize); // MMD\n // popDevPct = (totalPop - targetSize) / targetSize;\n bEqualPop = (Math.abs(popDevPct) <= deviationThreshold);\n }\n }\n\n // 10-22-2020 - Added Other votes. Revised from two-party to include Other.\n // let totVotes: number; <<< Now being accumulated by district\n let demPct: number = 0;\n let repPct: number = 0;\n let othPct: number = 0;\n let DemSeat: number = 0;\n\n // totVotes now being accumulated by district\n if (totVotes > 0)\n {\n // 10-24-2020 - Added guard against inconsistent election data.\n const bBadElection = (demVotes + repVotes > totVotes) ? true : false;\n if (bBadElection && bLog) console.log(\"Statistics: Inconsistent election data for district:\", i, demVotes, repVotes, totVotes);\n if (bBadElection) totVotes = demVotes + repVotes; // HACK to guard against bad election data!\n\n othVotes = totVotes - demVotes - repVotes;\n\n demPct = demVotes / totVotes;\n repPct = repVotes / totVotes;\n othPct = othVotes / totVotes;\n\n DemSeat = Partisan.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 = 0;\n let minorityPct: number = 0;\n let blackPct: number = 0;\n let hispanicPct: number = 0;\n let pacificPct: number = 0;\n let asianPct: number = 0;\n let nativePct: number = 0;\n\n if (totalVAP > 0)\n {\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 // COMPUTE DISTRICT-LEVEL VALUES\n\n // Validations\n\n // Leave the default values for the dummy unassigned district,\n // and districts that are empty.\n if ((i > 0) && bNotEmpty)\n {\n // GRAPH - 10/05/2020 - Using dra-graph instead.\n // bContiguous = isConnected(geoIDs, graph);\n // bNotEmbedded = (!isEmbedded(i, planByDistrict[i], plan, graph));\n\n // GRAPH - 10/05/2020 - Using dra-graph.\n const features = geoIDs;\n const nakedGraph = graph._graph;\n const nakedPlan = plan._planByGeoID;\n\n bContiguous = Graph.isConnected(features, nakedGraph, bLog);\n bNotEmbedded = (!Graph.isEmbedded(i, features, nakedPlan, nakedGraph, bLog));\n }\n\n { // UPDATE THE DISTRICT STATISTICS\n\n // NOTE - These are set below for both non-empty & empty districts:\n // * bNotEmpty;\n // * bContiguous;\n // * bNotEmbedded;\n // * totalPop;\n // * bEqualPop;\n\n this.table.popDevPct[i] = popDevPct;\n\n this.table.demVotes[i] = demVotes;\n this.table.repVotes[i] = repVotes;\n this.table.otherVotes[i] = othVotes;\n this.table.demPct[i] = demPct;\n this.table.repPct[i] = repPct;\n this.table.otherPct[i] = othPct;\n this.table.demSeat[i] = DemSeat;\n\n this.table.whitePop[i] = whitePop;\n this.table.minorityPop[i] = minorityPop;\n this.table.blackPop[i] = blackPop;\n this.table.hispanicPop[i] = hispanicPop;\n this.table.pacificPop[i] = pacificPop;\n this.table.asianPop[i] = asianPop;\n this.table.nativePop[i] = nativePop;\n\n this.table.totalVAP[i] = totalVAP;\n this.table.whitePct[i] = whitePct;\n this.table.minorityPct[i] = minorityPct;\n this.table.blackPct[i] = blackPct;\n this.table.hispanicPct[i] = hispanicPct;\n this.table.pacificPct[i] = pacificPct;\n this.table.asianPct[i] = asianPct;\n this.table.nativePct[i] = nativePct;\n }\n\n { // ACCUMULATE STATE STATISTICS FROM DISTRICT TOTALS\n\n // 10-22-2020 - Added Other votes\n stateTotVote += totVotes;\n // stateTPVote += totVotes;\n stateDemVote += demVotes;\n stateRepVote += repVotes;\n stateOthVote += othVotes;\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 else\n { // If a district is empty, zero these results (vs. null)\n this.table.popDevPct[i] = popDevPct;\n\n this.table.demVotes[i] = 0;\n this.table.repVotes[i] = 0;\n this.table.otherVotes[i] = 0;\n this.table.demPct[i] = 0;\n this.table.repPct[i] = 0;\n this.table.otherPct[i] = 0;\n this.table.demSeat[i] = 0;\n\n this.table.whitePop[i] = 0;\n this.table.minorityPop[i] = 0;\n this.table.blackPop[i] = 0;\n this.table.hispanicPop[i] = 0;\n this.table.pacificPop[i] = 0;\n this.table.asianPop[i] = 0;\n this.table.nativePop[i] = 0;\n\n this.table.totalVAP[i] = 0;\n this.table.whitePct[i] = 0;\n this.table.minorityPct[i] = 0;\n this.table.blackPct[i] = 0;\n this.table.hispanicPct[i] = 0;\n this.table.pacificPct[i] = 0;\n this.table.asianPct[i] = 0;\n this.table.nativePct[i] = 0;\n }\n\n { // UPDATE THESE DISTRICT STATISTICS, EVEN WHEN THEY ARE EMPTY\n this.table.totalPop[i] = totalPop;\n\n this.table.bNotEmpty[i] = bNotEmpty;\n this.table.bContiguous[i] = bContiguous;\n this.table.bNotEmbedded[i] = bNotEmbedded;\n this.table.bEqualPop[i] = bEqualPop;\n\n this.table.countySplits[i] = countySplits;\n }\n }\n\n // UPDATE STATE STATISTICS\n let summaryRow = this.numberOfRows() - 1;\n\n // 10-22-2020 - Added Other votes\n if (stateTotVote > 0)\n {\n this.table.demVotes[summaryRow] = stateDemVote;\n this.table.repVotes[summaryRow] = stateRepVote;\n\n this.table.demPct[summaryRow] = stateDemVote / stateTotVote;\n this.table.repPct[summaryRow] = stateRepVote / stateTotVote;\n this.table.otherPct[summaryRow] = stateOthVote / stateTotVote;\n }\n\n if (stateVAPPop > 0)\n {\n this.table.totalVAP[summaryRow] = stateVAPPop;\n this.table.whitePct[summaryRow] = stateWhitePop / stateVAPPop;\n this.table.minorityPct[summaryRow] = stateMinorityPop / stateVAPPop;\n this.table.blackPct[summaryRow] = stateBlackPop / stateVAPPop;\n this.table.hispanicPct[summaryRow] = stateHispanicPop / stateVAPPop;\n this.table.pacificPct[summaryRow] = statePacificPop / stateVAPPop;\n this.table.asianPct[summaryRow] = stateAsianPop / stateVAPPop;\n this.table.nativePct[summaryRow] = stateNativePop / stateVAPPop;\n }\n if (bLog)\n {\n console.log(`Statistics: ${nMissingDataset} features with missing datasets.`);\n console.log(`Statistics: ${nMissingProperty} features with missing properties.`);\n }\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 {\n extractDistrictProperties(this._session, bLog)\n }\n getCountyIndex(geoID: string): number\n {\n let countyFIPS = U.parseGeoID(geoID)['county'] as string;\n let countyIndex = this._session.counties.indexFromFIPS(countyFIPS);\n\n return countyIndex;\n }\n\n // 11-03-2020 - Added for racially polarized voting analysis\n extractVotesByDemographic(districtID: number, groups: Types.MinorityFilter, bLog: boolean = false): Types.DemographicVotingByFeature | undefined\n {\n let ids: string[] = [];\n let comparisonPts: Types.dictPoint[] = []; // Either White -or- (1 – <selected minority>) i.e., White++\n let hispanicPts: Types.dictPoint[] = [];\n let blackPts: Types.dictPoint[] = [];\n let pacificPts: Types.dictPoint[] = [];\n let asianPts: Types.dictPoint[] = [];\n let nativePts: Types.dictPoint[] = [];\n let minorityPts: Types.dictPoint[] = [];\n\n // let dataDump: any[] = []; // For testing\n\n // Gather [demographic %, D %] points for the selected district ID\n let i = districtID;\n\n // HACK - For comparing a minority group to everyone else (vs. just White),\n // infer the *single* minority group that has been selected.\n const selectedMinority: string = inferSelectedMinority(groups);\n\n // HACK - Because \"this\" gets ghosted inside the forEach loop below\n let outerThis = this;\n\n // Get the geoIDs assigned to the district\n // Guard against empty districts\n let geoIDs = this._session.plan.geoIDsForDistrictID(i);\n if (geoIDs && (geoIDs.size > 0))\n {\n // ... loop over the geoIDs collecting the points for ecological regression\n geoIDs.forEach(function (geoID: string): void\n {\n // Skip water-only features\n if (!(U.isWaterOnly(geoID)))\n {\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 if (!(f == undefined))\n {\n // Calculate the Dem two-party vote\n // 03-27-21\n const dkELECTION: string = outerThis._session.features._keys[T.Dataset.ELECTION];\n const featureDem = fieldForFeature(f, dkELECTION, T.FeatureField.DemVotes);\n const featureRep = fieldForFeature(f, dkELECTION, T.FeatureField.RepVotes);\n // const featureRep = outerThis._session.features.fieldForFeature(f, T.Dataset.ELECTION, T.FeatureField.RepVotes);\n\n if ((featureDem + featureRep) > 0)\n {\n const pctDem = featureDem / (featureDem + featureRep);\n\n // Calculate the VAP/CVAP percentages by demographic\n // 03-27-21\n const dkVAP: string = outerThis._session.features._keys[T.Dataset.VAP];\n const totalVAP = fieldForFeature(f, dkVAP, T.FeatureField.TotalPop);\n // const totalVAP = outerThis._session.features.fieldForFeature(f, T.Dataset.VAP, T.FeatureField.TotalPop);\n\n if (totalVAP > 0)\n {\n // Gather all points, for debugging purposes ...\n const hispanicVAP = fieldForFeature(f, dkVAP, T.FeatureField.HispanicPop);\n const blackVAP = fieldForFeature(f, dkVAP, T.FeatureField.BlackPop);\n const pacificVAP = fieldForFeature(f, dkVAP, T.FeatureField.PacificPop);\n const asianVAP = fieldForFeature(f, dkVAP, T.FeatureField.AsianPop);\n const nativeVAP = fieldForFeature(f, dkVAP, T.FeatureField.NativePop);\n\n const pctHispanic = hispanicVAP / totalVAP;\n const pctBlack = blackVAP / totalVAP;\n const pctPacific = pacificVAP / totalVAP;\n const pctAsian = asianVAP / totalVAP;\n const pctNative = nativeVAP / totalVAP;\n\n const whiteVAP = fieldForFeature(f, dkVAP, T.FeatureField.WhitePop);\n const minorityVAP = totalVAP - whiteVAP;\n const pctMinority = minorityVAP / totalVAP;\n\n let pctComparison = whiteVAP / totalVAP;\n if (groups.invertSelection)\n {\n switch (selectedMinority)\n {\n case 'Hispanic': {\n pctComparison = (totalVAP - hispanicVAP) / totalVAP;\n break;\n }\n case 'Black': {\n pctComparison = (totalVAP - blackVAP) / totalVAP;\n break;\n }\n case 'Pacific': {\n pctComparison = (totalVAP - pacificVAP) / totalVAP;\n break;\n }\n case 'Asian': {\n pctComparison = (totalVAP - asianVAP) / totalVAP;\n break;\n }\n case 'Native': {\n pctComparison = (totalVAP - nativeVAP) / totalVAP;\n break;\n }\n case 'Minority': {\n pctComparison = (totalVAP - minorityVAP) / totalVAP;\n break;\n }\n default: {\n console.log(\"Selected minority not recognized!\");\n break;\n }\n }\n }\n\n ids.push(geoID);\n comparisonPts.push({x: pctComparison, y: pctDem}); // White -or- (1 – <selected minority>)\n hispanicPts.push({x: pctHispanic, y: pctDem});\n blackPts.push({x: pctBlack, y: pctDem});\n pacificPts.push({x: pctPacific, y: pctDem});\n asianPts.push({x: pctAsian, y: pctDem});\n nativePts.push({x: pctNative, y: pctDem});\n minorityPts.push({x: pctMinority, y: pctDem});\n\n /* Dump test data based on config switch\n const s: AnalyticsSession = outerThis._session;\n const bDump = (('dump' in s.config) && s.config.dump) ? true : false;\n if (bDump)\n {\n const row: number[] = [pctWhite, pctMinority, pctBlack, pctHispanic, pctPacific, pctAsian, pctNative, pctDem];\n dataDump.push(row);\n }\n */\n }\n else\n {\n if (bLog) console.log(\"RPV: Total VAP not > 0.\")\n }\n }\n else\n {\n if (bLog) console.log(\"RPV: D + R not > 0.\")\n }\n }\n }\n });\n\n // ... but only keep points for the demographics that are going to be analyzed\n // dataDump = [];\n\n return {\n ids: ids,\n comparison: comparisonPts,\n minority: groups.minority ? minorityPts : [],\n black: groups.black ? blackPts : [],\n hispanic: groups.hispanic ? hispanicPts : [],\n pacific: groups.pacific ? pacificPts : [],\n asian: groups.asian ? asianPts : [],\n native: groups.native ? nativePts : []\n }\n }\n\n // If a district is empty\n return undefined;\n }\n}\n\nexport function inferSelectedMinority(groups: Types.MinorityFilter): string\n{\n if (groups.hispanic) return 'Hispanic';\n if (groups.black) return 'Black';\n if (groups.pacific) return 'Pacific';\n if (groups.asian) return 'Asian';\n if (groups.native) return 'Native';\n if (groups.minority) return 'Minority';\n\n return 'No minority selected!';\n}\n\n// CLASSES, ETC. FOR FEATURE & COUNTY DATA\n\n// Wrap data by feature, to abstract the specifics of the internal structure\nexport class Features\n{\n _session: AnalyticsSession;\n\n _data: T.GeoFeatureCollection;\n _keys: T.DatasetKeys;\n\n _featureIDs = {} as T.FeaturesByGeoID;\n\n constructor(s: AnalyticsSession, data: T.GeoFeatureCollection, keys: T.DatasetKeys)\n {\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 /* 03/27/21 - Moved to top-level & exported:\n geoIDForFeature(f: any): string\n {\n // 12-02-2020 - Switched to using ids vs. geoids per Terry\n if (f.properties && f.properties['id'])\n {\n return f.properties['id'];\n // GEOIDs will be one of these properties\n // const value = f.properties['GEOID10'] || f.properties['GEOID20'] || f.properties['GEOID'];\n\n // return value;\n }\n else\n {\n console.log(\"This feature does not have an id property:\", f);\n throw \"Feature with no id property.\";\n }\n }\n fieldForFeature(f: any, dt: T.Dataset, fk: string): any\n {\n const dk: string = this._keys[dt];\n\n let result = undefined;\n\n // 07-31-2020 - Fix to post-process PVI into the expected election composite format.\n if (dk === 'P16GPR')\n {\n // 10-27-2020 - Enabling a 'Tot' result for PVI, now that we're reporting 'Other'\n switch (fk)\n {\n case 'D': {\n result = (_getFeatures(f, dk, 'D12') + _getFeatures(f, dk, 'D16')) / 2;\n break;\n }\n case 'R': {\n result = (_getFeatures(f, dk, 'R12') + _getFeatures(f, dk, 'R16')) / 2;\n break;\n }\n case 'Tot': {\n result = (_getFeatures(f, dk, 'D12') + _getFeatures(f, dk, 'D16') + _getFeatures(f, dk, 'R12') + _getFeatures(f, dk, 'R16')) / 2;\n break;\n }\n default: {\n console.log(\"Field not recognized.\");\n break;\n }\n }\n // result = (_getFeatures(f, dk, (fk === 'D' ? 'D12' : 'R12')) + _getFeatures(f, dk, (fk === 'D' ? 'D16' : 'R16'))) / 2;\n }\n else\n result = _getFeatures(f, dk, fk);\n\n return result;\n }\n */\n resetDataset(d: T.Dataset, k: string): void\n {\n this._keys[d] = k;\n // NOTE - RECALC: Does anything need to be recalc'd now when a dataset is changed?\n }\n mapGeoIDsToFeatureIDs(): void\n {\n for (let i: number = 0; i < this._session.features.nFeatures(); i++)\n {\n let f: T.GeoFeature = this._session.features.featureByIndex(i);\n // 03-27-21\n let geoID: string = geoIDForFeature(f);\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\nexport function geoIDForFeature(f: any): string\n{\n // 12-02-2020 - Switched to using ids vs. geoids per Terry\n if (f.properties && f.properties['id'])\n {\n return f.properties['id'];\n // GEOIDs will be one of these properties\n // const value = f.properties['GEOID10'] || f.properties['GEOID20'] || f.properties['GEOID'];\n\n // return value;\n }\n else\n {\n console.log(\"This feature does not have an id property:\", f);\n throw \"Feature with no id property.\";\n }\n}\n\nexport function fieldForFeature(f: any, dk: string /* dt: T.Dataset */, ff: T.FeatureField): any\n{\n // Multiple keys to transparently handle NH and non-NH (e.g. Bl vs BlC) keyed fields\n // One of the values will always be missing and hence zero.\n const keys = T.fieldsFromFeatureField(dk, ff);\n\n let result = 0;\n keys.forEach(key => { result += _getFeatures(f, dk, key) });\n return result;\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\n\nfunction _getFeatures(f: any, datasetKey: string, p: string): number\n{\n if (! f.properties) return 0;\n\n // This is actual path\n if (f.properties.getDatasetField) return f.properties.getDatasetField(f, datasetKey, p);\n\n // This is old path looking through full dataset property structure\n if (! f.properties.datasets) return 0;\n if (datasetKey && !f.properties.datasets[datasetKey]) return 0;\n let n = datasetKey ? f.properties.datasets[datasetKey][p] : f.properties[p];\n return !n || isNaN(n) ? 0 : n;\n}\n\n// Wrap data by county, to abstract the specifics of the internal structure\nexport class Counties\n{\n _session: AnalyticsSession;\n\n _data: T.GeoFeatureCollection;\n _countyNameLookup: T.FIPSCodeToCountyNameMap = {};\n\n nCounties: number;\n index = {} as T.FIPSToOrdinalMap;\n fips = {} as T.OrdinalToFIPSlMap;\n totalPopulation: number[] = [];\n\n constructor(s: AnalyticsSession, data: T.GeoFeatureCollection)\n {\n this._session = s;\n\n this._data = data;\n this.nCounties = this._data.features.length;\n }\n countyByIndex(i: number): T.GeoFeature { return this._data.features[i]; }\n // 10-16-21 - Analyze view crashing because county names were undefined in the lookup table.\n // Property had changed from 'NAME' to 'name' for *some* states.\n propertyForCounty(f: any, pk: string): any \n { \n return f.properties[pk] ? f.properties[pk] : f.properties[pk.toLowerCase()]; \n }\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\n// MMD - Extended this for # of reps\nexport class State\n{\n _session: AnalyticsSession;\n\n xx: string;\n nDistricts: number;\n nReps: number;\n totalPop: number = 0;\n targetSize: number = 0; // HACK - Will get set by doPreprocessCensus()\n tooBigFIPS = [] as string[];\n tooBigName = [] as string[];\n singleCountyDistrictMax = 0;\n expectedSplits = 0;\n expectedAffected = 0;\n\n constructor(s: AnalyticsSession, xx: string, n: number)\n {\n this._session = s;\n\n this.xx = xx;\n this.nDistricts = n;\n\n this.nReps = (s.repsByDistrict) ? s.repsByDistrict.reduce((a, b) => a + b, 0) : this.nDistricts; // MMD\n }\n}\n\nexport class Plan\n{\n _session: AnalyticsSession;\n\n // NOTE - RECALC: 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 {\n this._session = s;\n\n\n this._planByGeoID = p;\n this._planByDistrictID = {} as T.PlanByDistrictID;\n\n this.districtIDs = []; // Set when the plan in inverted\n }\n // NOTE - DON'T remove water-only features from the plan, as they may be required\n // for contiguity. Just skip them in aggregating district statistics.\n //\n // removeWaterOnlyFeatures(plan: T.PlanByGeoID): T.PlanByGeoID {\n // let newPlan = {} as T.PlanByGeoID;\n\n // for (let geoID in plan) {\n // // Remove water-only features\n // if (!(U.isWaterOnly(geoID))) {\n // newPlan[geoID] = plan[geoID];\n // }\n // else {\n // console.log(\"Removing water-only feature\", geoID);\n // }\n // }\n\n // return newPlan;\n // }\n invertPlan(bLog: boolean = false): void\n {\n this._planByDistrictID = invertPlan(this._planByGeoID, this._session, bLog);\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\n// Invert a feature assignment structure to sets of ids by district\nexport function invertPlan(plan: T.PlanByGeoID, s?: AnalyticsSession, bLog: boolean = false): T.PlanByDistrictID\n{\n let invertedPlan = {} as T.PlanByDistrictID;\n\n // Add a dummy 'unassigned' district\n invertedPlan[S.NOT_ASSIGNED] = new Set();\n\n // The feature assignments coming from DRA do not include unassigned ones.\n // - In the DRA-calling context, there's an analytics session with a reference\n // to the features. Loop over all the features to find the unassigned ones,\n // and add them to the dummy unassigned district explicitly.\n // - In the CLI-calling context, there's no session (yet) but the plan is complete.\n if (!(s == undefined))\n {\n for (let i: number = 0; i < s.features.nFeatures(); i++)\n {\n let f: T.GeoFeature = s.features.featureByIndex(i);\n // 03-27-21\n let geoID: string = geoIDForFeature(f);\n // let geoID: string = s.features.geoIDForFeature(f);\n\n // If the feature is NOT explicitly assigned to a district, add the geoID\n // to the dummy unassigned district 0.\n if (!(U.keyExists(geoID, plan))) invertedPlan[S.NOT_ASSIGNED].add(geoID);\n\n // NOTE - NOT skipping WATER-ONLY features here, because we're\n // not skipping them below when they are explicitly assigned in plans. Should\n // we skip them in both places?\n }\n }\n\n for (let geoID in plan)\n {\n let districtID = plan[geoID];\n\n // Make sure the set for the districtID exists\n if (!(U.objectContains(invertedPlan, districtID)))\n {\n invertedPlan[districtID] = new Set();\n }\n\n // Add the geoID to the districtID's set\n invertedPlan[districtID].add(geoID);\n\n if (U.isWaterOnly(geoID) && bLog) console.log(\"Invert plan: Water-only feature still in plan!\", geoID);\n }\n\n return invertedPlan;\n}\n\nexport class GraphClass\n{\n _session: AnalyticsSession;\n\n _graph: T.ContiguityGraph;\n\n constructor(s: AnalyticsSession, graph: T.ContiguityGraph)\n {\n this._session = s;\n\n this._graph = graph;\n }\n peerNeighbors(node: string): string[]\n {\n // Get the neighboring geoIDs connected to a geoID\n // Ignore the lengths of the shared borders (the values), for now\n\n // Protect against getting a GEOID that's not in the graph\n if (U.keyExists(node, this._graph))\n {\n // Handle both unweighted & weighted neighbors\n let n = this._graph[node];\n let l = (n instanceof Array) ? n : U.getObjectKeys(n);\n\n return l;\n\n // return U.getObjectKeys(this._graph[node]);\n }\n else return [];\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 { AnalyticsSession } from './_api';\n\nimport { doIsComplete, doIsContiguous, doIsFreeOfHoles } from './valid'\nimport { doHasEqualPopulations } from './equal';\n\nimport { doFindCountiesSplitUnexpectedly, doFindSplitVTDs } from './cohesive';\n\n// Compile district-level info for plan/map-level analytics\nexport function doAnalyzeDistricts(s: AnalyticsSession, bLog: boolean = false): void\n{\n s.districts.recalcStatistics(bLog);\n s.districts.extractDistrictShapeProperties(bLog);\n}\n\n// Calculate the analytics & validations and cache the results\n// NOTE - doAnalyzePlan() depends on doAnalyzeDistricts() having run first.\n// NOTE - I could make this table-driven, but I'm thinking that the explicit\n// calls might make chunking for aync easier.\nexport function doAnalyzePlan(s: AnalyticsSession, bLog: boolean = false): void\n{\n s.tests[T.Test.Complete] = doIsComplete(s, bLog);\n s.tests[T.Test.Contiguous] = doIsContiguous(s, bLog);\n s.tests[T.Test.FreeOfHoles] = doIsFreeOfHoles(s, bLog);\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 s.tests[T.Test.UnexpectedCountySplits] = doFindCountiesSplitUnexpectedly(s, bLog);\n s.tests[T.Test.VTDSplits] = doFindSplitVTDs(s, bLog);\n\n // Enable a Test Log and Scorecard to be generated\n s.bPlanAnalyzed = true;\n s.bPostProcessingDone = false;\n}\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//\nexport function doDeriveSecondaryTests(s: AnalyticsSession, bLog: boolean = false): void\n{\n s.tests[T.Test.EqualPopulation] = doHasEqualPopulations(s, bLog);\n}\n","//\n// SPLITTING\n//\n\nimport * as T from './types'\nimport * as U from './utils';\n\nimport { AnalyticsSession } from './_api';\n\n\n// The main county-district splitting code is in the dra-analytics package.\n\n\n// ANALYZE SIMPLE COUNTY & VTD SPLITTING\n\n/*\n \nSample results for NC 2016 dongressional plan\n________________________________________________________________________________\n \nState: NC\nCensus: 2010\nTotal population: 9,535,483\nNumber of districts: 13\nTarget district size: 733,499\nNumber of counties: 100\n \nEqual Population: 11.24% deviation\nCompactness: None\nProportionality: 27.67% gap\nCohesiveness: 11 unexpected splits, affecting 27.14% of the total population\n \nThese counties are split unexpectedly (meaning that they're smaller than a district):\n \n • Bladen\n • Buncombe\n • Catawba\n • Cumberland\n • Durham\n • Guilford\n • Iredell\n • Johnston\n • Pitt\n • Rowan\n • Wilson\n \n*/\n\n// 10-23-21 - This analysis *assumes* that a map is complete (or nearly so).\n// - We do the analysis regardless, but\n// - Protect against weird results in the client\nexport function doFindCountiesSplitUnexpectedly(s: AnalyticsSession, bLog: boolean = false): T.TestEntry\n{\n let test = s.getTest(T.Test.UnexpectedCountySplits) 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 SPLITTING FOR THE PLAN\n\n // Get the county-district pivot (\"splits\")\n let countiesByDistrict = s.districts.table.countySplits;\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 {\n // See if there's only one county partition\n // Ignore the dummy unassigned 0 \"county.\"\n let nCountiesInDistrict = 0;\n for (let c = 1; c <= s.counties.nCounties; c++)\n {\n // Guard against empty district\n if (countiesByDistrict[d])\n {\n if (countiesByDistrict[d][c] > 0)\n {\n nCountiesInDistrict += 1;\n if (nCountiesInDistrict > 1)\n {\n break;\n }\n }\n }\n }\n // If so, save the district\n if (nCountiesInDistrict == 1)\n {\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 // 07-17-21 - For enumerating # of times each split county is split\n let countyIndexesWithSplits: number[][] = [];\n\n // Ignore the dummy unassigned 0 \"county.\"\n for (let c = 1; c <= s.counties.nCounties; c++)\n {\n let nCountyParts = 0;\n let subtotal = 0;\n\n // Ignore the dummy unassigned 0 and N+1 summary \"districts.\"\n for (let d = 1; d <= s.state.nDistricts; d++)\n {\n // Guard against empty district\n if (countiesByDistrict[d])\n {\n if (countiesByDistrict[d][c] > 0)\n {\n nPartitionsOverall += 1;\n nCountyParts += 1;\n if (!(U.arrayContains(singleCountyDistricts, d)))\n {\n subtotal += countiesByDistrict[d][c];\n }\n }\n }\n }\n if (nCountyParts > 1)\n {\n splitCounties.add(c);\n totalAffected += subtotal;\n\n // 07-17-21 - Enumerate # of times each split county is split\n countyIndexesWithSplits.push([c, nCountyParts - 1]);\n }\n }\n\n // 07-17-21 - Enumerate # of times each split county is split\n let splitCountiesWithSplits: string[] = [];\n\n countyIndexesWithSplits.forEach(pair =>\n {\n const index: number = pair[0];\n const splits: number = pair[1];\n\n // Convert 1–N indices to FIPS codes\n const fips: string = s.counties.fips[index];\n\n if (fips) \n {\n // Convert FIPS codes to names\n const name: string = s.counties.nameFromFIPS(fips);\n\n // Combine # of splits with names\n if (name)\n {\n const text: string = `${name} (${splits})`;\n splitCountiesWithSplits.push(text);\n }\n }\n });\n // Sort by name\n splitCountiesWithSplits.sort();\n\n // End\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 {\n if (!(U.arrayContains(s.state.tooBigFIPS, fips)))\n {\n countiesSplitUnexpectedlyFIPS.push(fips);\n }\n }\n\n // ... and convert the FIPS codes to county names.\n for (let fips of countiesSplitUnexpectedlyFIPS)\n {\n const name = s.counties.nameFromFIPS(fips);\n\n // 07-06-20 - Guard in case the FIPS code isn't in the county name lookup\n if (name)\n countiesSplitUnexpectedly.push(name);\n else\n {\n if (bLog) console.log(\"County is not in the FIPS-to-name lookup table: \", fips);\n }\n }\n countiesSplitUnexpectedly = countiesSplitUnexpectedly.sort();\n\n\n test['score'] = U.trim(unexpectedAffected);\n test['details']['nSplits'] = nSplits;\n test['details']['unexpectedSplits'] = unexpectedSplits;\n test['details']['countiesSplitUnexpectedly'] = countiesSplitUnexpectedly;\n\n // 02-23-21 - Added single-county district details\n test['details']['expectedSplits'] = s.state.expectedSplits;\n test['details']['tooBigName'] = s.state.tooBigName;\n test['details']['singleCountyDistrictMax'] = s.state.singleCountyDistrictMax;\n test['details']['nCountiesSplit'] = splitCountiesFIPS.length;\n test['details']['nSingleCountyDistricts'] = singleCountyDistricts.length;\n\n // 07-17-21 - Enumerate # of times each split county is split\n test['details']['countiesWithSplits'] = splitCountiesWithSplits;\n\n return test;\n}\n\n// NOTE - This function just creates an empty container that dra-client fills in when generating the UI\nexport function doFindSplitVTDs(s: AnalyticsSession, bLog: boolean = false): T.TestEntry\n{\n let test = s.getTest(T.Test.VTDSplits) as T.TestEntry;\n\n let splitVTDs: string[] = [];\n\n test['score'] = splitVTDs.length;\n test['details']['splitVTDs'] = splitVTDs;\n\n return test;\n}\n\n","//\n// COMPACT\n//\n\nimport { Poly } from '@dra2020/baseclient';\n\nimport * as T from './types';\nimport * as U from './utils';\n\nimport { AnalyticsSession } from './_api';\n\n\n// The main compactness code is in the dra-analytics package.\n\n// HELPER TO EXTRACT PROPERTIES OF DISTRICT SHAPES\nexport function extractDistrictProperties(s: AnalyticsSession, bLog: boolean = false): void\n{\n // NOTE - I am assuming that district IDs are integers 1–N\n for (let i = 1; i <= s.state.nDistricts; i++)\n {\n const poly: any = s.districts.getDistrictShapeByID(i);\n\n // Guard against no shape for empty districts AND null shapes\n if (isAShape(poly))\n {\n const area: number = Poly.polyAreaFlat(poly);\n const perimeter: number = Poly.polyPerimeterFlat(poly);\n const diameter: number = Poly.polyDiameterFlat(poly);\n\n let props: T.DistrictShapeProperties = [0, 0, 0];\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\nfunction isAShape(poly: any): boolean\n{\n if (poly == null) return false;\n if (Poly.polyNull(poly)) return false;\n return poly.geometry && poly.geometry.coordinates && !U.isArrayEmpty(poly.geometry.coordinates);\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 { AnalyticsSession } from './_api';\n\n\n// MMD - This generalizes for variable #'s of reps per district.\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, bLog: boolean = false): T.TestEntry\n{\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 const popDevPct: number = popDevTest['score'] as number;\n // const popDevNormalized: number = popDevTest['normalizedScore'] as number;\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.table.bEqualPop;\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bEqualPop[summaryRow] = test['score'] as boolean;\n\n return test;\n}\n","//\n// THE DISTRICT-ANALYTICS NODE PACKAGE API\n//\n\nexport * from './_api';\nexport { geoIDForFeature, fieldForFeature, inferSelectedMinority } from './_data';\nexport * from './results';\nexport * from './types';\nexport\n{\n Profile, Scorecard, SplittingScorecard, Measurement\n} from './legacy-types';\nexport * from './utils';\n\n\n// Re-export RPV types and COI splitting functions\n\nimport { Minority, Partisan, Rate, Splitting, Types } from '@dra2020/dra-analytics';\n\n// See the Typescript pre-3.8 hack described here:\n// https://stackoverflow.com/questions/54953960/typescript-errors-when-importing-a-not-exported-type-even-though-it-is-export\nexport type MinorityFilter = Types.MinorityFilter;\nexport type Point = Types.dictPoint;\nexport type DemographicVotingByFeature = Types.DemographicVotingByFeature;\nexport type RPVFactor = Types.RPVFactor;\nexport type RPVAnalysis = Types.RPVAnalysis;\n\nexport const estSeatProbability = Partisan.estSeatProbability;\n\nexport const ratePartisanBias = Rate.ratePartisanBias;\nexport const normalizePartisanBias = Rate.normalizePartisanBias;\nexport const isAntimajoritarian = Rate.isAntimajoritarian;\nexport const avgSVError = Partisan.avgSVError;\n\nexport const effectiveSplits = Splitting.effectiveSplits;\nexport const uncertaintyOfMembership = Splitting.uncertaintyOfMembership;","//\n// PROTECTS MINORITIES\n//\n\nimport { Minority, Types } from '@dra2020/dra-analytics';\n\nimport * as T from './types'\nimport { AnalyticsSession } from './_api';\n\nimport majorityMinority from '../static/majority-minority.json';\nimport vraSection5 from '../static/vra5-preclearance.json';\n\n// TODO - Update/revise this, when the update comes out in September:\n// Sources for majority-minority info:\n// - https://en.wikipedia.org/wiki/List_of_majority-minority_United_States_congressional_districts\n// - http://www.ncsl.org/Portals/1/Documents/Redistricting/Redistricting_2010.pdf (PP. 80–84)\n// - https://www.justice.gov/crt/jurisdictions-previously-covered-section-5\n\n\nexport function getMajorityMinority(s: AnalyticsSession): T.Dict\n{\n const xx: string = s.state.xx;\n\n const mMDict: T.Dict = majorityMinority;\n const stateMM: T.Dict = mMDict[xx];\n\n return stateMM;\n}\n\nexport function getVRASection5(s: AnalyticsSession): string\n{\n const xx: string = s.state.xx;\n\n const vraPreDict: T.Dict = vraSection5;\n const stateVRAPre: string = vraPreDict[xx];\n\n return stateVRAPre;\n}\n\n// RPV - pulled into a separate component 11-17-2020\nexport function doAnalyzeRacialPolarization(s: AnalyticsSession, districtID: number, groups: Types.MinorityFilter, bLog: boolean = false): Types.RPVAnalysis | undefined\n{\n // Make sure that a minority is specified\n if (!(groups.black || groups.hispanic || groups.pacific || groups.asian || groups.native || groups.minority)) return undefined;\n\n const points = s.districts.extractVotesByDemographic(districtID, groups, bLog);\n\n // Make sure the district is not empty & there are enough points\n if (points === undefined) return undefined;\n if (points.comparison === undefined) return undefined;\n if (points.comparison.length <= 10) return undefined;\n\n return Minority.analyzeRacialVoting(points, districtID, groups);\n}\n\n// RPV is in the dra-analytics package.\n","//\n// PREPROCESS DATA\n//\n\nimport * as T from './types'\nimport * as U from './utils';\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, bLog: boolean = false): void\n{\n // If necessary, do one-time preprocessing\n if (!s.bOneTimeProcessingDone)\n {\n doPreprocessCountyFeatures(s, bLog);\n doPreprocessCensus(s, bLog);\n // doPreprocessElection(s, bLog);\n s.bOneTimeProcessingDone = true;\n }\n\n // Invert the plan by district ID\n s.plan.invertPlan(bLog);\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, bLog: boolean = false): void\n{\n let fipsCodes = [];\n\n // CREATE A MAP OF FIPS CODES TO NAMES\n\n for (let i: number = 0; i < s.counties.nCounties; i++)\n {\n\n let county = s.counties.countyByIndex(i);\n\n let fips = s.counties.propertyForCounty(county, 'COUNTYFP');\n fipsCodes.push(fips);\n\n let name = s.counties.propertyForCounty(county, 'NAME');\n\n s.counties.mapFIPSToName(fips, name);\n }\n\n // CREATE A FIPS CODE-ORDINAL MAP\n\n // Sort the FIPS codes in the county shapes\n fipsCodes = fipsCodes.sort();\n\n // Add a dummy county, for county-district splitting analysis.\n fipsCodes.unshift('000');\n // NOTE - This was added for the legacy SPLITTING implementation.\n\n // Create the ID-ordinal map\n for (let i in fipsCodes)\n {\n s.counties.index[fipsCodes[i]] = Number(i);\n\n // 07-17-21 - For enumerating # of times each split county is split\n s.counties.fips[Number(i)] = fipsCodes[i];\n } \n}\n\n\n// ANALYZE THE CENSUS BY COUNTY\n\nfunction doPreprocessCensus(s: AnalyticsSession, bLog: boolean = false): void\n{\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 // SUM TOTAL POPULATION BY COUNTY\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 {\n let f: T.GeoFeature = s.features.featureByIndex(i);\n // 03-27-21\n let geoID: string = D.geoIDForFeature(f);\n // let geoID: string = s.features.geoIDForFeature(f);\n // Skip water-only features\n if (!(U.isWaterOnly(geoID)))\n {\n // 03-27-21\n const dk: string = s.features._keys[T.Dataset.CENSUS];\n let value: number = D.fieldForFeature(f, dk, T.FeatureField.TotalPop);\n // let value: number = s.features.fieldForFeature(f, T.Dataset.CENSUS, T.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 countyFIPS = U.parseGeoID(geoID)['county'] as string;\n\n // Ignore features when the county is unrecognized\n if (U.keyExists(countyFIPS, s.counties.index))\n {\n // If a subtotal for the county doesn't exist, initialize one\n if (!(U.keyExists(countyFIPS, totalByCounty)))\n {\n totalByCounty[countyFIPS] = 0;\n }\n // Sum total population by county\n totalByCounty[countyFIPS] += value;\n }\n else\n {\n if (bLog) console.log(\"County not recognized:\", geoID);\n }\n }\n else\n {\n if (bLog) console.log(\"Skipping water-only feature in Census preprocessing:\", geoID);\n }\n }\n // NOTE - The above could be replaced, if I got totals on county.geojson.\n\n\n /* Moved this to doPreprocessCountyFeatures() - 09-14-2020 to fix VA county mismatch bug\n // CREATE A FIPS CODE-ORDINAL MAP\n\n // Get the county FIPS codes\n let fipsCodes = U.getObjectKeys(totalByCounty);\n // Sort the results\n fipsCodes = fipsCodes.sort();\n\n // NOTE - This was added for the legacy SPLITTING implementation.\n // Add a dummy county, for county-district splitting analysis.\n fipsCodes.unshift('000');\n\n // Create the ID-ordinal map\n for (let i in fipsCodes)\n {\n s.counties.index[fipsCodes[i]] = Number(i);\n }\n */\n\n // MAKE AN ARRAY OF TOTAL POPULATIONS BY COUNTY INDEX\n\n // Add an extra 0th virtual county bucket for county-district splitting analysis \n let nCountyBuckets = s.counties.nCounties + 1;\n let countyTotals: number[] = U.initArray(nCountyBuckets, 0);\n\n for (let fipsCode in totalByCounty)\n {\n let i = s.counties.indexFromFIPS(fipsCode);\n\n countyTotals[i] = totalByCounty[fipsCode];\n }\n\n s.counties.totalPopulation = countyTotals;\n\n // MMD - Rationalized calculation of target size *per rep*\n s.state.targetSize = s.state.totalPop / s.state.nReps;\n\n // ANALYZE THE COUNTIES\n\n // MMD - This \"these counties must be split\" analysis does NOT generalize to heterogenous MMD.\n // 'target_size': 733499, # calc as total / districts\n const targetSize = s.state.targetSize;\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 singleCountyDistrictMax = 0;\n let expectedSplits = 0;\n let expectedAffected = 0;\n\n // Get the county FIPS codes\n let fipsCodes = U.getObjectKeys(s.counties.index);\n\n // Loop over the counties\n for (let county in fipsCodes)\n {\n let fipsCode = fipsCodes[county];\n\n // Skip the dummy county\n if (fipsCode == '000') continue;\n\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 {\n countyAffected = totalByCounty[fipsCode] % targetSize;\n tooBigFIPS.push(fipsCode);\n tooBigName.push(s.counties.nameFromFIPS(fipsCode));\n singleCountyDistrictMax += countySplits;\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 s.state.singleCountyDistrictMax = singleCountyDistrictMax;\n}\n\n\n// PREPROCESS ELECTION RESULTS\n\n// function doPreprocessElection(s: AnalyticsSession, bLog: boolean = false): void\n// {\n// if (bLog) console.log(\"Preprocessing election data ...\");\n// }\n\n","//\n// TEMPLATES FOR UNFORMATTED ANALYTICS RESULTS\n// \n\nimport * as Score from './legacy-types';\n\nimport * as T from './types';\nimport * as U from './utils';\n\nimport { AnalyticsSession } from './_api';\nimport { doDeriveSecondaryTests } from './analyze';\n\n\nexport type RequirementsChecklist = {\n score: boolean; // T.TriState;\n metrics: {\n complete: boolean; // T.TriState;\n contiguous: boolean; // T.TriState;\n freeOfHoles: boolean; // T.TriState;\n equalPopulation: boolean; // T.TriState;\n };\n details: {\n unassignedFeatures: string[]; // A possibly empty list of GEOIDs\n emptyDistricts: number[]; // A possibly empty list of district IDs\n discontiguousDistricts: number[]; // Ditto\n embeddedDistricts: number[]; // Ditto\n populationDeviation: number; // A fraction [0.0 – 1.0] to represent as a %\n deviationThreshold: number; // A fraction [0.0 – 1.0] to represent as a % \n };\n datasets: T.Datasets;\n resources: {\n // stateReqs: string;\n };\n};\n\nexport function prepareRequirementsChecklist(s: AnalyticsSession, bLog: boolean = false): RequirementsChecklist\n{\n if (!(s.bPostProcessingDone))\n {\n doAnalyzePostProcessing(s);\n }\n\n // REQUIREMENTS CATEGORY\n let paRequirements: RequirementsChecklist;\n\n {\n const completeTest = s.getTest(T.Test.Complete) as T.TestEntry;\n const contiguousTest = s.getTest(T.Test.Contiguous) as T.TestEntry;\n const freeOfHolesTest = s.getTest(T.Test.FreeOfHoles) as T.TestEntry;\n const equalPopulationTest = s.getTest(T.Test.EqualPopulation) as T.TestEntry;\n\n // Combine individual checks into an overall score\n\n const completeMetric = completeTest['score'] as boolean;\n const contiguousMetric = contiguousTest['score'] as boolean;\n const freeOfHolesMetric = freeOfHolesTest['score'] as boolean;\n const equalPopulationMetric = equalPopulationTest['score'] as boolean;\n const reqScore: boolean = completeMetric && contiguousMetric && freeOfHolesMetric && equalPopulationMetric;\n\n /* T.TriState\n // NOTE - Until we add three-state support top to bottom in\n // requirements/validations, map booleans to tri-states here.\n const completeMetric = U.mapBooleanToTriState(completeTest['score'] as boolean);\n const contiguousMetric = U.mapBooleanToTriState(contiguousTest['score'] as boolean);\n const freeOfHolesMetric = U.mapBooleanToTriState(freeOfHolesTest['score'] as boolean);\n const equalPopulationMetric = U.mapBooleanToTriState(equalPopulationTest['score'] as boolean);\n\n let reqScore: T.TriState = T.TriState.Green;\n const checks = [completeMetric, contiguousMetric, freeOfHolesMetric, equalPopulationMetric];\n if (checks.includes(T.TriState.Yellow)) reqScore = T.TriState.Yellow;\n if (checks.includes(T.TriState.Red)) reqScore = T.TriState.Red;\n */\n\n // Get values to support details entries\n const unassignedFeaturesDetail = U.deepCopy(completeTest['details']['unassignedFeatures']) || [];\n const emptyDistrictsDetail = U.deepCopy(completeTest['details']['emptyDistricts']) || [];\n const discontiguousDistrictsDetail = U.deepCopy(contiguousTest['details']['discontiguousDistricts']) || [];\n const embeddedDistrictsDetail = U.deepCopy(freeOfHolesTest['details']['embeddedDistricts']) || [];\n\n const populationDeviationDetail = U.deepCopy(equalPopulationTest['details']['deviation']);\n const deviationThresholdDetail = U.trim(s.populationDeviationThreshold());\n \n // const xx: string = s.state.xx;\n // const stateReqsDict: T.Dict = allStateReqs;\n // const reqLinkToStateReqs: string = stateReqsDict[xx];\n\n // Populate the category\n paRequirements = {\n score: reqScore,\n metrics: {\n complete: completeMetric,\n contiguous: contiguousMetric,\n freeOfHoles: freeOfHolesMetric,\n equalPopulation: equalPopulationMetric\n },\n details: {\n unassignedFeatures: unassignedFeaturesDetail,\n emptyDistricts: emptyDistrictsDetail,\n discontiguousDistricts: discontiguousDistrictsDetail,\n embeddedDistricts: embeddedDistrictsDetail,\n populationDeviation: populationDeviationDetail,\n deviationThreshold: deviationThresholdDetail\n },\n datasets: {\n census: U.deepCopy(s.config['descriptions']['CENSUS']),\n },\n resources: {\n // stateReqs: reqLinkToStateReqs\n }\n }\n }\n\n return paRequirements;\n}\n\n// DISTRICT STATISTICS\n\nexport type DistrictRow = {\n districtID: number;\n totalPop: number;\n popDevPct: number;\n bEqualPop: boolean;\n bNotEmpty: boolean;\n bContiguous: boolean;\n bNotEmbedded: boolean;\n demPct: number;\n repPct: number;\n othPct: number;\n totalVAP: number;\n whitePct: number;\n minorityPct: number;\n blackPct: number;\n hispanicPct: number;\n pacificPct: number;\n asianPct: number;\n nativePct: number;\n};\n\nexport type DistrictStatistics = {\n table: DistrictRow[];\n details: {}; // None at this time\n datasets: T.Datasets;\n resources: {}; // None at this time\n}\n\n// Create a DistrictStatistics instance, deep copying the underlying values.\nexport function prepareDistrictStatistics(s: AnalyticsSession, bLog: boolean = false): DistrictStatistics\n{\n if (!(s.bPostProcessingDone))\n {\n doAnalyzePostProcessing(s);\n }\n\n // Transpose the rows & columns, so rows are districts.\n let dsTable: DistrictRow[] = [];\n for (let i = 0; i < s.districts.numberOfRows(); i++)\n {\n const rawRow: DistrictRow = {\n districtID: i,\n totalPop: s.districts.table.totalPop[i],\n popDevPct: s.districts.table.popDevPct[i],\n bEqualPop: s.districts.table.bEqualPop[i],\n bNotEmpty: s.districts.table.bNotEmpty[i],\n bContiguous: s.districts.table.bContiguous[i],\n bNotEmbedded: s.districts.table.bNotEmbedded[i],\n demPct: s.districts.table.demPct[i],\n repPct: s.districts.table.repPct[i],\n othPct: s.districts.table.otherPct[i],\n whitePct: s.districts.table.whitePct[i],\n totalVAP: s.districts.table.totalVAP[i],\n minorityPct: s.districts.table.minorityPct[i],\n blackPct: s.districts.table.blackPct[i],\n hispanicPct: s.districts.table.hispanicPct[i],\n pacificPct: s.districts.table.pacificPct[i],\n asianPct: s.districts.table.asianPct[i],\n nativePct: s.districts.table.nativePct[i]\n };\n\n const readyRow: DistrictRow = U.deepCopy(rawRow);\n dsTable.push(readyRow);\n }\n\n const dsDetails = {\n // None at this time\n };\n\n const dsDatasets: T.Datasets = {\n shapes: U.deepCopy(s.config['descriptions']['SHAPES']), // 2020\n census: U.deepCopy(s.config['descriptions']['CENSUS']),\n vap: U.deepCopy(s.config['descriptions']['VAP']),\n election: U.deepCopy(s.config['descriptions']['ELECTION'])\n }\n\n const dsResources = {\n // None at this time\n };\n\n const ds: DistrictStatistics = {\n table: dsTable,\n details: dsDetails,\n datasets: dsDatasets,\n resources: dsResources\n };\n\n return ds;\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, bLog: boolean = false): void\n{\n // Just populate the normalized population deviation score in the test\n const scorecard = s._scorecard as Score.Scorecard;\n let popDev = s.getTest(T.Test.PopulationDeviation) as T.TestEntry;\n popDev['normalizedScore'] = scorecard.populationDeviation.normalized;\n\n const datasets: T.Datasets = {\n shapes: U.deepCopy(s.config['descriptions']['SHAPES']), // 2020\n census: U.deepCopy(s.config['descriptions']['CENSUS']),\n vap: U.deepCopy(s.config['descriptions']['VAP']),\n election: U.deepCopy(s.config['descriptions']['ELECTION'])\n }\n scorecard.partisan.details['election'] = datasets.election;\n scorecard.minority.details['vap'] = datasets.vap;\n scorecard.details['shapes'] = datasets.shapes;\n scorecard.details['census'] = datasets.census;\n\n const simpleSplits = s.getTest(T.Test.UnexpectedCountySplits) as T.TestEntry;\n scorecard.splitting.details['unexpectedAffected'] = simpleSplits['score'];\n scorecard.splitting.details['nSplits'] = simpleSplits['details']['nSplits'];\n scorecard.splitting.details['countiesSplitUnexpectedly'] = U.deepCopy(simpleSplits['details']['countiesSplitUnexpectedly']);\n\n // 02-23-21 - Added single-county district details\n scorecard.splitting.details['nTooBigCounties'] = simpleSplits['details']['expectedSplits'];\n scorecard.splitting.details['tooBigName'] = simpleSplits['details']['tooBigName'];\n scorecard.splitting.details['nCountiesSplit'] = simpleSplits['details']['nCountiesSplit'];\n scorecard.splitting.details['nSingleCountyDistricts'] = simpleSplits['details']['nSingleCountyDistricts'];\n scorecard.splitting.details['singleCountyDistrictMax'] = simpleSplits['details']['singleCountyDistrictMax'];\n\n // 07-17-21 - Enumerate # of times each split county is split\n scorecard.splitting.details['countiesWithSplits'] = simpleSplits['details']['countiesWithSplits'];\n\n // NOTE - Add split precincts in dra-client directly\n\n // Derive secondary tests\n // Note - The only secondary test is 'roughly equal population (true/false)\n doDeriveSecondaryTests(s, bLog);\n\n // Toggle the semaphore, so postprocessing isn't for both the testlog & scorecard\n s.bPostProcessingDone = true;\n}\n\n","//\n// SCORING\n// \n\nimport * as L from './legacy-types';\n\nimport * as T from './types';\nimport * as U from './utils';\nimport { AnalyticsSession } from './_api';\n\nimport { Compactness, Equal, Minority, Partisan, Rate, Splitting, Types, Utils } from '@dra2020/dra-analytics';\n\n\n// PROFILE A PLAN\n\nconst KEEP_DECIMALS: number = 6;\n\n// MMD - Added # reps per district to the profile\nexport function profilePlan(s: AnalyticsSession, bLog: boolean = false): L.Profile\n{\n const state: string = s.state.xx;\n const planName: string = s.title;\n const nDistricts: number = s.state.nDistricts;\n const nReps: number = s.state.nReps; // MMD\n const nCounties: number = s.counties.nCounties;\n\n const targetSize = Math.round(s.state.totalPop / nReps); // MMD\n // const targetSize: number = Math.round(s.state.totalPop / nDistricts);\n const popByDistrict: number[] = U.deepCopy(s.districts.table.totalPop.slice(1, -1)) as number[];\n\n const geoPropsByDistrict: L.GeoProperties[] = makeArrayOfGeoProps(s, bLog);\n\n const splits: number[][] = makeNakedCxD(s);\n\n const summaryRow: number = s.districts.numberOfRows() - 1;\n\n // 10-22-2020 - Converted Dem + Rep + Other = Total to two-party vote shares for analytics.\n const demVote: number = s.districts.table.demVotes[summaryRow];\n const repVote: number = s.districts.table.repVotes[summaryRow];\n\n const statewideVf: number = U.trim(demVote / (demVote + repVote), KEEP_DECIMALS);\n\n let vpiArray: number[] = [];\n const demVotes: number[] = U.deepCopy(s.districts.table.demVotes.slice(1, -1)) as number[];\n const repVotes: number[] = U.deepCopy(s.districts.table.repVotes.slice(1, -1)) as number[];\n\n for (let districtID = 1; districtID <= nDistricts; districtID++)\n {\n const D = demVotes[districtID - 1];\n const R = repVotes[districtID - 1];\n const T = D + R;\n const v = (T > 0) ? U.trim(D / T, KEEP_DECIMALS) : 0;\n vpiArray.push(v);\n }\n\n const statewideDemographics: L.Demographics = getStatewideDemographics(s);\n const demographicsByDistrict: L.Demographics[] = getDemographicsByDistrict(s);\n\n // MMD - Extended the profile for # reps per district\n const profile: L.Profile = {\n state: state,\n name: planName,\n nDistricts: nDistricts,\n repsByDistrict: s.repsByDistrict, // MMD\n nCounties: nCounties,\n bStateLeg: s.legislativeDistricts, // TODO - 2020\n population: {\n byDistrict: popByDistrict,\n targetSize: targetSize\n },\n shapes: geoPropsByDistrict,\n counties: splits,\n partisanship: {\n statewide: statewideVf,\n byDistrict: vpiArray\n },\n demographics: {\n statewide: statewideDemographics,\n byDistrict: demographicsByDistrict\n }\n }\n\n return profile;\n}\n\n// NOTE - The CxD splits structure from _data.ts includes dummy districts for\n// unassigned precincts & state summary and an extra 0 county. But dra-score takes\n// a simple 1–D x 1–C splits array (zero-based, of course).\nfunction makeNakedCxD(s: AnalyticsSession, bLog: boolean = false): number[][]\n{\n const adornedCxD: number[][] = s.districts.table.countySplits;\n let CxD: number[][] = [];\n\n // Remove the unassigned & total dummy \"districts\"\n for (let districtID = 1; districtID <= s.state.nDistricts; districtID++)\n {\n const splits = U.deepCopy(adornedCxD[districtID].slice(1));\n\n CxD.push(splits);\n }\n\n return CxD;\n}\n\nfunction makeArrayOfGeoProps(s: AnalyticsSession, bLog: boolean = false): L.GeoProperties[]\n{\n let geometryByDistrict: L.GeoProperties[] = [];\n\n for (let districtID = 1; districtID <= s.state.nDistricts; districtID++)\n {\n let districtProps = s.districts.getGeoProperties(districtID);\n // Guard against no shape and no properties\n if (districtProps)\n {\n let a = U.trim(districtProps[T.DistrictShapeProperty.Area], KEEP_DECIMALS);\n let p = U.trim(districtProps[T.DistrictShapeProperty.Perimeter], KEEP_DECIMALS);\n let d = U.trim(districtProps[T.DistrictShapeProperty.Diameter], KEEP_DECIMALS);\n\n // Save each triple\n geometryByDistrict.push({ area: a, perimeter: p, diameter: d });\n }\n }\n\n return geometryByDistrict;\n}\n\nfunction getDemographicsByDistrict(s: AnalyticsSession, bLog: boolean = false): L.Demographics[]\n{\n let demographicsArray: L.Demographics[] = [];\n\n // Remove the unassigned & total dummy \"districts\"\n for (let districtID = 1; districtID <= s.state.nDistricts; districtID++)\n {\n const districtDemographics: L.Demographics = {\n white: U.trim(s.districts.table.whitePct[districtID], KEEP_DECIMALS),\n minority: U.trim(s.districts.table.minorityPct[districtID], KEEP_DECIMALS),\n black: U.trim(s.districts.table.blackPct[districtID], KEEP_DECIMALS),\n hispanic: U.trim(s.districts.table.hispanicPct[districtID], KEEP_DECIMALS),\n pacific: U.trim(s.districts.table.pacificPct[districtID], KEEP_DECIMALS),\n asian: U.trim(s.districts.table.asianPct[districtID], KEEP_DECIMALS),\n native: U.trim(s.districts.table.nativePct[districtID], KEEP_DECIMALS)\n };\n\n demographicsArray.push(districtDemographics);\n }\n\n return demographicsArray;\n}\n\nexport function getStatewideDemographics(s: AnalyticsSession, bLog: boolean = false): L.Demographics\n{\n const summaryRow = s.districts.numberOfRows() - 1;\n\n const demographics: L.Demographics = {\n white: U.trim(s.districts.table.whitePct[summaryRow], KEEP_DECIMALS),\n minority: U.trim(s.districts.table.minorityPct[summaryRow], KEEP_DECIMALS),\n black: U.trim(s.districts.table.blackPct[summaryRow], KEEP_DECIMALS),\n hispanic: U.trim(s.districts.table.hispanicPct[summaryRow], KEEP_DECIMALS),\n pacific: U.trim(s.districts.table.pacificPct[summaryRow], KEEP_DECIMALS),\n asian: U.trim(s.districts.table.asianPct[summaryRow], KEEP_DECIMALS),\n native: U.trim(s.districts.table.nativePct[summaryRow], KEEP_DECIMALS)\n };\n\n return demographics;\n}\n\n\n// SCORE A PLAN using dra-analytics\n\nexport function computeMetrics(p: L.Profile, districtShapes: T.GeoFeatureCollection, bLog: boolean = false): Types.Scorecard\n{\n if (bLog) console.log(\"Computing metrics ...\");\n\n const bLegislative = p.bStateLeg;\n\n // Calculate bias & responsiveness metrics ...\n const byDistrictVf = p.partisanship.byDistrict;\n const statewideVf = p.partisanship.statewide;\n let _pS = Partisan.makePartisanScorecard(statewideVf, byDistrictVf, bLog);\n\n // Calculate minority representation metrics ...\n const statewideDemos = p.demographics.statewide;\n const byDistrictDemos = p.demographics.byDistrict;\n let _mS = Minority.makeMinorityScorecard(statewideDemos, byDistrictDemos, bLog);\n\n // Calculate compactness metrics ...\n let _cS = Compactness.makeCompactnessScorecard(districtShapes, bLog);\n\n // Calculate county-district splitting metrics ...\n const CxD = p.counties;\n const _sS = Splitting.makeSplittingScorecard(CxD, bLog);\n\n // MMD - Add # reps per district to call\n // Calculate population deviation-related metrics ...\n const totPopByDistrict = p.population.byDistrict;\n const targetSize = p.population.targetSize;\n const repsByDistrict = p.repsByDistrict;\n const _pdS = Equal.makePopulationScorecard(totPopByDistrict, targetSize, bLegislative, repsByDistrict, bLog);\n\n const details: Types.Dict = {};\n\n // Assemble the pieces into new scorecard\n const scorecard: Types.Scorecard = {\n partisan: _pS,\n minority: _mS,\n compactness: _cS,\n splitting: _sS,\n populationDeviation: _pdS,\n details: details,\n scratchpad: {} // Hack to pass legacy values between processing steps\n }\n\n return scorecard;\n}\n\nexport function rateKeyDimensions(scorecard: Types.Scorecard, p: L.Profile, bLog: boolean = false): Types.Scorecard\n{\n if (bLog) console.log(\"Rating key dimensions ...\");\n const bLegislative = p.bStateLeg;\n\n // Rate proportionality\n const statewideVf = p.partisanship.statewide;\n const Sf = scorecard.partisan.bias.estSf;\n scorecard.partisan.bias.score = Rate.rateProportionality(scorecard.partisan.bias.deviation, statewideVf, Sf);\n\n // Rate competititveness\n scorecard.partisan.responsiveness.score = Rate.rateCompetitiveness(scorecard.partisan.responsiveness.cDf);\n\n // Rate minority representation\n const rawOd = scorecard.minority.opportunityDistricts; \n const pOd = scorecard.minority.proportionalOpportunities;\n const rawCd = scorecard.minority.coalitionDistricts;\n const pCd = scorecard.minority.proportionalCoalitions;\n scorecard.minority.score = Rate.rateMinorityRepresentation(rawOd, pOd, rawCd, pCd);\n\n // Rate compactness\n const avgReock = scorecard.compactness.avgReock;\n const avgPolsby = scorecard.compactness.avgPolsby;\n const reockRating = Rate.rateReock(avgReock);\n const polsbyRating = Rate.ratePolsby(avgPolsby);\n scorecard.compactness.score = Rate.rateCompactness(reockRating, polsbyRating);\n\n // Rate county- & district-splitting\n const rawCountySplitting = scorecard.splitting.county;\n const rawDistrictSplitting = scorecard.splitting.district;\n const nCounties = p.nCounties;\n const nDistricts = p.nDistricts;\n const countyRating = Rate.rateCountySplitting(rawCountySplitting, nCounties, nDistricts);\n const districtRating = Rate.rateDistrictSplitting(rawDistrictSplitting, nCounties, nDistricts);\n scorecard.splitting.score = Rate.rateSplitting(countyRating, districtRating);\n\n // Rate population deviation\n const rawDeviation = scorecard.populationDeviation.deviation;\n scorecard.populationDeviation.score = Rate.ratePopulationDeviation(rawDeviation, bLegislative);\n\n // Squirrel away normalized compactness & splitting ratings for the legacy scorecard\n const keep: Types.Dict = {\n reockScore: reockRating,\n polsbyScore: polsbyRating,\n countyScore: countyRating,\n districtScore: districtRating\n };\n scorecard.scratchpad = keep;\n\n return scorecard;\n}\n\nexport function thunkScorecard(newScorecard: Types.Scorecard, bLog: boolean = false): L.Scorecard \n{\n if (bLog) console.log(\"Thunking new scorecard into legacy structure ...\");\n\n const scratchpad = newScorecard.scratchpad as Types.Dict;\n\n // Partisan scorecard\n const pS: L.PartisanScorecard = U.deepCopy(newScorecard.partisan) as L.PartisanScorecard;\n\n // EXPERIMENTAL\n const lPropAlt = newScorecard.partisan.experimental.lProp;\n if (lPropAlt) pS.details['lProp'] = lPropAlt;\n\n const lUE = newScorecard.partisan.experimental.lUE;\n if (lUE) pS.details['lUE'] = lUE;\n\n // Minority scorecard\n const mS: L.MinorityScorecard = U.deepCopy(newScorecard.minority) as L.MinorityScorecard;\n\n // Compactness scorecard\n const reockM: L.Measurement = {\n raw: newScorecard.compactness.avgReock,\n normalized: scratchpad.reockScore,\n notes: {}\n };\n const polsbyM: L.Measurement = {\n raw: newScorecard.compactness.avgPolsby,\n normalized: scratchpad.polsbyScore,\n notes: {}\n };\n let cS: L.CompactnessScorecard = {\n score: newScorecard.compactness.score as number,\n reock: reockM,\n polsby: polsbyM,\n details: U.deepCopy(newScorecard.compactness.details)\n };\n // Relocate byDistrict compactness #'s\n cS.details.byDistrict = U.deepCopy(newScorecard.compactness.byDistrict);\n // Add KIWYSI compactness score\n cS.details['kiwysi'] = newScorecard.compactness.avgKWIWYSI;\n\n // Splitting scorecard\n const countyM: L.Measurement = {\n raw: newScorecard.splitting.county,\n normalized: scratchpad.countyScore,\n notes: {}\n };\n const districtM: L.Measurement = {\n raw: newScorecard.splitting.district,\n normalized: scratchpad.districtScore,\n notes: {}\n };\n const sS: L.SplittingScorecard = {\n score: newScorecard.splitting.score as number,\n county: countyM,\n district: districtM,\n details: U.deepCopy(newScorecard.splitting.details)\n };\n\n // Population (equality) scorecard\n const pdM: L.Measurement = {\n raw: newScorecard.populationDeviation.deviation,\n normalized: newScorecard.populationDeviation.score as number,\n notes: newScorecard.populationDeviation.notes\n };\n const pdS: L.PopulationScorecard = pdM;\n\n const scorecard: L.Scorecard = {\n partisan: pS,\n minority: mS,\n compactness: cS,\n splitting: sS,\n populationDeviation: pdS,\n details: newScorecard.details\n }\n\n return scorecard;\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// The dummy district ID for features not assigned districts yet\nexport const NOT_ASSIGNED: number = 0;\n\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","//\n// TYPE DEFINITIONS\n//\n\nimport * as geojson from 'geojson';\nimport { DT } from '@dra2020/dra-types';\n\n// INPUT DATA TYPES\n\n// MMD - Extended for optional # reps per district\n// The SessionRequest specifies an analytics session\nexport type SessionRequest = {\n title: string;\n stateXX: string;\n nDistricts: number;\n repsByDistrict?: number[], // MMD\n planType?: DT.PlanType; // 2020\n legislativeDistricts?: boolean; // 2020\n plan: PlanByGeoID;\n data: GeoFeatureCollection;\n districtShapes: GeoFeatureCollection;\n // districtProperties: DistrictProperties; REMOVED 07-07-20 - not used\n graph: ContiguityGraph;\n counties: GeoFeatureCollection;\n config: {}\n}\n\n// 08-13-2020 - Moved from _data.ts\nexport const enum Dataset\n{\n SHAPES = \"SHAPES\",\n CENSUS = \"CENSUS\",\n VAP = \"VAP\",\n ELECTION = \"ELECTION\"\n}\n\n// 08-13-2020 - Moved from _data.ts\nexport type DatasetKeys = {\n SHAPES: string; // A shapefile\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\n// 08-13-2020 - Moved from _data.ts\n// Identifiers of fields for each feature in the datasets\nexport const enum FeatureField\n{\n TotalPop,\n WhitePop,\n BlackPop,\n HispanicPop,\n AsianPop,\n PacificPop,\n NativePop,\n DemVotes,\n RepVotes,\n // NOTE: \"Other\" is implied as Tot - D - R\n TotalVotes,\n}\n\nconst FieldsByFeatureField = [\n [ \"Tot\" ],\n [ \"Wh\" ],\n [ \"Bl\", \"BlC\" ],\n [ \"His\" ],\n [ \"Asn\", \"AsnC\" ],\n [ \"Pac\", \"PacC\" ],\n [ \"Nat\", \"NatC\" ],\n [ \"D\" ],\n [ \"R\" ],\n [ \"Tot\" ]\n];\n\nexport function fieldsFromFeatureField(ds: string, ff: FeatureField): string[]\n{\n return FieldsByFeatureField[ff]\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 [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// 07-17-21 - For enumerating # of times each split county is split\nexport type OrdinalToFIPSlMap = {\n [index: number]: string;\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{\n [geoID: string]: GeoFeature;\n}\n\n// Contiguity graph -- For each geoID, there's either:\n// a) a (new) unweighted list of neighbors; or\n// b) an (old) dictionary of neighbors, where the value for each\n// neighbor geoID key is the the length of the shared border.\nexport type ContiguityGraph = {\n [geoID: string]: UnweightedNeighbors | WeightedNeighbors;\n}\n\nexport type WeightedNeighbors = {\n [geoID: string]: number;\n}\n\nexport type UnweightedNeighbors = string[];\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// Analytics & validations\nexport const enum Test\n{\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 UnexpectedCountySplits,\n VTDSplits\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{\n Area,\n Diameter,\n Perimeter\n}\n\n// HELPER TYPES\n\nexport type GeoIDParts = {\n vfeature?: boolean;\n state: string;\n county: string;\n rest: string;\n // NOTE - Removing until needed\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// TYPES FOR RESULTS\n\n// For associating datasets with notes in a category\nexport type Datasets = {\n shapes?: string; // A shapefile\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 type Ratings = {\n proportionality: number;\n competitiveness: number;\n minorityRights: number;\n compactness: number;\n splitting: number;\n}\n\n","//\n// UTILITIES\n//\n\nimport { DT } from '@dra2020/dra-types';\n\nimport { AnalyticsSession } from './_api';\nimport { fieldForFeature } from './_data';\n\nimport * as T from './types'\nimport * as S from './settings';\n\n\n// PLAN HELPERS\n\n// Get the districtID to which a geoID is assigned\nexport function getDistrict(plan: T.PlanByGeoID, geoID: string): number | undefined\n{\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 {\n return plan[geoID];\n }\n else\n {\n return undefined;\n }\n}\n\n\n// WORKING WITH GEOIDS\n\nexport function parseGeoID(geoID: string): T.GeoIDParts\n{\n let bVfeature = false;\n // Rewrite vfeature GEOIDs to enable lexical parsing of higher-level parts\n // if (geoID.indexOf('vfeature') >= 0)\n if (DT.isVfeature(geoID))\n {\n bVfeature = true;\n geoID = DT.vgeoidToGeoid(geoID);\n }\n\n const parts: T.GeoIDParts = {\n vfeature: bVfeature,\n state: geoID.substring(0, 2),\n county: geoID.substring(2, 5),\n rest: geoID.slice(5)\n }\n\n return parts;\n}\n\n// 08-13-2020 - Enhanced completeness checking.\nexport function isWaterOnly(geoID: string, s?: AnalyticsSession): boolean\n{\n const waterOnlySignature = 'ZZZZZZ';\n\n if (geoID.indexOf(waterOnlySignature) >= 0) return true;\n\n if (s)\n {\n // If called with a session, get the feature ...\n const featureID = s.features.featureID(geoID);\n const f: any /* T.GeoFeature */ = s.features.featureByIndex(featureID);\n \n // ... and also check the 'ALAND' property\n const bNoLand = ((f.properties['ALAND10'] !== undefined) && (f.properties['ALAND10'] == 0)) ? true : false;\n\n return bNoLand;\n }\n else\n return false;\n}\n\nexport function isUninhabited(geoID: string, s: AnalyticsSession): boolean\n{\n const featureID = s.features.featureID(geoID);\n const f: any /* T.GeoFeature */ = s.features.featureByIndex(featureID);\n\n // 03-27-21\n const dk: string = s.features._keys[T.Dataset.CENSUS];\n const totalPop = fieldForFeature(f, dk, T.FeatureField.TotalPop); \n // const totalPop = s.features.fieldForFeature(f, T.Dataset.CENSUS, T.FeatureField.TotalPop);\n let bUninhabited: boolean = (totalPop > 0) ? false : true;\n\n // HACK for Kentucky's atypical data, so the official map shows as complete\n const geoIDparts = parseGeoID(geoID);\n if (geoIDparts.state == '21') // KY\n {\n if ((f.properties['POPULATION'] !== undefined) && (f.properties['POPULATION'] == 0))\n bUninhabited = true;\n }\n \n return bUninhabited;\n}\n\n// Round a fractional number [0-1] to the desired level of PRECISION.\nexport function trim(fullFraction: number, digits: number | undefined = undefined): number\n{\n if (digits == 0)\n {\n return Math.round(fullFraction);\n }\n else\n {\n let shiftPlaces = 10 ** (digits || S.PRECISION);\n\n return Math.round(fullFraction * shiftPlaces) / shiftPlaces;\n }\n}\n\n// ARRAY HELPERS\n\nexport function sumArray(arr: number[]): number\n{\n return arr.reduce((a, b) => a + b, 0);\n}\n\nexport function avgArray(arr: number[]): number\n{\n return (arr.reduce((a, b) => a + b, 0)) / arr.length;\n}\n\nexport function minArray(arr: number[]): number\n{\n return Math.min(...arr);\n}\n\nexport function maxArray(arr: number[]): number\n{\n return Math.max(...arr);\n}\n\nexport function initArray(n: number, value: any): any[]\n{\n return Array.from(Array(n), () => value);\n}\n\nexport function andArray(arr: boolean[]): boolean\n{\n return arr.reduce(function (a, b) { return a && b; }, true);\n}\n\n// WORKING WITH OBJECT KEYS/PROPERTIES\n\n// Does an object have a key/property?\nexport function keyExists(k: string, o: object): boolean\n{\n return k in o;\n}\n\n// Does an object (dict) have any keys/properties?\nexport function isObjectEmpty(o: object): boolean\n{\n return Object.keys(o).length === 0\n}\n// Does a Set have any members?\nexport function isSetEmpty(s: any): boolean\n{\n return s.size === 0\n}\n// Does an array hold any items?\nexport function isArrayEmpty(a: any[]): boolean\n{\n if (a === undefined || a.length == 0)\n {\n // array empty or does not exist\n return true;\n }\n else\n {\n return false;\n }\n}\n\n// Get the keys for an object\nexport function getObjectKeys(o: object): string[]\n{\n return Object.keys(o);\n}\n\nexport function getNumericObjectKeys(o: object): number[]\n{\n return Object.keys(o).map(Number);\n}\n\nexport function getSelectObjectKeys(o: T.Dict, v: any[]): string[]\n{\n let selectKeys: string[] = [];\n\n Object.keys(o).forEach(key =>\n {\n if (arrayContains(v, o[key]))\n {\n selectKeys.push(key);\n }\n });\n\n return selectKeys;\n}\n\nexport function arrayContains(a: any[], item: any): boolean\n{\n return a.some(x => x === item);\n}\n\nexport function objectContains(o: object, key: any): boolean\n{\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{\n let count = 0\n for (let item in enumName)\n {\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{\n if (Array.isArray(src))\n return src.slice();\n else if (typeof src === 'object')\n {\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{\n if (Array.isArray(src))\n {\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 {\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\nexport function depthof(a: any): number\n{\n if (a === null || a === undefined) return 1;\n\n switch (typeof a)\n {\n default: return 1;\n case 'number': return 1;\n case 'boolean': return 1;\n case 'string': return 1;\n\n case 'object':\n {\n let d: number = 0;\n if (Array.isArray(a))\n return a.length > 0 ? (1 + depthof(a[0])) : 2; // still return 2 for empty array\n else if (Buffer && Buffer.isBuffer(a))\n return 2;\n else if (a.hasOwnProperty === undefined)\n return 1;\n else\n {\n for (var key in a) if (a.hasOwnProperty(key))\n return 1 + depthof(a[key]);\n return 2; // or 2 for empty object\n }\n }\n }\n}\n\n","//\n// MAP/PLAN VALIDATIONS\n//\n\nimport * as T from './types'\nimport * as U from './utils';\nimport * as S from './settings';\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, bLog: boolean = false): T.TestEntry\n{\n let test = s.getTest(T.Test.Complete) as T.TestEntry;\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.table.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 let unassignedFeatures: string[] = [];\n let bAllAssigned: boolean = (!bNotEmptyByDistrict[S.NOT_ASSIGNED]);\n let bAllNonWaterOnlyAssigned: boolean = bAllAssigned ? true : false;\n\n if (!bAllAssigned)\n {\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 // 08-13-2020 - Enhanced completeness checking.\n // Are any of the unassigned features not water-only -or- inhabited?\n // Check the official congressional maps for CT, KY, IL, and MI.\n bAllNonWaterOnlyAssigned = !unassignedFeatures.some(function (geoID)\n {\n if (U.isWaterOnly(geoID, s))\n {\n if (bLog) console.log(\"Unassigned water-only feature ignored in completeness check: \", geoID);\n return false;\n }\n if (U.isUninhabited(geoID, s))\n {\n if (bLog) console.log(\"Uninhabited feature ignored in completeness check: \", geoID);\n return false;\n }\n \n // Not water-only and inhabited\n return true;\n }); \n }\n\n // Do all real districts have at least one feature assigned to them?\n let emptyDistricts: number[] = [];\n let bNoneEmpty: boolean = true;\n bNotEmptyByDistrict = bNotEmptyByDistrict.slice(1);\n\n let districtID = 1;\n bNotEmptyByDistrict.forEach(function (bNotEmpty: boolean): void\n {\n if (!bNotEmpty)\n {\n bNoneEmpty = false;\n emptyDistricts.push(districtID);\n }\n districtID += 1;\n });\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 // NOTE - 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 // 08-13-2020 - Revised completeness check:\n // A plan is complete if:\n // * All inhabited, not water-only districts are assigned to districts. \n // * No districts are empty, i.e., each has one or more geos assigned to them.\n // Note: We're not checking (in _data.ts) whether those geos are water-only\n // or have any population, but that's a real edge case.\n\n test['score'] = bAllNonWaterOnlyAssigned && bNoneEmpty;\n // test['score'] = bAllAssigned && bNoneEmpty;\n if (!bAllAssigned)\n {\n test['details']['unassignedFeatures'] = unassignedFeatures;\n }\n\n if (!bNoneEmpty)\n {\n test['details']['emptyDistricts'] = emptyDistricts;\n }\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bNotEmpty = s.districts.table.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, bLog: boolean = false): T.TestEntry\n{\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.table.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: boolean = 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 {\n if (!bDistrictContiguous) discontiguousDistricts.push(districtID);\n districtID += 1;\n });\n\n // Populate the test entry\n test['score'] = bMapContiguous;\n if (!bMapContiguous)\n {\n test['details'] = { 'discontiguousDistricts': discontiguousDistricts };\n }\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bContiguous = s.districts.table.bContiguous;\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bContiguous[summaryRow] = test['score'];\n\n return test;\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\nexport function doIsFreeOfHoles(s: AnalyticsSession, bLog: boolean = false): T.TestEntry\n{\n let test = s.getTest(T.Test.FreeOfHoles) as T.TestEntry;\n\n // Initialize values\n let bFreeOfHoles: boolean = 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.table.bNotEmbedded;\n bNotEmbeddedByDistrict = bNotEmbeddedByDistrict.slice(1, -1);\n\n let districtID = 1;\n bNotEmbeddedByDistrict.forEach(function (bDistrictNotEmbedded: boolean): void\n {\n if (!bDistrictNotEmbedded)\n {\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 {\n test['details'] = { 'embeddedDistricts': embeddedDistricts };\n }\n\n // Populate the N+1 summary \"district\" in district.statistics\n let bNotEmbedded = s.districts.table.bNotEmbedded;\n let summaryRow = s.districts.numberOfRows() - 1;\n\n bNotEmbedded[summaryRow] = test['score'];\n\n return test;\n}\n","module.exports = require(\"@dra2020/baseclient\");","module.exports = require(\"@dra2020/dra-analytics\");","module.exports = require(\"@dra2020/dra-types\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/index.ts\");\n",""],"names":[],"sourceRoot":""}
|