@dra2020/dra-analytics 4.1.2 → 4.1.4
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 +2 -0
- package/dist/dra-analytics.js +6 -6
- package/dist/dra-analytics.js.map +1 -1
- package/dist/lib/types/compactness.d.ts +3 -3
- package/docs/types.md +1 -1
- package/lib/compactness/compactness.ts +4 -4
- package/lib/compactness/kiwysi.ts +2 -2
- package/lib/types/compactness.ts +3 -3
- package/package.json +16 -15
|
@@ -28,7 +28,7 @@ export type GeoProperties = {
|
|
|
28
28
|
export type CompactnessScorecard = {
|
|
29
29
|
avgReock: number;
|
|
30
30
|
avgPolsby: number;
|
|
31
|
-
|
|
31
|
+
avgKIWYSI: number;
|
|
32
32
|
byDistrict: Compactness[];
|
|
33
33
|
details: T.Dict;
|
|
34
34
|
score?: number;
|
|
@@ -48,7 +48,7 @@ export type CompactnessAlt = {
|
|
|
48
48
|
export type CompactnessJSONReady = {
|
|
49
49
|
avgReock: number;
|
|
50
50
|
avgPolsby: number;
|
|
51
|
-
|
|
51
|
+
avgKIWYSI: number;
|
|
52
52
|
byDistrict: CompactnessAlt[];
|
|
53
53
|
};
|
|
54
54
|
export type KiwysiFeatures = {
|
|
@@ -62,6 +62,6 @@ export type KiwysiFeatures = {
|
|
|
62
62
|
kiwysiRank: number;
|
|
63
63
|
};
|
|
64
64
|
export type KiwysiJSONReady = {
|
|
65
|
-
|
|
65
|
+
avgKIWYSI: number;
|
|
66
66
|
byDistrict: KiwysiFeatures[];
|
|
67
67
|
};
|
package/docs/types.md
CHANGED
|
@@ -64,12 +64,12 @@ export function makeCompactnessScorecard(shapes: GeoJSON.FeatureCollection, bLog
|
|
|
64
64
|
|
|
65
65
|
const avgReock: number = totReock / shapes.features.length;
|
|
66
66
|
const avgPolsby: number = totPolsby / shapes.features.length;
|
|
67
|
-
const
|
|
67
|
+
const avgKIWYSI: number = Math.round(totKIWYSI / shapes.features.length);
|
|
68
68
|
|
|
69
69
|
const s: T.CompactnessScorecard = {
|
|
70
70
|
avgReock: avgReock,
|
|
71
71
|
avgPolsby: avgPolsby,
|
|
72
|
-
|
|
72
|
+
avgKIWYSI: avgKIWYSI,
|
|
73
73
|
byDistrict: byDistrict, // Legacy format
|
|
74
74
|
details: {}, // None
|
|
75
75
|
// score?:
|
|
@@ -121,12 +121,12 @@ export function calcCompactness(shapes: GeoJSON.FeatureCollection): T.Compactnes
|
|
|
121
121
|
|
|
122
122
|
const avgReock: number = totReock / shapes.features.length;
|
|
123
123
|
const avgPolsby: number = totPolsby / shapes.features.length;
|
|
124
|
-
const
|
|
124
|
+
const avgKIWYSI: number = Math.round(totKIWYSI / shapes.features.length);
|
|
125
125
|
|
|
126
126
|
const out: T.CompactnessJSONReady = {
|
|
127
127
|
avgReock: avgReock,
|
|
128
128
|
avgPolsby: avgPolsby,
|
|
129
|
-
|
|
129
|
+
avgKIWYSI: avgKIWYSI,
|
|
130
130
|
byDistrict: byDistrict
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -83,10 +83,10 @@ export function calcKIWYSICompactness(shapes: GeoJSON.FeatureCollection): T.Kiwy
|
|
|
83
83
|
byDistrict.push(entry);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const
|
|
86
|
+
const avgKIWYSI: number = Math.round(totKIWYSI / shapes.features.length);
|
|
87
87
|
|
|
88
88
|
const out: T.KiwysiJSONReady = {
|
|
89
|
-
|
|
89
|
+
avgKIWYSI: avgKIWYSI,
|
|
90
90
|
byDistrict: byDistrict
|
|
91
91
|
}
|
|
92
92
|
|
package/lib/types/compactness.ts
CHANGED
|
@@ -49,7 +49,7 @@ export type GeoProperties = {
|
|
|
49
49
|
export type CompactnessScorecard = {
|
|
50
50
|
avgReock: number,
|
|
51
51
|
avgPolsby: number,
|
|
52
|
-
|
|
52
|
+
avgKIWYSI: number,
|
|
53
53
|
byDistrict: Compactness[],
|
|
54
54
|
details: T.Dict,
|
|
55
55
|
score?: number
|
|
@@ -78,7 +78,7 @@ export type CompactnessAlt = {
|
|
|
78
78
|
export type CompactnessJSONReady = {
|
|
79
79
|
avgReock: number,
|
|
80
80
|
avgPolsby: number,
|
|
81
|
-
|
|
81
|
+
avgKIWYSI: number,
|
|
82
82
|
byDistrict: CompactnessAlt[]
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -95,7 +95,7 @@ export type KiwysiFeatures = {
|
|
|
95
95
|
|
|
96
96
|
// A minimal type for by-district KIWISI compactness features to be converted to JSON
|
|
97
97
|
export type KiwysiJSONReady = {
|
|
98
|
-
|
|
98
|
+
avgKIWYSI: number,
|
|
99
99
|
byDistrict: KiwysiFeatures[]
|
|
100
100
|
}
|
|
101
101
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dra2020/dra-analytics",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.4",
|
|
4
4
|
"description": "DRA analytics",
|
|
5
5
|
"main": "dist/dra-analytics.js",
|
|
6
6
|
"types": "./dist/lib/all/all.d.ts",
|
|
@@ -33,27 +33,28 @@
|
|
|
33
33
|
"homepage": "https://github.com/dra2020/dra-analytics#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/geojson": "^7946.0.10",
|
|
36
|
-
"@types/jest": "^
|
|
37
|
-
"@types/node": "^
|
|
38
|
-
"@types/yargs": "^
|
|
36
|
+
"@types/jest": "^29.5.1",
|
|
37
|
+
"@types/node": "^18.11.17",
|
|
38
|
+
"@types/yargs": "^11.1.8",
|
|
39
39
|
"csv-parse": "^4.16.3",
|
|
40
|
-
"jest": "^
|
|
40
|
+
"jest": "^29.5.0",
|
|
41
41
|
"json-loader": "^0.5.7",
|
|
42
|
-
"prettier": "^2.
|
|
42
|
+
"prettier": "^2.8.8",
|
|
43
43
|
"shapefile": "^0.6.6",
|
|
44
|
-
"source-map-loader": "^
|
|
45
|
-
"ts-jest": "^
|
|
46
|
-
"ts-loader": "^9.4.
|
|
44
|
+
"source-map-loader": "^4.0.1",
|
|
45
|
+
"ts-jest": "^29.1.0",
|
|
46
|
+
"ts-loader": "^9.4.2",
|
|
47
47
|
"tsify": "^5.0.4",
|
|
48
48
|
"tslint": "^6.1.3",
|
|
49
49
|
"tslint-config-prettier": "^1.18.0",
|
|
50
|
-
"typescript": "^4.9.
|
|
51
|
-
"webpack": "^5.
|
|
52
|
-
"webpack-cli": "^
|
|
53
|
-
"yargs": "^12.0.5"
|
|
50
|
+
"typescript": "^4.9.4",
|
|
51
|
+
"webpack": "^5.82.0",
|
|
52
|
+
"webpack-cli": "^5.1.0"
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
56
|
-
"@dra2020/baseclient": "^1.0.
|
|
57
|
-
"
|
|
55
|
+
"@dra2020/baseclient": "^1.0.153",
|
|
56
|
+
"cjs": "^0.0.11",
|
|
57
|
+
"geojson": "^0.5.0",
|
|
58
|
+
"yargs": "^12.0.5"
|
|
58
59
|
}
|
|
59
60
|
}
|