@dra2020/district-analytics 10.0.9 → 10.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.
@@ -22,6 +22,7 @@ export declare class AnalyticsSession {
22
22
  constructor(SessionRequest: T.SessionRequest);
23
23
  processConfig(config: T.Dict): T.Dict;
24
24
  analyzePlan(bLog?: boolean, overridesJSON?: any): boolean;
25
+ analyzeRacialPolarization(id: number, bLog?: boolean): D.Demographics | undefined;
25
26
  getDistrictStatistics(bLog?: boolean): DistrictStatistics;
26
27
  getPlanProfile(bLog?: boolean): Score.Profile;
27
28
  getPlanScorecard(bLog?: boolean): Score.Scorecard;
@@ -1,53 +1,75 @@
1
1
  import * as T from './types';
2
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
- OtherVotes = 9,
14
- DemPct = 10,
15
- RepPct = 11,
16
- OtherPct = 12,
17
- DemSeat = 13,
18
- TotalVAP = 14,
19
- MinorityPop = 15,
20
- WhitePop = 16,
21
- BlackPop = 17,
22
- HispanicPop = 18,
23
- PacificPop = 19,
24
- AsianPop = 20,
25
- NativePop = 21,
26
- WhitePct = 22,
27
- MinorityPct = 23,
28
- BlackPct = 24,
29
- HispanicPct = 25,
30
- PacificPct = 26,
31
- AsianPct = 27,
32
- NativePct = 28
33
- }
3
+ export declare type TransposedTable = {
4
+ totalPop: number[];
5
+ popDevPct: number[];
6
+ bEqualPop: boolean[];
7
+ bNotEmpty: boolean[];
8
+ bContiguous: boolean[];
9
+ bNotEmbedded: boolean[];
10
+ countySplits: number[][];
11
+ demVotes: number[];
12
+ repVotes: number[];
13
+ otherVotes: number[];
14
+ demPct: number[];
15
+ repPct: number[];
16
+ otherPct: number[];
17
+ demSeat: number[];
18
+ totalVAP: number[];
19
+ minorityPop: number[];
20
+ whitePop: number[];
21
+ blackPop: number[];
22
+ hispanicPop: number[];
23
+ pacificPop: number[];
24
+ asianPop: number[];
25
+ nativePop: number[];
26
+ whitePct: number[];
27
+ minorityPct: number[];
28
+ blackPct: number[];
29
+ hispanicPct: number[];
30
+ pacificPct: number[];
31
+ asianPct: number[];
32
+ nativePct: number[];
33
+ };
34
+ export declare type Demographics = {
35
+ white: number | undefined;
36
+ minority: number | undefined;
37
+ black: number | undefined;
38
+ hispanic: number | undefined;
39
+ pacific: number | undefined;
40
+ asian: number | undefined;
41
+ native: number | undefined;
42
+ };
43
+ export declare type Point = {
44
+ x: number;
45
+ y: number;
46
+ };
47
+ export declare type DemographicVotingByFeature = {
48
+ white: Point[];
49
+ minority: Point[];
50
+ black: Point[];
51
+ hispanic: Point[];
52
+ pacific: Point[];
53
+ asian: Point[];
54
+ native: Point[];
55
+ };
34
56
  export declare class Districts {
35
57
  _session: AnalyticsSession;
36
58
  _shapes: T.GeoFeatureCollection;
37
59
  _geoProperties: T.DistrictProperties;
38
- statistics: any[][];
60
+ table: TransposedTable;
39
61
  constructor(s: AnalyticsSession, ds: T.GeoFeatureCollection);
40
62
  getDistrictShapes(): T.GeoFeatureCollection;
41
63
  getDistrictShapeByID(id: number): T.GeoFeature | undefined;
42
64
  getGeoProperties(i: number): any;
43
65
  setGeoProperties(i: number, p: T.DistrictShapeProperties): void;
44
- numberOfColumns(): number;
45
66
  numberOfRows(): number;
46
67
  numberOfWorkingDistricts(): number;
47
- initStatistics(): any[][];
68
+ initTable(): TransposedTable;
48
69
  recalcStatistics(bLog?: boolean): void;
49
70
  extractDistrictShapeProperties(bLog?: boolean): void;
50
71
  getCountyIndex(geoID: string): number;
72
+ extractVotesByDemographic(districtID: number, bLog?: boolean): DemographicVotingByFeature | undefined;
51
73
  }
