Añadidas más codificaciones y memoria histórica

This commit is contained in:
2025-11-10 22:36:51 +00:00
parent 91cea199b5
commit 8b3470bdf0

View File

@@ -172,7 +172,7 @@
"finalize": "",
"libs": [],
"x": 450,
"y": 580,
"y": 640,
"wires": [
[
"535b18bcfc71f9cd"
@@ -244,7 +244,7 @@
"finalize": "",
"libs": [],
"x": 180,
"y": 580,
"y": 640,
"wires": [
[
"d647c9286ddb06ce"
@@ -269,7 +269,7 @@
"payload": "",
"payloadType": "date",
"x": 220,
"y": 640,
"y": 700,
"wires": [
[
"a5d5ef751185e3e9"
@@ -289,7 +289,7 @@
"finalize": "",
"libs": [],
"x": 320,
"y": 700,
"y": 760,
"wires": [
[
"495d54abe840ccc9"
@@ -309,7 +309,7 @@
"finalize": "",
"libs": [],
"x": 410,
"y": 640,
"y": 700,
"wires": [
[
"3acef3e43d0415d4"
@@ -330,7 +330,7 @@
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 700,
"y": 760,
"wires": []
},
{
@@ -347,7 +347,7 @@
"statusVal": "",
"statusType": "auto",
"x": 700,
"y": 580,
"y": 640,
"wires": []
},
{
@@ -421,7 +421,7 @@
"rowsPerMsg": 1,
"outputs": 1,
"x": 790,
"y": 640,
"y": 700,
"wires": [
[]
]
@@ -688,7 +688,7 @@
"id": "4250b98e85f30aa3",
"type": "change",
"z": "1a4b40705122dc91",
"name": "Prepara la query",
"name": "Preparación de la Consulta",
"rules": [
{
"t": "set",
@@ -708,7 +708,7 @@
"t": "set",
"p": "limit",
"pt": "msg",
"to": "6",
"to": "360",
"tot": "num"
},
{
@@ -724,8 +724,8 @@
"from": "",
"to": "",
"reg": false,
"x": 490,
"y": 460,
"x": 620,
"y": 580,
"wires": [
[
"4af6fd0defd481ea"
@@ -744,8 +744,8 @@
"maxTimeMS": "0",
"handleDocId": false,
"name": "",
"x": 670,
"y": 460,
"x": 830,
"y": 580,
"wires": [
[
"4644d386e752575d"
@@ -766,14 +766,14 @@
"statusVal": "",
"statusType": "auto",
"x": 860,
"y": 500,
"y": 640,
"wires": []
},
{
"id": "c29fc5be5de649c4",
"type": "inject",
"z": "1a4b40705122dc91",
"name": "Activación - Eliminar servicios sin calle",
"name": "Activación - Recuperar geoposiciones de CartoCiudad",
"props": [
{
"p": "payload"
@@ -783,15 +783,15 @@
"vt": "str"
}
],
"repeat": "60",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 220,
"y": 460,
"x": 260,
"y": 580,
"wires": [
[
"4250b98e85f30aa3"
@@ -807,10 +807,159 @@
"links": [
"ec0a560685f299d8"
],
"x": 775,
"x": 935,
"y": 580,
"wires": []
},
{
"id": "c6894593daa8fcf0",
"type": "inject",
"z": "1a4b40705122dc91",
"name": "Activación - Normalizaciones",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 180,
"y": 460,
"wires": [
[
"d66163bb05e6f12e",
"8081ba55b8146814"
]
]
},
{
"id": "d66163bb05e6f12e",
"type": "change",
"z": "1a4b40705122dc91",
"name": "numero_retirada de \"SN \" a \"SN\"",
"rules": [
{
"t": "set",
"p": "operation",
"pt": "msg",
"to": "updateMany",
"tot": "str"
},
{
"t": "set",
"p": "collection",
"pt": "msg",
"to": "servicios_consolidado_calle_filtrado",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[\t {\t \"numero_retirada\": \"SN \"\t },\t {\t \"$set\": {\t \"numero_retirada\": \"SN\"\t } \t }\t]",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 460,
"y": 460,
"wires": [
[
"004948a143b907dd"
]
]
},
{
"id": "004948a143b907dd",
"type": "mongodb4",
"z": "1a4b40705122dc91",
"clientNode": "648a51546e4dadc6",
"mode": "collection",
"collection": "",
"operation": "",
"output": "toArray",
"maxTimeMS": "0",
"handleDocId": false,
"name": "Consulta",
"x": 680,
"y": 460,
"wires": [
[
"bb5ad864c986b15f"
]
]
},
{
"id": "bb5ad864c986b15f",
"type": "debug",
"z": "1a4b40705122dc91",
"name": "Resultado (4 cambios)",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 860,
"y": 460,
"wires": []
},
{
"id": "8081ba55b8146814",
"type": "change",
"z": "1a4b40705122dc91",
"name": "numero_retirada de \"SQ\" a \"SN\"",
"rules": [
{
"t": "set",
"p": "operation",
"pt": "msg",
"to": "updateMany",
"tot": "str"
},
{
"t": "set",
"p": "collection",
"pt": "msg",
"to": "servicios_consolidado_calle_filtrado",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[\t {\t \"numero_retirada\": \"SQ\"\t },\t {\t \"$set\": {\t \"numero_retirada\": \"SN\"\t } \t }\t]",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 450,
"y": 500,
"wires": [
[
"004948a143b907dd"
]
]
},
{
"id": "1fd044cbc45e1620",
"type": "function",
@@ -900,7 +1049,7 @@
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "10",
"nbRateUnits": "5",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
@@ -953,7 +1102,7 @@
"t": "set",
"p": "consulta_calle",
"pt": "msg",
"to": "$join(\t $filter(\t [\t payload.TipoVia,\t payload.Calle,\t (payload.numero_retirada = \"SN\" or payload.numero_retirada = \"0\") ? undefined : payload.numero_retirada,\t payload.Poblacion\t ],\t function($v){ $v != null and $v != \"\" }\t ),\t \" \"\t)",
"to": "$join(\t $filter(\t [\t payload.TipoVia,\t payload.Calle,\t (payload.numero_retirada = \"SN\" or payload.numero_retirada = \"0\") ? undefined : payload.numero_retirada,\t payload.Poblacion,\t payload.extra_calle\t ],\t function($v){ $v != null and $v != \"\" }\t ),\t \" \"\t)",
"tot": "jsonata"
}
],
@@ -1310,8 +1459,8 @@
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 910,
"y": 340,
"x": 930,
"y": 300,
"wires": []
},
{
@@ -1377,10 +1526,11 @@
"id": "0b0d1db5adb29e98",
"type": "link out",
"z": "a796bfad8ab76fe4",
"name": "OUT - Memoria Histórica",
"name": "OUT - Fallos para Arreglar",
"mode": "link",
"links": [
"37f1c5b138623383"
"37f1c5b138623383",
"e795e6d956e3180e"
],
"x": 755,
"y": 300,
@@ -1407,7 +1557,7 @@
"type": "function",
"z": "a796bfad8ab76fe4",
"name": "Calles con Memoria Histórica",
"func": "msg.cambio = msg.cambio || {};\n\nif (msg.consulta_calle === \"CALLE JOSE LUIS DE ARRESE MADRID\") {\n msg.cambio.calle = \"POETA BLAS DE OTERO\";\n return msg;\n}",
"func": "// Referencia : https://www.elmundo.es/madrid/2016/07/21/5791123146163fd3028b45a3.html\n\nmsg.cambio = msg.cambio || {};\n\n// Internet\nif (msg.consulta_calle === \"CALLE JOSE LUIS DE ARRESE MADRID\") {\n msg.cambio.calle = \"POETA BLAS DE OTERO\";\n return msg;\n}\n// 12\nif (msg.consulta_calle === \"CALLE CAPITAN CORTES MADRID\") {\n msg.cambio.calle = \"MANUEL CHAVES NOGALES\";\n return msg;\n}\n\n// \nif (msg.consulta_calle === \"CALLE GENERAL ROMERO BASART 27 MADRID\") {\n msg.cambio.calle = \"BLAS CABRERA\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE GENERAL ORGAZ 1 MADRID\") {\n msg.cambio.calle = \"FORTUNATA Y JACINTA\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE GENERAL SALIQUET MADRID\") {\n msg.cambio.calle = \"SOLEDAD CAZORLA\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE COMANDANTE ZORITA 2 MADRID\") {\n msg.cambio.calle = \"AVIADOR ZORITA\";\n return msg;\n}\n\nif (msg.consulta_calle === \"PLAZA FERNANDEZ LADREDA 2 MADRID\") {\n msg.cambio.calle = \"ELIPTICA\";\n return msg;\n}\n\nif (msg.consulta_calle === \"GLORIETA PATINES MADRID\") {\n msg.cambio.calle = \"DE LOS NEVEROS\";\n return msg;\n}\n\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
@@ -1421,5 +1571,119 @@
"96d63073d4c3043e"
]
]
},
{
"id": "63bf04cd67af12fd",
"type": "function",
"z": "a796bfad8ab76fe4",
"name": "Calles con Mala codificación",
"func": "msg.cambio = msg.cambio || {};\n\n// Es una campa de recogida de vehículos de renting\nif (msg.consulta_calle === \"CAMINO SALOBRAL MADRID\") {\n msg.cambio.tipovia = \"Carretera\"\n msg.cambio.calle = \"Estación de Contenedores\";\n msg.cambio.numero_retirada = \"4\"\n return msg;\n}\n\n// Quitamos el kilometro\nif (msg.consulta_calle === \"CARRETERA VILLAVERDE KM 4.8 GETAFE\") {\n msg.cambio.numero_retirada = \"4\"\n return msg;\n}\n\n// Añadimos el codigo postal para que lo localice\nif (msg.consulta_calle === \"GLORIETA SANDRO PERTINI MADRID\") {\n msg.cambio.extra_calle = \"28043\"\n return msg;\n}\n\n// La plaza de Ciudad lineal no tiene carto, se cambia por alcala\nif (msg.consulta_calle === \"PLAZA CIUDAD LINEAL MADRID\") {\n msg.cambio.tipovia = \"CALLE\"\n msg.cambio.calle = \"ALCALA\";\n msg.cambio.numero_retirada = \"423\"\n return msg;\n}\n\n// Error de nombre\nif (msg.consulta_calle === \"CAMINO CABESTREROS 9 MADRID\") {\n msg.cambio.tipovia = \"CALLE\";\n msg.cambio.calle = \"CABESTREROS\";\n return msg;\n}\n\n// Error de nombre\nif (msg.consulta_calle === \"PLAZA CORREGIDOR CONDE DE MACEDA Y TABOADA MADRID\") {\n msg.cambio.calle = \"PICO DE LOS ARTILLEROS\";\n msg.cambio.tipovia = \"CALLE\"\n msg.cambio.calle = \"PICO DE LOS ARTILLEROS\";\n msg.cambio.numero_retirada = \"150\"\n return msg;\n}\n\n// Error de nombre\nif (msg.consulta_calle === \"AVENIDA AMERICA 2 FUENLABRADA\") {\n msg.cambio.numero_retirada = \"SN\"\n msg.cambio.extra_calle = \"2\"\n return msg;\n}\n\n// Mala condificación\nif (msg.consulta_calle === \"CALLE TACONA COMISARÍA MADRID\") {\n msg.cambio.numero_retirada = \"33\"\n return msg;\n}\n\n// Mala condificación\nif (msg.consulta_calle === \"CALLE DOCTOR TOLOSA LATOUR FAROLA 62 MADRID\") {\n msg.cambio.numero_retirada = \"62\"\n return msg;\n}\n\n// Mala condificación\nif (msg.consulta_calle === \"PLAZA BARICHARA 4 MADRID\") {\n msg.cambio.tipovia = \"CALLE\"\n return msg;\n}",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 260,
"y": 720,
"wires": [
[
"ddc2820a375bb8f6"
]
]
},
{
"id": "ddc2820a375bb8f6",
"type": "change",
"z": "a796bfad8ab76fe4",
"name": "Actualizamos los datos de las calles mal codificadas",
"rules": [
{
"t": "set",
"p": "operation",
"pt": "msg",
"to": "updateMany",
"tot": "str"
},
{
"t": "set",
"p": "collection",
"pt": "msg",
"to": "servicios_consolidado_calle_filtrado",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[\t {\t \"TipoVia\": msg.direccion.TipoVia,\t \"Calle\": msg.direccion.Calle,\t \"numero_retirada\": msg.direccion.numero_retirada,\t \"Poblacion\": msg.direccion.Poblacion,\t \"CP\": msg.direccion.CP \t },\t {\t \"$set\": {\t \"TipoVia\": msg.cambio.tipovia,\t \"Calle\": msg.cambio.calle,\t \"numero_retirada\": msg.cambio.numero_retirada,\t \"extra_calle\": msg.cambio.extra_calle\t }\t }\t]",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 680,
"y": 720,
"wires": [
[
"c9dfd4a858aeb687"
]
]
},
{
"id": "c9dfd4a858aeb687",
"type": "mongodb4",
"z": "a796bfad8ab76fe4",
"clientNode": "648a51546e4dadc6",
"mode": "collection",
"collection": "",
"operation": "",
"output": "toArray",
"maxTimeMS": "0",
"handleDocId": false,
"name": "",
"x": 970,
"y": 720,
"wires": [
[
"61bddcdd604826da"
]
]
},
{
"id": "e795e6d956e3180e",
"type": "link in",
"z": "a796bfad8ab76fe4",
"name": "IN - Mala codificación",
"links": [
"0b0d1db5adb29e98"
],
"x": 105,
"y": 720,
"wires": [
[
"63bf04cd67af12fd"
]
]
},
{
"id": "61bddcdd604826da",
"type": "debug",
"z": "a796bfad8ab76fe4",
"name": "Información de servicios procesados",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 890,
"y": 780,
"wires": []
}
]