@dra2020/dra-analytics 4.0.0 → 4.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/dist/dra-analytics.js +180 -88
- package/dist/dra-analytics.js.map +1 -1
- package/dist/lib/compactness/matrix.d.ts +1 -1
- package/dist/lib/types/all.d.ts +1 -1
- package/dist/lib/types/compactness.d.ts +10 -10
- package/dist/lib/types/general.d.ts +1 -1
- package/dist/lib/types/graph.d.ts +6 -6
- package/dist/lib/types/minority.d.ts +11 -11
- package/dist/lib/types/partisan.d.ts +9 -9
- package/dist/lib/types/population.d.ts +1 -1
- package/dist/lib/types/splitting.d.ts +7 -7
- package/package.json +18 -18
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Vector = number[];
|
|
2
2
|
export declare function dotProduct(a: Vector, b: Vector): number;
|
package/dist/lib/types/all.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { CompactnessScorecard } from './compactness';
|
|
|
11
11
|
import { SplittingScorecard } from './splitting';
|
|
12
12
|
import { PopulationScorecard } from './population';
|
|
13
13
|
import { Dict } from './general';
|
|
14
|
-
export
|
|
14
|
+
export type Scorecard = {
|
|
15
15
|
partisan: PartisanScorecard;
|
|
16
16
|
minority: MinorityScorecard;
|
|
17
17
|
compactness: CompactnessScorecard;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as T from './general';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type arrPoint = [number, number];
|
|
3
|
+
export type CompactnessFeatures = {
|
|
4
4
|
sym_x: number;
|
|
5
5
|
sym_y: number;
|
|
6
6
|
reock: number;
|
|
@@ -11,7 +11,7 @@ export declare type CompactnessFeatures = {
|
|
|
11
11
|
reockFlat: number;
|
|
12
12
|
polsbyFlat: number;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type FeaturesEntry = {
|
|
15
15
|
n: number;
|
|
16
16
|
features: CompactnessFeatures;
|
|
17
17
|
score: number;
|
|
@@ -20,12 +20,12 @@ export declare const enum PCAModel {
|
|
|
20
20
|
Revised = 0,
|
|
21
21
|
Original = 1
|
|
22
22
|
}
|
|
23
|
-
export
|
|
23
|
+
export type GeoProperties = {
|
|
24
24
|
area: number;
|
|
25
25
|
perimeter: number;
|
|
26
26
|
diameter: number;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type CompactnessScorecard = {
|
|
29
29
|
avgReock: number;
|
|
30
30
|
avgPolsby: number;
|
|
31
31
|
avgKWIWYSI: number;
|
|
@@ -33,25 +33,25 @@ export declare type CompactnessScorecard = {
|
|
|
33
33
|
details: T.Dict;
|
|
34
34
|
score?: number;
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type Compactness = {
|
|
37
37
|
rawReock: number;
|
|
38
38
|
normalizedReock: number;
|
|
39
39
|
rawPolsby: number;
|
|
40
40
|
normalizedPolsby: number;
|
|
41
41
|
kiwysiScore?: number;
|
|
42
42
|
};
|
|
43
|
-
export
|
|
43
|
+
export type CompactnessAlt = {
|
|
44
44
|
reock: number;
|
|
45
45
|
polsby: number;
|
|
46
46
|
kiwysiRank: number;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type CompactnessJSONReady = {
|
|
49
49
|
avgReock: number;
|
|
50
50
|
avgPolsby: number;
|
|
51
51
|
avgKWIWYSI: number;
|
|
52
52
|
byDistrict: CompactnessAlt[];
|
|
53
53
|
};
|
|
54
|
-
export
|
|
54
|
+
export type KiwysiFeatures = {
|
|
55
55
|
sym_x: number;
|
|
56
56
|
sym_y: number;
|
|
57
57
|
reock: number;
|
|
@@ -61,7 +61,7 @@ export declare type KiwysiFeatures = {
|
|
|
61
61
|
schwartzberg: number;
|
|
62
62
|
kiwysiRank: number;
|
|
63
63
|
};
|
|
64
|
-
export
|
|
64
|
+
export type KiwysiJSONReady = {
|
|
65
65
|
avgKWIWYSI: number;
|
|
66
66
|
byDistrict: KiwysiFeatures[];
|
|
67
67
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ContiguityGraph = {
|
|
2
2
|
[geoID: string]: UnweightedNeighbors | WeightedNeighbors;
|
|
3
3
|
};
|
|
4
|
-
export
|
|
4
|
+
export type WeightedNeighbors = {
|
|
5
5
|
[geoID: string]: number;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type UnweightedNeighbors = string[];
|
|
8
|
+
export type PlanByGeoID = {
|
|
9
9
|
[geoID: string]: number;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type PlanByDistrictID = {
|
|
12
12
|
[districtID: number]: Set<string>;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type FeatureGroup = Set<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as T from './general';
|
|
2
|
-
export
|
|
2
|
+
export type MinorityFilter = {
|
|
3
3
|
white: boolean;
|
|
4
4
|
hispanic: boolean;
|
|
5
5
|
black: boolean;
|
|
@@ -9,11 +9,11 @@ export declare type MinorityFilter = {
|
|
|
9
9
|
minority: boolean;
|
|
10
10
|
invertSelection: boolean;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type dictPoint = {
|
|
13
13
|
x: number;
|
|
14
14
|
y: number;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type DemographicVotingByFeature = {
|
|
17
17
|
ids: string[];
|
|
18
18
|
comparison: dictPoint[];
|
|
19
19
|
minority: dictPoint[];
|
|
@@ -23,18 +23,18 @@ export declare type DemographicVotingByFeature = {
|
|
|
23
23
|
asian: dictPoint[];
|
|
24
24
|
native: dictPoint[];
|
|
25
25
|
};
|
|
26
|
-
export
|
|
26
|
+
export type LinearRegression = {
|
|
27
27
|
slope: number;
|
|
28
28
|
intercept: number;
|
|
29
29
|
r2: number;
|
|
30
30
|
sterrs: StErrs;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type StErrs = {
|
|
33
33
|
slope: number;
|
|
34
34
|
intercept: number;
|
|
35
35
|
regression: number;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type RPVFactor = {
|
|
38
38
|
slope: number;
|
|
39
39
|
intercept: number;
|
|
40
40
|
r2: number;
|
|
@@ -42,7 +42,7 @@ export declare type RPVFactor = {
|
|
|
42
42
|
sterr: number;
|
|
43
43
|
points: dictPoint[];
|
|
44
44
|
};
|
|
45
|
-
export
|
|
45
|
+
export type RPVAnalysis = {
|
|
46
46
|
ids: string[] | undefined;
|
|
47
47
|
comparison: RPVFactor | undefined;
|
|
48
48
|
minority: RPVFactor | undefined;
|
|
@@ -52,7 +52,7 @@ export declare type RPVAnalysis = {
|
|
|
52
52
|
asian: RPVFactor | undefined;
|
|
53
53
|
native: RPVFactor | undefined;
|
|
54
54
|
};
|
|
55
|
-
export
|
|
55
|
+
export type Demographics = {
|
|
56
56
|
white: number;
|
|
57
57
|
minority: number;
|
|
58
58
|
black: number;
|
|
@@ -61,7 +61,7 @@ export declare type Demographics = {
|
|
|
61
61
|
asian: number;
|
|
62
62
|
native: number;
|
|
63
63
|
};
|
|
64
|
-
export
|
|
64
|
+
export type DemoBreakdown = {
|
|
65
65
|
pct35_40: number;
|
|
66
66
|
pct40_45: number;
|
|
67
67
|
pct45_50: number;
|
|
@@ -71,7 +71,7 @@ export declare type DemoBreakdown = {
|
|
|
71
71
|
vapPct: number;
|
|
72
72
|
propSeats: number;
|
|
73
73
|
};
|
|
74
|
-
export
|
|
74
|
+
export type DemographicPivot = {
|
|
75
75
|
minority: DemoBreakdown;
|
|
76
76
|
black: DemoBreakdown;
|
|
77
77
|
hispanic: DemoBreakdown;
|
|
@@ -79,7 +79,7 @@ export declare type DemographicPivot = {
|
|
|
79
79
|
asian: DemoBreakdown;
|
|
80
80
|
native: DemoBreakdown;
|
|
81
81
|
};
|
|
82
|
-
export
|
|
82
|
+
export type MinorityScorecard = {
|
|
83
83
|
pivotByDemographic: DemographicPivot;
|
|
84
84
|
opportunityDistricts: number;
|
|
85
85
|
coalitionDistricts: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as T from './general';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type VfArray = number[];
|
|
3
|
+
export type SVpoint = {
|
|
4
4
|
v: number;
|
|
5
5
|
s: number;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type rVpoints = {
|
|
8
8
|
Sb: number;
|
|
9
9
|
Ra: number;
|
|
10
10
|
Rb: number;
|
|
@@ -15,7 +15,7 @@ export declare const enum Shift {
|
|
|
15
15
|
Proportional = 0,
|
|
16
16
|
Uniform = 1
|
|
17
17
|
}
|
|
18
|
-
export
|
|
18
|
+
export type Bias = {
|
|
19
19
|
bestS: number;
|
|
20
20
|
bestSf: number;
|
|
21
21
|
estS: number;
|
|
@@ -37,11 +37,11 @@ export declare type Bias = {
|
|
|
37
37
|
mMd: number;
|
|
38
38
|
lO: number | undefined;
|
|
39
39
|
};
|
|
40
|
-
export
|
|
40
|
+
export type Impact = {
|
|
41
41
|
unearnedS: number;
|
|
42
42
|
score?: number;
|
|
43
43
|
};
|
|
44
|
-
export
|
|
44
|
+
export type Responsiveness = {
|
|
45
45
|
bigR?: number;
|
|
46
46
|
littleR?: number;
|
|
47
47
|
mIR?: number;
|
|
@@ -52,13 +52,13 @@ export declare type Responsiveness = {
|
|
|
52
52
|
cDf: number;
|
|
53
53
|
score?: number;
|
|
54
54
|
};
|
|
55
|
-
export
|
|
55
|
+
export type Experimental = {
|
|
56
56
|
lSym?: number;
|
|
57
57
|
lProp?: number;
|
|
58
58
|
lPropAlt?: number;
|
|
59
59
|
lUE?: number;
|
|
60
60
|
};
|
|
61
|
-
export
|
|
61
|
+
export type PartisanScorecard = {
|
|
62
62
|
bias: Bias;
|
|
63
63
|
impact: Impact;
|
|
64
64
|
responsiveness: Responsiveness;
|
|
@@ -69,7 +69,7 @@ export declare type PartisanScorecard = {
|
|
|
69
69
|
experimental: Experimental;
|
|
70
70
|
details: T.Dict;
|
|
71
71
|
};
|
|
72
|
-
export
|
|
72
|
+
export type PartisanJSONReady = {
|
|
73
73
|
bias: Bias;
|
|
74
74
|
responsiveness: Responsiveness;
|
|
75
75
|
dSVpoints: SVpoint[];
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import * as T from './general';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
2
|
+
export type CountyProfile = CxD;
|
|
3
|
+
export type CxD = number[][];
|
|
4
|
+
export type SplittingScorecard = {
|
|
5
5
|
county: number;
|
|
6
6
|
district: number;
|
|
7
7
|
details: T.Dict;
|
|
8
8
|
score?: number;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type SplittingJSONReady = {
|
|
11
11
|
county: number;
|
|
12
12
|
district: number;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type COISplits = {
|
|
15
15
|
name: string;
|
|
16
16
|
splits: number[];
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type COISplitting = {
|
|
19
19
|
name: string;
|
|
20
20
|
effectiveSplits: number;
|
|
21
21
|
uncertainty: number;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type COISplittingJSONReady = {
|
|
24
24
|
byCOI: COISplitting[];
|
|
25
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dra2020/dra-analytics",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "DRA analytics",
|
|
5
5
|
"main": "dist/dra-analytics.js",
|
|
6
6
|
"types": "./dist/lib/all/all.d.ts",
|
|
@@ -32,28 +32,28 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/dra2020/dra-analytics#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/geojson": "^7946.0.
|
|
36
|
-
"@types/
|
|
37
|
-
"@types/
|
|
38
|
-
"
|
|
39
|
-
"csv-parse": "^4.16.0",
|
|
40
|
-
"jest": "^27.4.3",
|
|
35
|
+
"@types/geojson": "^7946.0.10",
|
|
36
|
+
"@types/node": "^12.20.55",
|
|
37
|
+
"@types/yargs": "^12.0.20",
|
|
38
|
+
"csv-parse": "^4.16.3",
|
|
41
39
|
"json-loader": "^0.5.7",
|
|
42
|
-
"prettier": "^2.
|
|
40
|
+
"prettier": "^2.7.1",
|
|
43
41
|
"shapefile": "^0.6.6",
|
|
44
|
-
"source-map-loader": "^
|
|
45
|
-
"ts-
|
|
46
|
-
"ts-loader": "^9.2.6",
|
|
42
|
+
"source-map-loader": "^4.0.1",
|
|
43
|
+
"ts-loader": "^9.4.1",
|
|
47
44
|
"tsify": "^5.0.4",
|
|
48
45
|
"tslint": "^6.1.3",
|
|
49
46
|
"tslint-config-prettier": "^1.18.0",
|
|
50
|
-
"typescript": "^4.
|
|
51
|
-
"webpack": "^5.
|
|
52
|
-
"webpack-cli": "^4.
|
|
53
|
-
"yargs": "^
|
|
47
|
+
"typescript": "^4.9.3",
|
|
48
|
+
"webpack": "^5.75.0",
|
|
49
|
+
"webpack-cli": "^4.10.0",
|
|
50
|
+
"yargs": "^12.0.5"
|
|
54
51
|
},
|
|
55
52
|
"dependencies": {
|
|
56
|
-
"@dra2020/baseclient": "^1.0.
|
|
57
|
-
"
|
|
53
|
+
"@dra2020/baseclient": "^1.0.89",
|
|
54
|
+
"@types/jest": "^26.0.24",
|
|
55
|
+
"geojson": "^0.5.0",
|
|
56
|
+
"jest": "^26.6.3",
|
|
57
|
+
"ts-jest": "^26.5.6"
|
|
58
58
|
}
|
|
59
|
-
}
|
|
59
|
+
}
|