@redus/georedus-ui 0.19.4 → 0.19.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @orioro/template-react
2
2
 
3
+ ## 0.19.5
4
+
5
+ ### Patch Changes
6
+
7
+ - fix custom geojson aggregation
8
+
3
9
  ## 0.19.4
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -4165,6 +4165,7 @@ var VIEW_TYPE_SURFACE_CHOROPLETH = 'surface_choropleth';
4165
4165
 
4166
4166
  function parseSchema(viewSpec, allViewSpecs, context) {
4167
4167
  var collection_id = viewSpec.collection_id,
4168
+ source_table_id = viewSpec.source_table_id,
4168
4169
  indicator_path = viewSpec.indicator_path,
4169
4170
  indicator_id = viewSpec.indicator_id,
4170
4171
  indicator_label = viewSpec.indicator_label,
@@ -4199,6 +4200,7 @@ function parseSchema(viewSpec, allViewSpecs, context) {
4199
4200
  var sourceLabel = "CENSO ".concat(year);
4200
4201
  return {
4201
4202
  viewId: viewId,
4203
+ source_table_id: source_table_id,
4202
4204
  path: indicator_path,
4203
4205
  label: indicator_label,
4204
4206
  metodology: metodology,
@@ -5203,7 +5205,7 @@ function _customGeoJSON_metadata() {
5203
5205
  });
5204
5206
  variableId = context.view.conf.data.variableId;
5205
5207
  variant = PARSED_SCHEMA.variantsByVariableId[variableId]; //
5206
- // Fetch variable values using rpc aggregate_by_geojson
5208
+ // Fetch variable values using rpc aggregate_by_geojson with join
5207
5209
  //
5208
5210
  _context.next = 13;
5209
5211
  return fetch("".concat(GLOBAL_CONTEXT.METADATA_API_ENDPOINT, "/rpc/aggregate_by_geojson"), {
@@ -5215,9 +5217,12 @@ function _customGeoJSON_metadata() {
5215
5217
  geometries: AREAS_FEATURES.map(function (feat) {
5216
5218
  return feat.geometry;
5217
5219
  }),
5218
- view: "ibge_malha_br_setor_censitario_".concat(PARSED_SCHEMA.year, "_spatial_agg"),
5220
+ view: "".concat(PARSED_SCHEMA.source_table_id),
5221
+ // no more need to generate a single unique table with all variables, since we are now sending the source table id in the body of the request to perform the join and aggregation in the backend
5222
+ join_table: "ibge_malha_br_setor_censitario_".concat(PARSED_SCHEMA.year),
5223
+ // added in order to perform the join in the backend
5219
5224
  agg_column: variableId,
5220
- agg_type: variableId.endsWith('_pct') ? 'weighted_avg' : 'sum'
5225
+ agg_type: variableId.endsWith('_2') ? 'weighted_avg' : 'sum' // _2 is the new suffix to indicate percentage variables
5221
5226
  })
5222
5227
  }).then(function (res) {
5223
5228
  return res.json();
@@ -5541,7 +5546,7 @@ function setor_censitario_layers(opts) {
5541
5546
  }
5542
5547
  } else {
5543
5548
  var value = get$1(context, 'feature.properties.value');
5544
- var isPercentage = variableId.endsWith('_pct');
5549
+ var isPercentage = variableId.endsWith('_2'); // _2 is the new suffix to indicate percentage variables
5545
5550
  var format = isPercentage ? {
5546
5551
  style: 'percent'
5547
5552
  } : {};
@@ -1,5 +1,6 @@
1
1
  export function parseSchema(viewSpec: any, allViewSpecs: any, context: any): {
2
2
  viewId: string;
3
+ source_table_id: any;
3
4
  path: any;
4
5
  label: any;
5
6
  metodology: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redus/georedus-ui",
3
- "version": "0.19.4",
3
+ "version": "0.19.5",
4
4
  "packageManager": "yarn@4.0.2",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",