Añadimos revisión de errores

This commit is contained in:
2025-11-12 16:29:10 +00:00
parent 8b3470bdf0
commit e58622f8f0

View File

@@ -171,8 +171,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 450, "x": 430,
"y": 640, "y": 880,
"wires": [ "wires": [
[ [
"535b18bcfc71f9cd" "535b18bcfc71f9cd"
@@ -243,8 +243,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 180, "x": 160,
"y": 640, "y": 880,
"wires": [ "wires": [
[ [
"d647c9286ddb06ce" "d647c9286ddb06ce"
@@ -268,8 +268,8 @@
"topic": "", "topic": "",
"payload": "", "payload": "",
"payloadType": "date", "payloadType": "date",
"x": 220, "x": 200,
"y": 700, "y": 940,
"wires": [ "wires": [
[ [
"a5d5ef751185e3e9" "a5d5ef751185e3e9"
@@ -288,8 +288,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 320, "x": 300,
"y": 760, "y": 1000,
"wires": [ "wires": [
[ [
"495d54abe840ccc9" "495d54abe840ccc9"
@@ -308,8 +308,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 410, "x": 390,
"y": 700, "y": 940,
"wires": [ "wires": [
[ [
"3acef3e43d0415d4" "3acef3e43d0415d4"
@@ -329,8 +329,8 @@
"targetType": "msg", "targetType": "msg",
"statusVal": "", "statusVal": "",
"statusType": "auto", "statusType": "auto",
"x": 630, "x": 610,
"y": 760, "y": 1000,
"wires": [] "wires": []
}, },
{ {
@@ -346,8 +346,8 @@
"targetType": "msg", "targetType": "msg",
"statusVal": "", "statusVal": "",
"statusType": "auto", "statusType": "auto",
"x": 700, "x": 680,
"y": 640, "y": 880,
"wires": [] "wires": []
}, },
{ {
@@ -420,8 +420,8 @@
"split": false, "split": false,
"rowsPerMsg": 1, "rowsPerMsg": 1,
"outputs": 1, "outputs": 1,
"x": 790, "x": 770,
"y": 700, "y": 940,
"wires": [ "wires": [
[] []
] ]
@@ -546,7 +546,7 @@
"type": "function", "type": "function",
"z": "1a4b40705122dc91", "z": "1a4b40705122dc91",
"name": "Prepación de la Consulta", "name": "Prepación de la Consulta",
"func": "// aggregation pipeline\nconst pipeline = [\n {\n $addFields: {\n TipoVia: { $ifNull: [\"$TipoVia1\", { $ifNull: [\"$TipoVia2\", \"CONSOLIDADO\"] }] },\n Calle: { $ifNull: [\"$Calle1\", { $ifNull: [\"$Calle2\", \"CONSOLIDADO\"] }] },\n Poblacion: { $ifNull: [\"$Poblacion1\", { $ifNull: [\"$Poblacion2\", \"CONSOLIDADO\"] }] },\n CP: { $ifNull: [\"$cp1\", { $ifNull: [\"$cp2\", \"00000\"] }] }\n }\n },\n {\n $project: {\n TipoVia1: 0,\n TipoVia2: 0,\n Calle1: 0,\n Calle2: 0,\n Poblacion1: 0,\n Poblacion2: 0,\n cp1: 0,\n cp2: 0\n }\n },\n {\n $out: \"servicios_consolidado_calle\" // guarda el resultado en otra colección\n }\n ];\n// optional: aggregate options\nconst options = {\n allowDiskUse: true\n};\n// payload for mongodb4 node\nmsg.collection = \"servicios_sin_filtrar\";\nmsg.operation = \"aggregate\";\nmsg.payload = [pipeline, options];\nreturn msg;", "func": "// aggregation pipeline\nconst pipeline = [\n {\n $addFields: {\n TipoVia: { $ifNull: [\"$TipoVia1\", { $ifNull: [\"$TipoVia2\", \"CALLE\"] }] },\n Calle: { $ifNull: [\"$Calle1\", { $ifNull: [\"$Calle2\", \"SIN DATOS\"] }] },\n Poblacion: { $ifNull: [\"$Poblacion1\", { $ifNull: [\"$Poblacion2\", \"MADRID\"] }] },\n CP: { $ifNull: [\"$cp1\", { $ifNull: [\"$cp2\", \"00000\"] }] }\n }\n },\n {\n $project: {\n TipoVia1: 0,\n TipoVia2: 0,\n Calle1: 0,\n Calle2: 0,\n Poblacion1: 0,\n Poblacion2: 0,\n cp1: 0,\n cp2: 0\n }\n },\n {\n $out: \"servicios_consolidado_calle\" // guarda el resultado en otra colección\n }\n ];\n// optional: aggregate options\nconst options = {\n allowDiskUse: true\n};\n// payload for mongodb4 node\nmsg.collection = \"servicios_sin_filtrar\";\nmsg.operation = \"aggregate\";\nmsg.payload = [pipeline, options];\nreturn msg;",
"outputs": 1, "outputs": 1,
"timeout": 0, "timeout": 0,
"noerr": 0, "noerr": 0,
@@ -632,14 +632,14 @@
"type": "function", "type": "function",
"z": "1a4b40705122dc91", "z": "1a4b40705122dc91",
"name": "Prepación de la Consulta", "name": "Prepación de la Consulta",
"func": "// aggregation pipeline\nconst pipeline = [\n {\n $match: {\n $and: [\n { $expr: { $ne: [\"$Calle\", \"CONSOLIDADO\"] } },\n { $expr: { $ne: [\"$Poblacion\", \"CONSOLIDADO\"] } },\n ]\n }\n },\n {\n $out: \"servicios_consolidado_calle_filtrado\" // guarda el resultado en otra colección\n }\n ];\n// optional: aggregate options\nconst options = {\n allowDiskUse: true\n};\n// payload for mongodb4 node\nmsg.collection = \"servicios_consolidado_calle\";\nmsg.operation = \"aggregate\";\nmsg.payload = [pipeline, options];\nreturn msg;", "func": "// aggregation pipeline\nconst pipeline = [\n {\n $match: {\n $and: [\n { $expr: { $ne: [\"$Calle\", \"SIN DATOS\"] } },\n ]\n }\n },\n {\n $out: \"servicios_consolidado_calle_filtrado\" // guarda el resultado en otra colección\n }\n ];\n// optional: aggregate options\nconst options = {\n allowDiskUse: true\n};\n// payload for mongodb4 node\nmsg.collection = \"servicios_consolidado_calle\";\nmsg.operation = \"aggregate\";\nmsg.payload = [pipeline, options];\nreturn msg;",
"outputs": 1, "outputs": 1,
"timeout": 0, "timeout": 0,
"noerr": 0, "noerr": 0,
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 490, "x": 530,
"y": 400, "y": 400,
"wires": [ "wires": [
[ [
@@ -659,7 +659,7 @@
"maxTimeMS": "0", "maxTimeMS": "0",
"handleDocId": false, "handleDocId": false,
"name": "Consulta", "name": "Consulta",
"x": 680, "x": 720,
"y": 400, "y": 400,
"wires": [ "wires": [
[ [
@@ -680,7 +680,7 @@
"targetType": "full", "targetType": "full",
"statusVal": "", "statusVal": "",
"statusType": "auto", "statusType": "auto",
"x": 820, "x": 860,
"y": 400, "y": 400,
"wires": [] "wires": []
}, },
@@ -708,7 +708,7 @@
"t": "set", "t": "set",
"p": "limit", "p": "limit",
"pt": "msg", "pt": "msg",
"to": "360", "to": "500",
"tot": "num" "tot": "num"
}, },
{ {
@@ -765,8 +765,8 @@
"targetType": "full", "targetType": "full",
"statusVal": "", "statusVal": "",
"statusType": "auto", "statusType": "auto",
"x": 860, "x": 840,
"y": 640, "y": 880,
"wires": [] "wires": []
}, },
{ {
@@ -785,8 +785,8 @@
], ],
"repeat": "", "repeat": "",
"crontab": "", "crontab": "",
"once": false, "once": true,
"onceDelay": 0.1, "onceDelay": "1",
"topic": "", "topic": "",
"payload": "", "payload": "",
"payloadType": "date", "payloadType": "date",
@@ -833,7 +833,7 @@
"payload": "", "payload": "",
"payloadType": "date", "payloadType": "date",
"x": 180, "x": 180,
"y": 460, "y": 660,
"wires": [ "wires": [
[ [
"d66163bb05e6f12e", "d66163bb05e6f12e",
@@ -875,7 +875,7 @@
"to": "", "to": "",
"reg": false, "reg": false,
"x": 460, "x": 460,
"y": 460, "y": 660,
"wires": [ "wires": [
[ [
"004948a143b907dd" "004948a143b907dd"
@@ -894,8 +894,8 @@
"maxTimeMS": "0", "maxTimeMS": "0",
"handleDocId": false, "handleDocId": false,
"name": "Consulta", "name": "Consulta",
"x": 680, "x": 720,
"y": 460, "y": 660,
"wires": [ "wires": [
[ [
"bb5ad864c986b15f" "bb5ad864c986b15f"
@@ -915,8 +915,8 @@
"targetType": "full", "targetType": "full",
"statusVal": "", "statusVal": "",
"statusType": "auto", "statusType": "auto",
"x": 860, "x": 900,
"y": 460, "y": 660,
"wires": [] "wires": []
}, },
{ {
@@ -953,7 +953,7 @@
"to": "", "to": "",
"reg": false, "reg": false,
"x": 450, "x": 450,
"y": 500, "y": 700,
"wires": [ "wires": [
[ [
"004948a143b907dd" "004948a143b907dd"
@@ -1049,7 +1049,7 @@
"timeout": "5", "timeout": "5",
"timeoutUnits": "seconds", "timeoutUnits": "seconds",
"rate": "1", "rate": "1",
"nbRateUnits": "5", "nbRateUnits": "2",
"rateUnits": "second", "rateUnits": "second",
"randomFirst": "1", "randomFirst": "1",
"randomLast": "5", "randomLast": "5",
@@ -1211,10 +1211,10 @@
"y": 200, "y": 200,
"wires": [ "wires": [
[ [
"4063e875162c944d" "b176ccfcb67d19a0"
], ],
[ [
"59f364d9feca28e5" "2432622b4a8371d9"
] ]
], ],
"outputLabels": [ "outputLabels": [
@@ -1385,19 +1385,8 @@
"links": [ "links": [
"717811bdd780a620" "717811bdd780a620"
], ],
"x": 655, "x": 835,
"y": 180, "y": 200,
"wires": []
},
{
"id": "59f364d9feca28e5",
"type": "link out",
"z": "a796bfad8ab76fe4",
"name": "OUT - Error",
"mode": "link",
"links": [],
"x": 655,
"y": 220,
"wires": [] "wires": []
}, },
{ {
@@ -1455,12 +1444,12 @@
"tosidebar": true, "tosidebar": true,
"console": false, "console": false,
"tostatus": false, "tostatus": false,
"complete": "true", "complete": "consulta_calle",
"targetType": "full", "targetType": "msg",
"statusVal": "", "statusVal": "",
"statusType": "auto", "statusType": "auto",
"x": 930, "x": 890,
"y": 300, "y": 340,
"wires": [] "wires": []
}, },
{ {
@@ -1519,7 +1508,9 @@
"x": 970, "x": 970,
"y": 660, "y": 660,
"wires": [ "wires": [
[] [
"61bddcdd604826da"
]
] ]
}, },
{ {
@@ -1557,7 +1548,7 @@
"type": "function", "type": "function",
"z": "a796bfad8ab76fe4", "z": "a796bfad8ab76fe4",
"name": "Calles con Memoria Histórica", "name": "Calles con Memoria Histórica",
"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", "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 === \"PLAZA FERNANDEZ LADREDA 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\nif (msg.consulta_calle === \"PLAZA HERMANOS FALCO Y ALVAREZ DE TOLEDO 13 MADRID\") {\n msg.cambio.calle = \"MAYOR DE BARAJAS\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE CAPITAN CORTES MADRID\") {\n msg.cambio.calle = \"MANUEL CHAVES NOGALES\";\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 === \"PLAZA HERMANOS FALCO Y ALVAREZ DE TOLEDO 13 MADRID\") {\n msg.cambio.calle = \"MAYOR DE BARAJAS\";\n return msg;\n}\n\nif (msg.consulta_calle === \"PLAZA GENERAL SAGARDIA RAMOS 21 MADRID\") {\n msg.cambio.calle = \"PASEO DE LA MAESTRA MARIA SANCHEZ ARBOS\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE GARCIA MORATO MADRID\") {\n msg.cambio.calle = \"ROBERT CAPA\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE GENERAL YAGUE 5 MADRID\") {\n msg.cambio.calle = \"SAN GERMAN\";\n return msg;\n}\n\n",
"outputs": 1, "outputs": 1,
"timeout": 0, "timeout": 0,
"noerr": 0, "noerr": 0,
@@ -1577,7 +1568,7 @@
"type": "function", "type": "function",
"z": "a796bfad8ab76fe4", "z": "a796bfad8ab76fe4",
"name": "Calles con Mala codificación", "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}", "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\nif (msg.consulta_calle === \"AVENIDA AMERICA 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}\n\n// Mala condificación\nif (msg.consulta_calle === \"CALLE QUINTANAORTUÑO MADRID\") {\n msg.cambio.calle = \"QUINTANAPALLA\"\n return msg;\n}\n\n// Mala condificación\nif (msg.consulta_calle === \"CALLE GABRIEL MIRO 1 MADRID\") {\n msg.cambio.tipovia = \"PLAZA\"\n return msg;\n}\n\nif (msg.consulta_calle === \"CAMINO CABESTROS 9 MADRID\") {\n msg.cambio.tipovia = \"CALLE\";\n msg.cambio.calle = \"CABESTREROS\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE BENIMAMET FRENTE 6 MADRID\") {\n msg.cambio.tipovia = \"CALLE\";\n msg.cambio.numero_retirada = \"6\";\n return msg;\n}\n\nif (msg.consulta_calle === \"GLORIETA DE LOS NEVEROS MADRID\") {\n msg.cambio.tipovia = \"CALLE\";\n msg.cambio.calle = \"PUERTA DEL ANGEL\";\n msg.cambio.numero_retirada = \"10\";\n return msg;\n}\n\nif (msg.consulta_calle === \"PASEO GENERAL SAGARDIA RAMOS 21 MADRID\") {\n msg.cambio.tipovia = \"PLAZA\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE LUSCINDA FTE 7 MADRID\") {\n msg.cambio.numero_retirada = \"7\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CAMINO LEÑEROS MADRID\") {\n msg.cambio.tipovia = \"CALLE\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE SANTIAGO RUISEÑOR MADRID\") {\n msg.cambio.tipovia = \"SANTIAGO RUSIÑOL\";\n return msg;\n}\n\n\nif (msg.consulta_calle === \"CALLE PARQUE FERIAL JUAN CARLOS I MADRID\") {\n msg.cambio.tipovia = \"VIA\";\n msg.cambio.calle = \"DUBLIN\";\n msg.cambio.numero_retirada = \"6\";\n return msg;\n}",
"outputs": 1, "outputs": 1,
"timeout": 0, "timeout": 0,
"noerr": 0, "noerr": 0,
@@ -1674,7 +1665,7 @@
"type": "debug", "type": "debug",
"z": "a796bfad8ab76fe4", "z": "a796bfad8ab76fe4",
"name": "Información de servicios procesados", "name": "Información de servicios procesados",
"active": true, "active": false,
"tosidebar": true, "tosidebar": true,
"console": false, "console": false,
"tostatus": false, "tostatus": false,
@@ -1682,8 +1673,170 @@
"targetType": "full", "targetType": "full",
"statusVal": "", "statusVal": "",
"statusType": "auto", "statusType": "auto",
"x": 890, "x": 1230,
"y": 780, "y": 720,
"wires": [] "wires": []
},
{
"id": "a1f0210367ec78c3",
"type": "debug",
"z": "a796bfad8ab76fe4",
"name": "debug 1",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1360,
"y": 260,
"wires": []
},
{
"id": "b176ccfcb67d19a0",
"type": "function",
"z": "a796bfad8ab76fe4",
"name": "Calles a eliminar",
"func": "// Registro a eliminar sino procesamos\nif (msg.consulta_calle === \"CALLE SIN DETERMINAR MADRID\" ||\n msg.consulta_calle === \"BASE MEDIODIA 3 MADRID\" ||\n msg.consulta_calle === \"BASE COLON MADRID\" ||\n msg.consulta_calle === \"BASE MEDIODIA 2 1 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada MADRID\" ||\n msg.consulta_calle === \"ACCESO POBLADO DE LAS BARRANQUILLAS sn MADRID\" ||\n msg.consulta_calle === \"BASE BARCELO MADRID\" ||\n msg.consulta_calle === \"EDIFICIO JUZGADO MADRID\" ||\n msg.consulta_calle === \"CALLE CAÑADA REAL GALIANA PARC 12 MADRID\" ||\n msg.consulta_calle === \"CALLE CAÑADA REAL GALIANA PARC. 127 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada S / N MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada 8,400 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada KM 12700 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada KM 2.400 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada - MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada S/N MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada FAROLA4 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada 12500 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada 6, 800 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada 6, 500 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada 6,800 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada 6,500 MADRID\" ||\n msg.consulta_calle === \"CARRETERA A-3 ACCESO A VALDEMINGOMEZ MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada 2.200 MADRID\" ||\n msg.consulta_calle === \"CALLE No Codificada FAROLA 2 MADRID\" ||\n msg.consulta_calle === \"CALLE CAÑADA REAL GALIANA FAR. 31 MADRID\" ||\n msg.consulta_calle === \"ZONA COMISARIA HORTALEZA MADRID\" ||\n msg.consulta_calle === \"PASO PARTICULAR ELVIRA GOYA 12 MADRID\" ||\n msg.consulta_calle === \"PASO PARTICULAR ELVIRA GOYA 38 MADRID\" ||\n msg.consulta_calle === \"ACCESO AEROPUERTO DE BARAJAS T2 SALIDAS MADRID\"\n ) {\n return [msg, null]\n} else {\n return [null, msg]\n}\n\n",
"outputs": 2,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 720,
"y": 180,
"wires": [
[
"fa2e9116677470ca"
],
[
"4063e875162c944d"
]
]
},
{
"id": "fa2e9116677470ca",
"type": "change",
"z": "a796bfad8ab76fe4",
"name": "Peparamos el identificador de calle a borrar",
"rules": [
{
"t": "set",
"p": "operation",
"pt": "msg",
"to": "deleteOne",
"tot": "str"
},
{
"t": "set",
"p": "collection",
"pt": "msg",
"to": "servicios_consolidado_calle_filtrado",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[\t {\t \"_id\": direccion._id\t }\t]",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 990,
"y": 160,
"wires": [
[
"4eee84ac85459806"
]
]
},
{
"id": "4eee84ac85459806",
"type": "mongodb4",
"z": "a796bfad8ab76fe4",
"clientNode": "648a51546e4dadc6",
"mode": "collection",
"collection": "",
"operation": "",
"output": "toArray",
"maxTimeMS": "0",
"handleDocId": false,
"name": "",
"x": 1250,
"y": 160,
"wires": [
[
"61bddcdd604826da"
]
]
},
{
"id": "2432622b4a8371d9",
"type": "change",
"z": "a796bfad8ab76fe4",
"name": "Actualizamos los datos de todas las calles que sean iguales",
"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\": direccion.TipoVia,\t \"Calle\": direccion.Calle,\t \"numero_retirada\": direccion.numero_retirada,\t \"Poblacion\": direccion.Poblacion,\t \"CP\": direccion.CP \t\t },\t {\t \"$set\": {\t \"latitud\": payload[0].lat,\t \"longitud\": payload[0].lon,\t \"geocodingProcesado\": true\t } \t }\t]",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 900,
"y": 260,
"wires": [
[
"f33442e9c3fb97aa"
]
]
},
{
"id": "f33442e9c3fb97aa",
"type": "mongodb4",
"z": "a796bfad8ab76fe4",
"clientNode": "648a51546e4dadc6",
"mode": "collection",
"collection": "",
"operation": "",
"output": "toArray",
"maxTimeMS": "0",
"handleDocId": false,
"name": "",
"x": 1210,
"y": 260,
"wires": [
[
"a1f0210367ec78c3"
]
]
} }
] ]