@dra2020/district-analytics 3.3.0 → 4.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.
@@ -2600,7 +2600,8 @@ function profilePlan(s, bLog = false) {
2600
2600
  const summaryRow = s.districts.numberOfRows() - 1;
2601
2601
  const statewideVf = U.trim(s.districts.statistics[D.DistrictField.DemPct][summaryRow], 6);
2602
2602
  const vpiArray = U.deepCopy(s.districts.statistics[D.DistrictField.DemPct].slice(1, -1));
2603
- const demographicsByDistrict = makeArrayOfDemographics(s);
2603
+ const statewideDemographics = getStatewideDemographics(s);
2604
+ const demographicsByDistrict = getDemographicsByDistrict(s);
2604
2605
  const profile = {
2605
2606
  state: state,
2606
2607
  planName: planName,
@@ -2608,21 +2609,22 @@ function profilePlan(s, bLog = false) {
2608
2609
  nCounties: nCounties,
2609
2610
  legislativeDistricts: s.legislativeDistricts,
2610
2611
  populationProfile: {
2611
- TotalPopByDistrict: popByDistrict,
2612
+ totalPopByDistrict: popByDistrict,
2612
2613
  targetSize: targetSize
2613
2614
  },
2614
2615
  compactnessProfile: {
2615
- GeometryByDistrict: geoPropsByDistrict
2616
+ geometryByDistrict: geoPropsByDistrict
2616
2617
  },
2617
2618
  splittingProfile: {
2618
- CountyPopByDistrict: splits
2619
+ countyPopByDistrict: splits
2619
2620
  },
2620
2621
  partisanProfile: {
2621
2622
  statewideVf: statewideVf,
2622
- VfArray: vpiArray
2623
+ vfArray: vpiArray
2623
2624
  },
2624
2625
  demographicProfile: {
2625
- DemographicsByDistrict: demographicsByDistrict
2626
+ stateMfArray: statewideDemographics,
2627
+ mfArrayByDistrict: demographicsByDistrict
2626
2628
  }
2627
2629
  };
2628
2630
  return profile;
@@ -2656,7 +2658,7 @@ function makeArrayOfGeoProps(s, bLog = false) {
2656
2658
  }
2657
2659
  return geometryByDistrict;
2658
2660
  }
2659
- function makeArrayOfDemographics(s, bLog = false) {
2661
+ function getDemographicsByDistrict(s, bLog = false) {
2660
2662
  let demographicsArray = [];
2661
2663
  // Remove the unassigned & total dummy "districts"
2662
2664
  for (let districtID = 1; districtID <= s.state.nDistricts; districtID++) {
@@ -2673,6 +2675,19 @@ function makeArrayOfDemographics(s, bLog = false) {
2673
2675
  }
2674
2676
  return demographicsArray;
2675
2677
  }
2678
+ function getStatewideDemographics(s, bLog = false) {
2679
+ const summaryRow = s.districts.numberOfRows() - 1;
2680
+ const demographicsArray = [
2681
+ U.deepCopy(s.districts.statistics[D.DistrictField.WhitePct][summaryRow]),
2682
+ U.deepCopy(s.districts.statistics[D.DistrictField.MinorityPct][summaryRow]),
2683
+ U.deepCopy(s.districts.statistics[D.DistrictField.BlackPct][summaryRow]),
2684
+ U.deepCopy(s.districts.statistics[D.DistrictField.HispanicPct][summaryRow]),
2685
+ U.deepCopy(s.districts.statistics[D.DistrictField.PacificPct][summaryRow]),
2686
+ U.deepCopy(s.districts.statistics[D.DistrictField.AsianPct][summaryRow]),
2687
+ U.deepCopy(s.districts.statistics[D.DistrictField.NativePct][summaryRow])
2688
+ ];
2689
+ return demographicsArray;
2690
+ }
2676
2691
  // SCORE A PLAN
2677
2692
  function scorePlan(s, p, bLog = false, overridesJSON) {
2678
2693
  let scorer = new Score.Scorer();
@@ -2754,6 +2769,8 @@ exports.DISTRICT_SPLITTING_WEIGHT = 1.0 - exports.COUNTY_SPLITTING_WEIGHT;
2754
2769
  Object.defineProperty(exports, "__esModule", { value: true });
2755
2770
  // TODO - SCORE
2756
2771
  var dra_score_1 = __webpack_require__(/*! @dra2020/dra-score */ "@dra2020/dra-score");
2772
+ // PartisanProfile,
2773
+ // PopulationProfile, ShapeProfile, SplittingProfile,
2757
2774
  exports.sampleProfile = dra_score_1.sampleProfile;
2758
2775
  exports.sampleScorecard = dra_score_1.sampleScorecard;
2759
2776
  // END