@dra2020/district-analytics 1.0.4 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +5 -0
- package/dist/_api.d.ts +27 -0
- package/dist/_data.d.ts +130 -0
- package/dist/analyze.d.ts +4 -0
- package/dist/cli.js +12091 -0
- package/dist/cli.js.map +1 -0
- package/dist/cohesive.d.ts +4 -0
- package/dist/compact.d.ts +5 -0
- package/dist/constants.d.ts +6 -0
- package/dist/district-analytics.js +102 -52
- package/dist/district-analytics.js.map +1 -0
- package/dist/equal.d.ts +4 -0
- package/dist/geofeature.d.ts +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/minority.d.ts +3 -0
- package/dist/political.d.ts +8 -0
- package/dist/preprocess.d.ts +2 -0
- package/dist/report.d.ts +15 -0
- package/dist/settings.d.ts +5 -0
- package/dist/test/_cli.d.ts +5 -0
- package/dist/types.d.ts +110 -0
- package/dist/utils.d.ts +28 -0
- package/dist/valid.d.ts +8 -0
- package/jestconfig.json +14 -0
- package/lib/HelloWorld.d.ts +3 -0
- package/lib/HelloWorld.js +11 -0
- package/lib/_api.js +91 -0
- package/lib/_api.js.map +1 -0
- package/lib/_cli.js +434 -0
- package/lib/_cli.js.map +1 -0
- package/lib/_data.js +425 -0
- package/lib/_data.js.map +1 -0
- package/lib/analyze.d.ts +3 -0
- package/lib/analyze.js +69 -0
- package/lib/analyze.js.map +1 -0
- package/lib/api.d.ts +34 -0
- package/lib/api.js +117 -0
- package/lib/api.js.map +1 -0
- package/lib/cli.d.ts +1 -0
- package/lib/cli.js +386 -0
- package/lib/cli.js.map +1 -0
- package/lib/cohesive.d.ts +4 -0
- package/lib/cohesive.js +132 -0
- package/lib/cohesive.js.map +1 -0
- package/lib/compact.d.ts +4 -0
- package/lib/compact.js +183 -0
- package/lib/compact.js.map +1 -0
- package/lib/constants.js +367 -0
- package/lib/constants.js.map +1 -0
- package/lib/data.js +188 -0
- package/lib/data.js.map +1 -0
- package/lib/equal.d.ts +4 -0
- package/lib/equal.js +59 -0
- package/lib/equal.js.map +1 -0
- package/lib/features.js +19 -0
- package/lib/features.js.map +1 -0
- package/lib/geofeature.js +112 -0
- package/lib/geofeature.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/minority.d.ts +3 -0
- package/lib/minority.js +61 -0
- package/lib/minority.js.map +1 -0
- package/lib/political.d.ts +7 -0
- package/lib/political.js +88 -0
- package/lib/political.js.map +1 -0
- package/lib/preprocess.d.ts +4 -0
- package/lib/preprocess.js +101 -0
- package/lib/preprocess.js.map +1 -0
- package/lib/report.d.ts +14 -0
- package/lib/report.js +817 -0
- package/lib/report.js.map +1 -0
- package/lib/sample.d.ts +1 -0
- package/lib/sample.js +32 -0
- package/lib/sample.js.map +1 -0
- package/lib/scorecard.d.ts +4 -0
- package/lib/scorecard.js +237 -0
- package/lib/scorecard.js.map +1 -0
- package/lib/settings.d.ts +5 -0
- package/lib/settings.js +18 -0
- package/lib/settings.js.map +1 -0
- package/lib/types.d.ts +125 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +20 -0
- package/lib/utils.js +223 -0
- package/lib/utils.js.map +1 -0
- package/lib/valid.d.ts +5 -0
- package/lib/valid.js +230 -0
- package/lib/valid.js.map +1 -0
- package/main.js +4 -0
- package/package.json +2 -7
- package/src/_api.ts +121 -0
- package/src/_data.ts +595 -0
- package/src/analyze.ts +92 -0
- package/src/cohesive.ts +156 -0
- package/src/compact.ts +208 -0
- package/src/constants.ts +371 -0
- package/src/equal.ts +75 -0
- package/src/geofeature.ts +138 -0
- package/src/index.ts +6 -0
- package/src/minority.ts +70 -0
- package/src/political.ts +114 -0
- package/src/preprocess.ts +132 -0
- package/src/report.ts +1022 -0
- package/src/settings.ts +20 -0
- package/src/types.ts +185 -0
- package/src/utils.ts +245 -0
- package/src/valid.ts +275 -0
- package/tsconfig.json +25 -0
- package/tslint.json +3 -0
- package/types/polygon-clipping/index.d.ts +1 -0
- package/webpack.config.js +73 -0
package/.prettierrc
ADDED
package/dist/_api.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Scorecard } from './report';
|
|
2
|
+
import * as D from './_data';
|
|
3
|
+
import * as T from './types';
|
|
4
|
+
export declare class AnalyticsSession {
|
|
5
|
+
title: string;
|
|
6
|
+
legislativeDistricts: boolean;
|
|
7
|
+
config: T.Dict;
|
|
8
|
+
bOneTimeProcessingDone: boolean;
|
|
9
|
+
bPlanAnalyzed: boolean;
|
|
10
|
+
bPostProcessingDone: boolean;
|
|
11
|
+
testScales: T.TestScales;
|
|
12
|
+
tests: T.TestEntries;
|
|
13
|
+
scorecard: Scorecard;
|
|
14
|
+
state: D.State;
|
|
15
|
+
counties: D.Counties;
|
|
16
|
+
graph: D.Graph;
|
|
17
|
+
features: D.Features;
|
|
18
|
+
plan: D.Plan;
|
|
19
|
+
districts: D.Districts;
|
|
20
|
+
constructor(SessionRequest: T.SessionRequest);
|
|
21
|
+
processConfig(config: T.Dict): T.Dict;
|
|
22
|
+
analyzePlan(bLog?: boolean): boolean;
|
|
23
|
+
getTest(testID: T.Test): T.TestEntry;
|
|
24
|
+
prepareScorecard(): any;
|
|
25
|
+
prepareTestLog(): any;
|
|
26
|
+
populationDeviationThreshold(): number;
|
|
27
|
+
}
|
package/dist/_data.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import * as T from './types';
|
|
2
|
+
import { AnalyticsSession } from './_api';
|
|
3
|
+
export declare enum DistrictField {
|
|
4
|
+
TotalPop = 0,
|
|
5
|
+
PopDevPct = 1,
|
|
6
|
+
bEqualPop = 2,
|
|
7
|
+
bNotEmpty = 3,
|
|
8
|
+
bContiguous = 4,
|
|
9
|
+
bNotEmbedded = 5,
|
|
10
|
+
CountySplits = 6,
|
|
11
|
+
DemVotes = 7,
|
|
12
|
+
RepVotes = 8,
|
|
13
|
+
TwoPartyVote = 9,
|
|
14
|
+
DemPct = 10,
|
|
15
|
+
RepPct = 11,
|
|
16
|
+
DemSeat = 12,
|
|
17
|
+
TotalVAP = 13,
|
|
18
|
+
MinorityPop = 14,
|
|
19
|
+
WhitePop = 15,
|
|
20
|
+
BlackPop = 16,
|
|
21
|
+
HispanicPop = 17,
|
|
22
|
+
PacificPop = 18,
|
|
23
|
+
AsianPop = 19,
|
|
24
|
+
NativePop = 20,
|
|
25
|
+
WhitePct = 21,
|
|
26
|
+
MinorityPct = 22,
|
|
27
|
+
BlackPct = 23,
|
|
28
|
+
HispanicPct = 24,
|
|
29
|
+
PacificPct = 25,
|
|
30
|
+
AsianPct = 26,
|
|
31
|
+
NativePct = 27
|
|
32
|
+
}
|
|
33
|
+
export declare const DisplayFields: DistrictField[];
|
|
34
|
+
export declare class Districts {
|
|
35
|
+
_session: AnalyticsSession;
|
|
36
|
+
_shapes: T.GeoFeatureCollection;
|
|
37
|
+
_geoProperties: T.DistrictProperties;
|
|
38
|
+
statistics: any[][];
|
|
39
|
+
constructor(s: AnalyticsSession, ds: T.GeoFeatureCollection);
|
|
40
|
+
getShape(i: number): T.GeoFeature;
|
|
41
|
+
getGeoProperties(i: number): any;
|
|
42
|
+
setGeoProperties(i: number, p: T.DistrictShapeProperties): void;
|
|
43
|
+
numberOfColumns(): number;
|
|
44
|
+
numberOfRows(): number;
|
|
45
|
+
numberOfWorkingDistricts(): number;
|
|
46
|
+
initStatistics(): any[][];
|
|
47
|
+
recalcStatistics(bLog?: boolean): void;
|
|
48
|
+
extractDistrictShapeProperties(bLog?: boolean): void;
|
|
49
|
+
getCountyIndex(geoID: string): number;
|
|
50
|
+
}
|
|
51
|
+
export declare const enum Dataset {
|
|
52
|
+
CENSUS = "CENSUS",
|
|
53
|
+
VAP = "VAP",
|
|
54
|
+
ELECTION = "ELECTION"
|
|
55
|
+
}
|
|
56
|
+
export declare type DatasetKeys = {
|
|
57
|
+
CENSUS: string;
|
|
58
|
+
VAP: string;
|
|
59
|
+
ELECTION: string;
|
|
60
|
+
};
|
|
61
|
+
export declare const DatasetDescriptions: any;
|
|
62
|
+
export declare const enum FeatureField {
|
|
63
|
+
TotalPop = "Tot",
|
|
64
|
+
WhitePop = "Wh",
|
|
65
|
+
BlackPop = "BlC",
|
|
66
|
+
HispanicPop = "His",
|
|
67
|
+
AsianPop = "AsnC",
|
|
68
|
+
PacificPop = "PacC",
|
|
69
|
+
NativePop = "NatC",
|
|
70
|
+
DemVotes = "D",
|
|
71
|
+
RepVotes = "R",
|
|
72
|
+
TotalVotes = "Tot"
|
|
73
|
+
}
|
|
74
|
+
export declare class Features {
|
|
75
|
+
_session: AnalyticsSession;
|
|
76
|
+
_data: T.GeoFeatureCollection;
|
|
77
|
+
_keys: DatasetKeys;
|
|
78
|
+
_featureIDs: T.FeaturesByGeoID;
|
|
79
|
+
constructor(s: AnalyticsSession, data: T.GeoFeatureCollection, keys: DatasetKeys);
|
|
80
|
+
nFeatures(): number;
|
|
81
|
+
featureByIndex(i: number): T.GeoFeature;
|
|
82
|
+
geoIDForFeature(f: any): string;
|
|
83
|
+
fieldForFeature(f: any, dt: Dataset, fk: string): any;
|
|
84
|
+
resetDataset(d: Dataset, k: string): void;
|
|
85
|
+
mapGeoIDsToFeatureIDs(): void;
|
|
86
|
+
featureID(i: string): number;
|
|
87
|
+
}
|
|
88
|
+
export declare class Counties {
|
|
89
|
+
_session: AnalyticsSession;
|
|
90
|
+
_data: T.GeoFeatureCollection;
|
|
91
|
+
_countyNameLookup: T.FIPSCodeToCountyNameMap;
|
|
92
|
+
nCounties: number;
|
|
93
|
+
index: T.FIPSToOrdinalMap;
|
|
94
|
+
constructor(s: AnalyticsSession, data: T.GeoFeatureCollection);
|
|
95
|
+
countyByIndex(i: number): T.GeoFeature;
|
|
96
|
+
propertyForCounty(f: any, pk: string): any;
|
|
97
|
+
mapFIPSToName(fips: string, name: string): void;
|
|
98
|
+
nameFromFIPS(fips: string): string;
|
|
99
|
+
indexFromFIPS(fips: string): number;
|
|
100
|
+
}
|
|
101
|
+
export declare class State {
|
|
102
|
+
_session: AnalyticsSession;
|
|
103
|
+
xx: string;
|
|
104
|
+
nDistricts: number;
|
|
105
|
+
totalPop: number;
|
|
106
|
+
tooBigFIPS: string[];
|
|
107
|
+
tooBigName: string[];
|
|
108
|
+
expectedSplits: number;
|
|
109
|
+
expectedAffected: number;
|
|
110
|
+
constructor(s: AnalyticsSession, xx: string, n: number);
|
|
111
|
+
}
|
|
112
|
+
export declare class Plan {
|
|
113
|
+
_session: AnalyticsSession;
|
|
114
|
+
_planByGeoID: T.PlanByGeoID;
|
|
115
|
+
_planByDistrictID: T.PlanByDistrictID;
|
|
116
|
+
districtIDs: number[];
|
|
117
|
+
constructor(s: AnalyticsSession, p: T.PlanByGeoID);
|
|
118
|
+
invertPlan(): void;
|
|
119
|
+
initializeDistrict(i: number): void;
|
|
120
|
+
byGeoID(): T.PlanByGeoID;
|
|
121
|
+
byDistrictID(): T.PlanByDistrictID;
|
|
122
|
+
districtForGeoID(i: string): number;
|
|
123
|
+
geoIDsForDistrictID(i: number): Set<string>;
|
|
124
|
+
}
|
|
125
|
+
export declare class Graph {
|
|
126
|
+
_session: AnalyticsSession;
|
|
127
|
+
_graph: T.ContiguityGraph;
|
|
128
|
+
constructor(s: AnalyticsSession, graph: T.ContiguityGraph);
|
|
129
|
+
peerNeighbors(node: string): string[];
|
|
130
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AnalyticsSession } from './_api';
|
|
2
|
+
export declare function doAnalyzeDistricts(s: AnalyticsSession, bLog?: boolean): void;
|
|
3
|
+
export declare function doAnalyzePlan(s: AnalyticsSession, bLog?: boolean): void;
|
|
4
|
+
export declare function doDeriveSecondaryTests(s: AnalyticsSession): void;
|