Commit 608b48a0 by vida092

actualizacion enero

parent 50597612
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>COMUNIDAD - SPECIES</title> <title>COMUNIDAD - EPI SPECIES</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<meta http-equiv="Cache-control" content="no-cache"> <meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache-control" content="no-store"> <meta http-equiv="Cache-control" content="no-store">
<title>NICHO - SPECIES</title> <title>NICHO EPI-SPECIES</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
<!-- <button id="btn_tutorial" type="button" title="" class="btn btn-warning "></button> --> <!-- <button id="btn_tutorial" type="button" title="" class="btn btn-warning "></button> -->
<!-- <button id="btn_demo" type="button" title="" class="btn btn-warning display-marker" data-toggle="modal" data-target="#modalDemo"></button> --> <!-- <button id="btn_demo" type="button" title="" class="btn btn-warning display-marker" data-toggle="modal" data-target="#modalDemo"></button> -->
<button id="nicho_link" type="button" class="btn btn-primary pull-right"></button> <button id="nicho_link" type="button" class="btn btn-primary pull-right" style="visibility: hidden"></button>
<!-- <button id="tuto_res" class="btn btn-warning display-marker" type="button" <!-- <button id="tuto_res" class="btn btn-warning display-marker" type="button"
style="visibility: hidden" style="visibility: hidden"
...@@ -271,9 +271,9 @@ ...@@ -271,9 +271,9 @@
<!--<div class="col-md-12 col-sm-12 col-xs-12">--> <!--<div class="col-md-12 col-sm-12 col-xs-12">-->
<label class="text-sm" id="footprint_region" ></label> <label class="text-sm" id="footprint_region" ></label>
<select id="footprint_region_select" class="form-control" > <select id="footprint_region_select" class="form-control" >
<option value="México" selected="selected"> <!-- <option value="México" selected="selected">
México México
</option> </option> -->
</select> </select>
<!--agregar sólo México--> <!--agregar sólo México-->
</div> </div>
...@@ -286,10 +286,10 @@ ...@@ -286,10 +286,10 @@
<option value="state">Estados</option> <option value="state">Estados</option>
<option selected="selected" value="mun">Municipios</option> <option selected="selected" value="mun">Municipios</option>
<option value="ageb">AGEBs</option> <option value="ageb">AGEBs</option>
<option value="8">8 km</option> <option value="8km">8 km</option>
<option value="16">16 km</option> <option value="16km">16 km</option>
<option value="32">32 km</option> <option value="32km">32 km</option>
<option value="64">64 km</option> <option value="64km">64 km</option>
</select> </select>
</div> </div>
...@@ -553,7 +553,7 @@ ...@@ -553,7 +553,7 @@
<h2 id="lb_params_variables" class="sidebar-header-species"></h2> <h2 id="lb_params_variables" class="sidebar-header-species"></h2>
<div id="tuto_val" class="row container_20p "> <!-- <div id="tuto_val" class="row container_20p ">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 padding-sides-zero"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 padding-sides-zero">
...@@ -578,7 +578,7 @@ ...@@ -578,7 +578,7 @@
</div> </div>
<!-- <div class="row"> -->
<div class="col-md-12 col-sm-12 col-xs-12 "> <div class="col-md-12 col-sm-12 col-xs-12 ">
...@@ -594,9 +594,9 @@ ...@@ -594,9 +594,9 @@
</div> </div>
<!-- </div> -->
</div>
</div> -->
<div id="tuto_val" class="row container_15p "> <div id="tuto_val" class="row container_15p ">
...@@ -661,7 +661,7 @@ ...@@ -661,7 +661,7 @@
</div> </div>
<div id="tuto_apriori" class="row container_15p"> <!-- <div id="tuto_apriori" class="row container_15p">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 padding-sides-zero"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 padding-sides-zero">
...@@ -692,9 +692,9 @@ ...@@ -692,9 +692,9 @@
</div> </div> -->
<div id="tuto_map_prob" class="row container_15p"> <!-- <div id="tuto_map_prob" class="row container_15p">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 padding-sides-zero"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 padding-sides-zero">
...@@ -722,7 +722,7 @@ ...@@ -722,7 +722,7 @@
</div> </div>
</div> </div> -->
<!-- </div> --> <!-- </div> -->
...@@ -778,7 +778,7 @@ ...@@ -778,7 +778,7 @@
<label for="basic-url">Visualización</label> <label for="basic-url">Visualización</label>
<!-- <div class=" dropdown_group "> <div class=" dropdown_group ">
...@@ -790,14 +790,14 @@ ...@@ -790,14 +790,14 @@
<ul class="dropdown-menu dropdown_idioma"> <ul class="dropdown-menu dropdown_idioma">
<li><a class="map_type" label="Equal range" value="range">Equal range </a></li> <li><a class="map_type" label="Equal range" value="range">Equal range </a></li>
<li><a class="map_type" label="Standard deviation" value="deviation" ">Standard deviation </a></li> <li><a class="map_type" label="Standard deviation" value="deviation" >Standard deviation </a></li>
<li><a class="map_type" label="Natural Breaks" value="jenks" ">Natural Breaks </a></li> <li><a class="map_type" label="Natural Breaks" value="jenks" >Natural Breaks </a></li>
</ul> </ul>
</div> </div>
</div> --> </div>
</div> </div>
...@@ -870,18 +870,19 @@ ...@@ -870,18 +870,19 @@
<div class="row"> <div class="row">
<div id="div_munlist" class="row-fluid myScrollableBlockDecilList box_shadow bg-card"> <!-- <div id="div_munlist" class="row-fluid myScrollableBlockDecilList box_shadow bg-card">
<table id="tbl_munlist" class="display compact cell-border" cellspacing="0"></table> <table id="tbl_munlist" class="display compact cell-border" cellspacing="0"></table>
</div> </div> -->
</div> </div>
<div id="treeAddedPanel" class="row-fluid myScrollableBlockDecilList box_shadow bg-card">
<table id="tdisplay" class="display compact cell-border" ></table>
<div class="row"> </div>
<div class="row histogramrow" style="visibility:hidden; display: none;">
<div id="histcontainer_row" class="row-fluid histcontainer_row "> <div id="histcontainer_row" class="row-fluid histcontainer_row ">
...@@ -912,13 +913,6 @@ ...@@ -912,13 +913,6 @@
</div> </div>
<div id="treeAddedPanel" class="row-fluid myScrollableBlockDecilList box_shadow bg-card">
<table id="tdisplay" class="display compact cell-border" ></table>
</div>
</div> </div>
......
images/dna.png

951 Bytes

images/rep.png

360 Bytes

