@redus/georedus-ui 0.19.0 → 0.19.2
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 +12 -0
- package/dist/main.js +59 -32
- package/dist/viewSpecs/presets/cem_censo/2022/download.d.ts +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/main.js
CHANGED
|
@@ -3932,7 +3932,7 @@ function cem_escolas_2022(config, allViewSpecs, context) {
|
|
|
3932
3932
|
return filter ? fmtMetadataApiFilterExp(filter) : {};
|
|
3933
3933
|
});
|
|
3934
3934
|
var _id_municipio_apiFilterExpr = ['$template', 'eq.${0}', ['$get', 'municipioId']];
|
|
3935
|
-
var $sourceLabel = 'INEP
|
|
3935
|
+
var $sourceLabel = 'INEP';
|
|
3936
3936
|
|
|
3937
3937
|
//
|
|
3938
3938
|
// Specify some utilities connected to the base setup
|
|
@@ -4092,23 +4092,46 @@ function cem_escolas_2022(config, allViewSpecs, context) {
|
|
|
4092
4092
|
var $tooltip = {
|
|
4093
4093
|
title: ['$literal', ['$get', 'feature.properties.no_escola']],
|
|
4094
4094
|
entries: [[indicator_label, ['$literal', ['$coalesce', ['$get', "feature.properties.".concat(VARIABLE_ID, "::string({\n number: ").concat(JSON.stringify(number_format), ",\n boolean: {\n true: 'Sim',\n false: 'N\xE3o'\n }\n })")], 'Sem dados']]], sizing_variable_id ? [sizing_variable_label, ['$literal', ['$get', "feature.properties.".concat(sizing_variable_id, "::string")]]] : null, ['Etapas de ensino', ['$literal', resolve.fn(function (context) {
|
|
4095
|
-
var
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
}
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4095
|
+
var _context$feature;
|
|
4096
|
+
var properties = (context === null || context === void 0 || (_context$feature = context.feature) === null || _context$feature === void 0 ? void 0 : _context$feature.properties) || {};
|
|
4097
|
+
|
|
4098
|
+
// Mapeamos os rótulos aos possíveis finais de string (sufixos)
|
|
4099
|
+
// que essa coluna pode ter na base de 2022 ou nas bases >= 2023
|
|
4100
|
+
// 'in_inf_cre' é o sufixo para a etapa "Infantil / Creche" na base de 2022, enquanto 'edu02_etp_cre_0' é o sufixo para a mesma etapa nas bases de 2023 em diante
|
|
4101
|
+
// Na tabela de 2023, a coluna se chama in23_edu02_etp_cre_0, por exemplo, mas como só nos importam os sufixos finais, conseguimos usar a mesma lógica para todos os anos
|
|
4102
|
+
var ETAPAS = [{
|
|
4103
|
+
label: 'Infantil / Creche',
|
|
4104
|
+
sufixos: ['in_inf_cre', 'edu02_etp_cre_0']
|
|
4105
|
+
}, {
|
|
4106
|
+
label: 'Infantil / Pré-escola',
|
|
4107
|
+
sufixos: ['in_inf_pre', 'edu02_etp_pre_0']
|
|
4108
|
+
}, {
|
|
4109
|
+
label: 'Fundamental I',
|
|
4110
|
+
sufixos: ['in_fund_ai', 'edu02_etp_fn1_0']
|
|
4111
|
+
}, {
|
|
4112
|
+
label: 'Fundamental II',
|
|
4113
|
+
sufixos: ['in_fund_af', 'edu02_etp_fn2_0']
|
|
4114
|
+
}, {
|
|
4115
|
+
label: 'Ensino Médio',
|
|
4116
|
+
sufixos: ['in_med', 'edu02_etp_em_0']
|
|
4117
|
+
}];
|
|
4118
|
+
return ETAPAS.filter(function (_ref3) {
|
|
4119
|
+
var sufixos = _ref3.sufixos;
|
|
4120
|
+
// Percorre todas as propriedades da feature atual
|
|
4121
|
+
return Object.entries(properties).some(function (_ref4) {
|
|
4122
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
4123
|
+
key = _ref5[0],
|
|
4124
|
+
value = _ref5[1];
|
|
4125
|
+
return (
|
|
4126
|
+
// Verifica se o nome da coluna termina com algum dos sufixos mapeados
|
|
4127
|
+
// E se o valor da coluna é "truthy" (maior que 0, true, etc)
|
|
4128
|
+
sufixos.some(function (sufixo) {
|
|
4129
|
+
return key.endsWith(sufixo);
|
|
4130
|
+
}) && value
|
|
4131
|
+
);
|
|
4132
|
+
});
|
|
4133
|
+
}).map(function (_ref6) {
|
|
4134
|
+
var label = _ref6.label;
|
|
4112
4135
|
return label;
|
|
4113
4136
|
}).join(', ');
|
|
4114
4137
|
})]], ['Rede de ensino', ['$literal', ['$get', 'feature.properties.tp_dependencia']]]].filter(Boolean)
|
|
@@ -4953,7 +4976,8 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
4953
4976
|
};
|
|
4954
4977
|
}
|
|
4955
4978
|
|
|
4956
|
-
function download(context) {
|
|
4979
|
+
function download(context, _ref) {
|
|
4980
|
+
var PARSED_SCHEMA = _ref.PARSED_SCHEMA;
|
|
4957
4981
|
var METADATA_API_ENDPOINT = context.METADATA_API_ENDPOINT;
|
|
4958
4982
|
return downloadResolver({
|
|
4959
4983
|
fileNameBase: ['$template', '${0}_${1}_georedus_censo_${2}', [['$get', 'view.conf.data.variableId'], ['$get', 'municipioId'], '2022']],
|
|
@@ -4961,48 +4985,49 @@ function download(context) {
|
|
|
4961
4985
|
availableVariableIds: [],
|
|
4962
4986
|
fetchData: resolve.fn(function (ctx) {
|
|
4963
4987
|
return /*#__PURE__*/function () {
|
|
4964
|
-
var
|
|
4965
|
-
var options, variableId, dataUrl, data, geometriesUrl, geometries;
|
|
4988
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
4989
|
+
var options, variableId, source_table_id, dataUrl, data, geometriesUrl, geometries;
|
|
4966
4990
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4967
4991
|
while (1) switch (_context.prev = _context.next) {
|
|
4968
4992
|
case 0:
|
|
4969
|
-
|
|
4993
|
+
_ref2.variableIds, options = _ref2.options;
|
|
4970
4994
|
variableId = ctx.view.conf.data.variableId;
|
|
4971
|
-
|
|
4972
|
-
|
|
4995
|
+
source_table_id = PARSED_SCHEMA.variantsByVariableId[variableId].source_table_id;
|
|
4996
|
+
dataUrl = "".concat(METADATA_API_ENDPOINT, "/").concat(source_table_id, "?") + "cd_mun=eq.".concat(ctx.app.municipioId, "&") + "select=id,".concat(variableId, ",").concat(variableId, "_src");
|
|
4997
|
+
_context.next = 6;
|
|
4973
4998
|
return fetch(dataUrl).then(function (res) {
|
|
4974
4999
|
return res.json();
|
|
4975
5000
|
});
|
|
4976
|
-
case
|
|
5001
|
+
case 6:
|
|
4977
5002
|
data = _context.sent.map(function (entry) {
|
|
4978
5003
|
var newEntry = _objectSpread2(_objectSpread2({}, entry), entry["".concat(variableId, "_src")]);
|
|
4979
5004
|
delete newEntry["".concat(variableId, "_src")];
|
|
4980
5005
|
return newEntry;
|
|
4981
5006
|
});
|
|
4982
5007
|
if (!(options.format === 'CSV')) {
|
|
4983
|
-
_context.next =
|
|
5008
|
+
_context.next = 9;
|
|
4984
5009
|
break;
|
|
4985
5010
|
}
|
|
4986
5011
|
return _context.abrupt("return", data);
|
|
4987
|
-
case
|
|
5012
|
+
case 9:
|
|
4988
5013
|
geometriesUrl = "".concat(METADATA_API_ENDPOINT, "/ibge_malha_br_setor_censitario_2022?") + "cd_mun=eq.".concat(ctx.app.municipioId, "&") + "select=id,geom";
|
|
4989
|
-
_context.next =
|
|
5014
|
+
_context.next = 12;
|
|
4990
5015
|
return fetch(geometriesUrl).then(function (res) {
|
|
4991
5016
|
return res.json();
|
|
4992
5017
|
});
|
|
4993
|
-
case
|
|
5018
|
+
case 12:
|
|
4994
5019
|
geometries = _context.sent;
|
|
4995
5020
|
return _context.abrupt("return", dataJoin([geometries, data], {
|
|
4996
5021
|
key: 'id'
|
|
4997
5022
|
}));
|
|
4998
|
-
case
|
|
5023
|
+
case 14:
|
|
4999
5024
|
case "end":
|
|
5000
5025
|
return _context.stop();
|
|
5001
5026
|
}
|
|
5002
5027
|
}, _callee);
|
|
5003
5028
|
}));
|
|
5004
5029
|
return function (_x) {
|
|
5005
|
-
return
|
|
5030
|
+
return _ref3.apply(this, arguments);
|
|
5006
5031
|
};
|
|
5007
5032
|
}();
|
|
5008
5033
|
})
|
|
@@ -5883,7 +5908,9 @@ function cem_censo_2022(viewSpec, allViewSpecs, context) {
|
|
|
5883
5908
|
if (!PARSED_SCHEMA) {
|
|
5884
5909
|
return null;
|
|
5885
5910
|
}
|
|
5886
|
-
var DOWNLOAD = download(context
|
|
5911
|
+
var DOWNLOAD = download(context, {
|
|
5912
|
+
PARSED_SCHEMA: PARSED_SCHEMA
|
|
5913
|
+
});
|
|
5887
5914
|
var CHOROPLETH = choropleth({
|
|
5888
5915
|
GLOBAL_CONTEXT: context,
|
|
5889
5916
|
PARSED_SCHEMA: PARSED_SCHEMA
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export function download(context: any
|
|
1
|
+
export function download(context: any, { PARSED_SCHEMA }: {
|
|
2
|
+
PARSED_SCHEMA: any;
|
|
3
|
+
}): {
|
|
2
4
|
[x: string]: any;
|
|
3
5
|
$$resolver: symbol;
|
|
4
6
|
$$unresolved?: Record<string | number, import("@orioro/resolve").ResolutionNode> | undefined;
|