@dra2020/district-analytics 16.1.1 → 16.1.3

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 CHANGED
@@ -1,21 +1,433 @@
1
- MIT License
2
-
3
- Copyright (c) 2020-2022 Dave's Redistricting, LLC.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Copyright (c) 2020-2024 Social Good Fund for Dave's Redistricting.
2
+
3
+ This software is openly licensed via the Creative Commons Attribution-ShareAlike 4.0 International License, which appears below.
4
+ (https://creativecommons.org/licenses/by-sa/4.0/)
5
+
6
+
7
+ Attribution-ShareAlike 4.0 International
8
+
9
+ =======================================================================
10
+
11
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
12
+ does not provide legal services or legal advice. Distribution of
13
+ Creative Commons public licenses does not create a lawyer-client or
14
+ other relationship. Creative Commons makes its licenses and related
15
+ information available on an "as-is" basis. Creative Commons gives no
16
+ warranties regarding its licenses, any material licensed under their
17
+ terms and conditions, or any related information. Creative Commons
18
+ disclaims all liability for damages resulting from their use to the
19
+ fullest extent possible.
20
+
21
+ Using Creative Commons Public Licenses
22
+
23
+ Creative Commons public licenses provide a standard set of terms and
24
+ conditions that creators and other rights holders may use to share
25
+ original works of authorship and other material subject to copyright
26
+ and certain other rights specified in the public license below. The
27
+ following considerations are for informational purposes only, are not
28
+ exhaustive, and do not form part of our licenses.
29
+
30
+ Considerations for licensors: Our public licenses are
31
+ intended for use by those authorized to give the public
32
+ permission to use material in ways otherwise restricted by
33
+ copyright and certain other rights. Our licenses are
34
+ irrevocable. Licensors should read and understand the terms
35
+ and conditions of the license they choose before applying it.
36
+ Licensors should also secure all rights necessary before
37
+ applying our licenses so that the public can reuse the
38
+ material as expected. Licensors should clearly mark any
39
+ material not subject to the license. This includes other CC-
40
+ licensed material, or material used under an exception or
41
+ limitation to copyright. More considerations for licensors:
42
+ wiki.creativecommons.org/Considerations_for_licensors
43
+
44
+ Considerations for the public: By using one of our public
45
+ licenses, a licensor grants the public permission to use the
46
+ licensed material under specified terms and conditions. If
47
+ the licensor's permission is not necessary for any reason--for
48
+ example, because of any applicable exception or limitation to
49
+ copyright--then that use is not regulated by the license. Our
50
+ licenses grant only permissions under copyright and certain
51
+ other rights that a licensor has authority to grant. Use of
52
+ the licensed material may still be restricted for other
53
+ reasons, including because others have copyright or other
54
+ rights in the material. A licensor may make special requests,
55
+ such as asking that all changes be marked or described.
56
+ Although not required by our licenses, you are encouraged to
57
+ respect those requests where reasonable. More_considerations
58
+ for the public:
59
+ wiki.creativecommons.org/Considerations_for_licensees
60
+
61
+ =======================================================================
62
+
63
+ Creative Commons Attribution-ShareAlike 4.0 International Public
64
+ License
65
+
66
+ By exercising the Licensed Rights (defined below), You accept and agree
67
+ to be bound by the terms and conditions of this Creative Commons
68
+ Attribution-ShareAlike 4.0 International Public License ("Public
69
+ License"). To the extent this Public License may be interpreted as a
70
+ contract, You are granted the Licensed Rights in consideration of Your
71
+ acceptance of these terms and conditions, and the Licensor grants You
72
+ such rights in consideration of benefits the Licensor receives from
73
+ making the Licensed Material available under these terms and
74
+ conditions.
75
+
76
+
77
+ Section 1 -- Definitions.
78
+
79
+ a. Adapted Material means material subject to Copyright and Similar
80
+ Rights that is derived from or based upon the Licensed Material
81
+ and in which the Licensed Material is translated, altered,
82
+ arranged, transformed, or otherwise modified in a manner requiring
83
+ permission under the Copyright and Similar Rights held by the
84
+ Licensor. For purposes of this Public License, where the Licensed
85
+ Material is a musical work, performance, or sound recording,
86
+ Adapted Material is always produced where the Licensed Material is
87
+ synched in timed relation with a moving image.
88
+
89
+ b. Adapter's License means the license You apply to Your Copyright
90
+ and Similar Rights in Your contributions to Adapted Material in
91
+ accordance with the terms and conditions of this Public License.
92
+
93
+ c. BY-SA Compatible License means a license listed at
94
+ creativecommons.org/compatiblelicenses, approved by Creative
95
+ Commons as essentially the equivalent of this Public License.
96
+
97
+ d. Copyright and Similar Rights means copyright and/or similar rights
98
+ closely related to copyright including, without limitation,
99
+ performance, broadcast, sound recording, and Sui Generis Database
100
+ Rights, without regard to how the rights are labeled or
101
+ categorized. For purposes of this Public License, the rights
102
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
103
+ Rights.
104
+
105
+ e. Effective Technological Measures means those measures that, in the
106
+ absence of proper authority, may not be circumvented under laws
107
+ fulfilling obligations under Article 11 of the WIPO Copyright
108
+ Treaty adopted on December 20, 1996, and/or similar international
109
+ agreements.
110
+
111
+ f. Exceptions and Limitations means fair use, fair dealing, and/or
112
+ any other exception or limitation to Copyright and Similar Rights
113
+ that applies to Your use of the Licensed Material.
114
+
115
+ g. License Elements means the license attributes listed in the name
116
+ of a Creative Commons Public License. The License Elements of this
117
+ Public License are Attribution and ShareAlike.
118
+
119
+ h. Licensed Material means the artistic or literary work, database,
120
+ or other material to which the Licensor applied this Public
121
+ License.
122
+
123
+ i. Licensed Rights means the rights granted to You subject to the
124
+ terms and conditions of this Public License, which are limited to
125
+ all Copyright and Similar Rights that apply to Your use of the
126
+ Licensed Material and that the Licensor has authority to license.
127
+
128
+ j. Licensor means the individual(s) or entity(ies) granting rights
129
+ under this Public License.
130
+
131
+ k. Share means to provide material to the public by any means or
132
+ process that requires permission under the Licensed Rights, such
133
+ as reproduction, public display, public performance, distribution,
134
+ dissemination, communication, or importation, and to make material
135
+ available to the public including in ways that members of the
136
+ public may access the material from a place and at a time
137
+ individually chosen by them.
138
+
139
+ l. Sui Generis Database Rights means rights other than copyright
140
+ resulting from Directive 96/9/EC of the European Parliament and of
141
+ the Council of 11 March 1996 on the legal protection of databases,
142
+ as amended and/or succeeded, as well as other essentially
143
+ equivalent rights anywhere in the world.
144
+
145
+ m. You means the individual or entity exercising the Licensed Rights
146
+ under this Public License. Your has a corresponding meaning.
147
+
148
+
149
+ Section 2 -- Scope.
150
+
151
+ a. License grant.
152
+
153
+ 1. Subject to the terms and conditions of this Public License,
154
+ the Licensor hereby grants You a worldwide, royalty-free,
155
+ non-sublicensable, non-exclusive, irrevocable license to
156
+ exercise the Licensed Rights in the Licensed Material to:
157
+
158
+ a. reproduce and Share the Licensed Material, in whole or
159
+ in part; and
160
+
161
+ b. produce, reproduce, and Share Adapted Material.
162
+
163
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
164
+ Exceptions and Limitations apply to Your use, this Public
165
+ License does not apply, and You do not need to comply with
166
+ its terms and conditions.
167
+
168
+ 3. Term. The term of this Public License is specified in Section
169
+ 6(a).
170
+
171
+ 4. Media and formats; technical modifications allowed. The
172
+ Licensor authorizes You to exercise the Licensed Rights in
173
+ all media and formats whether now known or hereafter created,
174
+ and to make technical modifications necessary to do so. The
175
+ Licensor waives and/or agrees not to assert any right or
176
+ authority to forbid You from making technical modifications
177
+ necessary to exercise the Licensed Rights, including
178
+ technical modifications necessary to circumvent Effective
179
+ Technological Measures. For purposes of this Public License,
180
+ simply making modifications authorized by this Section 2(a)
181
+ (4) never produces Adapted Material.
182
+
183
+ 5. Downstream recipients.
184
+
185
+ a. Offer from the Licensor -- Licensed Material. Every
186
+ recipient of the Licensed Material automatically
187
+ receives an offer from the Licensor to exercise the
188
+ Licensed Rights under the terms and conditions of this
189
+ Public License.
190
+
191
+ b. Additional offer from the Licensor -- Adapted Material.
192
+ Every recipient of Adapted Material from You
193
+ automatically receives an offer from the Licensor to
194
+ exercise the Licensed Rights in the Adapted Material
195
+ under the conditions of the Adapter's License You apply.
196
+
197
+ c. No downstream restrictions. You may not offer or impose
198
+ any additional or different terms or conditions on, or
199
+ apply any Effective Technological Measures to, the
200
+ Licensed Material if doing so restricts exercise of the
201
+ Licensed Rights by any recipient of the Licensed
202
+ Material.
203
+
204
+ 6. No endorsement. Nothing in this Public License constitutes or
205
+ may be construed as permission to assert or imply that You
206
+ are, or that Your use of the Licensed Material is, connected
207
+ with, or sponsored, endorsed, or granted official status by,
208
+ the Licensor or others designated to receive attribution as
209
+ provided in Section 3(a)(1)(A)(i).
210
+
211
+ b. Other rights.
212
+
213
+ 1. Moral rights, such as the right of integrity, are not
214
+ licensed under this Public License, nor are publicity,
215
+ privacy, and/or other similar personality rights; however, to
216
+ the extent possible, the Licensor waives and/or agrees not to
217
+ assert any such rights held by the Licensor to the limited
218
+ extent necessary to allow You to exercise the Licensed
219
+ Rights, but not otherwise.
220
+
221
+ 2. Patent and trademark rights are not licensed under this
222
+ Public License.
223
+
224
+ 3. To the extent possible, the Licensor waives any right to
225
+ collect royalties from You for the exercise of the Licensed
226
+ Rights, whether directly or through a collecting society
227
+ under any voluntary or waivable statutory or compulsory
228
+ licensing scheme. In all other cases the Licensor expressly
229
+ reserves any right to collect such royalties.
230
+
231
+
232
+ Section 3 -- License Conditions.
233
+
234
+ Your exercise of the Licensed Rights is expressly made subject to the
235
+ following conditions.
236
+
237
+ a. Attribution.
238
+
239
+ 1. If You Share the Licensed Material (including in modified
240
+ form), You must:
241
+
242
+ a. retain the following if it is supplied by the Licensor
243
+ with the Licensed Material:
244
+
245
+ i. identification of the creator(s) of the Licensed
246
+ Material and any others designated to receive
247
+ attribution, in any reasonable manner requested by
248
+ the Licensor (including by pseudonym if
249
+ designated);
250
+
251
+ ii. a copyright notice;
252
+
253
+ iii. a notice that refers to this Public License;
254
+
255
+ iv. a notice that refers to the disclaimer of
256
+ warranties;
257
+
258
+ v. a URI or hyperlink to the Licensed Material to the
259
+ extent reasonably practicable;
260
+
261
+ b. indicate if You modified the Licensed Material and
262
+ retain an indication of any previous modifications; and
263
+
264
+ c. indicate the Licensed Material is licensed under this
265
+ Public License, and include the text of, or the URI or
266
+ hyperlink to, this Public License.
267
+
268
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
269
+ reasonable manner based on the medium, means, and context in
270
+ which You Share the Licensed Material. For example, it may be
271
+ reasonable to satisfy the conditions by providing a URI or
272
+ hyperlink to a resource that includes the required
273
+ information.
274
+
275
+ 3. If requested by the Licensor, You must remove any of the
276
+ information required by Section 3(a)(1)(A) to the extent
277
+ reasonably practicable.
278
+
279
+ b. ShareAlike.
280
+
281
+ In addition to the conditions in Section 3(a), if You Share
282
+ Adapted Material You produce, the following conditions also apply.
283
+
284
+ 1. The Adapter's License You apply must be a Creative Commons
285
+ license with the same License Elements, this version or
286
+ later, or a BY-SA Compatible License.
287
+
288
+ 2. You must include the text of, or the URI or hyperlink to, the
289
+ Adapter's License You apply. You may satisfy this condition
290
+ in any reasonable manner based on the medium, means, and
291
+ context in which You Share Adapted Material.
292
+
293
+ 3. You may not offer or impose any additional or different terms
294
+ or conditions on, or apply any Effective Technological
295
+ Measures to, Adapted Material that restrict exercise of the
296
+ rights granted under the Adapter's License You apply.
297
+
298
+
299
+ Section 4 -- Sui Generis Database Rights.
300
+
301
+ Where the Licensed Rights include Sui Generis Database Rights that
302
+ apply to Your use of the Licensed Material:
303
+
304
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
305
+ to extract, reuse, reproduce, and Share all or a substantial
306
+ portion of the contents of the database;
307
+
308
+ b. if You include all or a substantial portion of the database
309
+ contents in a database in which You have Sui Generis Database
310
+ Rights, then the database in which You have Sui Generis Database
311
+ Rights (but not its individual contents) is Adapted Material,
312
+
313
+ including for purposes of Section 3(b); and
314
+ c. You must comply with the conditions in Section 3(a) if You Share
315
+ all or a substantial portion of the contents of the database.
316
+
317
+ For the avoidance of doubt, this Section 4 supplements and does not
318
+ replace Your obligations under this Public License where the Licensed
319
+ Rights include other Copyright and Similar Rights.
320
+
321
+
322
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
323
+
324
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
325
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
326
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
327
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
328
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
329
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
330
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
331
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
332
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
333
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
334
+
335
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
336
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
337
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
338
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
339
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
340
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
341
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
342
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
343
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
344
+
345
+ c. The disclaimer of warranties and limitation of liability provided
346
+ above shall be interpreted in a manner that, to the extent
347
+ possible, most closely approximates an absolute disclaimer and
348
+ waiver of all liability.
349
+
350
+
351
+ Section 6 -- Term and Termination.
352
+
353
+ a. This Public License applies for the term of the Copyright and
354
+ Similar Rights licensed here. However, if You fail to comply with
355
+ this Public License, then Your rights under this Public License
356
+ terminate automatically.
357
+
358
+ b. Where Your right to use the Licensed Material has terminated under
359
+ Section 6(a), it reinstates:
360
+
361
+ 1. automatically as of the date the violation is cured, provided
362
+ it is cured within 30 days of Your discovery of the
363
+ violation; or
364
+
365
+ 2. upon express reinstatement by the Licensor.
366
+
367
+ For the avoidance of doubt, this Section 6(b) does not affect any
368
+ right the Licensor may have to seek remedies for Your violations
369
+ of this Public License.
370
+
371
+ c. For the avoidance of doubt, the Licensor may also offer the
372
+ Licensed Material under separate terms or conditions or stop
373
+ distributing the Licensed Material at any time; however, doing so
374
+ will not terminate this Public License.
375
+
376
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
377
+ License.
378
+
379
+
380
+ Section 7 -- Other Terms and Conditions.
381
+
382
+ a. The Licensor shall not be bound by any additional or different
383
+ terms or conditions communicated by You unless expressly agreed.
384
+
385
+ b. Any arrangements, understandings, or agreements regarding the
386
+ Licensed Material not stated herein are separate from and
387
+ independent of the terms and conditions of this Public License.
388
+
389
+
390
+ Section 8 -- Interpretation.
391
+
392
+ a. For the avoidance of doubt, this Public License does not, and
393
+ shall not be interpreted to, reduce, limit, restrict, or impose
394
+ conditions on any use of the Licensed Material that could lawfully
395
+ be made without permission under this Public License.
396
+
397
+ b. To the extent possible, if any provision of this Public License is
398
+ deemed unenforceable, it shall be automatically reformed to the
399
+ minimum extent necessary to make it enforceable. If the provision
400
+ cannot be reformed, it shall be severed from this Public License
401
+ without affecting the enforceability of the remaining terms and
402
+ conditions.
403
+
404
+ c. No term or condition of this Public License will be waived and no
405
+ failure to comply consented to unless expressly agreed to by the
406
+ Licensor.
407
+
408
+ d. Nothing in this Public License constitutes or may be interpreted
409
+ as a limitation upon, or waiver of, any privileges and immunities
410
+ that apply to the Licensor or You, including from the legal
411
+ processes of any jurisdiction or authority.
412
+
413
+
414
+ =======================================================================
415
+
416
+ Creative Commons is not a party to its public
417
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
418
+ its public licenses to material it publishes and in those instances
419
+ will be considered the “Licensor.” The text of the Creative Commons
420
+ public licenses is dedicated to the public domain under the CC0 Public
421
+ Domain Dedication. Except for the limited purpose of indicating that
422
+ material is shared under a Creative Commons public license or as
423
+ otherwise permitted by the Creative Commons policies published at
424
+ creativecommons.org/policies, Creative Commons does not authorize the
425
+ use of the trademark "Creative Commons" or any other trademark or logo
426
+ of Creative Commons without its prior written consent including,
427
+ without limitation, in connection with any unauthorized modifications
428
+ to any of its public licenses or any other arrangements,
429
+ understandings, or agreements concerning use of licensed material. For
430
+ the avoidance of doubt, this paragraph does not form part of the
431
+ public licenses.
432
+
433
+ Creative Commons may be contacted at creativecommons.org.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # District Analytics
2
2
 
3
- This is the shim between the DRA client proper (dra-client) and the DRA analytics code (dra-analytics).
3
+ Type definitions and code used by dra-client and fn-all (lambdas), and which invokes dra-analytics
4
4
 
5
5
  ## Build Status
6
6
 
package/dist/_api.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { Types } from '@dra2020/dra-analytics';
2
+ import { RequirementsChecklist } from './results';
3
+ import { DistrictStatistics } from './results';
4
+ import * as D from './_data';
5
+ import * as T from './types';
6
+ import * as L from './legacy-types';
7
+ export declare class AnalyticsSession {
8
+ title: string;
9
+ legislativeDistricts: boolean;
10
+ config: T.Dict;
11
+ bOneTimeProcessingDone: boolean;
12
+ bPlanAnalyzed: boolean;
13
+ bPostProcessingDone: boolean;
14
+ tests: T.TestEntries;
15
+ _profile?: L.Profile;
16
+ _scorecard?: L.Scorecard;
17
+ state: D.State;
18
+ counties: D.Counties;
19
+ graph: D.GraphClass;
20
+ features: D.Features;
21
+ plan: D.Plan;
22
+ districts: D.Districts;
23
+ repsByDistrict?: number[];
24
+ constructor(SessionRequest: T.SessionRequest);
25
+ processConfig(config: T.Dict): T.Dict;
26
+ analyzePlan(bLog?: boolean, overridesJSON?: any): boolean;
27
+ getGoodShapes(): T.GeoFeatureCollection;
28
+ analyzeRacialPolarization(districtID: number, groups: Types.MinorityFilter, bLog?: boolean): Types.RPVAnalysis | undefined;
29
+ getDistrictStatistics(bLog?: boolean): DistrictStatistics;
30
+ getPlanProfile(bLog?: boolean): L.Profile;
31
+ getPlanScorecard(bLog?: boolean): L.Scorecard;
32
+ getRatings(bLog?: boolean): T.Ratings;
33
+ getRequirementsChecklist(bLog?: boolean): RequirementsChecklist;
34
+ getDiscontiguousDistrictFeatures(bLog?: boolean): T.GeoFeatureCollection;
35
+ getTest(testID: T.Test): T.TestEntry;
36
+ populationDeviationThreshold(): number;
37
+ }
@@ -0,0 +1,116 @@
1
+ import { Types } from '@dra2020/dra-analytics';
2
+ import * as T from './types';
3
+ import { AnalyticsSession } from './_api';
4
+ export type TransposedTable = {
5
+ totalPop: number[];
6
+ popDevPct: number[];
7
+ bEqualPop: boolean[];
8
+ bNotEmpty: boolean[];
9
+ bContiguous: boolean[];
10
+ bNotEmbedded: boolean[];
11
+ countySplits: number[][];
12
+ demVotes: number[];
13
+ repVotes: number[];
14
+ otherVotes: number[];
15
+ demPct: number[];
16
+ repPct: number[];
17
+ otherPct: number[];
18
+ demSeat: number[];
19
+ totalVAP: number[];
20
+ minorityPop: number[];
21
+ whitePop: number[];
22
+ blackPop: number[];
23
+ hispanicPop: number[];
24
+ pacificPop: number[];
25
+ asianPop: number[];
26
+ nativePop: number[];
27
+ whitePct: number[];
28
+ minorityPct: number[];
29
+ blackPct: number[];
30
+ hispanicPct: number[];
31
+ pacificPct: number[];
32
+ asianPct: number[];
33
+ nativePct: number[];
34
+ };
35
+ export declare class Districts {
36
+ _session: AnalyticsSession;
37
+ _shapes: T.GeoFeatureCollection;
38
+ _geoProperties: T.DistrictProperties;
39
+ table: TransposedTable;
40
+ constructor(s: AnalyticsSession, ds: T.GeoFeatureCollection);
41
+ getDistrictShapes(): T.GeoFeatureCollection;
42
+ getDistrictShapeByID(id: number): T.GeoFeature | undefined;
43
+ getGeoProperties(i: number): any;
44
+ setGeoProperties(i: number, p: T.DistrictShapeProperties): void;
45
+ numberOfRows(): number;
46
+ numberOfWorkingDistricts(): number;
47
+ initTable(): TransposedTable;
48
+ recalcStatistics(bLog?: boolean): void;
49
+ extractDistrictShapeProperties(bLog?: boolean): void;
50
+ getCountyIndex(geoID: string): number;
51
+ extractVotesByDemographic(districtID: number, groups: Types.MinorityFilter, bLog?: boolean): Types.DemographicVotingByFeature | undefined;
52
+ }
53
+ export declare function inferSelectedMinority(groups: Types.MinorityFilter): string;
54
+ export declare class Features {
55
+ _session: AnalyticsSession;
56
+ _data: T.GeoFeatureCollection;
57
+ _keys: T.DatasetKeys;
58
+ _featureIDs: T.FeaturesByGeoID;
59
+ constructor(s: AnalyticsSession, data: T.GeoFeatureCollection, keys: T.DatasetKeys);
60
+ nFeatures(): number;
61
+ featureByIndex(i: number): T.GeoFeature;
62
+ resetDataset(d: T.Dataset, k: string): void;
63
+ mapGeoIDsToFeatureIDs(): void;
64
+ featureID(i: string): number;
65
+ }
66
+ export declare function geoIDForFeature(f: any): string;
67
+ export declare function fieldForFeature(f: any, dk: string, ff: T.FeatureField): any;
68
+ export declare class Counties {
69
+ _session: AnalyticsSession;
70
+ _data: T.GeoFeatureCollection;
71
+ _countyNameLookup: T.FIPSCodeToCountyNameMap;
72
+ nCounties: number;
73
+ index: T.FIPSToOrdinalMap;
74
+ fips: T.OrdinalToFIPSlMap;
75
+ totalPopulation: number[];
76
+ constructor(s: AnalyticsSession, data: T.GeoFeatureCollection);
77
+ countyByIndex(i: number): T.GeoFeature;
78
+ propertyForCounty(f: any, pk: string): any;
79
+ mapFIPSToName(fips: string, name: string): void;
80
+ nameFromFIPS(fips: string): string;
81
+ indexFromFIPS(fips: string): number;
82
+ }
83
+ export declare class State {
84
+ _session: AnalyticsSession;
85
+ xx: string;
86
+ nDistricts: number;
87
+ nReps: number;
88
+ totalPop: number;
89
+ targetSize: number;
90
+ tooBigFIPS: string[];
91
+ tooBigName: string[];
92
+ singleCountyDistrictMax: number;
93
+ expectedSplits: number;
94
+ expectedAffected: number;
95
+ constructor(s: AnalyticsSession, xx: string, n: number);
96
+ }
97
+ export declare class Plan {
98
+ _session: AnalyticsSession;
99
+ _planByGeoID: T.PlanByGeoID;
100
+ _planByDistrictID: T.PlanByDistrictID;
101
+ districtIDs: number[];
102
+ constructor(s: AnalyticsSession, p: T.PlanByGeoID);
103
+ invertPlan(bLog?: boolean): void;
104
+ initializeDistrict(i: number): void;
105
+ byGeoID(): T.PlanByGeoID;
106
+ byDistrictID(): T.PlanByDistrictID;
107
+ districtForGeoID(i: string): number;
108
+ geoIDsForDistrictID(i: number): Set<string>;
109
+ }
110
+ export declare function invertPlan(plan: T.PlanByGeoID, s?: AnalyticsSession, bLog?: boolean): T.PlanByDistrictID;
111
+ export declare class GraphClass {
112
+ _session: AnalyticsSession;
113
+ _graph: T.ContiguityGraph;
114
+ constructor(s: AnalyticsSession, graph: T.ContiguityGraph);
115
+ peerNeighbors(node: string): string[];
116
+ }
@@ -0,0 +1,4 @@
1
+ import { AnalyticsSession } from './_api';
2
+ export declare function doAnalyzeDistricts(s: AnalyticsSession, bLog?: boolean): void;
3
+ export declare function doAnalyzePlan(s: AnalyticsSession, bLog?: boolean): void;
4
+ export declare function doDeriveSecondaryTests(s: AnalyticsSession, bLog?: boolean): void;
@@ -0,0 +1,4 @@
1
+ import * as T from './types';
2
+ import { AnalyticsSession } from './_api';
3
+ export declare function doFindCountiesSplitUnexpectedly(s: AnalyticsSession, bLog?: boolean): T.TestEntry;
4
+ export declare function doFindSplitVTDs(s: AnalyticsSession, bLog?: boolean): T.TestEntry;
@@ -0,0 +1,2 @@
1
+ import { AnalyticsSession } from './_api';
2
+ export declare function extractDistrictProperties(s: AnalyticsSession, bLog?: boolean): void;