...@@ -57,7 +57,8 @@ ...@@ -57,7 +57,8 @@
<a class="logo" id="logoCIC" href="http://www.cic-ctic.unam.mx" target="_blank">Coordinación de la Investigación Científica</a> <a class="logo" id="logoCIC" href="http://www.cic-ctic.unam.mx" target="_blank">Coordinación de la Investigación Científica</a>
<a class="logo" id="logoC3" href="https://www.c3.unam.mx" target="_blank">Centro de Ciencias de la Complejidad</a> <a class="logo" id="logoC3" href="https://www.c3.unam.mx" target="_blank">Centro de Ciencias de la Complejidad</a>
<a class="logo" id="logoPINCC" href="https://www.pincc.unam.mx/" target="_blank">Programa de Investigación en Cambio Climatico</a> <a class="logo" id="logoPINCC" href="https://www.pincc.unam.mx/" target="_blank">Programa de Investigación en Cambio Climatico</a>
<a class="logo" id="logoChilam" href="https://chilam.c3.unam.mx">Chilam – Laboratorio para la simulación de Sistemas Complejos Adaptativos</a> <a class="logo" id="logoCAyCC" href="https://www.atmosfera.unam.mx/" target="_blank">Instituto de Ciencias de la Atmósfera y Cambio Climático</a>
<a class="logo" id="logoChilam" href="https://chilam.c3.unam.mx" target="_blank">Chilam – Laboratorio para la simulación de Sistemas Complejos Adaptativos</a>
</div> </div>
<a target="_blank" href="https://chilam.c3.unam.mx/proyectos/epi-species" class="button-2">Más información sobre EPI-SPECIES</a> <a target="_blank" href="https://chilam.c3.unam.mx/proyectos/epi-species" class="button-2">Más información sobre EPI-SPECIES</a>
......
...@@ -299,19 +299,20 @@ var histogram_module = (function (verbose) { ...@@ -299,19 +299,20 @@ var histogram_module = (function (verbose) {
.on("click",function(d,i) { .on("click",function(d,i) {
console.log("calculando valores") console.log("calculando valores")
// console.log(d) console.log(d)
console.log(i)
var deciles = [], grupos = [] var deciles = [], grupos = []
d3.selectAll(".lbdecil_chk .tick .selected") d3.selectAll(".lbdecil_chk .tick .selected")
.each(function (d, i) { .each(function (d, i) {
// console.log(d) console.log(d)
deciles.push(d) deciles.push(d)
}) })
d3.selectAll(".rect_legend.selected") d3.selectAll(".rect_legend.selected")
.each(function (d, i) { .each(function (d, i) {
// console.log(d) console.log(d)
grupos.push(d) grupos.push(d)
}) })
...@@ -324,6 +325,10 @@ var histogram_module = (function (verbose) { ...@@ -324,6 +325,10 @@ var histogram_module = (function (verbose) {
_toast_module.showToast_BottomCenter(_iTrans.prop('no_decilgrupo'), "warning"); _toast_module.showToast_BottomCenter(_iTrans.prop('no_decilgrupo'), "warning");
return return
} }
body.selected_decile = deciles
console.log(body.selected_decile)
console.log(body)
console.log("ahora se llama ala función load decile table")
// _display_module_nicho.loadDecilDataTable(d.decil, d.name, false, [], []); // _display_module_nicho.loadDecilDataTable(d.decil, d.name, false, [], []);
...@@ -926,7 +931,7 @@ var histogram_module = (function (verbose) { ...@@ -926,7 +931,7 @@ var histogram_module = (function (verbose) {
return y_right(d.recall); return y_right(d.recall);
}); });
// console.log(line);
svg.append("path") svg.append("path")
.datum(recall_item) .datum(recall_item)
...@@ -949,7 +954,7 @@ var histogram_module = (function (verbose) { ...@@ -949,7 +954,7 @@ var histogram_module = (function (verbose) {
.attr("r", 3.5) .attr("r", 3.5)
.attr("cx", function (d, i) { .attr("cx", function (d, i) {
// return x0(recall_item.length - i) + (x1.rangeBand() * (ageNames.length / 2));
return x0(d.decil) + (x1.rangeBand() * (ageNames.length / 2)); return x0(d.decil) + (x1.rangeBand() * (ageNames.length / 2));
......
/** /**
* Módulo mapa, utilizado para crear y gestionar el mapa en nicho ecológico y comunidad ecológica. * Módulo mapa, utilizado para crear y gestionar el mapa en nicho ecológico y comunidad ecológica.
* *
...@@ -692,12 +691,9 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) { ...@@ -692,12 +691,9 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) {
_REGION_SELECTED = region_selected; _REGION_SELECTED = region_selected;
let query = 'query{get_mesh(grid_res: "' + _grid_res + '"){cve simplified_geom}}' let query = 'query{get_mesh(grid_res: "' + _grid_res + '"){cve simplified_geom}}'
console.log(query) console.log(query)
console.log("aquí está el query ------------------------------------")
// query{get_mesh(grid_res: "mun"){cve simplified_geom}}
$.ajax({ $.ajax({
...@@ -710,7 +706,7 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) { ...@@ -710,7 +706,7 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) {
let obj = data["get_mesh"] let obj = data["get_mesh"]
let json = {type: 'FeatureCollection',crs: {}, features: []} let json = {type: 'FeatureCollection',crs: {}, features: []}
console.log(obj) //console.log(obj)
for (let i = 0; i < obj.length; i++) for (let i = 0; i < obj.length; i++)
...@@ -2110,8 +2106,8 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) { ...@@ -2110,8 +2106,8 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) {
console.log("region: " + region) console.log("region: " + region)
_DISEASE_SELECTED = disease; _DISEASE_SELECTED = disease;
_AGENT_SELECTED = agent; _AGENT_SELECTED = agent;
console.log("_DISEASE_SELECTED" + disease) console.log("_DISEASE_SELECTED: " + disease)
console.log("_AGENT_SELECTED" + _AGENT_SELECTED) console.log("_AGENT_SELECTED: " + _AGENT_SELECTED)
_taxones = taxones _taxones = taxones
...@@ -2218,12 +2214,7 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) { ...@@ -2218,12 +2214,7 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) {
"region": region "region": region
} }
// if (_AGENT_SELECTED == 'Hospederos')
// var _url = 'http://10.90.0.42:4006/graphql/hospederos/'
// else if (_AGENT_SELECTED == 'Patogenos')
// var _url = "http://10.90.0.42:4007/graphql/patogenos/"
// else
// var _url = "http://10.90.0.42:4008/graphql/vectores/"
var _url = "https://covid19.c3.unam.mx/gateway/api/nodes/" var _url = "https://covid19.c3.unam.mx/gateway/api/nodes/"
...@@ -2231,11 +2222,40 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) { ...@@ -2231,11 +2222,40 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) {
let fecha_ini = document.getElementById("yearPicker_start").value.trim() let fecha_ini = document.getElementById("yearPicker_start").value.trim()
let fecha_fin = document.getElementById("yearPicker_end").value.trim() let fecha_fin = document.getElementById("yearPicker_end").value.trim()
console.log( _PARENT_FIELD)
//_PARENT_FIELD.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "")
switch(_PARENT_FIELD){
case("phylum"):
var label_target = "phylum"
break;
case("class"):
var label_target = "clase";
break;
case("order"):
var label_target = "orden";
break;
case("family"):
var label_target = "familia";
break;
case("genus"):
var label_target = "genero";
break;
case("species"):
var label_target= "species"
break;
default:
console.log("nada que hacer")
}
if(label_target === "species"){
label_target = "nombrecientifico"
}
console.log(label_target)
if ( fecha_ini.length < 3) if ( fecha_ini.length < 3)
var query = 'query{occurrences_by_taxon_' + nodo + '(query: "nombreenfermedad = \''+ _DISEASE_SELECTED + '\' AND '+ _PARENT_FIELD.toLowerCase() +' = \'' + _LABEL_VALUE +'\' "){individuosinfectados gridid_'+ _grid_res + '}}' var query = 'query{occurrences_by_taxon_' + nodo + '(query: "nombreenfermedad = \''+ _DISEASE_SELECTED + '\' AND '+ label_target +' = \'' + _LABEL_VALUE +'\' "){individuosinfectados gridid_'+ _grid_res + '}}'
else else
var query = 'query{occurrences_by_taxon_' + nodo + '(query: "nombreenfermedad = \''+ _DISEASE_SELECTED + '\' AND '+ _PARENT_FIELD.toLowerCase() +' = \'' + _LABEL_VALUE +'\' AND aniocolecta >= \''+ fecha_ini + ' \' AND aniocolecta <= \'' + fecha_fin + ' \'"){individuosinfectados gridid_'+ _grid_res + '}}' var query = 'query{occurrences_by_taxon_' + nodo + '(query: "nombreenfermedad = \''+ _DISEASE_SELECTED + '\' AND '+ label_target +' = \'' + _LABEL_VALUE +'\' AND aniocolecta >= \''+ fecha_ini + ' \' AND aniocolecta <= \'' + fecha_fin + ' \'"){individuosinfectados gridid_'+ _grid_res + '}}'
console.log(query) console.log(query)
...@@ -2250,7 +2270,7 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) { ...@@ -2250,7 +2270,7 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) {
let data2 = resp.data["occurrences_by_taxon_" + nodo] let data2 = resp.data["occurrences_by_taxon_" + nodo]
//let data = resp["data"]; //let data = resp["data"];
//let obj = data["get_mesh"] //let obj = data["get_mesh"]
console.log(data2) //console.log(data2)
let gridid = {gridid: []} let gridid = {gridid: []}
for (let i = 0; i < data2.length; i++) { for (let i = 0; i < data2.length; i++) {
let mesh = "gridid_" + _grid_res let mesh = "gridid_" + _grid_res
...@@ -2316,7 +2336,7 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) { ...@@ -2316,7 +2336,7 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) {
num_occ += parseInt(item["occ"]) num_occ += parseInt(item["occ"])
}) })
console.log(_data_sp_occ) //console.log(_data_sp_occ)
console.log("num_cell_occ: " + num_cell_occ) console.log("num_cell_occ: " + num_cell_occ)
console.log("num_occ: " + num_occ) console.log("num_occ: " + num_occ)
...@@ -2784,21 +2804,22 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) { ...@@ -2784,21 +2804,22 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) {
_VERBOSE ? console.log("createRankColor") : _VERBOSE; _VERBOSE ? console.log("createRankColor") : _VERBOSE;
console.log(json)
// console.log("map_type: " + map_type)
var equal_range_sections = 9; var equal_range_sections = 9;
var grid_color = d3.map([]); var grid_color = d3.map([]);
var colors = jQuery.extend(true, [], colorbrewer.RdBu[9]); var colors = jQuery.extend(true, [], colorbrewer.RdBu[9]);
colors = colors.reverse() colors = colors.reverse()
// console.log(colors)
var equal_range_colors = jQuery.extend(true, [], colorbrewer.Blues[equal_range_sections]) console.log(mapa_prob)
console.log(json)
console.log(colors)
console.log("map_type: " + map_type)
var equal_range_colors = jQuery.extend(true, [], colorbrewer.Blues[equal_range_sections])
equal_range_colors = equal_range_colors.reverse() equal_range_colors = equal_range_colors.reverse()
equal_range_colors = equal_range_colors.concat(jQuery.extend(true, [], colorbrewer.Reds[equal_range_sections])) equal_range_colors = equal_range_colors.concat(jQuery.extend(true, [], colorbrewer.Reds[equal_range_sections]))
...@@ -2927,31 +2948,24 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) { ...@@ -2927,31 +2948,24 @@ var map_module = (function (url_geoserver, workspace, verbose, url_zacatuche) {
.domain(arr_range_deviations) .domain(arr_range_deviations)
.range(colors); .range(colors);
// scales.quantize = d3.scale.quantize()
// .domain([min_scr, max_scr])
// .range(colors);
scales.jenks = d3.scale.threshold() scales.jenks = d3.scale.threshold()
.domain(breaks) .domain(breaks)
.range(colors); .range(colors);
// console.log(colors)
// console.log(rateById)
// console.log(scales['jenks9'])
// console.log(rateById[8526])
// console.log(scales['jenks'](rateById[8526]))
// console.log(scales['deviation'](-45))
// console.log(scales['deviation'](0))
// console.log(scales['deviation'](3))
// console.log(scales['deviation'](20))
// console.log(scales['deviation'](80))
$.each(json, function (index, d) {
var no_cells = 0
console.log("<====================================================>3")
map_type = 'range'
console.log(scales)
console.log(map_type)
console.log(">====================================================<3")
$.each(json, function (_index, d) {
//console.log("<====================================================>4")
//no_cells += 1
//console.log(d, no_cells)
//console.log(">====================================================<4")
grid_color.set(parseInt(d.gridid), {color: scales[map_type](rateById[d.gridid]), score: d.tscore}); grid_color.set(parseInt(d.gridid), {color: scales[map_type](rateById[d.gridid]), score: d.tscore});
// grid_color.set(parseInt(d.gridid), {color: scales['deviation'](rateById[d.gridid]), score: d.tscore}); //grid_color.set(parseInt(d.gridid), {color: scales['deviation'](rateById[d.gridid]), score: d.tscore});
}) })
......
...@@ -1500,7 +1500,7 @@ var net_module = (function(verbose, url_zacatuche, map_module_net, utils_module) ...@@ -1500,7 +1500,7 @@ var net_module = (function(verbose, url_zacatuche, map_module_net, utils_module)
$.ajax({ $.ajax({
// url: _url_zacatuche + "/niche/especie/getCountGridid", // url: _url_zacatuche + "/niche/especie/getCountGridid",
url: _url_zacatuche + "/niche/especie/getGroupCountGridid", url: "https://covid19.c3.unam.mx/gateway/api/nodes/",
type: 'post', type: 'post',
data: sdata, data: sdata,
success: function(resp) { success: function(resp) {
......
...@@ -17,7 +17,7 @@ var module_nicho = (function () { ...@@ -17,7 +17,7 @@ var module_nicho = (function () {
var _AGENT_TEXT_SELECTED; var _AGENT_TEXT_SELECTED;
// actualizar este arreglo si cambian los ids de las secciones // actualizar este arreglo si cambian los ids de las secciones
var _SCROLL_SECTIONS = ["section0","section1","map","myScrollableBlockEpsilonDecil","histcontainer_row"]; var _SCROLL_SECTIONS = ["section0","section1","map","myScrollableBlockEpsilonDecil"]//,"histcontainer_row"];
var _SCROLL_INDEX = 0; var _SCROLL_INDEX = 0;
...@@ -297,7 +297,7 @@ var module_nicho = (function () { ...@@ -297,7 +297,7 @@ var module_nicho = (function () {
$("#grid_resolution").change(function (e) { $("#grid_resolution").change(function (e) {
_VERBOSE ? console.log("Cambia grid resolución") : _VERBOSE; _VERBOSE ? console.log("Cambia grid resolución a" + $("#grid_resolution").val() ) : _VERBOSE;
// No es necesario regenerar resultados // No es necesario regenerar resultados
_regenMessage(); _regenMessage();
...@@ -309,6 +309,8 @@ var module_nicho = (function () { ...@@ -309,6 +309,8 @@ var module_nicho = (function () {
// No es necesario regenerar resultados // No es necesario regenerar resultados
_regenMessage(); _regenMessage();
}); });
...@@ -721,6 +723,7 @@ var module_nicho = (function () { ...@@ -721,6 +723,7 @@ var module_nicho = (function () {
} }
function _regenMessage() { function _regenMessage() {
if ($("#reload_map").hasClass("btn-primary") && _map_module_nicho.get_specieTarget()) { if ($("#reload_map").hasClass("btn-primary") && _map_module_nicho.get_specieTarget()) {
...@@ -1138,26 +1141,28 @@ var module_nicho = (function () { ...@@ -1138,26 +1141,28 @@ var module_nicho = (function () {
} }
// se ejecutan los modulos necesarios para iniciar el proceso de obteción de epsilon y score y visualización de tablas, histogramas y mapa // se ejecutan los modulos necesarios para iniciar el proceso de obteción de epsilon y score y visualización de tablas, histogramas y mapa
$("#get_esc_ep").click(function () { $("#get_esc_ep").click(function () {
_VERBOSE ? console.log("get_esc_ep") : _VERBOSE; _VERBOSE ? console.log("get_esc_ep") : _VERBOSE;
var num_items = 0, spid, idreg, subgroups, sp_target; var num_items = 0, spid, idreg, subgroups, sp_target;
// $("#specie_next").css('visibility', 'hidden');
$("#specie_next").css('visibility', 'hidden');
$("#show_gen").css('visibility', 'visible'); $("#show_gen").css('visibility', 'visible');
$("#btn_tuto_steps_result").css('visibility', 'visible'); $("#btn_tuto_steps_result").css('visibility', 'visible');
// _cleanTutorialButtons(); // _cleanTutorialButtons();
console.log(_taxones)
if (_taxones.length === 0) { if (_taxones.length === 0) {
// no se ha seleccionado especie objetivo // no se ha seleccionado especie objetivo
_module_toast.showToast_BottomCenter(_iTrans.prop('lb_error_especie'), "error"); _module_toast.showToast_BottomCenter(_iTrans.prop('lb_error_especie'), "error");
return; return;
} }
// spid = _map_module_nicho.get_specieTarget().spid; // spid = _map_module_nicho.get_specieTarget().spid;
// _VERBOSE ? console.log(spid) : _VERBOSE; // _VERBOSE ? console.log(spid) : _VERBOSE;
...@@ -1185,24 +1190,23 @@ var module_nicho = (function () { ...@@ -1185,24 +1190,23 @@ var module_nicho = (function () {
_res_display_module_nicho.set_typeBioclim(type_time); _res_display_module_nicho.set_typeBioclim(type_time);
if (subgroups.length > 0) { if (subgroups.length > 0) {
// // asegura que si el grupo de variables seleccionado tiene mas de un grupo taxonomico agregue el total // asegura que si el grupo de variables seleccionado tiene mas de un grupo taxonomico agregue el total
// subgroups.forEach(function (grupo) { subgroups.forEach(function (grupo) {
// if (grupo.value.length > 1) { if (grupo.value.length > 1) {
// grupo.value.forEach(function (item) { grupo.value.forEach(function (item) {
// num_items++; num_items++;
// }); });
// } }
// }); });
// // asegura que si existe mas de un grupo de variables, se calcule el total de todos los grupos // asegura que si existe mas de un grupo de variables, se calcule el total de todos los grupos
// if (subgroups.length > 1) { if (subgroups.length > 1) {
// num_items++; num_items++;
// } }
} else { } else {
...@@ -1241,8 +1245,8 @@ var module_nicho = (function () { ...@@ -1241,8 +1245,8 @@ var module_nicho = (function () {
console.log("grid_res: " + grid_res); console.log("grid_res: " + grid_res);
console.log("footprint_region: " + footprint_region); console.log("footprint_region: " + footprint_region);
console.log("disease" + disease); console.log("disease: " + disease.toLowerCase());
console.log("agent"+ agent); console.log("agent: "+ agent.normalize('NFD').replace(/[\u0300-\u036f]/g,""));
var fossil = $("#chkFosil").is(':checked'); var fossil = $("#chkFosil").is(':checked');
...@@ -1265,12 +1269,57 @@ var module_nicho = (function () { ...@@ -1265,12 +1269,57 @@ var module_nicho = (function () {
// if (rango_fechas[0] == $("#sliderFecha").slider("option", "min") && rango_fechas[1] == $("#sliderFecha").slider("option", "max")) { // if (rango_fechas[0] == $("#sliderFecha").slider("option", "min") && rango_fechas[1] == $("#sliderFecha").slider("option", "max")) {
// rango_fechas = undefined; // rango_fechas = undefined;
// } // }
console.log( subgroups)
var chkFecha = $("#chkFecha").is(':checked'); var chkFecha = $("#chkFecha").is(':checked');
// slider_value = val_process ? $("#sliderValidation").slider("value") : 0;
//slider_value = val_process ? $("#sliderValidation").slider("value") : 0;
var slider_value = val_process ? true : false; var slider_value = val_process ? true : false;
_componente_fuente.getBodyElements()
covariables=[];
covariables_filter={}
//covobj= {"inegi2020": inegi2020, "snib": snib, "worldclim":worldclim}
Object.keys(covobj).forEach(key=>{
if (covobj[key].length > 0){
covariables.push(key);
covariables_filter[key]=covobj[key]
}
})
switch(agent){
case ("Vectores"):
var agente="vector";
break;
default:
var agente = agent.normalize('NFD').replace(/[\u0300-\u036f]/g,"").toLowerCase().substring(0, agent.length - 1);
break;
}
body={
"selected_decile": [10],
"mesh": grid_res,
"covariables":covariables,
"covariable_filter":covariables_filter,
"target":{
"species": target_species[0], //Por el momento el target debe tener un sólo taxon, luego sólo hay que borrar "[0]"
"disease": disease,
"agent": agente
},
"target_attribute_filter":[],
"lim_inf_first": "2021-04-03",
"lim_sup_first": "2021-05-02",
"lim_inf_training": "2021-05-03",
"lim_sup_training": "2021-06-02",
"lim_inf_validation": "2021-06-03",
"lim_sup_validation": "2021-07-02"
}
...@@ -1281,6 +1330,7 @@ var module_nicho = (function () { ...@@ -1281,6 +1330,7 @@ var module_nicho = (function () {
} }
}); });
......
...@@ -254,6 +254,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -254,6 +254,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
*/ */
function set_subGroups(subgroups) { function set_subGroups(subgroups) {
_subgroups = subgroups; _subgroups = subgroups;
console.log(subgroups)
} }
/** /**
...@@ -437,7 +438,9 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -437,7 +438,9 @@ var res_display_module = (function (verbose, url_zacatuche) {
_configureStyleMap(); _configureStyleMap();
if (_return_map) { if (_return_map) {
_map_module_nicho.set_colorCellsDecilMap(); _map_module_nicho.set_colorCellsDecilMap();
} }
...@@ -576,9 +579,10 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -576,9 +579,10 @@ var res_display_module = (function (verbose, url_zacatuche) {
_REQUESTS = num_items + _subgroups.length; //_REQUESTS = num_items + _subgroups.length;
_REQUESTS=1
_ITER_REQUESTS = _REQUESTS; _ITER_REQUESTS = _REQUESTS;
// _VERBOSE ? console.log("Peticiones al servidor: " + _REQUESTS) : _VERBOSE; _VERBOSE ? console.log("Peticiones al servidor: " + _REQUESTS) : _VERBOSE;
// document.getElementById("tbl_hist").style.display = "inline"; // document.getElementById("tbl_hist").style.display = "inline";
_cleanPanel(); _cleanPanel();
...@@ -613,6 +617,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -613,6 +617,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
_VERBOSE ? console.log("callDisplayProcess NICHO") : _VERBOSE; _VERBOSE ? console.log("callDisplayProcess NICHO") : _VERBOSE;
despliegaLoadings(); despliegaLoadings();
var taxon_values = []; var taxon_values = [];
...@@ -683,7 +689,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -683,7 +689,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
$.ajax({ $.ajax({
url: _url_zacatuche + "/niche/especie/getGroupValidationTables", url: "https://covid19.c3.unam.mx/gateway/api/analysis/cells/",
type: 'post', type: 'post',
data: { data: {
// spid: _spid, // spid: _spid,
...@@ -728,8 +734,29 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -728,8 +734,29 @@ var res_display_module = (function (verbose, url_zacatuche) {
_VERBOSE ? console.log("_deleteValidationTables") : _VERBOSE; _VERBOSE ? console.log("_deleteValidationTables") : _VERBOSE;
// $.ajax({
// url: _url_zacatuche + "/niche/especie/deleteValidationTables",
// type: 'post',
// data: {
// idtable: _idtemptable
// },
// dataType: "json",
// success: function (resp) {
// console.log("delete");
// console.log(resp);
// _requestReturned = 1;
// _idtemptable = "";
// },
// error: function (jqXHR, textStatus, errorThrown) {
// _VERBOSE ? console.log("textStatus: " + textStatus) : _VERBOSE;
// _VERBOSE ? console.log("errorThrown: " + errorThrown) : _VERBOSE;
// }
// });
$.ajax({ $.ajax({
url: _url_zacatuche + "/niche/especie/deleteValidationTables", url: "https://covid19.c3.unam.mx/gateway/api/analysis/cells/",
type: 'post', type: 'post',
data: { data: {
idtable: _idtemptable idtable: _idtemptable
...@@ -1087,6 +1114,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1087,6 +1114,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
}); });
_REQUESTS_NUMBER = _REQUESTS_MADE.length; _REQUESTS_NUMBER = _REQUESTS_MADE.length;
console.log("_REQUESTS_NUMBER: " + _REQUESTS_NUMBER); console.log("_REQUESTS_NUMBER: " + _REQUESTS_NUMBER);
// console.log(_TREE_GENERATED); // console.log(_TREE_GENERATED);
// console.log(_REQUESTS_MADE); // console.log(_REQUESTS_MADE);
...@@ -1094,10 +1122,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1094,10 +1122,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
// return; // return;
_REQUESTS_MADE.forEach(function (item, index) { _REQUESTS_MADE.forEach(function (item, index) {
// console.log(item);
_createScore_Decil(item); _createScore_Decil(item);
}); });
} }
...@@ -1117,6 +1142,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1117,6 +1142,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
*/ */
function _createScore_Decil(decildata) { function _createScore_Decil(decildata) {
_VERBOSE ? console.log("_createScore_Decil") : _VERBOSE; _VERBOSE ? console.log("_createScore_Decil") : _VERBOSE;
$('#chartdiv_score_decil').loading({ $('#chartdiv_score_decil').loading({
...@@ -1124,9 +1151,11 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1124,9 +1151,11 @@ var res_display_module = (function (verbose, url_zacatuche) {
}); });
var data_request = jQuery.extend(true, {}, decildata); var data_request = jQuery.extend(true, {}, decildata);
//var data_request = JSON.stringify(body)
console.log(data_request)
data_request["decil_selected"] = [_default_decil] data_request["decil_selected"] = [_default_decil]
console.log("<====================================================>1")
console.log(data_request)
// decildata["with_data_freq"] = false; // decildata["with_data_freq"] = false;
...@@ -1134,20 +1163,25 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1134,20 +1163,25 @@ var res_display_module = (function (verbose, url_zacatuche) {
// decildata["with_data_freq_cell"] = false; // decildata["with_data_freq_cell"] = false;
// decildata["with_data_score_decil"] = false; // decildata["with_data_score_decil"] = false;
///tal vez quitar
var verbo = _val_process_temp ? "countsTaxonsGroupTimeValidation" : "countsTaxonsGroup" var verbo = _val_process_temp ? "countsTaxonsGroupTimeValidation" : "countsTaxonsGroup"
// cambiando peticiones ajax por promesas y fetch api
fetch(_url_zacatuche + "/niche/" + verbo, { // Si se esta haciendo bien la peticion al servidor de epi-puma 2.0
method: "POST", fetch("https://covid19.c3.unam.mx/gateway/api/analysis/cells/",{
body: JSON.stringify(data_request), method:"POST",
headers: { //body: JSON.stringify(data_request),
body: JSON.stringify(body),
headers:{
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}) })
.then(resp => resp.json()) .then(resp => resp.json())
.then(respuesta => { .then(respuesta => {
console.log("<====================================================>2")
console.log(respuesta) console.log(respuesta)
console.log(">====================================================<2")
if(!respuesta.ok){ if(!respuesta.ok){
// TODO: mandar mensaje de error // TODO: mandar mensaje de error
...@@ -1156,15 +1190,25 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1156,15 +1190,25 @@ var res_display_module = (function (verbose, url_zacatuche) {
return return
} }
_REQUESTS_NUMBER = _REQUESTS_NUMBER - 1; ///talvez modificar
_REQUESTS_NUMBER = 0;
// PROCESANDO PETICIONES INDIVIDUALES // PROCESANDO PETICIONES INDIVIDUALES
var data_response = jQuery.extend(true, [], respuesta.data); //var data_response = jQuery.extend(true, [], respuesta.data);
var validation_data = _val_process_temp ? respuesta.time_validation : respuesta.validation_data var data_response = respuesta.data
console.log(data_response)
var validation_data = respuesta.validation_data
processSingleResponse(data_response, data_request, validation_data); processSingleResponse(data_response, data_request, validation_data);
_REQUESTS_DONE.push(respuesta); _REQUESTS_DONE.push(respuesta);
console.log("****************-------********")
console.log(_REQUESTS_DONE)
_REQUESTS_DONE=_REQUESTS_DONE.slice(0,1)
console.log("****************-------********")
console.log(_REQUESTS_DONE)
// todas las peticiones han sido realizadas // todas las peticiones han sido realizadas
if (_REQUESTS_NUMBER === 0) { if (_REQUESTS_NUMBER === 0) {
...@@ -1191,6 +1235,14 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1191,6 +1235,14 @@ var res_display_module = (function (verbose, url_zacatuche) {
cell_summary = cell_summary.concat(item.cell_summary); cell_summary = cell_summary.concat(item.cell_summary);
}); });
// total_score_cell = respuesta.data_score_cell;
// percentage_avg = respuesta.percentage_avg
// decil_cells = respuesta.decil_cells
// time_validacion_decil = respuesta.time_validation // revisar si es necesario
// cell_summary = respuesta.cell_summary
console.log(total_eps_scr); console.log(total_eps_scr);
console.log(total_score_cell); console.log(total_score_cell);
console.log(percentage_avg); console.log(percentage_avg);
...@@ -1297,11 +1349,13 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1297,11 +1349,13 @@ var res_display_module = (function (verbose, url_zacatuche) {
total_request.decil_selected = [_default_decil] total_request.decil_selected = [_default_decil]
verbo = _val_process_temp ? "countsTaxonsGroupTimeValidation" : "countsTaxonsGroup" verbo = _val_process_temp ? "countsTaxonsGroupTimeValidation" : "countsTaxonsGroup"
///ojo
fetch(_url_zacatuche + "/niche/" + verbo, { fetch("https://covid19.c3.unam.mx/gateway/api/analysis/cells/",{
method: "POST", method:"POST",
body: JSON.stringify(total_request), //body: JSON.stringify(data_request),
headers: { body: JSON.stringify(body),
headers:{
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}) })
...@@ -1314,7 +1368,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1314,7 +1368,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
var total_counts = resp.data; var total_counts = resp.data;
var validation_data = _val_process_temp ? resp.time_validation : resp.validation_data
var validation_data = resp.validation_data
// var validation_data = resp.validation_data // var validation_data = resp.validation_data
...@@ -1325,23 +1380,20 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1325,23 +1380,20 @@ var res_display_module = (function (verbose, url_zacatuche) {
var decil_cells = resp.decil_cells var decil_cells = resp.decil_cells
// sobre escribe el resultado en caso de ser total // sobre escribe el resultado en caso de ser total
cell_summary = resp.cell_summary //cell_summary = resp.cell_summary
// console.log("total_counts: " + total_counts.length) // console.log("total_counts: " + total_counts.length)
// console.log(decil_cells) // console.log(decil_cells)
// console.log(percentage_avg) console.log(percentage_avg)
console.log("<====================================================>8")
console.log(validation_data) console.log(validation_data)
console.log(data_score_cell) console.log(data_score_cell)
console.log(">====================================================<8")
// console.log(cell_summary) // console.log(cell_summary)
if(_val_process_temp){
$("#div_munlist").show();
processTableMun(cell_summary);
}
else{
$("#div_munlist").hide(); $("#div_munlist").hide();
}
var data_decil_byanalysis = {data: _utils_module.processDataForScoreDecil(data_score_cell), gpo_name: "Total", names: names_byanalysis, deciles: validation_data}; var data_decil_byanalysis = {data: _utils_module.processDataForScoreDecil(data_score_cell), gpo_name: "Total", names: names_byanalysis, deciles: validation_data};
...@@ -1372,18 +1424,13 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1372,18 +1424,13 @@ var res_display_module = (function (verbose, url_zacatuche) {
}); });
} } else{
else{
console.log("<=======================RESULTS_TODISPLAY=============================>7")
console.log(_RESULTS_TODISPLAY) console.log(_RESULTS_TODISPLAY)
console.log(">====================================================<7")
if(_val_process_temp){
$("#div_munlist").show();
processTableMun(cell_summary);
}
else{
$("#div_munlist").hide(); $("#div_munlist").hide();
}
_histogram_module_nicho.createMultipleBarChart(_RESULTS_TODISPLAY, [], _id_chartscr_decil, d3.map([])); _histogram_module_nicho.createMultipleBarChart(_RESULTS_TODISPLAY, [], _id_chartscr_decil, d3.map([]));
...@@ -1442,11 +1489,10 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1442,11 +1489,10 @@ var res_display_module = (function (verbose, url_zacatuche) {
console.log("gridres_column: " + gridres_column); console.log("gridres_column: " + gridres_column);
console.log(map_result); console.log(map_result);
console.log(data); console.log(data);
fetch("https://covid19.c3.unam.mx/gateway/api/analysis/cells/",{
fetch(_url_zacatuche + "/niche/especie/getColumnsGrid", { method:"POST",
method: "POST",
body: JSON.stringify(data), body: JSON.stringify(data),
headers: { headers:{
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}) })
...@@ -1556,11 +1602,12 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1556,11 +1602,12 @@ var res_display_module = (function (verbose, url_zacatuche) {
function processSingleResponse(data, data_request, validation_data = []) { function processSingleResponse(data, data_request, validation_data = []) {
_VERBOSE ? console.log("processSingleResponse") : _VERBOSE; _VERBOSE ? console.log("processSingleResponse") : _VERBOSE;
console.log(_TREE_GENERATED)
_TREE_GENERATED.groups.forEach(function (group_item, index) { _TREE_GENERATED.groups.forEach(function (group_item, index) {
// console.log(group_item); console.log(group_item);
// console.log(data_request); console.log(data_request);
if (group_item.groupid === data_request.covariables[0].group_item) { if (group_item.groupid === data_request.covariables[0].group_item) {
...@@ -1651,10 +1698,6 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1651,10 +1698,6 @@ var res_display_module = (function (verbose, url_zacatuche) {
console.log("value.name: " + value.name); console.log("value.name: " + value.name);
console.log("name: " + name); console.log("name: " + name);
console.log(_currentNameView !== name); console.log(_currentNameView !== name);
// console.log(_currentDecil !== decil);
console.log(_currentDecil); console.log(_currentDecil);
console.log(deciles); console.log(deciles);
...@@ -1714,10 +1757,10 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1714,10 +1757,10 @@ var res_display_module = (function (verbose, url_zacatuche) {
$('#map').loading('stop'); $('#map').loading('stop');
} }
else{ else{
console.log("se hace la petición a la segunda tabla")
fetch(_url_zacatuche + "/niche/countsTaxonsGroup", { fetch("https://covid19.c3.unam.mx/gateway/api/analysis/cells/", {
method: "POST", method: "POST",
body: JSON.stringify(request), body: JSON.stringify(body),
headers: { headers: {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
...@@ -1730,11 +1773,12 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1730,11 +1773,12 @@ var res_display_module = (function (verbose, url_zacatuche) {
if (resp.ok) { if (resp.ok) {
_VERBOSE ? console.log("loadDecilDataTable resp.ok") : _VERBOSE; _VERBOSE ? console.log("loadDecilDataTable resp.ok") : _VERBOSE;
var percentage_avg = resp.percentage_avg; var percentage_avg = resp.percentage_avg;
var decil_cells = resp.decil_cells; var decil_cells = resp.data_score_cell;
console.log(percentage_avg) console.log(percentage_avg)
...@@ -1774,7 +1818,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1774,7 +1818,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
var decil_list = []; var decil_list = [];
// console.log(counts)
console.log(counts)
_table_module_eps.createDecilList(counts); _table_module_eps.createDecilList(counts);
...@@ -1915,12 +1960,14 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1915,12 +1960,14 @@ var res_display_module = (function (verbose, url_zacatuche) {
data.forEach(function (d) { data.forEach(function (d) {
var item_list = []; var item_list = [];
// console.log("*****-----*****----**---*-**--*-*")
// console.log(d)
// las variables climáticas no cuentan con reino, phylum, clase, etc // las variables climáticas no cuentan con reino, phylum, clase, etc
if (d.reinovalido === "" && d.phylumdivisionvalido === "" && d.especieepiteto === "") { if (d.reinovalido === "" && d.phylumdivisionvalido === "" && d.especieepiteto === "") {
// var arg_values = d.especievalidabusqueda.split(" ") // var arg_values = d.especievalidabusqueda.split(" ")
console.log(d) //console.log(d)
var range = d.tag.split(":") var range = d.tag.split(":")
var label = d.label.replace(/[^a-zA-Z0-9]/g, "").replace(/ /g,'') var label = d.label.replace(/[^a-zA-Z0-9]/g, "").replace(/ /g,'')
...@@ -1932,7 +1979,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1932,7 +1979,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
if(d.tag.split(":").length > 1){ if(d.tag.split(":").length > 1){
var value = _iTrans.prop(label) + " (" + min + " : " + max + ") "; var value = _iTrans.prop(label) + " (" + d.tag + ") ";
}else { }else {
var value = _iTrans.prop(label) + ' (' + d.tag + ')'; var value = _iTrans.prop(label) + ' (' + d.tag + ')';
} }
...@@ -1943,7 +1990,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1943,7 +1990,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
} else { } else {
//item_list.push(d.generovalido + " " +d.especieepiteto + " " + d.nombreinfra) //item_list.push(d.generovalido + " " +d.especieepiteto + " " + d.nombreinfra)
item_list.push(d.description + ' ' + d.especieepiteto) //item_list.push(d.generovalido + ' ' + d.especievalida)
item_list.push(d.especievalida)
} }
// var namesp = d.reinovalido === "" ? d.type +" "+ d.layer : // var namesp = d.reinovalido === "" ? d.type +" "+ d.layer :
...@@ -1964,6 +2012,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1964,6 +2012,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
}); });
var json_arg = {data: data_list} var json_arg = {data: data_list}
console.log("*//*/*/*/*/*/*/*/*/*/*/*/")
console.log(json_arg)
_table_module_eps.createEspList(json_arg); _table_module_eps.createEspList(json_arg);
_tbl_eps = true; _tbl_eps = true;
...@@ -1980,6 +2030,8 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -1980,6 +2030,8 @@ var res_display_module = (function (verbose, url_zacatuche) {
_VERBOSE ? console.log("activeDecilOccurrences") : _VERBOSE; _VERBOSE ? console.log("activeDecilOccurrences") : _VERBOSE;
console.log(decil_cells)
_map_module_nicho.updateDecilLayer(deciles) _map_module_nicho.updateDecilLayer(deciles)
_map_module_nicho.setDecilCells(decil_cells); _map_module_nicho.setDecilCells(decil_cells);
...@@ -2826,12 +2878,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -2826,12 +2878,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
} }
else{ else{
// if (_AGENT_SELECTED == 'Hospederos')
// var _url = 'http://10.90.0.42:4006/graphql/hospederos/'
// else if (_AGENT_SELECTED == 'Patogenos')
// var _url = "http://10.90.0.42:4007/graphql/patogenos/"
// else
// var _url = "http://10.90.0.42:4008/graphql/vectores/"
var _url = "https://covid19.c3.unam.mx/gateway/api/nodes/" var _url = "https://covid19.c3.unam.mx/gateway/api/nodes/"
let nodo = _AGENT_SELECTED.toLowerCase() let nodo = _AGENT_SELECTED.toLowerCase()
...@@ -3243,7 +3290,7 @@ var res_display_module = (function (verbose, url_zacatuche) { ...@@ -3243,7 +3290,7 @@ var res_display_module = (function (verbose, url_zacatuche) {
setHistogramModule: setHistogramModule, setHistogramModule: setHistogramModule,
loadDecilDataTable: loadDecilDataTable, loadDecilDataTable: loadDecilDataTable,
set_taxones: set_taxones, set_taxones: set_taxones,
// _configureStyleMap: _configureStyleMap _configureStyleMap: _configureStyleMap,
activeDecilOccurrences: activeDecilOccurrences activeDecilOccurrences: activeDecilOccurrences
} }
......
...@@ -293,13 +293,13 @@ $("#modalMail").modal("hide"); ...@@ -293,13 +293,13 @@ $("#modalMail").modal("hide");
var temp_item_value = itemGroup.label.toString().split(">>")[1].trim(); var temp_item_value = itemGroup.label.toString().split(">>")[1].trim();
var temp_item_parent = itemGroup.parent ? itemGroup.parent : ""; var temp_item_parent = itemGroup.parent ? itemGroup.parent : "";
// _VERBOSE ? console.log(_reino_campos[temp_item_field]) : _VERBOSE; //_VERBOSE ? console.log(_reino_campos[temp_item_field]) : _VERBOSE;
_VERBOSE ? console.log(temp_item_field) : _VERBOSE; _VERBOSE ? console.log(temp_item_field) : _VERBOSE;
_VERBOSE ? console.log(temp_item_value) : _VERBOSE; _VERBOSE ? console.log(temp_item_value) : _VERBOSE;
_VERBOSE ? console.log(temp_item_parent) : _VERBOSE; _VERBOSE ? console.log(temp_item_parent) : _VERBOSE;
filters.push({ filters.push({
'biotic': true, 'biotic': true,
'level': group_level_biotic, 'level': group_level_biotic,
'rank': map_taxon.get(temp_item_field), 'rank': map_taxon.get(temp_item_field),
......
...@@ -71,6 +71,7 @@ var table_module = (function(verbose) { ...@@ -71,6 +71,7 @@ var table_module = (function(verbose) {
function createDecilList(list_elements = null) { function createDecilList(list_elements = null) {
_VERBOSE ? console.log("createDecilList") : _VERBOSE; _VERBOSE ? console.log("createDecilList") : _VERBOSE;
console.log(list_elements.length)
if(list_elements){ if(list_elements){
...@@ -78,7 +79,7 @@ var table_module = (function(verbose) { ...@@ -78,7 +79,7 @@ var table_module = (function(verbose) {
list_elements.forEach(function(d) { list_elements.forEach(function(d) {
// console.log(d) //console.log(d)
var value_abio = ""; var value_abio = "";
if (d.species.indexOf("|") !== -1) { if (d.species.indexOf("|") !== -1) {
...@@ -125,19 +126,22 @@ var table_module = (function(verbose) { ...@@ -125,19 +126,22 @@ var table_module = (function(verbose) {
var item_list = []; var item_list = [];
item_list.push(d.decil) item_list.push(d.decil)
if(d.description === '') { // if(d.description === '') {
item_list.push(value_abio) // item_list.push(value_abio)
}else{ // }else{
item_list.push(d.description + ' '+ d.species.split(' ')[1]) // item_list.push(d.description + ' '+ d.species.split(' ')[1])
} // }
item_list.push(d.species)
item_list.push(d.epsilon) item_list.push(d.epsilon.toFixed(3))
item_list.push(d.score) item_list.push(d.score.toFixed(3))
item_list.push(d.occ) item_list.push(d.occ)
item_list.push(d.occ_perdecile) item_list.push(d.occ_perdecile)
_data_list_decil.push(item_list) _data_list_decil.push(item_list)
}) })
} }
...@@ -318,9 +322,20 @@ var table_module = (function(verbose) { ...@@ -318,9 +322,20 @@ var table_module = (function(verbose) {
function createEspList(rawdata = null) { function createEspList(rawdata = null) {
_VERBOSE ? console.log("createEspList") : _VERBOSE; _VERBOSE ? console.log("createEspList") : _VERBOSE;
console.log("cambiar a 3 decimales")
// var data_list = rawdata.data; // var data_list = rawdata.data;
_data_list_eps = rawdata ? rawdata.data : _data_list_eps _data_list_eps = rawdata ? rawdata.data : _data_list_eps
// console.log(rawdata)
// console.log(rawdata.data)
_data_list_eps.forEach(element=> element[6]=element[6].toFixed(3))
_data_list_eps.forEach(element=> element[5]=element[5].toFixed(3))
console.log(_data_list_eps)
if (_tbl != false) { if (_tbl != false) {
// $('#tdisplay').dataTable().fnClearTable(); // $('#tdisplay').dataTable().fnClearTable();
...@@ -838,20 +853,22 @@ var table_module = (function(verbose) { ...@@ -838,20 +853,22 @@ var table_module = (function(verbose) {
item_list.push(name_s); item_list.push(name_s);
item_list.push(name_t); item_list.push(name_t);
item_list.push(val.nij); item_list.push(val.nij);
item_list.push(val.nj); item_list.push(val.nj);
item_list.push(val.ni); item_list.push(val.ni);
item_list.push(val.n); item_list.push(val.n);
item_list.push(val.value); item_list.push(val.value.toFixed(3));
item_list.push(val.score); item_list.push(val.score.toFixed(3));
data_list.push(item_list) data_list.push(item_list)
}); });
// }) // })
console.log("data_list.length: " + data_list.length) console.log("data_list.length: " + data_list.length)
......
...@@ -35,9 +35,9 @@ var toast_module = (function(verbose){ ...@@ -35,9 +35,9 @@ var toast_module = (function(verbose){
"debug": false, "debug": false,
"onclick": null, "onclick": null,
"fadeIn": 300, "fadeIn": 300,
"fadeOut": 1000, "fadeOut": 2000,
"timeOut": 2000, "timeOut": 2000,
"extendedTimeOut": 2000, "extendedTimeOut": 3000,
"positionClass": "toast-center-center", "positionClass": "toast-center-center",
"preventDuplicates": true, "preventDuplicates": true,
"progressBar": true "progressBar": true
......
...@@ -2,6 +2,7 @@ var _PARENT_FIELD = ""; ...@@ -2,6 +2,7 @@ var _PARENT_FIELD = "";
var _LABEL_VALUE = ""; var _LABEL_VALUE = "";
var _AGENT_SELECTED = ""; var _AGENT_SELECTED = "";
/** /**
* Módulo variable, utilizado para crear y gestionar los selectores de grupos de variables en nicho ecológico y comunidad ecológica. * Módulo variable, utilizado para crear y gestionar los selectores de grupos de variables en nicho ecológico y comunidad ecológica.
* *
...@@ -12,12 +13,16 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -12,12 +13,16 @@ var variable_module = (function (verbose, url_zacatuche) {
var _url_zacatuche = url_zacatuche; var _url_zacatuche = url_zacatuche;
var _VERBOSE = verbose; var _VERBOSE = verbose;
var _selectors_created = []; var _selectors_created = [];
_module_toast = toast_module(_VERBOSE);
_module_toast.startToast();
var _id; var _id;
var _TYPE_BIO = 0, var _TYPE_BIO = 0, //snib
_TYPE_ABIO = 1, _TYPE_ABIO = 1, // worldclim
_TYPE_TERRESTRE = 2; _TYPE_TERRESTRE = 2; //inegi2020
var _TYPE_TAXON = 0, var _TYPE_TAXON = 0,
_TYPE_CLIMA = 0, _TYPE_CLIMA = 0,
...@@ -76,6 +81,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -76,6 +81,7 @@ var variable_module = (function (verbose, url_zacatuche) {
*/ */
function getVarSelArray() { function getVarSelArray() {
return _var_sel_array; return _var_sel_array;
} }
/** /**
...@@ -108,6 +114,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -108,6 +114,7 @@ var variable_module = (function (verbose, url_zacatuche) {
// se comentan variables topograficas por expansión de terreno // se comentan variables topograficas por expansión de terreno
var tags = abio_tab ? ['a_taxon', 'a_raster', 'a_socio'] : ['a_taxon']; var tags = abio_tab ? ['a_taxon', 'a_raster', 'a_socio'] : ['a_taxon'];
//var tags = ['a_taxon', 'a_raster', 'a_socio'];
var sp_items = [ 'a_item_clase', 'a_item_orden', 'a_item_familia', 'a_item_genero','a_item_especie']; var sp_items = [ 'a_item_clase', 'a_item_orden', 'a_item_familia', 'a_item_genero','a_item_especie'];
...@@ -134,10 +141,16 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -134,10 +141,16 @@ var variable_module = (function (verbose, url_zacatuche) {
self.arrayVarSelected; self.arrayVarSelected;
self.groupvar_dataset = []; self.groupvar_dataset = [];
self.var_sel_array = []; self.var_sel_array = [];
//self.arrayBioclimSelected2 = [];
self.arraySocioSelected2 = [];
self.last_event; self.last_event;
self.arrayBioclimSelected = []; self.arrayBioclimSelected = [];
self.groupbioclimvar_dataset = []; self.groupbioclimvar_dataset = [];
//en covariables se hará un push con inegi y worldclim siempre que tengan elementos
self.covariables=[];
self.groupDatasetTotal = []; self.groupDatasetTotal = [];
...@@ -149,6 +162,8 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -149,6 +162,8 @@ var variable_module = (function (verbose, url_zacatuche) {
// return self.taxones; // return self.taxones;
// } // }
self.getTreeTarget = function(){ self.getTreeTarget = function(){
_VERBOSE ? console.log("self.getTreeTarget") : _VERBOSE; _VERBOSE ? console.log("self.getTreeTarget") : _VERBOSE;
...@@ -261,7 +276,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -261,7 +276,7 @@ var variable_module = (function (verbose, url_zacatuche) {
}); });
$('#disease_selected').change(function(e){ $('#disease_selected').change(function(e){
_module_toast.showToast_CenterCenter("El árbol taxonómico se está cargando, espere unos segundos...","info")
var agent_selected = $('#agent_selected').val() var agent_selected = $('#agent_selected').val()
var disease_text_selected = $("#disease_selected option:selected").text(); var disease_text_selected = $("#disease_selected option:selected").text();
...@@ -271,10 +286,6 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -271,10 +286,6 @@ var variable_module = (function (verbose, url_zacatuche) {
var query = "query{occurrences_by_taxon_"+ nodo + "(query: \"nombreenfermedad='"+ disease_text_selected +"'\"){reino phylum clase orden familia genero nombrecientifico}}" var query = "query{occurrences_by_taxon_"+ nodo + "(query: \"nombreenfermedad='"+ disease_text_selected +"'\"){reino phylum clase orden familia genero nombrecientifico}}"
console.log(' =>>>>>>>>>>>>>>>>>>>>>>>>> ')
console.log(query)
$.ajax({ $.ajax({
url: _url, url: _url,
method: "POST", method: "POST",
...@@ -282,10 +293,6 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -282,10 +293,6 @@ var variable_module = (function (verbose, url_zacatuche) {
data: JSON.stringify({query: query}), data: JSON.stringify({query: query}),
success: function(resp){ success: function(resp){
console.log(' =>>>>>>>>>>>>>>>>>>>>>>>>> ')
console.log(resp)
console.log(' =>>>>>>>>>>>>>>>>>>>>>>>>> ')
if (agent_selected == 'Hospederos'){ if (agent_selected == 'Hospederos'){
var species = resp.data.occurrences_by_taxon_hospederos; var species = resp.data.occurrences_by_taxon_hospederos;
} }
...@@ -315,7 +322,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -315,7 +322,7 @@ var variable_module = (function (verbose, url_zacatuche) {
species.forEach(specie=>{ species.forEach(specie=>{
if(!phylums.includes(specie.phylum)){ if(!phylums.includes(specie.phylum)){
phylums.push(specie.phylum); phylums.push(specie.phylum);
data.push({ "id" : specie.phylum, "parent" : "#", "text" : specie.phylum, 'state': {'opened': true, 'selected': true},"icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 3, "type": 0}}) data.push({ "id" : specie.phylum, "parent" : "#", "text" : specie.phylum, 'state': {'opened': true, 'selected': false},"icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 3, "type": 0}})
} }
}) })
...@@ -389,15 +396,10 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -389,15 +396,10 @@ var variable_module = (function (verbose, url_zacatuche) {
}) })
$(function () { $('#jstree_variables_species_target').jstree(); });
console.log(' =>>>>>>>>>>>>>>>>>>>>>>>>> ')
console.log("arbol es")
console.log(data)
console.log(' =>>>>>>>>>>>>>>>>>>>>>>>>> ')
$('#jstree_variables_species_target').jstree("destroy").empty(); $('#jstree_variables_species_target').jstree("destroy").empty();
$('#jstree_variables_species_target').on('open_node.jstree', self.getTreeVar); $('#jstree_variables_species_target').on('open_node.jstree', self.getTreeVar);
$("#jstree_variables_species_target").on('changed.jstree', self.getChangeTreeVar); $("#jstree_variables_species_target").on('changed.jstree', self.getChangeTreeVarTarget);
$("#jstree_variables_species_target").on('loaded.jstree', self.loadNodes); $("#jstree_variables_species_target").on('loaded.jstree', self.loadNodes);
...@@ -415,44 +417,13 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -415,44 +417,13 @@ var variable_module = (function (verbose, url_zacatuche) {
'check_callback': true 'check_callback': true
} }
}); });
_module_toast.showToast_CenterCenter("El árbol taxonómico se cargó adecuadamente","success")
console.log(' =>>>>>>>>>>>>>>>>>>>>>>>>> ') }
console.log(Object.keys(arbol['Animalia']))
console.log(' =>>>>>>>>>>>>>>>>>>>>>>>>> ')
Object.keys(arbol["Animalia"]).forEach(phylum=>{
console.log(' =>>>>>>>>>>>>>>>>>>>>>>>>> ')
console.log(phylum)
Object.keys(arbol["Animalia"][phylum]).forEach(clase=>{
console.log(" " + clase)
Object.keys(arbol["Animalia"][phylum][clase]).forEach(orden=>{
console.log(" " + orden)
Object.keys(arbol["Animalia"][phylum][clase][orden]).forEach(familia=>{
console.log(" " + familia)
Object.keys(arbol["Animalia"][phylum][clase][orden][familia]).forEach(genero=>{
console.log(" " + genero)
arbol["Animalia"][phylum][clase][orden][familia][genero].forEach(nombre=>{
console.log(" " + nombre)
})
})
})
})
})
}) })
}
})
console.log(' =>>>>>>>>>>>>>>>>>>>>>>>>> ')
}) })
} }
...@@ -481,227 +452,144 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -481,227 +452,144 @@ var variable_module = (function (verbose, url_zacatuche) {
console.log("REGION_SELECTED: " + _REGION_SELECTED); console.log("REGION_SELECTED: " + _REGION_SELECTED);
console.log("_GRID_RES: " + _GRID_RES); console.log("_GRID_RES: " + _GRID_RES);
$.ajax({
url: _url_zacatuche + "/niche/especie/getRasterVariables",
dataType: "json",
type: "post",
data: {
"footprint_region": _REGION_SELECTED,
"level": level_root,
"grid_res": _GRID_RES
},
success: function (resp) {
var data = resp.data;
$('#jstree_variables_bioclim_' + id).jstree("destroy").empty();
var tree_reinos = [{
"text": text_raster,
"id": var_selected,
attr: {"bid": var_selected, "parent": text_raster, "level": level_root, "type": _TYPE_CLIMA},
'state': {'opened': true, 'disabled' : true },
"icon": "plugins/jstree/images/dna.png"
}];
$("#jstree_variables_bioclim_" + id).jstree({
'plugins': ["wholerow", "checkbox"],
'core': {
'data': data,
'themes': {
'name': 'proton',
'responsive': true
},
'check_callback': true
} }
});
$("#jstree_variables_bioclim_" + id).on('changed.jstree', self.getChangeTreeVarRaster); self.getTreeSocio = function (){
$('#jstree_variables_bioclim_' + id).on('open_node.jstree', self.getTreeVarRaster); var query = "query{all_censo_inegi_2020_covariables(limit: 2400, filter:\"\"){id name interval bin code}}"
$.ajax({
url:"https://covid19.c3.unam.mx/gateway/api/nodes/",
method: "POST",
contentType: "application/json",
data: JSON.stringify({query: query}),
success: function(resp){
var sei=resp.data.all_censo_inegi_2020_covariables
data = [{"id": "inegi", "parent": "#", "text": "CENSO INEGI 2020", "state":{"opened":true}, "icon": "plugins/jstree/images/rep.png", "attr":{"nivel":6, "type":0}}]
var intervals = []
sei.forEach(element =>{
if(!intervals.includes(element.interval)){
intervals.push(element.interval)
}
})
var names=[]
$("#jstree_variables_bioclim_" + id).on('loaded.jstree', function () { sei.forEach(element=>{
if(!names.includes(element.name)){
names.push(element.name)
}
})
var current_node = $('#jstree_variables_bioclim_' + id).jstree(true).get_node($("#" + var_selected));
for (var i = 0; i < data.length; i++) { var codes={}
sei.forEach(element=>{
codes[element.name]=element.code
})
// console.log(data[i]);
var idNode = (data[i].fuente).replace(/ /g, '').replace(/\./g, '').replace(/\(/g, '').replace(/\)/g, '');
var default_son = level_vartree < 2 ? [{text: "cargando..."}] : [];
var newNode = { names.forEach(element=>{
id: idNode, data.push({"id":element, "parent":"inegi","text":element,"state":{"opened":false}, "icon":"plugins/jstree/images/group.png","attr":{"nivel":7, "type":2,"code":codes[element]}})
text: data[i].fuente, })
icon: "plugins/jstree/images/dna.png",
attr: {"bid": idNode, "parent": text_raster, "level": level_vartree, "type": data[i].type},
state: {'opened': false},
"children": default_son
};
console.log("nodes-loadTreeVarRaster --------------------"); sei.forEach(element=>{
console.log(newNode); names.forEach(name=>{
$('#jstree_variables_bioclim_' + id).jstree("create_node", current_node, newNode, 'last', false, false); if(intervals.includes(element.interval) && element.name === name){
data.push({"id":element.interval, "parent": element.name, "text":element.interval, "state":{"opened":false}, "icon":"plugins/jstree/images/percent.png", "attr":{"nivel":8, "type":2, "bin":element.bin, "code":element.code}})
}
})
})
$("#jstree_variables_socio_fuente").jstree({
"plugins":["wholerow", "checkbox"],
"core":{
"data": data,
"themes":{
"name":"proton",
"responsive":true
},
"check_callback":true
} }
})
$(function () { $('#jstree_variables_socio_fuente').jstree(); });
$("#jstree_variables_socio_fuente").on("changed.jstree", self.getChangeTreeVarSocio)
// $("#jstree_variables_bioclim_" + id).jstree(true).set_icon(current_node.id, "./plugins/jstree/images/dna.png");
});
} }
})
});
} }
self.getTreeVarRaster = function (e, d) {
//evita la petición cuando no se requieren las variables climáticas
if(!abio_tab) return;
_VERBOSE ? console.log("self.getTreeVarRaster") : _VERBOSE;
_VERBOSE ? console.log(d) : _VERBOSE;
_VERBOSE ? console.log(d.node) : _VERBOSE;
// _VERBOSE ? console.log("length: " + d.node.children.length) : _VERBOSE;
// _VERBOSE ? console.log("indexOf: " + d.node.children[0].indexOf("bio") === 0) : _VERBOSE;
if (d.node.children.length > 1 || d.node.children[0].indexOf("bio") === 0)
return;
console.log(d.node.original.attr);
var level_vartree = d.node.original.attr.level;
var raster_type = d.node.original.attr.type;
var current_id = d.node.original.attr.bid;
var parent_name = d.node.original.attr.parent;
console.log("current_id 0: " + current_id);
var max_level = 3;
$("#jstree_variables_bioclim_" + id).jstree(true).set_icon(d.node.id, "./plugins/jstree/images/dna.png");
_REGION_SELECTED = ($("#footprint_region_select").val() !== null && $("#footprint_region_select").val() !== undefined) ? parseInt($("#footprint_region_select").val()) : _REGION_SELECTED;
_GRID_RES = $("#grid_resolution").val();
console.log("REGION_SELECTED: " + _REGION_SELECTED);
console.log("_GRID_RES: " + _GRID_RES);
current_id = current_id.replace(/#/g,'').replace(/\(/g,'').replace(/\)/g,'') self.getTreeVarRaster = function () {
console.log("current_id: " + current_id); var query = "query{all_worldclim_covariables(limit: 550, filter: \"\"){id label interval layer icat}}"
// console.log("id: " + id);
// console.log("level_vartree: " + level_vartree);
// console.log("raster_type: " + raster_type);
// console.log("parent_name: " + parent_name);
// console.log("REGION_SELECTED: " + _REGION_SELECTED);
$.ajax({ $.ajax({
url: _url_zacatuche + "/niche/especie/getRasterVariables", url: "https://covid19.c3.unam.mx/gateway/api/nodes/",
dataType: "json", method: "POST",
type: "post", contentType: "application/json",
data: { data: JSON.stringify({query: query}),
"level": level_vartree, success: function(data){
"field": current_id, var awc = data.data.all_worldclim_covariables
"type": raster_type, //console.log(awc)
"region": _REGION_SELECTED, data = [{ "id" : "WorlClim", "parent" : "#", "text" : "WorldClim","icon": "plugins/jstree/images/world.png", 'state': {'opened': true},'attr': {'nivel': 6, "type": 1} }]
"grid_res": _GRID_RES var intervals=[]
}, awc.forEach(element => {
success: function (resp) { if(!intervals.includes(element.interval)){
intervals.push(element.interval)
var data = resp.data;
console.log(data)
console.log($("#" + current_id));
var current_node = $('#jstree_variables_bioclim_' + id).jstree(true).get_node($("#" + current_id));
_VERBOSE ? console.log(current_node) : _VERBOSE;
level_vartree = level_vartree + 1;
for (var i = 0; i < data.length; i++) {
// console.log(data[i]);
var default_son = level_vartree < max_level ? [{text: "cargando..."}] : [];
var tag = "", min = "", max = "";
var ttext = "";
var newNode = {};
if (level_vartree > 2) {
// console.log(data[i])
tag = String(data[i].tag).split(":")
min = (parseFloat(tag[0]) * data[i].coeficiente).toFixed(3) + " " + data[i].unidad
max = (parseFloat(tag[1]) * data[i].coeficiente).toFixed(3) + " " + data[i].unidad
var idNode = "";
if ($("#" + data[i].bid).length > 0) {
idNode = data[i].bid + "_" + Math.floor((Math.random() * 1000) + 1)
} else {
idNode = data[i].bid;
}
if(String(data[i].tag).split(":").length > 1){
ttext = min + " : " + max;
}else{
ttext = data[i].tag;
} }
});
newNode = { var labels=[]
id: idNode, var layers={}
text: ttext, awc.forEach(element=>{
icon: "plugins/jstree/images/dna.png", if(!labels.includes(element.label)){
attr: {"bid": data[i].bid, "parent": data[i].layer, "level": level_vartree, "type": data[i].type}, labels.push(element.label)
state: {'opened': false},
"children": default_son
};
} }
else { })
awc.forEach(element=>{
console.log(data[i].label) layers[element.label]=element.layer
// eliminacaraacteres especiales y espacios en blanco })
var lb = data[i].label.replace(/[^a-zA-Z0-9]/g, "").replace(/ /g,'').replace(/#/g,'')
// console.log(_iTrans.prop(lb))
newNode = {
id: (data[i].layer).replace(" ", ""),
// text: raster_type !== 0 ? _iTrans.prop("a_item_" + data[i].layer) : data[i].label,
text: raster_type !== 0 ? _iTrans.prop(lb) : data[i].label,
icon: "plugins/jstree/images/dna.png",
attr: {"bid": data[i].layer, "parent": data[i].fuente, "level": level_vartree, "type": data[i].type},
state: {'opened': false},
"children": default_son
};
labels.forEach(element=>{
data.push({"id": element, "parent":"WorlClim", "text":element,'state': {'opened': false}, "icon": "plugins/jstree/images/clima.png",
'attr': {'nivel': 7, "type": 1, "layer":layers[element] }})
})
awc.forEach(element=>{
labels.forEach(label=>{
if(intervals.includes(element.interval) && element.label===label){
data.push({"id":element.interval, "parent":element.label, "text":element.interval, 'state': {'opened': false}, "icon": "plugins/jstree/images/termometro.png",
'attr': {'nivel': 8, "type": 1, "id": element.id}})
} }
})
})
$('#jstree_variables_bioclim_' + id).jstree("create_node", current_node, newNode, 'last', false, false); //console.log(data)
$('#jtreeVariableBioclim_' + id).jstree("destroy").empty();
$('#treeVariableBioclim_fuente').jstree({
'plugins': ["wholerow", "checkbox"],
'core': {
'data': data,
'themes': {
'name': 'proton',
'responsive': true
},
'check_callback': true
} }
});
$("#jstree_variables_bioclim_" + id).jstree(true).delete_node(d.node.children[0]); $(function () { $('#treeVariableBioclim_' + id).jstree(); });
$("#jstree_variables_bioclim_" + id).jstree(true).set_icon(current_node.id, "./plugins/jstree/images/dna.png"); $("#treeVariableBioclim_" + id).on('changed.jstree', self.getChangeTreeVarRaster);
//$('#treeVariableBioclim_' + id).on('open_node.jstree', self.getTreeVarRaster);
} }
}); })
} }
self.getTreeVarRaster()
self.getTreeSocio()
/****************************************************************************************** GENERACION DE PANEL */ /****************************************************************************************** GENERACION DE PANEL */
...@@ -745,19 +633,21 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -745,19 +633,21 @@ var variable_module = (function (verbose, url_zacatuche) {
// sea agregan los tabs disponibles // sea agregan los tabs disponibles
$.each(tags, function (i) { $.each(tags, function (i) {
var name_class = 'nav-variables'; var name_class = 'nav-variables';
if(id=="fuente"){
if (i == 0) { if (i == 0) {
name_class = 'active nav-variables'; name_class = 'active nav-variables';
} }
if(id=="fuente"){
var li = $('<li/>') var li = $('<li/>')
.addClass(name_class) .addClass(name_class)
.appendTo(nav_items) .appendTo(nav_items)
.click(function (e) { .click(function (e) {
$('.nav-tabs a[href="' + e.target.getAttribute('href') + '"]').tab('show'); $('.nav-tabs a[href="' + e.target.getAttribute('href') + '"]').tab('show');
e.preventDefault(); e.preventDefault();
});} });
var aaa = $('<a/>') var aaa = $('<a/>')
.attr('id', tags[i] + "_" + id) .attr('id', tags[i] + "_" + id)
...@@ -765,33 +655,31 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -765,33 +655,31 @@ var variable_module = (function (verbose, url_zacatuche) {
.attr('data-toggle', 'tab' + i + "_" + id) .attr('data-toggle', 'tab' + i + "_" + id)
.text(_iTrans.prop(tags[i])) .text(_iTrans.prop(tags[i]))
.appendTo(li); .appendTo(li);
}
}); });
// div que alamcena el cuerpo de los tabs // div que alamcena el cuerpo de los tabs
var tab_content = $('<div/>') var tab_content = $('<div/>')
.attr('id', "tab_content_" + id) .attr('id', "tab_content_" + id )
.addClass('tab-content') .addClass('tab-content')
.appendTo(nav_selection); .appendTo(nav_selection);
// agregando contenido de cada tab // agregando contenido de cada tab
$.each(tags, function (i) { $.each(tags, function (i) {
if (i === 0) { if (i === 0) {
// generando tab panel para variables taxonomicas // generando tab panel para variables taxonomicas
// _VERBOSE ? console.log(tags[i]) : _VERBOSE; //_VERBOSE ? console.log(tags[i]) : _VERBOSE;
//div del tab[i]_id
// div del tab[i]_id
var tab_pane = $('<div/>') var tab_pane = $('<div/>')
.attr('id', 'tab' + i + "_" + id) .attr('id', 'tab' + i + "_" + id)
.addClass('tab-pane active') .addClass('tab-pane active')
.appendTo(tab_content); .appendTo(tab_content);
//div id="tab_content_fuente" & class="tab-content"
// div que contiene el dropdown-button de tipos taxonomicos y textfiled para insertar valores // div que contiene el dropdown-button de tipos taxonomicos y textfiled para insertar valores
if (id === "fuente"){ if (id === "fuente"){
...@@ -828,9 +716,11 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -828,9 +716,11 @@ var variable_module = (function (verbose, url_zacatuche) {
console.log(sp_items[i]) console.log(sp_items[i])
console.log(_iTrans.prop(sp_items[i])) console.log(_iTrans.prop(sp_items[i]))
// establece el nivel taxonomico inicial del buscador. Donde 0 es reino. // establece el nivel taxonomico inicial del buscador. Donde 0 es reino.
if(start_level > i) // if(start_level > i)
return true; // return true;
var li = $('<li/>') var li = $('<li/>')
...@@ -873,34 +763,33 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -873,34 +763,33 @@ var variable_module = (function (verbose, url_zacatuche) {
.addClass('form-control') .addClass('form-control')
.autocomplete({ .autocomplete({
source: function (request, response) { source: function (request, response) {
console.log(varfield) console.log(varfield + "seleccionado")
switch(varfield){ switch(varfield){
case "Clase": case "Clase":
console.log("clase valida"); console.log("clase valida");
var query = "query{all_snib_covariables(limit: 1, filter: \" clasevalida LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){clasevalida}} " var query = "query{all_snib_covariables(limit: 1, filter: \" clasevalida LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){clasevalida}} "
var el = "clasevalida "
break; break;
case "Orden": case "Orden":
console.log("orden valido"); console.log("orden valido");
var query = "query{all_snib_covariables(limit: 1, filter: \" ordenvalido LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){ordenvalido}} " var query = "query{all_snib_covariables(limit: 1, filter: \" ordenvalido LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){ordenvalido}} "
var el = "ordenvalido "
break; break;
case "Familia": case "Familia":
console.log("familia valida"); console.log("familia valida");
var query = "query{all_snib_covariables(limit: 1, filter: \" familiavalida LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){familiavalida}} " var query = "query{all_snib_covariables(limit: 1, filter: \" familiavalida LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){familiavalida}} "
var el = "familiavalida "
break; break;
case "Género": case "Género":
console.log("genero valido"); console.log("genero valido");
var query = "query{all_snib_covariables(limit: 1, filter: \" generovalido LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){generovalido}} " var query = "query{all_snib_covariables(limit: 1, filter: \" generovalido LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){generovalido}} "
var el = "generovalido "
break; break;
default: default:
console.log("Especie ") console.log("Especie ")
var query = "query{all_snib_covariables(limit: 1, filter: \" especievalida LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){especievalida}} " var query = "query{all_snib_covariables(limit: 1, filter: \" especievalida LIKE '" + request.term.charAt(0).toUpperCase()+ request.term.slice(1) + "%'\"){especievalida}} "
var el = "especievalida "
break; break;
} }
...@@ -911,8 +800,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -911,8 +800,7 @@ var variable_module = (function (verbose, url_zacatuche) {
var _url = "https://covid19.c3.unam.mx/gateway/api/nodes/" var _url = "https://covid19.c3.unam.mx/gateway/api/nodes/"
let lst = [] let lst = []
console.log(query) console.log(query)
console.log("---------*********-----------")
console.log(el)
$.ajax({ $.ajax({
method: "POST", method: "POST",
url: _url, url: _url,
...@@ -920,14 +808,13 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -920,14 +808,13 @@ var variable_module = (function (verbose, url_zacatuche) {
data: JSON.stringify({query: query}), data: JSON.stringify({query: query}),
success: function (resp) { success: function (resp) {
let au = resp.data.all_snib_covariables let au = resp.data.all_snib_covariables
// console.log(au[0])
console.log(au[0])
response($.map(resp.data.all_snib_covariables, function (item) { response($.map(resp.data.all_snib_covariables, function (item) {
var arrayObj = Object.keys(au[0]).map(function(key){ var arrayObj = Object.keys(au[0]).map(function(key){
return au[0][key]; return au[0][key];
}); });
console.log(arrayObj) // console.log(arrayObj)
for (let i = 0; i < arrayObj.length; i++) { for (let i = 0; i < arrayObj.length; i++) {
...@@ -951,7 +838,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -951,7 +838,7 @@ var variable_module = (function (verbose, url_zacatuche) {
}, },
minLength: 3, minLength: 2,
change: function (event, ui) { change: function (event, ui) {
if (!ui.item) { if (!ui.item) {
...@@ -974,7 +861,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -974,7 +861,7 @@ var variable_module = (function (verbose, url_zacatuche) {
data: JSON.stringify({query: query}), data: JSON.stringify({query: query}),
success: function(resp){ success: function(resp){
var sel = resp.data.all_snib_covariables var sel = resp.data.all_snib_covariables
console.log(sel) //console.log(sel)
var data_cov=[] var data_cov=[]
var species_names = []; var species_names = [];
sel.forEach(specie=>{ sel.forEach(specie=>{
...@@ -989,7 +876,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -989,7 +876,7 @@ var variable_module = (function (verbose, url_zacatuche) {
var ordenes=[] var ordenes=[]
if(!clases.includes(specie.clasevalida)){ if(!clases.includes(specie.clasevalida)){
clases.push(specie.clasevalida) clases.push(specie.clasevalida)
data_cov.push({ "id" : specie.clasevalida, "parent" : "#", "text" : specie.clasevalida, 'state': {'opened': true, 'selected': true},"icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 5, "type": 0}}) data_cov.push({ "id" : specie.clasevalida, "parent" : "#", "text" : specie.clasevalida, 'state': {'opened': true, 'selected': false},"icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 4, "type": 0}})
} }
}) })
...@@ -1000,7 +887,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1000,7 +887,7 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!ordenes.includes(specie.ordenvalido) && specie.clasevalida === clase){ if(!ordenes.includes(specie.ordenvalido) && specie.clasevalida === clase){
ordenes.push(specie.ordenvalido) ordenes.push(specie.ordenvalido)
data_cov.push({ "id" : specie.ordenvalido , "parent" : specie.clasevalida , "text" : specie.ordenvalido,'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 6, "type": 0}}) data_cov.push({ "id" : specie.ordenvalido , "parent" : specie.clasevalida , "text" : specie.ordenvalido,'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 5, "type": 0}})
} }
}) })
...@@ -1010,7 +897,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1010,7 +897,7 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!familias.includes(specie.familiavalida) && specie.ordenvalido === orden){ if(!familias.includes(specie.familiavalida) && specie.ordenvalido === orden){
familias.push(specie.familiavalida) familias.push(specie.familiavalida)
data_cov.push({ "id" : specie.familiavalida , "parent" : specie.ordenvalido , "text" : specie.familiavalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 7, "type": 0}}) data_cov.push({ "id" : specie.familiavalida , "parent" : specie.ordenvalido , "text" : specie.familiavalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 6, "type": 0}})
} }
}) })
...@@ -1020,7 +907,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1020,7 +907,7 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!generos.includes(specie.generovalido)&& specie.familiavalida === familia){ if(!generos.includes(specie.generovalido)&& specie.familiavalida === familia){
generos.push(specie.generovalido) generos.push(specie.generovalido)
data_cov.push({ "id" : specie.generovalido , "parent" : specie.familiavalida , "text" : specie.generovalido, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 8, "type": 0}}) data_cov.push({ "id" : specie.generovalido , "parent" : specie.familiavalida , "text" : specie.generovalido, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 7, "type": 0}})
} }
}) })
var generos_obj = {} var generos_obj = {}
...@@ -1029,7 +916,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1029,7 +916,7 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!especievalida.includes(specie.especievalida) && specie.generovalido === genero){ if(!especievalida.includes(specie.especievalida) && specie.generovalido === genero){
especievalida.push(specie.especievalida); especievalida.push(specie.especievalida);
data_cov.push({ "id" : specie.especievalida , "parent" : specie.generovalido , "text" : specie.especievalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 9, "type": 0}}) data_cov.push({ "id" : specie.especievalida , "parent" : specie.generovalido , "text" : specie.especievalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 8, "type": 0}})
} }
}) })
generos_obj[genero] = especievalida generos_obj[genero] = especievalida
...@@ -1039,13 +926,13 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1039,13 +926,13 @@ var variable_module = (function (verbose, url_zacatuche) {
ordenes_obj[orden] = familias_obj ordenes_obj[orden] = familias_obj
}) })
clases_obj[clase]=ordenes_obj clases_obj[clase]=ordenes_obj
console.log(clases_obj) //console.log(clases_obj)
}) })
console.log(data_cov) //console.log(data_cov)
console.log("jstree_variables_species_fuente") console.log("jstree_variables_species_fuente")
$('#jstree_variables_species_' + id).jstree("destroy").empty(); $('#jstree_variables_species_' + id).jstree("destroy").empty();
$('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar); $('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar);
$("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVar); $("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVarFuente);
$("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes); $("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes);
self.value_vartree = ui.item.id; self.value_vartree = ui.item.id;
...@@ -1090,15 +977,15 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1090,15 +977,15 @@ var variable_module = (function (verbose, url_zacatuche) {
species_names.push(specie.especievalida) species_names.push(specie.especievalida)
} }
}) })
console.log(species_names) // console.log(species_names)
var ordenes = [] var ordenes = []
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!ordenes.includes(specie.ordenvalido)){ if(!ordenes.includes(specie.ordenvalido)){
ordenes.push(specie.ordenvalido) ordenes.push(specie.ordenvalido)
data_cov.push({ "id" : specie.ordenvalido, "parent" : "#", "text" : specie.ordenvalido, 'state': {'opened': true, 'selected': true},"icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 1, "type": 0}}) data_cov.push({ "id" : specie.ordenvalido, "parent" : "#", "text" : specie.ordenvalido, 'state': {'opened': true, 'selected': false},"icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 5, "type": 0}})
} }
}) })
console.log("************ ordenes ************")
console.log(ordenes) console.log(ordenes)
var ordenes_obj = {} var ordenes_obj = {}
...@@ -1107,7 +994,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1107,7 +994,7 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!familias.includes(specie.familiavalida) && specie.ordenvalido === orden){ if(!familias.includes(specie.familiavalida) && specie.ordenvalido === orden){
familias.push(specie.familiavalida) familias.push(specie.familiavalida)
data_cov.push({ "id" : specie.familiavalida , "parent" : specie.ordenvalido , "text" : specie.familiavalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 2, "type": 0}}) data_cov.push({ "id" : specie.familiavalida , "parent" : specie.ordenvalido , "text" : specie.familiavalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 6, "type": 0}})
} }
}) })
var familias_obj = {} var familias_obj = {}
...@@ -1116,7 +1003,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1116,7 +1003,7 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!generos.includes(specie.generovalido) && specie.familiavalida === familia){ if(!generos.includes(specie.generovalido) && specie.familiavalida === familia){
generos.push(specie.generovalido); generos.push(specie.generovalido);
data_cov.push({ "id" : specie.generovalido , "parent" : specie.familiavalida , "text" : specie.generovalido, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 3, "type": 0}}) data_cov.push({ "id" : specie.generovalido , "parent" : specie.familiavalida , "text" : specie.generovalido, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 7, "type": 0}})
} }
}) })
var generos_obj = {} var generos_obj = {}
...@@ -1125,7 +1012,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1125,7 +1012,7 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!especievalida.includes(specie.especievalida) && specie.generovalido === genero){ if(!especievalida.includes(specie.especievalida) && specie.generovalido === genero){
especievalida.push(specie.especievalida) especievalida.push(specie.especievalida)
data_cov.push({ "id" : specie.especievalida , "parent" : specie.generovalido , "text" : specie.especievalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 4, "type": 0}}) data_cov.push({ "id" : specie.especievalida , "parent" : specie.generovalido , "text" : specie.especievalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 8, "type": 0}})
} }
}) })
generos_obj[genero] = especievalida generos_obj[genero] = especievalida
...@@ -1140,7 +1027,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1140,7 +1027,7 @@ var variable_module = (function (verbose, url_zacatuche) {
console.log("jstree_variables_species_fuente") console.log("jstree_variables_species_fuente")
$('#jstree_variables_species_' + id).jstree("destroy").empty(); $('#jstree_variables_species_' + id).jstree("destroy").empty();
$('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar); $('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar);
$("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVar); $("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVarFuente);
$("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes); $("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes);
self.value_vartree = ui.item.id; self.value_vartree = ui.item.id;
...@@ -1171,7 +1058,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1171,7 +1058,7 @@ var variable_module = (function (verbose, url_zacatuche) {
}else if(self.varfilter_selected[1] === "familia"){ }else if(self.varfilter_selected[1] === "familia"){
var button_val = lst[2] var button_val = lst[2]
var query = "query{all_snib_covariables(limit:2000, filter:\""+ button_val +" ='"+ ui.item.id +"'\"){familiavalida generovalido especievalida}}" var query = "query{all_snib_covariables(limit:2500, filter:\""+ button_val +" ='"+ ui.item.id +"'\"){familiavalida generovalido especievalida}}"
$.ajax({ $.ajax({
url: "https://covid19.c3.unam.mx/gateway/api/nodes/", url: "https://covid19.c3.unam.mx/gateway/api/nodes/",
method: "POST", method: "POST",
...@@ -1191,18 +1078,18 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1191,18 +1078,18 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!familias.includes(specie.familiavalida)){ if(!familias.includes(specie.familiavalida)){
familias.push(specie.familiavalida) familias.push(specie.familiavalida)
data_cov.push({ "id" : specie.familiavalida , "parent" : "#" , "text" : specie.familiavalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 1, "type": 0}}) data_cov.push({ "id" : specie.familiavalida , "parent" : "#" , "text" : specie.familiavalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 6, "type": 0}})
} }
}) })
console.log("********** familias *************")
var familias_obj = {} var familias_obj = {}
familias.forEach(familia=>{ familias.forEach(familia=>{
var generos = [] var generos = []
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!generos.includes(specie.generovalido) && specie.familiavalida === familia){ if(!generos.includes(specie.generovalido) && specie.familiavalida === familia){
generos.push(specie.generovalido) generos.push(specie.generovalido)
data_cov.push({ "id" : specie.generovalido , "parent" : specie.familiavalida , "text" : specie.generovalido, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 2, "type": 0}}) data_cov.push({ "id" : specie.generovalido , "parent" : specie.familiavalida , "text" : specie.generovalido, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 7, "type": 0}})
} }
}) })
var generos_obj = {} var generos_obj = {}
...@@ -1211,7 +1098,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1211,7 +1098,7 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!especievalida.includes(specie.especievalida) && specie.generovalido === genero){ if(!especievalida.includes(specie.especievalida) && specie.generovalido === genero){
especievalida.push(specie.especievalida) especievalida.push(specie.especievalida)
data_cov.push({ "id" : specie.especievalida , "parent" : specie.generovalido , "text" : specie.especievalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 3, "type": 0}}) data_cov.push({ "id" : specie.especievalida , "parent" : specie.generovalido , "text" : specie.especievalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 8, "type": 0}})
} }
}) })
generos_obj[genero] = especievalida generos_obj[genero] = especievalida
...@@ -1224,7 +1111,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1224,7 +1111,7 @@ var variable_module = (function (verbose, url_zacatuche) {
console.log("jstree_variables_species_fuente") console.log("jstree_variables_species_fuente")
$('#jstree_variables_species_' + id).jstree("destroy").empty(); $('#jstree_variables_species_' + id).jstree("destroy").empty();
$('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar); $('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar);
$("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVar); $("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVarFuente);
$("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes); $("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes);
self.value_vartree = ui.item.id; self.value_vartree = ui.item.id;
...@@ -1274,11 +1161,11 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1274,11 +1161,11 @@ var variable_module = (function (verbose, url_zacatuche) {
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!generos.includes(specie.generovalido)){ if(!generos.includes(specie.generovalido)){
generos.push(specie.generovalido) generos.push(specie.generovalido)
data_cov.push({ "id" : specie.generovalido , "parent" : "#" , "text" : specie.generovalido, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 1, "type": 0}}) data_cov.push({ "id" : specie.generovalido , "parent" : "#" , "text" : specie.generovalido, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 7, "type": 0}})
} }
}) })
console.log(generos) // console.log(generos)
var generos_obj = {} var generos_obj = {}
generos.forEach(genero=>{ generos.forEach(genero=>{
var especievalida = [] var especievalida = []
...@@ -1296,7 +1183,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1296,7 +1183,7 @@ var variable_module = (function (verbose, url_zacatuche) {
console.log("jstree_variables_species_fuente") console.log("jstree_variables_species_fuente")
$('#jstree_variables_species_' + id).jstree("destroy").empty(); $('#jstree_variables_species_' + id).jstree("destroy").empty();
$('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar); $('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar);
$("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVar); $("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVarFuente);
$("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes); $("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes);
self.value_vartree = ui.item.id; self.value_vartree = ui.item.id;
...@@ -1336,33 +1223,32 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1336,33 +1223,32 @@ var variable_module = (function (verbose, url_zacatuche) {
success: function(resp){ success: function(resp){
var sel = resp.data.all_snib_covariables var sel = resp.data.all_snib_covariables
console.log(sel) console.log(sel)
var data_cov = [{ "id" : "raiz" , "parent" :"#", "text" : "raiz", 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 1, "type": 0}}] var data_cov = [{ "id" : "raiz" , "parent" :"#", "text" : "raiz", 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 7, "type": 0}}]
var species_names = []; var species_names = [];
sel.forEach(specie=>{ sel.forEach(specie=>{
if(!species_names.includes(specie.especievalida)){ if(!species_names.includes(specie.especievalida)){
species_names.push(specie.especievalida) species_names.push(specie.especievalida)
data_cov.push(data_cov.push({ "id" : specie.especievalida , "parent" :"raiz", "text" : specie.especievalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 2, "type": 0}})) data_cov.push(data_cov.push({ "id" : specie.especievalida , "parent" :"raiz", "text" : specie.especievalida, 'state': {'opened': false}, "icon": "plugins/jstree/images/dna.png", 'attr': {'nivel': 8, "type": 0}}))
} }
}) })
console.log(data_cov) // console.log(data_cov)
console.log("**********arbol**********") // console.log("jstree_variables_species_fuente")
console.log("jstree_variables_species_fuente")
$('#jstree_variables_species_' + id).jstree("destroy").empty(); $('#jstree_variables_species_' + id).jstree("destroy").empty();
$('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar); $('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar);
$("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVar); $("#jstree_variables_species_" + id).on('changed.jstree', self.getChangeTreeVarFuente);
$("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes); $("#jstree_variables_species_" + id).on('loaded.jstree', self.loadNodes);
// self.value_vartree = ui.item.id; self.value_vartree = ui.item.id;
// self.field_vartree = self.varfilter_selected[0]; self.field_vartree = self.varfilter_selected[0];
// self.parent_field_vartree = self.varfilter_selected[1]; self.parent_field_vartree = self.varfilter_selected[1];
// self.level_vartree = self.varfilter_selected[2]; self.level_vartree = self.varfilter_selected[2];
// _VERBOSE ? console.log("nivel") : _VERBOSE; _VERBOSE ? console.log("nivel") : _VERBOSE;
// _VERBOSE ? console.log(self.level_vartree) : _VERBOSE; _VERBOSE ? console.log(self.level_vartree) : _VERBOSE;
var icon = parseInt(self.level_vartree) === 8 ? "plugins/jstree/images/dna.png" : "plugins/jstree/images/dna.png" var icon = parseInt(self.level_vartree) === 8 ? "plugins/jstree/images/loagind.gif" : "plugins/jstree/images/loading.gif"
// _VERBOSE ? console.log(self.level_vartree) : _VERBOSE; _VERBOSE ? console.log(self.level_vartree) : _VERBOSE;
$('#jstree_variables_species_' + id).jstree({ $('#jstree_variables_species_' + id).jstree({
'plugins': ["wholerow", "checkbox"], 'plugins': ["wholerow", "checkbox"],
'core': { 'core': {
...@@ -1380,7 +1266,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1380,7 +1266,7 @@ var variable_module = (function (verbose, url_zacatuche) {
}) })
} }
console.log(query)
// $('#jstree_variables_species_' + id).jstree("destroy").empty(); // $('#jstree_variables_species_' + id).jstree("destroy").empty();
// $('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar); // $('#jstree_variables_species_' + id).on('open_node.jstree', self.getTreeVar);
...@@ -1450,10 +1336,16 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1450,10 +1336,16 @@ var variable_module = (function (verbose, url_zacatuche) {
.attr('type', 'button') .attr('type', 'button')
.addClass('btn btn-primary glyphicon glyphicon-plus pull-left no-mg-top') .addClass('btn btn-primary glyphicon glyphicon-plus pull-left no-mg-top')
.click(function (e) { .click(function (e) {
switch(id){
console.log('>>>>>>>>>>>>>> este es mi id ' + id) case "fuente":
self.formQuery('jstree_variables_species_'+ id, self.arrayVarSelectedFuente2)
self.addOtherGroup('jstree_variables_species_' + id, self.arrayVarSelected, 'Bio', 'treeAddedPanel_' + id, _TYPE_BIO); self.addOtherGroup('jstree_variables_species_' + id, self.arrayVarSelectedFuente, 'Bio', 'treeAddedPanel_' + id, _TYPE_BIO);
break;
case "target":
self.formQuery('jstree_variables_species_'+ id, self.arrayVarSelectedTarget2)
self.addOtherGroup('jstree_variables_species_' + id, self.arrayVarSelectedTarget, 'Bio', 'treeAddedPanel_' + id, _TYPE_BIO);
break;
}
$('#jstree_variables_species_' + id).jstree("destroy").empty(); $('#jstree_variables_species_' + id).jstree("destroy").empty();
$('#jstree_variables_species_' + id).off('open_node.jstree', self.getTreeVar); $('#jstree_variables_species_' + id).off('open_node.jstree', self.getTreeVar);
$("#jstree_variables_species_" + id).off('changed.jstree', self.getChangeTreeVar); $("#jstree_variables_species_" + id).off('changed.jstree', self.getChangeTreeVar);
...@@ -1550,12 +1442,13 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1550,12 +1442,13 @@ var variable_module = (function (verbose, url_zacatuche) {
else if (i === 1) { else if (i === 1) {
// generando tab panel para variables climaticas // generando tab panel para variables climaticas
// _VERBOSE ? console.log(tags[i]) : _VERBOSE;
var tab_pane = $('<div/>') var tab_pane = $('<div/>')
.attr('id', 'tab' + i + "_" + id) .attr('id', 'tab' + i + "_" + id)
.addClass('tab-pane') .addClass('tab-pane')
.appendTo(tab_content); .appendTo(tab_content)
...@@ -1582,6 +1475,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1582,6 +1475,7 @@ var variable_module = (function (verbose, url_zacatuche) {
.addClass('btn btn-primary glyphicon glyphicon-plus pull-left') .addClass('btn btn-primary glyphicon glyphicon-plus pull-left')
.click(function (e) { .click(function (e) {
self.formQuery('jstree_variables_bioclim_' + id, self.arrayBioclimSelected2)
self.addOtherGroup('jstree_variables_bioclim_' + id, self.arrayBioclimSelected, 'Raster', 'treeAddedPanel_' + id, _TYPE_ABIO); self.addOtherGroup('jstree_variables_bioclim_' + id, self.arrayBioclimSelected, 'Raster', 'treeAddedPanel_' + id, _TYPE_ABIO);
e.preventDefault(); e.preventDefault();
...@@ -1596,7 +1490,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1596,7 +1490,7 @@ var variable_module = (function (verbose, url_zacatuche) {
self.arrayBioclimSelected = []; self.arrayBioclimSelected = [];
// self.groupbioclimvar_dataset = []; // self.groupbioclimvar_dataset = [];
self.cleanVariables('jstree_variables_bioclim_' + id, 'treeAddedPanel_' + id, _TYPE_ABIO); self.cleanVariables('jstree_variables_bioclim_' + id, 'treeAddedPanel_' + id, _TYPE_TERRESTRE);
e.preventDefault(); e.preventDefault();
}) })
...@@ -1604,172 +1498,60 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1604,172 +1498,60 @@ var variable_module = (function (verbose, url_zacatuche) {
// carga árbol de variables raster // carga árbol de variables raster
self.loadTreeVarRaster(); //self.loadTreeVarRaster();
}
});
// Es un evento generado cuando se realiza la carga del árbol de selección (jstree: https://www.jstree.com/) que contiene el selector de variables.
self.loadNodes = function () {
_VERBOSE ? console.log("self.loadNodes") : _VERBOSE;
// se incrementa level para asignar el nivel adecuado a los hijos de la raiz
// la funcion es llamda dos veces, por tantro se decidio utilizar el arreglo + 1, en lufar de utilzar la variable global "level_vartree"
self.level_vartree = parseInt(self.varfilter_selected[2]) + 1;
_VERBOSE ? console.log("level_vartree: " + self.level_vartree) : _VERBOSE;
console.log(self.varfilter_selected);
var field_r = self.field_vartree;
var parentfield_r = self.parent_field_vartree;
if(parseInt(self.level_vartree) > 8){
field_r = 'especievalidabusqueda';
parentfield_r = '';
}
_VERBOSE ? console.log(self.field_vartree) : _VERBOSE;
_VERBOSE ? console.log(self.value_vartree) : _VERBOSE;
_REGION_SELECTED = ($("#footprint_region_select").val() !== null && $("#footprint_region_select").val() !== undefined) ? parseInt($("#footprint_region_select").val()) : _REGION_SELECTED;
_GRID_RES = $("#grid_resolution").val();
_AGENT_SELECTED = $("#agent_selected").val();
console.log("REGION_SELECTED: " + _REGION_SELECTED);
console.log("_GRID_RES: " + _GRID_RES);
console.log("_AGENT_SELECTED" + _AGENT_SELECTED);
if (_AGENT_SELECTED == 'Hospederos')
var _url = 'http://10.90.0.42:4006/graphql/hospederos/'
else if (_AGENT_SELECTED == 'Patogenos')
var _url = "http://10.90.0.42:4007/graphql/patogenos/"
else
var _url = "http://10.90.0.42:4008/graphql/vectores/"
let nodo = _AGENT_SELECTED.toLowerCase()
let field_t = field_r.normalize('NFD').replace(/[\u0300-\u036f]/g,"");
let query = 'query{occurrences_by_taxon_' + nodo + '(query: "nombreenfermedad = \''+ _DISEASE_SELECTED + '\' AND '+ varfield.toLowerCase().replace(/é/gi,"e") +' = \'' + self.value_vartree +'\' "){'+ field_r.replace(/é/gi,"e") +'}}'
console.log(query)
$.ajax({
method: "POST",
url: _url,
contentType: "application/json",
data: JSON.stringify({query: query}),
success: function (resp) {
console.log(resp)
let data2 = resp.data["occurrences_by_taxon_"+ nodo]
console.log(data2)
let uniqueObjArray = [
...new Map(data2.map((item) => [item["name"], item])).values(),
];
console.log(uniqueObjArray)
let data = uniqueObjArray
var current_node = $('#jstree_variables_species_' + id).jstree(true).get_node($("#root"));
//current_node.prop('title', );
$('ul').tooltip('hide');
$('li').tooltip('hide');
$('li').removeAttr("title");
$('li').removeAttr("data-original-title");
$('#jstree_variables_species_' + id).removeAttr("data-original-title");
$('#jstree_variables_species_' + id).removeAttr("title");
if(field_r !== 'especievalidabusqueda'){
for (i = 0; i < data.length; i++) {
var idNode = "";
let result = field_r;
console.log(Object.values(data))
var namesp1 = data[i]
var namesp = namesp1[field_r]
console.log(namesp)
var namesp = namesp1[field_r].replace(/ /g,"").replace(/\%/g,"").replace(/\)/g,"").replace(/\(/g,"").replace(/\./g,"").replace(/,/g,"")
// console.log(namesp)
if ($("#" + namesp).length > 0) {
idNode = namesp + "_" + Math.floor((Math.random() * 1000) + 1)
} else {
idNode = namesp;
}
console.log("idNode: " + idNode)
var default_son = self.level_vartree < 8 ? [{text: "cargando..."}] : [];
var label_taxon = self.level_vartree < 8 ? namesp1[field_r] : namesp1[field_r];
// label_taxon = self.level_vartree == 8 ? self.value_vartree + " " + label_taxon : label_taxon;
// _VERBOSE ? console.log(self.parent_field_vartree) : _VERBOSE;
// _VERBOSE ? console.log(data[i].name) : _VERBOSE;
var newNode = {
id: idNode,
text: label_taxon, //data[i].name + " (spp: " + data[i].spp + ")",
icon: "plugins/jstree/images/dna.png",
attr: {
"nivel": self.level_vartree,
"type": _TYPE_TAXON
},
state: {'opened': false},
"children": default_son
};
if(data[i].description+'' !== 'undefined'){
newNode['li_attr'] = {"title": data[i].description + ' ' + data[i].name.split(' ')[1]};
}
$('#jstree_variables_species_' + id).jstree("create_node", current_node, newNode, 'last', false, false);
} }
else if (i===2){
var tab_pane = $('<div/>')
.attr('id', 'tab' + i + "_" + id)
.addClass('tab-pane')
.appendTo(tab_content)
} var tree_nav_container = $('<div/>')
.addClass('row nav_species_container')
.appendTo(tab_pane)
$("#jstree_variables_species_" + id).jstree(true).set_icon(current_node.id, "./plugins/jstree/images/dna.png");
var description_complement = '';
if(namesp1[field_r].split(' ').length > 1 && field_r === 'especievalidabusqueda'){ var div_tree = $('<div/>')
.attr('id', "treeVariableSocio" + id)
.addClass('myScrollableBlockVar')
.appendTo(tree_nav_container);
description_complement += namesp1[field_r].split(' ')[1]; var tree = $('<div/>')
.attr('id', "jstree_variables_socio_" + id)
.appendTo(div_tree);
}
if(data[0].description+'' !== 'undefined'){ var btn_add = $('<button/>')
.attr('id', 'add_group_bioclim' + "_" + id)
.attr('type', 'button')
.addClass('btn btn-primary glyphicon glyphicon-plus pull-left')
.click(function (e) {
$("#jstree_variables_species_" + id).prop('title', data[0].description + ' ' + description_complement); self.formQuery("jstree_variables_socio_" + id, self.arraySocioSelected2)
$("#jstree_variables_species_" + id).prop('data-original-title', data[0].description + ' ' + description_complement); self.addOtherGroup("jstree_variables_socio_" + id, self.arraySocioSelected, 'Socio', 'treeAddedPanel_' + id, _TYPE_ABIO);
$("#jstree_variables_species_" + id).tooltip(); e.preventDefault();
$('li').tooltip();
$('ul').tooltip();
} })
.appendTo(tab_pane);
} var btn_add = $('<button/>')
.attr('id', 'clean_var_bioclim' + "_" + id)
.attr('type', 'button')
.addClass('btn btn-primary glyphicon glyphicon-trash pull-left')
.click(function (e) {
// self.groupbioclimvar_dataset = [];
self.cleanVariables("jstree_variables_socio_" + id, 'treeAddedPanel_' + id, _TYPE_ABIO);
e.preventDefault();
}) })
.appendTo(tab_pane);
} }
});
// Evento generado cuando se realiza la acción de abrir una rama del árbol de selección, realiza la carga de los elementos que componen la rama a la cual se desea tener acceso. // Evento generado cuando se realiza la acción de abrir una rama del árbol de selección, realiza la carga de los elementos que componen la rama a la cual se desea tener acceso.
self.getTreeVar = function (e, d) { self.getTreeVar = function (e, d) {
...@@ -1777,6 +1559,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1777,6 +1559,7 @@ var variable_module = (function (verbose, url_zacatuche) {
_VERBOSE ? console.log(d.node.original.attr.nivel) : _VERBOSE; _VERBOSE ? console.log(d.node.original.attr.nivel) : _VERBOSE;
_VERBOSE ? console.log(d.node.children) : _VERBOSE; _VERBOSE ? console.log(d.node.children) : _VERBOSE;
console.log("esto es d "+ d)
if (d.node.children.length > 1){ if (d.node.children.length > 1){
console.log("No se encontraron datos debajo de este nivel") console.log("No se encontraron datos debajo de este nivel")
...@@ -1836,14 +1619,11 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1836,14 +1619,11 @@ var variable_module = (function (verbose, url_zacatuche) {
console.log("REGION_SELECTED: " + _REGION_SELECTED); console.log("REGION_SELECTED: " + _REGION_SELECTED);
console.log("_GRID_RES: " + _GRID_RES); console.log("_GRID_RES: " + _GRID_RES);
if (_AGENT_SELECTED == 'Hospederos')
var _url = 'http://10.90.0.42:4006/graphql/hospederos/' var _url="https://covid19.c3.unam.mx/gateway/api/nodes/"
else if (_AGENT_SELECTED == 'Patogenos')
var _url = "http://10.90.0.42:4007/graphql/patogenos/"
else
var _url = "http://10.90.0.42:4008/graphql/vectores/"
let nodo = _AGENT_SELECTED.toLowerCase() let nodo = _AGENT_SELECTED.toLowerCase()
let _DISEASE_SELECTED = $("#disease_selected option:selected").text();
let query = 'query{occurrences_by_taxon_' + nodo + '(query: "nombreenfermedad = \''+ _DISEASE_SELECTED + '\' AND '+ parent_field.toLowerCase() +' = \'' + label_value +'\' "){'+ next_field +'}}' let query = 'query{occurrences_by_taxon_' + nodo + '(query: "nombreenfermedad = \''+ _DISEASE_SELECTED + '\' AND '+ parent_field.toLowerCase() +' = \'' + label_value +'\' "){'+ next_field +'}}'
...@@ -1945,62 +1725,72 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -1945,62 +1725,72 @@ var variable_module = (function (verbose, url_zacatuche) {
// Evento generado cuando cambia el estado de selección del árbol, almacena los elementos que fueron seleccionados del grupo de variables taxonómicas. // Evento generado cuando cambia el estado de selección del árbol, almacena los elementos que fueron seleccionados del grupo de variables taxonómicas.
self.getChangeTreeVar = function (e, data) { self.getChangeTreeVarTarget = function (e, data) {
console.log("cambiaste el arbol") console.log("cambiaste el arbol")
_VERBOSE ? console.log("self.getChangeTreeVar") : _VERBOSE; _VERBOSE ? console.log("self.getChangeTreeVar") : _VERBOSE;
self.arrayVarSelected = []; self.arrayVarSelectedTarget = []; //para el front
self.arrayVarSelectedTarget2 = []; //para el query
if ($('#jstree_variables_species_' + id).jstree(true).get_top_selected().length > 0) { if ($('#jstree_variables_species_target').jstree(true).get_top_selected().length > 0) {
// _VERBOSE ? console.log("acceder node header del dom") : _VERBOSE; // _VERBOSE ? console.log("acceder node header del dom") : _VERBOSE;
var headers_selected = $('#jstree_variables_species_' + id).jstree(true).get_top_selected().length; var headers_selected = $('#jstree_variables_species_target').jstree(true).get_top_selected().length;
for (i = 0; i < headers_selected; i++) { for (i = 0; i < headers_selected; i++) {
var node_temp = $('#jstree_variables_species_' + id).jstree(true).get_node($('#jstree_variables_species_' + id).jstree(true).get_top_selected()[i]).original; var node_temp = $('#jstree_variables_species_target').jstree(true).get_node($('#jstree_variables_species_target').jstree(true).get_top_selected()[i]).original;
var level = ""; var level = "";
if (node_temp.attr.nivel == 2) if (node_temp.attr.nivel == 2)
level = _iTrans.prop('a_item_reino'); //level = _iTrans.prop('a_item_reino');
level = "kingdom"
else if (node_temp.attr.nivel == 3) else if (node_temp.attr.nivel == 3)
level = _iTrans.prop('a_item_phylum'); //level = _iTrans.prop('a_item_phylum');
level = "phylum"
else if (node_temp.attr.nivel == 4) else if (node_temp.attr.nivel == 4)
level = _iTrans.prop('a_item_clase'); //level = _iTrans.prop('a_item_clase');
level = "class"
else if (node_temp.attr.nivel == 5) else if (node_temp.attr.nivel == 5)
level = _iTrans.prop('a_item_orden'); //level = _iTrans.prop('a_item_orden');
level = "order"
else if (node_temp.attr.nivel == 6) else if (node_temp.attr.nivel == 6)
level = _iTrans.prop('a_item_familia'); //level = _iTrans.prop('a_item_familia');
level = "family"
else if (node_temp.attr.nivel == 7) else if (node_temp.attr.nivel == 7)
level = _iTrans.prop('a_item_genero'); //level = _iTrans.prop('a_item_genero');
level = "genus"
else if (node_temp.attr.nivel == 8) else if (node_temp.attr.nivel == 8)
level = _iTrans.prop('a_item_especie'); //level = _iTrans.prop('a_item_especie');
level = "species"
_VERBOSE ? console.log("level: " + level) : _VERBOSE; _VERBOSE ? console.log("level: " + level) : _VERBOSE;
var parent_node = $('#jstree_variables_species_' + id).jstree(true).get_node($('#jstree_variables_species_' + id).jstree(true).get_parent($('#jstree_variables_species_' + id).jstree(true).get_top_selected()[i])).original; var parent_node = $('#jstree_variables_species_target').jstree(true).get_node($('#jstree_variables_species_target').jstree(true).get_parent($('#jstree_variables_species_' + id).jstree(true).get_top_selected()[i])).original;
_VERBOSE ? console.log(parent_node) : _VERBOSE; _VERBOSE ? console.log(parent_node) : _VERBOSE;
_VERBOSE ? console.log(node_temp) : _VERBOSE; _VERBOSE ? console.log(node_temp) : _VERBOSE;
if (parent_node) { if (parent_node ) {
self.arrayVarSelectedTarget.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type, parent: parent_node.text});
self.arrayVarSelectedTarget2.push({taxon: level, value:node_temp.text })
self.arrayVarSelected.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type, parent: parent_node.text}); // if (node_temp.attr.nivel == 8) {
// if (node_temp.attr.nivel == 8) { // self.arrayVarSelected.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type, parent: parent_node.text});
//
// self.arrayVarSelected.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type, parent: parent_node.text}); // }
// // else {
// }
// else { // self.arrayVarSelected.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type, parent: parent_node.text});
// // }
// self.arrayVarSelected.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type, parent: parent_node.text});
// }
} else { } else {
self.arrayVarSelected.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type}); self.arrayVarSelectedTarget.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type});
self.arrayVarSelectedTarget2.push({taxon: level, value: node_temp.text })
} }
...@@ -2008,34 +1798,219 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2008,34 +1798,219 @@ var variable_module = (function (verbose, url_zacatuche) {
} }
_VERBOSE ? console.log(self.arrayVarSelected) : _VERBOSE; _VERBOSE ? console.log(self.arrayVarSelectedTarget) : _VERBOSE;
_VERBOSE ? console.log(self.arrayVarSelectedTarget2) : _VERBOSE;
}; };
self.getChangeTreeVarFuente = function (e, data) {
console.log("cambiaste el arbol")
_VERBOSE ? console.log("self.getChangeTreeVarFuente") : _VERBOSE;
self.arrayVarSelectedFuente = []; //para el front
self.arrayVarSelectedFuente2 = []; //para el query
console.log($('#jstree_variables_species_fuente').jstree(true).get_top_selected().length)
if ($('#jstree_variables_species_fuente').jstree(true).get_top_selected().length > 0) {
// _VERBOSE ? console.log("acceder node header del dom") : _VERBOSE;
var headers_selected = $('#jstree_variables_species_fuente').jstree(true).get_top_selected().length;
for (i = 0; i < headers_selected; i++) {
var node_temp = $('#jstree_variables_species_fuente').jstree(true).get_node($('#jstree_variables_species_fuente').jstree(true).get_top_selected()[i]).original;
var level = "";
if (node_temp.attr.nivel == 2)
//level = _iTrans.prop('a_item_reino');
level = "kingdom"
else if (node_temp.attr.nivel == 3)
//level = _iTrans.prop('a_item_phylum');
level = "phylum"
else if (node_temp.attr.nivel == 4)
//level = _iTrans.prop('a_item_clase');
level = "class"
else if (node_temp.attr.nivel == 5)
//level = _iTrans.prop('a_item_orden');
level = "order"
else if (node_temp.attr.nivel == 6)
//level = _iTrans.prop('a_item_familia');
level = "family"
else if (node_temp.attr.nivel == 7)
//level = _iTrans.prop('a_item_genero');
level = "genus"
else if (node_temp.attr.nivel == 8)
//level = _iTrans.prop('a_item_especie');
level = "species"
_VERBOSE ? console.log("level: " + level) : _VERBOSE;
var parent_node = $('#jstree_variables_species_fuente').jstree(true).get_node($('#jstree_variables_species_fuente').jstree(true).get_parent($('#jstree_variables_species_' + id).jstree(true).get_top_selected()[i])).original;
_VERBOSE ? console.log(parent_node) : _VERBOSE;
_VERBOSE ? console.log(node_temp) : _VERBOSE;
if (parent_node ) {
self.arrayVarSelectedFuente.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type, parent: parent_node.text});
self.arrayVarSelectedFuente2.push({taxon: level, value:node_temp.text })
// if (node_temp.attr.nivel == 8) {
// self.arrayVarSelected.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type, parent: parent_node.text});
// }
// else {
// self.arrayVarSelected.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type, parent: parent_node.text});
// }
} else {
self.arrayVarSelectedFuente.push({label: node_temp.text, level: level, numlevel: node_temp.attr.nivel, type: node_temp.attr.type});
self.arrayVarSelectedFuente2.push({taxon: level, value: node_temp.text })
}
}
}
_VERBOSE ? console.log(self.arrayVarSelectedFuente) : _VERBOSE;
_VERBOSE ? console.log(self.arrayVarSelectedFuente2) : _VERBOSE;
};
// Evento generado cuando cambia el estado de selección del árbol, almacena los elementos que fueron seleccionados del grupo de variables climáticas. // Evento generado cuando cambia el estado de selección del árbol, almacena los elementos que fueron seleccionados del grupo de variables climáticas.
self.getChangeTreeVarRaster = function (e, data) { self.getChangeTreeVarRaster = function (e, data) {
_VERBOSE ? console.log("self.getChangeTreeVarRaster") : _VERBOSE; _VERBOSE ? console.log("self.getChangeTreeVarRaster") : _VERBOSE;
self.arrayBioclimSelected= [];
self.arrayBioclimSelected2 = [];
console.log($("#treeVariableBioclim_fuente").jstree(true).get_top_selected())
self.arrayBioclimSelected = []; if($("#treeVariableBioclim_fuente").jstree(true).get_top_selected()[0] === 'WorlClim' && $("#treeVariableBioclim_fuente").jstree(true).get_top_selected().length > 0){
// _module_toast = toast_module(_VERBOSE);
// _module_toast.startToast();
_module_toast.showToast_CenterCenter("Cargando todos los layers de Worldclim", "info")
self.arrayBioclimSelected.push({label: "WordlClim", id: " ", parent: "Raster ", level: "5", type: " "})
$.ajax({
method: "POST",
url: "https://covid19.c3.unam.mx/gateway/api/nodes/",
contentType: "application/json",
data: JSON.stringify({query: "query{ all_worldclim_covariables(limit: 1000, filter: \"\"){ layer}}"}),
success: function(resp){
_module_toast.showToast_CenterCenter("Se han cargado todos los layers", "success")
var layers=[]
resp.data.all_worldclim_covariables.forEach(json=>{
if(!layers.includes(json.layer)){
layers.push(json.layer)
}
})
layers.forEach(layer=>{
self.arrayBioclimSelected2.push({taxon:"layer", value:layer})
})
if ($('#jstree_variables_bioclim_' + id).jstree(true).get_top_selected().length > 0) {
var headers_selected = $('#jstree_variables_bioclim_' + id).jstree(true).get_top_selected().length; }
})
}else if ($("#treeVariableBioclim_fuente").jstree(true).get_top_selected().length > 0) {
console.log("elegiste algúnos nodos")
var headers_selected = $("#treeVariableBioclim_fuente").jstree(true).get_top_selected().length;
for (i = 0; i < headers_selected; i++) { for (i = 0; i < headers_selected; i++) {
var node_temp = $('#jstree_variables_bioclim_' + id).jstree(true).get_node($('#jstree_variables_bioclim_' + id).jstree(true).get_top_selected()[i]).original; var node_temp = $("#treeVariableBioclim_fuente").jstree(true).get_node($("#treeVariableBioclim_fuente").jstree(true).get_top_selected()[i]).original;
_VERBOSE ? console.log(node_temp) : _VERBOSE; _VERBOSE ? console.log(node_temp) : _VERBOSE;
if(node_temp.attr.nivel===7){
self.arrayBioclimSelected.push({label: node_temp.text, id: node_temp.attr.layer, parent: node_temp.parent, level: node_temp.attr.level, type: node_temp.attr.type});
self.arrayBioclimSelected2.push({taxon:"layer" , value: node_temp.attr.layer})
}else if(node_temp.attr.nivel ===8){
self.arrayBioclimSelected.push({label: node_temp.text, id: node_temp.attr.layer, parent: node_temp.parent, level: node_temp.attr.level, type: node_temp.attr.type});
self.arrayBioclimSelected2.push({taxon:"id" , value: node_temp.attr.id})
self.arrayBioclimSelected.push({label: node_temp.text, id: node_temp.attr.bid, parent: node_temp.attr.parent, level: node_temp.attr.level, type: node_temp.attr.type}); }
} }
} }
_VERBOSE ? console.log(self.arrayBioclimSelected) : _VERBOSE;
_VERBOSE ? console.log(self.arrayBioclimSelected2) : _VERBOSE;
}; };
self.getChangeTreeVarSocio = function(e, data){
_VERBOSE ? console.log("self.getChangeTreeVarSocio") : _VERBOSE;
self.arraySocioSelected=[];
self.arraySocioSelected2=[];
console.log("socioselected2 es ")
console.log(self.arraySocioSelected2)
console.log($("#jstree_variables_socio_fuente").jstree(true).get_top_selected())
if($("#jstree_variables_socio_fuente").jstree(true).get_top_selected()[0]==="inegi" && $("#jstree_variables_socio_fuente").jstree(true).get_top_selected().length > 0){
_module_toast.showToast_CenterCenter("Cargando todos los layers de INEGI", "info")
self.arraySocioSelected.push({label: "INEGI 2020", id: " ", parent: "Socio ", level: "5", type: " "})
console.log("elegiste INEGI2020")
$.ajax({
method: "POST",
url: "https://covid19.c3.unam.mx/gateway/api/nodes/",
contentType: "application/json",
data: JSON.stringify({query: "query{all_censo_inegi_2020_covariables(limit: 2000, filter:\"\"){code}}"}),
success:function(resp){
var codes=[]
resp.data.all_censo_inegi_2020_covariables.forEach(json=>{
if(!codes.includes(json.code)){
codes.push(json.code)
}
})
console.log(self.arraySocioSelected2)
codes.forEach(code=>{
self.arraySocioSelected2.push({taxon: "code", value: code})
})
_module_toast.showToast_CenterCenter("Se han cargado todos los layers", "success")
}
})
}else if ($("#jstree_variables_socio_fuente").jstree(true).get_top_selected().length > 0) {
console.log("elegiste alguno de los nodos")
var headers_selected = $("#jstree_variables_socio_fuente").jstree(true).get_top_selected().length;
for (i = 0; i < headers_selected; i++) {
var node_temp = $("#jstree_variables_socio_fuente").jstree(true).get_node($("#jstree_variables_socio_fuente").jstree(true).get_top_selected()[i]).original;
_VERBOSE ? console.log(node_temp) : _VERBOSE;
if (node_temp.attr.nivel === 7){
self.arraySocioSelected.push({label: node_temp.text, id: node_temp.attr, parent: node_temp.parent, level: node_temp.attr.level, type: node_temp.attr.type});
self.arraySocioSelected2.push({taxon: "code", value: node_temp.attr.code})
}else if(node_temp.attr.nivel === 8){
self.arraySocioSelected.push({label: node_temp.text, id: node_temp.attr, parent: node_temp.attr.parent, level: node_temp.attr.level, type: node_temp.attr.type});
self.arraySocioSelected2.push({taxon: "id", value:node_temp.attr.id })
}
}
}
console.log("Array para el front")
_VERBOSE ? console.log(self.arraySocioSelected) : _VERBOSE;
console.log("Array para el body")
_VERBOSE ? console.log(self.arraySocioSelected2) : _VERBOSE;
}
self.isKingdomLevel = function (arraySelected) { self.isKingdomLevel = function (arraySelected) {
...@@ -2204,14 +2179,53 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2204,14 +2179,53 @@ var variable_module = (function (verbose, url_zacatuche) {
}); });
} }
inegi = [];
worldclim = [];
snib = [];
target_species = []
//Evento que guarda la selección de (co)variables para el elemento covariable_filter
self.formQuery = function (idTree, arraySelected2){
_VERBOSE ? console.log("self.formQuery") : _VERBOSE;
console.log(idTree)
console.log(arraySelected2)
switch (idTree) {
case 'jstree_variables_socio_fuente':
inegi=[...arraySelected2]
console.log("se agregó información de inegi2020")
console.log(inegi)
break;
case 'jstree_variables_bioclim_fuente':
worldclim=[...arraySelected2]
console.log("se agregó información de worldclim")
console.log(worldclim)
break;
case "jstree_variables_species_fuente" :
snib=[...arraySelected2]
console.log("se agrego información a snib")
console.log(snib)
break;
case "jstree_variables_species_target":
target_species=[...arraySelected2]
console.log("se agrego información a target")
console.log(target_species)
break;
default:
console.log("nada que hacer");
break;
}
}
// Evento que es generado cuando se desea agregar un grupo seleccionado previamente, realiza la adición del grupo seleccionado al conjunto de variables con las cuales se realizan los cálculos de épsilon y score en ambos sistemas // Evento que es generado cuando se desea agregar un grupo seleccionado previamente, realiza la adición del grupo seleccionado al conjunto de variables con las cuales se realizan los cálculos de épsilon y score en ambos sistemas
self.addOtherGroup = function (idTree, arraySelected, gpoName, idDivContainer, typeVar) { self.addOtherGroup = function (idTree, arraySelected, gpoName, idDivContainer, typeVar) {
_VERBOSE ? console.log("self.addOtherGroup") : _VERBOSE; _VERBOSE ? console.log("self.addOtherGroup") : _VERBOSE;
// console.log(idTree); console.log("***** addOtherGroup variables *****")
console.log(arraySelected); console.log(idTree)
console.log(arraySelected)
const iterator = arraySelected.values(); const iterator = arraySelected.values();
for (const value of iterator) { for (const value of iterator) {
...@@ -2225,10 +2239,6 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2225,10 +2239,6 @@ var variable_module = (function (verbose, url_zacatuche) {
} }
// console.log(gpoName);
// console.log(idDivContainer);
// console.log(typeVar);
if (arraySelected.length === 0) if (arraySelected.length === 0)
return; return;
...@@ -2255,18 +2265,25 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2255,18 +2265,25 @@ var variable_module = (function (verbose, url_zacatuche) {
})); }));
var subgroup = []; var subgroup = [];
species_target_array =[]
_VERBOSE ? console.log(arraySelected) : _VERBOSE; _VERBOSE ? console.log(arraySelected) : _VERBOSE;
for (i = 0; i < arraySelected.length; i++) { for (i = 0; i < arraySelected.length; i++) {
// se elimita el spp del label cuando es tipo BIO // se elimita el spp del label cuando es tipo BIO
if (typeVar == _TYPE_BIO) { if (typeVar == _TYPE_BIO) {
var label_taxon = arraySelected[i].numlevel == 8 ? arraySelected[i].label : arraySelected[i].label.split(" ")[0] var label_taxon = arraySelected[i].numlevel == 8 ? arraySelected[i].label : arraySelected[i].label.split(" ")[0]
subgroup.push({label: arraySelected[i].level + " >> " + label_taxon, level: arraySelected[i].numlevel, type: arraySelected[i].type}); subgroup.push({label: arraySelected[i].level + " >> " + label_taxon, level: arraySelected[i].numlevel, type: arraySelected[i].type});
species_target_array.push({ taxon:arraySelected[i].level, value:label_taxon })
} else { } else {
subgroup.push({value: arraySelected[i].id, label: arraySelected[i].parent + " >> " + arraySelected[i].label, level: arraySelected[i].level, type: arraySelected[i].type}); subgroup.push({value: arraySelected[i].id, label: arraySelected[i].parent + " >> " + arraySelected[i].label, level: arraySelected[i].level, type: arraySelected[i].type});
//species_target_array.push({ taxon:arraySelected[i].level, value:label_taxon })
} }
} }
...@@ -2370,11 +2387,11 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2370,11 +2387,11 @@ var variable_module = (function (verbose, url_zacatuche) {
}); });
if (typeVar == _TYPE_TERRESTRE || typeVar == _TYPE_ABIO) { // if (typeVar == _TYPE_TERRESTRE || typeVar == _TYPE_ABIO) {
$('#' + idTree + _id).jstree(true).deselect_all(); // $('#' + idTree + _id).jstree(true).deselect_all();
} else { // } else {
$('#' + idTree + _id).jstree("destroy").empty(); // $('#' + idTree + _id).jstree("destroy").empty();
} // }
// se envia solo el elemento agregado // se envia solo el elemento agregado
self.updateVarSelArray(temp_grupo, _AGREGADO); self.updateVarSelArray(temp_grupo, _AGREGADO);
...@@ -2391,20 +2408,13 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2391,20 +2408,13 @@ var variable_module = (function (verbose, url_zacatuche) {
// Realiza la actualización del grupo final con el cual se realizan los cálculos de épsilon y score. // Realiza la actualización del grupo final con el cual se realizan los cálculos de épsilon y score.
self.updateVarSelArray = function (item, operacion) { self.updateVarSelArray = function (item, operacion) {
// item - llega en forma de array, por tanto para obtener su valor se accede al primer valor // item - llega en forma de array, por tanto para obtener su valor se accede al primer valor
console.log("updateVarSelArray")
console.log(self.var_sel_array)
if (operacion == _BORRADO) { if (operacion == _BORRADO) {
_VERBOSE ? console.log("elemento borrado") : _VERBOSE; _VERBOSE ? console.log("elemento borrado") : _VERBOSE;
$('#jstree_variables_species_target').jstree({
'plugins': ["wholerow", "checkbox"],
'core': {
'data': data,
'themes': {
'name': 'proton',
'responsive': true
},
'check_callback': true
}
});
$.each(self.var_sel_array, function (index, gpo_var) { $.each(self.var_sel_array, function (index, gpo_var) {
...@@ -2421,31 +2431,61 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2421,31 +2431,61 @@ var variable_module = (function (verbose, url_zacatuche) {
_VERBOSE ? console.log("elemento añadido") : _VERBOSE; _VERBOSE ? console.log("elemento añadido") : _VERBOSE;
self.var_sel_array.push({"value": item.elements, "type": item.type, "groupid": item.groupid, "title": item.title}); self.var_sel_array.push({"value": item.elements, "type": item.type, "groupid": item.groupid, "title": item.title});
} }
_VERBOSE ? console.log(self.var_sel_array) : _VERBOSE; _VERBOSE ? console.log(self.var_sel_array) : _VERBOSE;
_VERBOSE ? console.log(self.var_sel_array.length) : _VERBOSE;
//species_target_array guarda los datos target para el body
} }
// Elimina las variables previamente agregadas al grupo final con el cual se realizan los cálculos de épsilon y score. // Elimina las variables previamente agregadas al grupo final con el cual se realizan los cálculos de épsilon y score.
self.cleanVariables = function (idTree, idDivContainer, typeVar) { self.cleanVariables = function (idTree, idDivContainer, typeVar) {
_VERBOSE ? console.log("self.cleanVariables") : _VERBOSE; _VERBOSE ? console.log("self.cleanVariables") : _VERBOSE;
$('#disease_selected').val("dis_default")
$('#' + idDivContainer).empty(); $('#' + idDivContainer).empty();
//agregar caso socioeconomico
if (typeVar == _TYPE_TERRESTRE || typeVar == _TYPE_ABIO) { if (typeVar == _TYPE_TERRESTRE || typeVar == _TYPE_ABIO) {
$('#' + idTree + _id).jstree(true).deselect_all(); $('#treeVariableBioclim_fuente').jstree("deselect_all")
} else { } else {
$('#' + idTree + _id).jstree("destroy").empty(); $('#' + idTree + _id).jstree("destroy").empty();
$('#disease_selected').val("dis_default")
} }
self.var_sel_array = []; self.var_sel_array = [];
self.groupDatasetTotal = []; self.groupDatasetTotal = [];
switch (idTree) {
case 'jstree_variables_socio_fuente':
inegi=[]
console.log("se eliminó información inegi2020")
break;
case 'jstree_variables_bioclim_fuente':
worldclim=[]
console.log("se eliminó información de worldclim")
break;
case "jstree_variables_species_fuente" :
snib=[]
console.log("se eliminó información taxonomica fuente")
break;
case "jstree_variables_species_target":
target_species=[]
console.log("se eliminó información taxonomica target")
break;
default:
console.log(`nada que hacer`);
break;
}
// for(i = 0; i < self.var_sel_array.length; i++){ // for(i = 0; i < self.var_sel_array.length; i++){
// if (self.var_sel_array[i].type == typeVar){ // if (self.var_sel_array[i].type == typeVar){
// self.var_sel_array.splice(i, 1); // self.var_sel_array.splice(i, 1);
...@@ -2459,7 +2499,7 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2459,7 +2499,7 @@ var variable_module = (function (verbose, url_zacatuche) {
self.getVarSelArray = function () { self.getVarSelArray = function () {
_VERBOSE ? console.log("self.getVarSelArray") : _VERBOSE; _VERBOSE ? console.log("self.getVarSelArray") : _VERBOSE;
_VERBOSE ? console.log(self.var_sel_array) : _VERBOSE;
return self.var_sel_array; return self.var_sel_array;
} }
...@@ -2480,18 +2520,22 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2480,18 +2520,22 @@ var variable_module = (function (verbose, url_zacatuche) {
} }
self.getTimeBioclim = function () { self.getTimeBioclim = function () {
_VERBOSE ? console.log("self.getTimeBioclim") : _VERBOSE; _VERBOSE ? console.log("self.getTimeBioclim") : _VERBOSE;
console.log(self.type_time)
return self.type_time; return self.type_time;
}
self.getBodyElements = function(){
//se cargan los elementos necesarios para formar el body
covobj= {"inegi2020": inegi, "snib": snib, "worldclim":worldclim}
return snib, covobj, inegi, worldclim, target_species
} }
} }
function loadAvailableLayers() { function loadAvailableLayers() {
_VERBOSE ? console.log("loadAvailableLayers") : _VERBOSE; _VERBOSE ? console.log("loadAvailableLayers") : _VERBOSE;
...@@ -2521,6 +2565,8 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2521,6 +2565,8 @@ var variable_module = (function (verbose, url_zacatuche) {
} }
/** /**
* Éste método llama a la creación del selector de variables. * Éste método llama a la creación del selector de variables.
* *
...@@ -2579,11 +2625,13 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2579,11 +2625,13 @@ var variable_module = (function (verbose, url_zacatuche) {
_iTrans = _language_module.getI18(); _iTrans = _language_module.getI18();
_tipo_modulo = tipo_modulo; _tipo_modulo = tipo_modulo;
loadAvailableLayers(); //loadAvailableLayers();
} }
/** /**
* Éste método realiza el llamado a la función que inicializa las variables necesarias para la creación del selector de variables. * Éste método realiza el llamado a la función que inicializa las variables necesarias para la creación del selector de variables.
* *
...@@ -2605,12 +2653,6 @@ var variable_module = (function (verbose, url_zacatuche) { ...@@ -2605,12 +2653,6 @@ var variable_module = (function (verbose, url_zacatuche) {
_initializeVarComponents(language_module, tipo_modulo, map_module); _initializeVarComponents(language_module, tipo_modulo, map_module);
} }
function getTreeTargetFunction(agent_selected, disease_text_selected) {
}
return{ return{
startVar: startVar, startVar: startVar,
getVarSelArray: getVarSelArray, getVarSelArray: getVarSelArray,
......
...@@ -107,10 +107,11 @@ header .logo{ ...@@ -107,10 +107,11 @@ header .logo{
} }
header #logoPINCC{ header #logoPINCC{
background-color: rgba(195,195,195,.25); background-color: rgba(195,195,195,.25);
background-image: url(https://www.pincc.unam.mx/wp-content/uploads/2021/04/cropped-logo_pincc_alta.png); background-image: url(/images/pincc.jpg);
background-size:4em; background-size:5em;
width: 5em; width: 5em;
} }
header #logoC3{ header #logoC3{
background-color: rgba(195,195,195,.25); background-color: rgba(195,195,195,.25);
background-image: url(https://chilam.c3.unam.mx/wp-content/themes/chilam/images/logos/c3-g.svg); background-image: url(https://chilam.c3.unam.mx/wp-content/themes/chilam/images/logos/c3-g.svg);
...@@ -122,6 +123,13 @@ header #logoChilam{ ...@@ -122,6 +123,13 @@ header #logoChilam{
background-size:15rem; background-size:15rem;
width: 15.5rem; width: 15.5rem;
} }
header #logoCAyCC{
background-image: url(/images/CAyCC.png);
background-size:14rem;
width: 15.5rem;
}
header #logoCIC{ header #logoCIC{
background-color: rgba(195,195,195,.5); background-color: rgba(195,195,195,.5);
background-image: url(https://chilam.c3.unam.mx/wp-content/themes/chilam/images/logos/cic-g.svg); background-image: url(https://chilam.c3.unam.mx/wp-content/themes/chilam/images/logos/cic-g.svg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment