@dra2020/district-analytics 16.0.2 → 16.1.0
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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/district-analytics.js +121 -81
- package/dist/district-analytics.js.map +1 -1
- package/dist/src/_data.d.ts +1 -1
- package/dist/src/index.d.ts +5 -5
- package/dist/src/legacy-types.d.ts +27 -27
- package/dist/src/results.d.ts +3 -3
- package/dist/src/types.d.ts +24 -24
- package/package.json +12 -14
package/dist/src/_data.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Types } from '@dra2020/dra-analytics';
|
|
2
2
|
import * as T from './types';
|
|
3
3
|
import { AnalyticsSession } from './_api';
|
|
4
|
-
export
|
|
4
|
+
export type TransposedTable = {
|
|
5
5
|
totalPop: number[];
|
|
6
6
|
popDevPct: number[];
|
|
7
7
|
bEqualPop: boolean[];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ export * from './types';
|
|
|
5
5
|
export { Profile, Scorecard, SplittingScorecard, Measurement } from './legacy-types';
|
|
6
6
|
export * from './utils';
|
|
7
7
|
import { Partisan, Rate, Splitting, Types } from '@dra2020/dra-analytics';
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
8
|
+
export type MinorityFilter = Types.MinorityFilter;
|
|
9
|
+
export type Point = Types.dictPoint;
|
|
10
|
+
export type DemographicVotingByFeature = Types.DemographicVotingByFeature;
|
|
11
|
+
export type RPVFactor = Types.RPVFactor;
|
|
12
|
+
export type RPVAnalysis = Types.RPVAnalysis;
|
|
13
13
|
export declare const estSeatProbability: typeof Partisan.estSeatProbability;
|
|
14
14
|
export declare const ratePartisanBias: typeof Rate.ratePartisanBias;
|
|
15
15
|
export declare const normalizePartisanBias: typeof Rate.normalizePartisanBias;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Profile = {
|
|
2
2
|
state: string;
|
|
3
3
|
name: string;
|
|
4
4
|
nDistricts: number;
|
|
@@ -11,7 +11,7 @@ export declare type Profile = {
|
|
|
11
11
|
partisanship: PartisanProfile;
|
|
12
12
|
demographics: DemographicProfile;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type Scorecard = {
|
|
15
15
|
partisan: PartisanScorecard;
|
|
16
16
|
minority: MinorityScorecard;
|
|
17
17
|
compactness: CompactnessScorecard;
|
|
@@ -19,12 +19,12 @@ export declare type Scorecard = {
|
|
|
19
19
|
populationDeviation: PopulationScorecard;
|
|
20
20
|
details: Dict;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type PartisanProfile = {
|
|
23
23
|
statewide: number;
|
|
24
24
|
byDistrict: VfArray;
|
|
25
25
|
};
|
|
26
|
-
export
|
|
27
|
-
export
|
|
26
|
+
export type VfArray = number[];
|
|
27
|
+
export type PartisanScorecard = {
|
|
28
28
|
bias: Bias;
|
|
29
29
|
impact: Impact;
|
|
30
30
|
responsiveness: Responsiveness;
|
|
@@ -34,14 +34,14 @@ export declare type PartisanScorecard = {
|
|
|
34
34
|
averageRVf: number | undefined;
|
|
35
35
|
details: Dict;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type rVpoints = {
|
|
38
38
|
Sb: number;
|
|
39
39
|
Ra: number;
|
|
40
40
|
Rb: number;
|
|
41
41
|
Va: number;
|
|
42
42
|
Vb: number;
|
|
43
43
|
};
|
|
44
|
-
export
|
|
44
|
+
export type Bias = {
|
|
45
45
|
bestS: number;
|
|
46
46
|
bestSf: number;
|
|
47
47
|
estS: number;
|
|
@@ -63,11 +63,11 @@ export declare type Bias = {
|
|
|
63
63
|
mMd?: number;
|
|
64
64
|
lO?: number | undefined;
|
|
65
65
|
};
|
|
66
|
-
export
|
|
66
|
+
export type Impact = {
|
|
67
67
|
unearnedS: number;
|
|
68
68
|
score: number;
|
|
69
69
|
};
|
|
70
|
-
export
|
|
70
|
+
export type Responsiveness = {
|
|
71
71
|
bigR?: number | undefined;
|
|
72
72
|
littleR?: number | undefined;
|
|
73
73
|
mIR?: number | undefined;
|
|
@@ -78,40 +78,40 @@ export declare type Responsiveness = {
|
|
|
78
78
|
cDf: number;
|
|
79
79
|
score: number;
|
|
80
80
|
};
|
|
81
|
-
export
|
|
81
|
+
export type PopulationProfile = {
|
|
82
82
|
byDistrict: totalPopByDistrict;
|
|
83
83
|
targetSize: number;
|
|
84
84
|
};
|
|
85
|
-
export
|
|
86
|
-
export
|
|
87
|
-
export
|
|
85
|
+
export type totalPopByDistrict = number[];
|
|
86
|
+
export type PopulationScorecard = Measurement;
|
|
87
|
+
export type GeoProperties = {
|
|
88
88
|
area: number;
|
|
89
89
|
perimeter: number;
|
|
90
90
|
diameter: number;
|
|
91
91
|
};
|
|
92
|
-
export
|
|
93
|
-
export
|
|
92
|
+
export type ShapeProfile = GeoProperties[];
|
|
93
|
+
export type CompactnessScorecard = {
|
|
94
94
|
score: number;
|
|
95
95
|
reock: Measurement;
|
|
96
96
|
polsby: Measurement;
|
|
97
97
|
details: Dict;
|
|
98
98
|
};
|
|
99
|
-
export
|
|
99
|
+
export type CompactnessByDistrict = {
|
|
100
100
|
rawReock: number;
|
|
101
101
|
normalizedReock: number;
|
|
102
102
|
rawPolsby: number;
|
|
103
103
|
normalizedPolsby: number;
|
|
104
104
|
kiwysiScore?: number;
|
|
105
105
|
};
|
|
106
|
-
export
|
|
107
|
-
export
|
|
108
|
-
export
|
|
106
|
+
export type CountyProfile = CxD;
|
|
107
|
+
export type CxD = number[][];
|
|
108
|
+
export type SplittingScorecard = {
|
|
109
109
|
score: number;
|
|
110
110
|
county: Measurement;
|
|
111
111
|
district: Measurement;
|
|
112
112
|
details: Dict;
|
|
113
113
|
};
|
|
114
|
-
export
|
|
114
|
+
export type Demographics = {
|
|
115
115
|
white: number;
|
|
116
116
|
minority: number;
|
|
117
117
|
black: number;
|
|
@@ -120,11 +120,11 @@ export declare type Demographics = {
|
|
|
120
120
|
asian: number;
|
|
121
121
|
native: number;
|
|
122
122
|
};
|
|
123
|
-
export
|
|
123
|
+
export type DemographicProfile = {
|
|
124
124
|
statewide: Demographics;
|
|
125
125
|
byDistrict: Demographics[];
|
|
126
126
|
};
|
|
127
|
-
export
|
|
127
|
+
export type DemoBreakdown = {
|
|
128
128
|
pct35_40: number;
|
|
129
129
|
pct40_45: number;
|
|
130
130
|
pct45_50: number;
|
|
@@ -134,7 +134,7 @@ export declare type DemoBreakdown = {
|
|
|
134
134
|
vapPct: number;
|
|
135
135
|
propSeats: number;
|
|
136
136
|
};
|
|
137
|
-
export
|
|
137
|
+
export type DemographicPivot = {
|
|
138
138
|
minority: DemoBreakdown;
|
|
139
139
|
black: DemoBreakdown;
|
|
140
140
|
hispanic: DemoBreakdown;
|
|
@@ -142,23 +142,23 @@ export declare type DemographicPivot = {
|
|
|
142
142
|
asian: DemoBreakdown;
|
|
143
143
|
native: DemoBreakdown;
|
|
144
144
|
};
|
|
145
|
-
export
|
|
145
|
+
export type MinorityScorecard = {
|
|
146
146
|
pivotByDemographic: DemographicPivot;
|
|
147
147
|
opportunityDistricts: number;
|
|
148
148
|
coalitionDistricts: number;
|
|
149
149
|
score: number;
|
|
150
150
|
details: Dict;
|
|
151
151
|
};
|
|
152
|
-
export
|
|
152
|
+
export type Measurement = {
|
|
153
153
|
raw: number;
|
|
154
154
|
normalized: number;
|
|
155
155
|
byDistrict?: any[];
|
|
156
156
|
notes: Dict;
|
|
157
157
|
};
|
|
158
|
-
export
|
|
158
|
+
export type SVpoint = {
|
|
159
159
|
v: number;
|
|
160
160
|
s: number;
|
|
161
161
|
};
|
|
162
|
-
export
|
|
162
|
+
export type Dict = {
|
|
163
163
|
[key: string]: any;
|
|
164
164
|
};
|
package/dist/src/results.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as T from './types';
|
|
2
2
|
import { AnalyticsSession } from './_api';
|
|
3
|
-
export
|
|
3
|
+
export type RequirementsChecklist = {
|
|
4
4
|
score: boolean;
|
|
5
5
|
metrics: {
|
|
6
6
|
complete: boolean;
|
|
@@ -20,7 +20,7 @@ export declare type RequirementsChecklist = {
|
|
|
20
20
|
resources: {};
|
|
21
21
|
};
|
|
22
22
|
export declare function prepareRequirementsChecklist(s: AnalyticsSession, bLog?: boolean): RequirementsChecklist;
|
|
23
|
-
export
|
|
23
|
+
export type DistrictRow = {
|
|
24
24
|
districtID: number;
|
|
25
25
|
totalPop: number;
|
|
26
26
|
popDevPct: number;
|
|
@@ -40,7 +40,7 @@ export declare type DistrictRow = {
|
|
|
40
40
|
asianPct: number;
|
|
41
41
|
nativePct: number;
|
|
42
42
|
};
|
|
43
|
-
export
|
|
43
|
+
export type DistrictStatistics = {
|
|
44
44
|
table: DistrictRow[];
|
|
45
45
|
details: {};
|
|
46
46
|
datasets: T.Datasets;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as geojson from 'geojson';
|
|
2
2
|
import * as DT from '@dra2020/dra-types';
|
|
3
|
-
export
|
|
3
|
+
export type SessionRequest = {
|
|
4
4
|
title: string;
|
|
5
5
|
stateXX: string;
|
|
6
6
|
nDistricts: number;
|
|
@@ -20,7 +20,7 @@ export declare const enum Dataset {
|
|
|
20
20
|
VAP = "VAP",
|
|
21
21
|
ELECTION = "ELECTION"
|
|
22
22
|
}
|
|
23
|
-
export
|
|
23
|
+
export type DatasetKeys = {
|
|
24
24
|
SHAPES: string;
|
|
25
25
|
CENSUS: string;
|
|
26
26
|
VAP: string;
|
|
@@ -39,43 +39,43 @@ export declare const enum FeatureField {
|
|
|
39
39
|
TotalVotes = 9
|
|
40
40
|
}
|
|
41
41
|
export declare function fieldFromFeatureField(ds: string, ff: FeatureField): string;
|
|
42
|
-
export
|
|
42
|
+
export type PlanByGeoID = {
|
|
43
43
|
[geoID: string]: number;
|
|
44
44
|
};
|
|
45
|
-
export
|
|
45
|
+
export type PlanByDistrictID = {
|
|
46
46
|
[districtID: number]: Set<string>;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type FeaturesByGeoID = {
|
|
49
49
|
[geoID: string]: number;
|
|
50
50
|
};
|
|
51
|
-
export
|
|
51
|
+
export type FIPSCodeToCountyNameMap = {
|
|
52
52
|
[FIPSCode: string]: string;
|
|
53
53
|
};
|
|
54
|
-
export
|
|
54
|
+
export type FIPSToOrdinalMap = {
|
|
55
55
|
[FIPSCode: string]: number;
|
|
56
56
|
};
|
|
57
|
-
export
|
|
57
|
+
export type OrdinalToFIPSlMap = {
|
|
58
58
|
[index: number]: string;
|
|
59
59
|
};
|
|
60
|
-
export
|
|
61
|
-
export
|
|
62
|
-
export
|
|
60
|
+
export type GeoFeature = geojson.Feature;
|
|
61
|
+
export type GeoFeatureArray = GeoFeature[];
|
|
62
|
+
export type GeoFeatureCollection = geojson.FeatureCollection;
|
|
63
63
|
export interface GeoFeatureMap {
|
|
64
64
|
[geoID: string]: GeoFeature;
|
|
65
65
|
}
|
|
66
|
-
export
|
|
66
|
+
export type ContiguityGraph = {
|
|
67
67
|
[geoID: string]: UnweightedNeighbors | WeightedNeighbors;
|
|
68
68
|
};
|
|
69
|
-
export
|
|
69
|
+
export type WeightedNeighbors = {
|
|
70
70
|
[geoID: string]: number;
|
|
71
71
|
};
|
|
72
|
-
export
|
|
73
|
-
export
|
|
72
|
+
export type UnweightedNeighbors = string[];
|
|
73
|
+
export type TestEntry = {
|
|
74
74
|
score?: number | boolean;
|
|
75
75
|
details: Dict;
|
|
76
76
|
normalizedScore?: number;
|
|
77
77
|
};
|
|
78
|
-
export
|
|
78
|
+
export type DistrictWIP = {
|
|
79
79
|
[districtID: number]: any;
|
|
80
80
|
};
|
|
81
81
|
export declare const enum Test {
|
|
@@ -87,37 +87,37 @@ export declare const enum Test {
|
|
|
87
87
|
UnexpectedCountySplits = 5,
|
|
88
88
|
VTDSplits = 6
|
|
89
89
|
}
|
|
90
|
-
export
|
|
90
|
+
export type TestEntries = {
|
|
91
91
|
[test: number]: TestEntry;
|
|
92
92
|
};
|
|
93
|
-
export
|
|
93
|
+
export type DistrictProperties = {
|
|
94
94
|
[districtID: number]: any;
|
|
95
95
|
};
|
|
96
|
-
export
|
|
96
|
+
export type DistrictShapeProperties = [number, number, number];
|
|
97
97
|
export declare const enum DistrictShapeProperty {
|
|
98
98
|
Area = 0,
|
|
99
99
|
Diameter = 1,
|
|
100
100
|
Perimeter = 2
|
|
101
101
|
}
|
|
102
|
-
export
|
|
102
|
+
export type GeoIDParts = {
|
|
103
103
|
vfeature?: boolean;
|
|
104
104
|
state: string;
|
|
105
105
|
county: string;
|
|
106
106
|
rest: string;
|
|
107
107
|
};
|
|
108
|
-
export
|
|
108
|
+
export type GeoIDTotal = {
|
|
109
109
|
[geoID: string]: number;
|
|
110
110
|
};
|
|
111
|
-
export
|
|
111
|
+
export type Dict = {
|
|
112
112
|
[key: string]: any;
|
|
113
113
|
};
|
|
114
|
-
export
|
|
114
|
+
export type Datasets = {
|
|
115
115
|
shapes?: string;
|
|
116
116
|
census?: string;
|
|
117
117
|
vap?: string;
|
|
118
118
|
election?: string;
|
|
119
119
|
};
|
|
120
|
-
export
|
|
120
|
+
export type Ratings = {
|
|
121
121
|
proportionality: number;
|
|
122
122
|
competitiveness: number;
|
|
123
123
|
minorityRights: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dra2020/district-analytics",
|
|
3
|
-
"version": "16.0
|
|
3
|
+
"version": "16.1.0",
|
|
4
4
|
"description": "District analytics TypeScript package",
|
|
5
5
|
"main": "dist/district-analytics.js",
|
|
6
6
|
"files": [
|
|
@@ -29,27 +29,25 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/dra2020/district-analytics#readme",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/geojson": "^7946.0.
|
|
33
|
-
"@types/jest": "^27.0.3",
|
|
32
|
+
"@types/geojson": "^7946.0.10",
|
|
34
33
|
"@types/node": "^12.20.23",
|
|
35
|
-
"@types/yargs": "^
|
|
36
|
-
"jest": "^27.4.3",
|
|
34
|
+
"@types/yargs": "^12.0.20",
|
|
37
35
|
"json-loader": "^0.5.7",
|
|
38
|
-
"prettier": "^2.
|
|
36
|
+
"prettier": "^2.7.1",
|
|
39
37
|
"source-map-loader": "^3.0.0",
|
|
40
|
-
"ts-loader": "^9.
|
|
38
|
+
"ts-loader": "^9.4.1",
|
|
41
39
|
"tsify": "^5.0.4",
|
|
42
40
|
"tslint": "^6.1.3",
|
|
43
41
|
"tslint-config-prettier": "^1.18.0",
|
|
44
|
-
"typescript": "^4.
|
|
45
|
-
"webpack": "^5.
|
|
46
|
-
"webpack-cli": "^4.
|
|
47
|
-
"yargs": "^
|
|
42
|
+
"typescript": "^4.9.3",
|
|
43
|
+
"webpack": "^5.75.0",
|
|
44
|
+
"webpack-cli": "^4.10.0",
|
|
45
|
+
"yargs": "^12.0.5"
|
|
48
46
|
},
|
|
49
47
|
"dependencies": {
|
|
50
|
-
"@dra2020/baseclient": "^1.0.
|
|
51
|
-
"@dra2020/dra-analytics": "^4.
|
|
52
|
-
"@dra2020/dra-types": "^1.8.
|
|
48
|
+
"@dra2020/baseclient": "^1.0.90",
|
|
49
|
+
"@dra2020/dra-analytics": "^4.1.2",
|
|
50
|
+
"@dra2020/dra-types": "^1.8.75",
|
|
53
51
|
"geojson": "^0.5.0"
|
|
54
52
|
}
|
|
55
53
|
}
|