@dra2020/district-analytics 2.0.7 → 3.0.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.
@@ -1,4 +1,6 @@
1
- import { PlanAnalytics, DistrictStatistics } from './results';
1
+ import * as Score from '@dra2020/dra-score';
2
+ import { RequirementsChecklist } from './results';
3
+ import { DistrictStatistics } from './results';
2
4
  import * as D from './_data';
3
5
  import * as T from './types';
4
6
  export declare class AnalyticsSession {
@@ -10,6 +12,8 @@ export declare class AnalyticsSession {
10
12
  bPostProcessingDone: boolean;
11
13
  testScales: T.TestScales;
12
14
  tests: T.TestEntries;
15
+ _profile?: Score.Profile;
16
+ _scorecard?: Score.Scorecard;
13
17
  state: D.State;
14
18
  counties: D.Counties;
15
19
  graph: D.Graph;
@@ -19,8 +23,10 @@ export declare class AnalyticsSession {
19
23
  constructor(SessionRequest: T.SessionRequest);
20
24
  processConfig(config: T.Dict): T.Dict;
21
25
  analyzePlan(bLog?: boolean): boolean;
22
- getPlanAnalytics(bLog?: boolean): PlanAnalytics;
23
26
  getDistrictStatistics(bLog?: boolean): DistrictStatistics;
27
+ getPlanProfile(bLog?: boolean): Score.Profile;
28
+ getPlanScorecard(bLog?: boolean): Score.Scorecard;
29
+ getRequirementsChecklist(bLog?: boolean): RequirementsChecklist;
24
30
  getDiscontiguousDistrictFeatures(bLog?: boolean): T.GeoFeatureCollection;
25
31
  getTest(testID: T.Test): T.TestEntry;
26
32
  populationDeviationThreshold(): number;
@@ -1,5 +1,26 @@
1
1
  import * as T from './types';
2
2
  import { AnalyticsSession } from './_api';
3
+ export declare type RequirementsChecklist = {
4
+ score: T.TriState;
5
+ metrics: {
6
+ complete: T.TriState;
7
+ contiguous: T.TriState;
8
+ freeOfHoles: T.TriState;
9
+ equalPopulation: T.TriState;
10
+ };
11
+ details: {
12
+ unassignedFeatures: string[];
13
+ emptyDistricts: number[];
14
+ discontiguousDistricts: number[];
15
+ embeddedDistricts: number[];
16
+ populationDeviation: number;
17
+ deviationThreshold: number;
18
+ };
19
+ datasets: T.Datasets;
20
+ resources: {
21
+ stateReqs: string;
22
+ };
23
+ };
3
24
  export declare type RequirementsCategory = {
4
25
  score: T.TriState;
5
26
  metrics: {
@@ -90,7 +111,7 @@ export declare type PlanAnalytics = {
90
111
  minority: MinorityCategory;
91
112
  };
92
113
  export declare const samplePlanAnalytics: PlanAnalytics;
93
- export declare function preparePlanAnalytics(s: AnalyticsSession, bLog?: boolean): PlanAnalytics;
114
+ export declare function prepareRequirementsChecklist(s: AnalyticsSession, bLog?: boolean): RequirementsChecklist;
94
115
  export declare const enum DistrictColumn {
95
116
  DistrictID = 0,
96
117
  TotalPop = 1,
@@ -0,0 +1,4 @@
1
+ import * as Score from '@dra2020/dra-score';
2
+ import { AnalyticsSession } from './_api';
3
+ export declare function profilePlan(s: AnalyticsSession, bLog?: boolean): Score.Profile;
4
+ export declare function scorePlan(p: Score.Profile, bLog?: boolean): Score.Scorecard;
@@ -99,11 +99,10 @@ export declare const enum DistrictShapeProperty {
99
99
  Perimeter = 2
100
100
  }
101
101
  export declare type GeoIDParts = {
102
- state?: string;
103
- county?: string;
104
- tract?: string;
105
- bg?: string;
106
- block?: string;
102
+ vfeature?: boolean;
103
+ state: string;
104
+ county: string;
105
+ rest: string;
107
106
  };
108
107
  export declare type GeoIDTotal = {
109
108
  [geoID: string]: number;
@@ -122,3 +121,4 @@ export declare type Datasets = {
122
121
  vap?: string;
123
122
  election?: string;
124
123
  };
124
+ export { Profile, Scorecard, PopulationProfile, ShapeProfile, SplittingProfile, PartisanProfile, sampleProfile, sampleScorecard } from '@dra2020/dra-score';
@@ -3,7 +3,6 @@ export declare function isInState(geoID: string): boolean;
3
3
  export declare function isOutOfState(geoID: string): boolean;
4
4
  export declare function getDistrict(plan: T.PlanByGeoID, geoID: string): number | undefined;
5
5
  export declare function parseGeoID(geoID: string): T.GeoIDParts;
6
- export declare function getFIPSFromCountyGeoID(geoID: string): string;
7
6
  export declare function isWaterOnly(geoID: string): boolean;
8
7
  export declare function normalize(rawScore: number, testScale: T.TestScale): number;
9
8
  export declare function trim(fullFraction: number, digits?: number | undefined): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/district-analytics",
3
- "version": "2.0.7",
3
+ "version": "3.0.0",
4
4
  "description": "District analytics TypeScript package",
5
5
  "main": "dist/district-analytics.js",
6
6
  "files": [
@@ -48,6 +48,7 @@
48
48
  "yargs": "^12.0.5"
49
49
  },
50
50
  "dependencies": {
51
+ "@dra2020/dra-score": "^1.3.2",
51
52
  "@dra2020/poly": "1.0.9",
52
53
  "@dra2020/util": "1.0.24",
53
54
  "csv-parse": "^4.4.5",