@dra2020/district-analytics 1.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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/district-analytics.js +2937 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Alec Ramsay
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# District Analytics
|
|
2
|
+
|
|
3
|
+
Analytics for scoring congressional and legislative district maps.
|
|
4
|
+
|
|
5
|
+
## Sample Code
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
import * as DA from 'district-analytics';
|
|
9
|
+
|
|
10
|
+
let sr = {} as DA.SessionRequest;
|
|
11
|
+
sr['title'] = "NC 2016 Contingent Corrected Map";
|
|
12
|
+
sr['stateXX'] = "NC";
|
|
13
|
+
sr['nDistricts'] = 13;
|
|
14
|
+
sr['data'] = data as T.GeoFeatureCollection;
|
|
15
|
+
sr['counties'] = counties as T.GeoFeatureCollection;
|
|
16
|
+
sr['graph'] = graph as T.ContiguityGraph;
|
|
17
|
+
sr['plan'] = planByGeoID as DA.PlanByGeoID;
|
|
18
|
+
sr['districtShapes'] = districtShapes as T.GeoFeatureCollection;
|
|
19
|
+
sr['config'] = config as T.Dict;
|
|
20
|
+
|
|
21
|
+
let text: any;
|
|
22
|
+
let score: DA.GradedTest | DA.PassFailTest;
|
|
23
|
+
let s = new DA.AnalyticsSession(sr);
|
|
24
|
+
|
|
25
|
+
s.analyzePlan();
|
|
26
|
+
text = s.prepareScorecard();
|
|
27
|
+
text = s.prepareTestLog();
|
|
28
|
+
|
|
29
|
+
s.getTest(DA.Tests.Contiguous)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
Distributed under the [The MIT License (MIT)](https://github.com/alecramsay/district-analytics/blob/master/LICENSE) Copyright © 2019 Alec Ramsay
|