52
74
  export declare class Features {
53
75
  _session: AnalyticsSession;
@@ -1,4 +1,4 @@
1
1
  export * from './_api';
2
- export * from './_data';
3
2
  export * from './results';
4
3
  export * from './types';
4
+ export { Demographics } from './_data';
@@ -1,4 +1,6 @@
1
1
  import * as T from './types';
2
2
  import { AnalyticsSession } from './_api';
3
+ import { Demographics } from './_data';
3
4
  export declare function getMajorityMinority(s: AnalyticsSession): T.Dict;
4
5
  export declare function getVRASection5(s: AnalyticsSession): string;
6
+ export declare function doAnalyzeRacialPolarization(s: AnalyticsSession, districtID: number, bLog?: boolean): Demographics | undefined;
@@ -20,44 +20,26 @@ export declare type RequirementsChecklist = {
20
20
  resources: {};
21
21
  };
22
22
  export declare function prepareRequirementsChecklist(s: AnalyticsSession, bLog?: boolean): RequirementsChecklist;
23
- export declare const enum DistrictColumn {
24
- DistrictID = 0,
25
- TotalPop = 1,
26
- PopDevPct = 2,
27
- bEqualPop = 3,
28
- bNotEmpty = 4,
29
- bContiguous = 5,
30
- bNotEmbedded = 6,
31
- DemPct = 7,
32
- RepPct = 8,
33
- WhitePct = 9,
34
- MinorityPct = 10,
35
- BlackPct = 11,
36
- HispanicPct = 12,
37
- PacificPct = 13,
38
- AsianPct = 14,
39
- NativePct = 15,
40
- TotalVAP = 16,
41
- OthPct = 17
42
- }
43
- export declare type DistrictRow = [number, // DistrictID
44
- number, // TotalPop
45
- number, // PopDevPct
46
- boolean, /* T.TriState | null, */ // bEqualPop
47
- boolean, /* T.TriState | null, */ // bNotEmpty
48
- boolean, /* T.TriState | null, */ // bContiguous
49
- boolean, /* T.TriState | null, */ // bNotEmbedded
50
- number, // DemPct
51
- number, // RepPct
52
- number, // WhitePct
53
- number, // MinorityPct
54
- number, // BlackPct
55
- number, // HispanicPct
56
- number, // PacificPct
57
- number, // AsianPct
58
- number, // NativePct
59
- number, // Total VAP
60
- number];
23
+ export declare type DistrictRow = {
24
+ districtID: number;
25
+ totalPop: number;
26
+ popDevPct: number;
27
+ bEqualPop: boolean;
28
+ bNotEmpty: boolean;
29
+ bContiguous: boolean;
30
+ bNotEmbedded: boolean;
31
+ demPct: number;
32
+ repPct: number;
33
+ othPct: number;
34
+ totalVAP: number;
35
+ whitePct: number;
36
+ minorityPct: number;
37
+ blackPct: number;
38
+ hispanicPct: number;
39
+ pacificPct: number;
40
+ asianPct: number;
41
+ nativePct: number;
42
+ };
61
43
  export declare type DistrictStatistics = {
62
44
  table: DistrictRow[];
63
45
  details: {};
@@ -1,4 +1,5 @@
1
1
  import * as Score from '@dra2020/dra-score';
2
2
  import { AnalyticsSession } from './_api';
3
3
  export declare function profilePlan(s: AnalyticsSession, bLog?: boolean): Score.Profile;
4
+ export declare function getStatewideDemographics(s: AnalyticsSession, bLog?: boolean): Score.Demographics;
4
5
  export declare function scorePlan(s: AnalyticsSession, p: Score.Profile, bLog?: boolean, overridesJSON?: any): Score.Scorecard;
@@ -1,9 +1,4 @@
1
1
  import * as geojson from 'geojson';
2
- export declare const enum Suite {
3
- Legal = 0,
4
- Fair = 1,
5
- Best = 2
6
- }
7
2
  export declare type SessionRequest = {
8
3
  title: string;
9
4
  stateXX: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/district-analytics",
3
- "version": "10.0.9",
3
+ "version": "10.1.0",
4
4
  "description": "District analytics TypeScript package",
5
5
  "main": "dist/district-analytics.js",
6
6
  "files": [