@dra2020/district-analytics 16.1.13 → 17.0.1

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/README.md CHANGED
@@ -22,6 +22,7 @@ sr['counties'] = counties as T.GeoFeatureCollection;
22
22
  sr['graph'] = graph as T.ContiguityGraph;
23
23
  sr['plan'] = planByGeoID as DA.PlanByGeoID;
24
24
  sr['districtShapes'] = districtShapes as T.GeoFeatureCollection;
25
+ sr['aggregates'] = aggregates as PF.PackedFields[];
25
26
  sr['config'] = config as T.Dict;
26
27
 
27
28
  let s = new DA.AnalyticsSession(sr);
@@ -38,6 +39,3 @@ const discontiguous = DA.GeoFeatureCollection = s.getDiscontiguousDistrictFeatur
38
39
 
39
40
  ```
40
41
 
41
- ## License
42
-
43
- Distributed under the [The MIT License (MIT)](https://github.com/alecramsay/district-analytics/blob/master/LICENSE) Copyright © 2019 Alec Ramsay
package/dist/_api.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Types } from '@dra2020/dra-analytics';
2
+ import { PF } from '@dra2020/dra-types';
2
3
  import { RequirementsChecklist } from './results';
3
4
  import { DistrictStatistics } from './results';
4
5
  import * as D from './_data';
@@ -20,6 +21,7 @@ export declare class AnalyticsSession {
20
21
  features: D.Features;
21
22
  plan: D.Plan;
22
23
  districts: D.Districts;
24
+ aggregates: PF.PackedFields[];
23
25
  repsByDistrict?: number[];
24
26
  constructor(SessionRequest: T.SessionRequest);
25
27
  processConfig(config: T.Dict): T.Dict;
package/dist/data.d.ts ADDED
@@ -0,0 +1,68 @@
1
+ import * as T from './types';
2
+ import { AnalyticsSession } from './_api';
3
+ export declare class Districts {
4
+ _session: AnalyticsSession;
5
+ _shapes: T.GeoFeatureCollection;
6
+ _geoProperties: T.DistrictProperties;
7
+ constructor(s: AnalyticsSession, ds: T.GeoFeatureCollection);
8
+ getDistrictShapes(): T.GeoFeatureCollection;
9
+ getDistrictShapeByID(id: number): T.GeoFeature | undefined;
10
+ getCountyIndex(geoID: string): number;
11
+ }
12
+ export declare class Features {
13
+ _session: AnalyticsSession;
14
+ _data: T.GeoFeatureCollection;
15
+ _keys: T.DatasetKeys;
16
+ _featureIDs: T.FeaturesByGeoID;
17
+ constructor(s: AnalyticsSession, data: T.GeoFeatureCollection, keys: T.DatasetKeys);
18
+ nFeatures(): number;
19
+ featureByIndex(i: number): T.GeoFeature;
20
+ resetDataset(d: T.Dataset, k: string): void;
21
+ mapGeoIDsToFeatureIDs(): void;
22
+ featureID(i: string): number;
23
+ }
24
+ export declare function geoIDForFeature(f: any): string;
25
+ export declare function fieldForFeature(f: any, dk: string, ff: T.FeatureField): any;
26
+ export declare class Counties {
27
+ _session: AnalyticsSession;
28
+ _data: T.GeoFeatureCollection;
29
+ _countyNameLookup: T.FIPSCodeToCountyNameMap;
30
+ nCounties: number;
31
+ index: T.FIPSToOrdinalMap;
32
+ fips: T.OrdinalToFIPSlMap;
33
+ totalPopulation: number[];
34
+ constructor(s: AnalyticsSession, data: T.GeoFeatureCollection);
35
+ countyByIndex(i: number): T.GeoFeature;
36
+ propertyForCounty(f: any, pk: string): any;
37
+ mapFIPSToName(fips: string, name: string): void;
38
+ nameFromFIPS(fips: string): string;
39
+ indexFromFIPS(fips: string): number;
40
+ }
41
+ export declare class State {
42
+ _session: AnalyticsSession;
43
+ xx: string;
44
+ nDistricts: number;
45
+ nReps: number;
46
+ totalPop: number;
47
+ targetSize: number;
48
+ tooBigFIPS: string[];
49
+ tooBigName: string[];
50
+ singleCountyDistrictMax: number;
51
+ expectedSplits: number;
52
+ expectedAffected: number;
53
+ constructor(s: AnalyticsSession, xx: string, n: number);
54
+ }
55
+ export declare class Plan {
56
+ _session: AnalyticsSession;
57
+ _planByGeoID: T.PlanByGeoID;
58
+ _planByDistrictID: T.PlanByDistrictID;
59
+ districtIDs: number[];
60
+ constructor(s: AnalyticsSession, p: T.PlanByGeoID);
61
+ invertPlan(bLog?: boolean): void;
62
+ initializeDistrict(i: number): void;
63
+ byGeoID(): T.PlanByGeoID;
64
+ byDistrictID(): T.PlanByDistrictID;
65
+ districtForGeoID(i: string): number;
66
+ geoIDsForDistrictID(i: number): Set<string>;
67
+ }
68
+ export declare function invertPlan(plan: T.PlanByGeoID, s?: AnalyticsSession, bLog?: boolean): T.PlanByDistrictID;
@@ -105,6 +105,7 @@ class AnalyticsSession {
105
105
  this.features = new D.Features(this, SessionRequest['data'], this.config['datasets']);
106
106
  this.plan = new D.Plan(this, SessionRequest['plan']);
107
107
  this.districts = new D.Districts(this, SessionRequest['districtShapes']);
108
+ this.aggregates = SessionRequest['aggregates'];
108
109
  }
109
110
  processConfig(config) {
110
111
  // Default the Census & redistricting cycle to 2010