[ { "id": "1a4b40705122dc91", "type": "tab", "label": "ETL", "disabled": false, "info": "", "env": [] }, { "id": "a796bfad8ab76fe4", "type": "tab", "label": "Cartociudad", "disabled": false, "info": "", "env": [] }, { "id": "6e1ee0f06e75580d", "type": "tab", "label": "Cartociudad Rapido", "disabled": false, "info": "", "env": [] }, { "id": "a3043505f409dd12", "type": "group", "z": "1a4b40705122dc91", "name": "ETL - Exportación", "style": { "stroke": "#000000", "fill": "#ffffbf", "label": true, "label-position": "n", "color": "#000000" }, "nodes": [ "da1a19e474be7c21", "5750be6f324be5da", "40b5904a3022e5eb", "4ef62ad77f7d4652", "2a46f606e21ec6b3", "08e53863f9d0559f", "6eb9b5543808fedb" ], "x": 14, "y": 19, "w": 892, "h": 202 }, { "id": "db09bd514ed7c061", "type": "MSSQL-CN", "tdsVersion": "7_3_B", "name": "Gruassql", "server": "10.5.14.245", "port": "1433", "encyption": false, "trustServerCertificate": true, "database": "madrid_movilidad", "useUTC": true, "connectTimeout": "15000", "requestTimeout": "15000", "cancelTimeout": "5000", "pool": "5", "parseJSON": false, "enableArithAbort": true, "readOnlyIntent": false }, { "id": "748b5921246ec468", "type": "postgreSQLConfig", "name": "PostGIS", "host": "10.10.5.32", "hostFieldType": "str", "port": 5432, "portFieldType": "num", "database": "postgres", "databaseFieldType": "str", "ssl": "false", "sslFieldType": "bool", "applicationName": "", "applicationNameType": "str", "max": "500", "maxFieldType": "num", "idle": "10000", "idleFieldType": "num", "connectionTimeout": "30000", "connectionTimeoutFieldType": "num", "user": "postgres", "userFieldType": "str", "password": "tfmuocdfcarvajal", "passwordFieldType": "str" }, { "id": "648a51546e4dadc6", "type": "mongodb4-client", "name": "mongodb", "protocol": "mongodb", "hostname": "10.10.5.33", "port": "27017", "dbName": "Volcado", "appName": "", "authSource": "", "authMechanism": "DEFAULT", "tls": false, "tlsCAFile": "", "tlsCertificateKeyFile": "", "tlsInsecure": false, "connectTimeoutMS": "30000", "socketTimeoutMS": "0", "minPoolSize": "0", "maxPoolSize": "100", "maxIdleTimeMS": "0", "uri": "", "advanced": "{}", "uriTabActive": "tab-uri-simple" }, { "id": "15fe39abe7f560b2", "type": "ui-base", "name": "My Dashboard", "path": "/dashboard", "appIcon": "", "includeClientData": true, "acceptsClientConfig": [ "ui-notification", "ui-control" ], "showPathInSidebar": false, "headerContent": "page", "navigationStyle": "default", "titleBarStyle": "default", "showReconnectNotification": true, "notificationDisplayTime": 1, "showDisconnectNotification": true, "allowInstall": false }, { "id": "423c5b5820f88c05", "type": "ui-theme", "name": "Default Theme", "colors": { "surface": "#ffffff", "primary": "#0094CE", "bgPage": "#eeeeee", "groupBg": "#ffffff", "groupOutline": "#cccccc" }, "sizes": { "density": "default", "pagePadding": "12px", "groupGap": "12px", "groupBorderRadius": "4px", "widgetGap": "12px" } }, { "id": "d5367e576f526ae9", "type": "ui-page", "name": "Page 1", "ui": "15fe39abe7f560b2", "path": "/page1", "icon": "home", "layout": "grid", "theme": "423c5b5820f88c05", "breakpoints": [ { "name": "Default", "px": 0, "cols": 3 }, { "name": "Tablet", "px": 576, "cols": 6 }, { "name": "Small Desktop", "px": 768, "cols": 9 }, { "name": "Desktop", "px": 1024, "cols": 12 } ], "order": 1, "className": "", "visible": "true", "disabled": "false" }, { "id": "2365cb156242b3e6", "type": "ui-group", "name": "Group 1", "page": "d5367e576f526ae9", "width": 6, "height": 1, "order": 2, "showTitle": true, "className": "", "visible": true, "disabled": false, "groupType": "default" }, { "id": "29e5d13e29bfbb4b", "type": "ui-group", "name": "Validar", "page": "d5367e576f526ae9", "width": 6, "height": 1, "order": 1, "showTitle": true, "className": "", "visible": "true", "disabled": "false", "groupType": "default" }, { "id": "da1a19e474be7c21", "type": "MSSQL", "z": "1a4b40705122dc91", "g": "a3043505f409dd12", "mssqlCN": "db09bd514ed7c061", "name": "GruasSQL - Query Servicios", "outField": "payload", "returnType": 0, "throwErrors": 1, "query": "", "modeOpt": "queryMode", "modeOptType": "query", "queryOpt": "query", "queryOptType": "msg", "paramsOpt": "", "paramsOptType": "none", "rows": "rows", "rowsType": "msg", "parseMustache": true, "params": [], "x": 700, "y": 120, "wires": [ [ "6eb9b5543808fedb" ] ] }, { "id": "5750be6f324be5da", "type": "function", "z": "1a4b40705122dc91", "g": "a3043505f409dd12", "name": "Query para la exportación de datos de SQL", "func": "msg.query =`\nSELECT \n s.id AS id_servicio,\n s.id_vehiculo,\n v.matricula,\n v.fecha_entrada,\n s.fecha AS fecha_servicio,\n g.codigo_grua,\n ts.nombre AS TipoServicio,\n s.id_ubicacion_origen,\n altechs.latitud,\n altechs.longitud,\n altechs.calleRetirada_descripcion AS altech_calleRetirada_descripcion,\n altechs.calleRetirada_numero AS altech_calleRetirada_numero,\n s.id_calle_retirada,\n s.numero_retirada,\n via1.tipo AS TipoVia1,\n cp1.nombre AS Calle1,\n poblac1.poblacion AS Poblacion1,\n cp1.cp as cp1,\n via2.tipo AS TipoVia2,\n cp2.nombre AS Calle2,\n poblac2.poblacion AS Poblacion2,\n cp2.cp as cp2\nFROM Vista_UnionServicios s\nLEFT JOIN Vista_UnionVehiculos v ON v.id = s.id_vehiculo\nLEFT JOIN AltechAltaServicio altechs ON altechs.idVehiculo = s.id_vehiculo\nLEFT JOIN TC_Tipos_Servicio ts ON ts.id = s.id_tipo\nLEFT JOIN TC_Gruas g ON g.id_grua = s.id_grua\nLEFT JOIN CodPostal cp1 ON s.id_calle_retirada = cp1.id\nLEFT JOIN CodPostal_t cp2 ON s.id_calle_retirada2 = cp2.id\nLEFT JOIN codvia via1 ON via1.id = cp1.id_tipovia\nLEFT JOIN codvia via2 ON via2.id = cp2.id_tipo_v\nLEFT JOIN codpob poblac1 ON poblac1.id = cp1.id_pobl\nLEFT JOIN codpob_t poblac2 ON poblac2.id = cp2.id_pobl\nWHERE YEAR(s.fecha) = ${msg.payload}\nORDER BY s.fecha\n`;\n\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 120, "wires": [ [ "da1a19e474be7c21" ] ] }, { "id": "d647c9286ddb06ce", "type": "function", "z": "1a4b40705122dc91", "name": "Primer filtrado de valores y guarda en disco", "func": "const servicios_fecha = \"servicios_\" + msg.payload;\nflow.set(servicios_fecha, msg.result, \"file\");\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 430, "y": 1000, "wires": [ [ "535b18bcfc71f9cd" ] ], "info": "Sin limitación - 33095\r\nPosicion no nula - 31943" }, { "id": "40b5904a3022e5eb", "type": "function", "z": "1a4b40705122dc91", "g": "a3043505f409dd12", "name": "2005 - 2025", "func": "const start = 2005;\nconst end = 2025;\n\nfor (let year = start; year <= end; year++) {\n setTimeout(() => {\n node.send({ payload: year });\n }, (year - start) * 10000);\n};\n\n// No devolvemos msg porque los mensajes ya se envían con setTimeout\nreturn null;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 130, "y": 120, "wires": [ [ "5750be6f324be5da" ] ] }, { "id": "4ef62ad77f7d4652", "type": "inject", "z": "1a4b40705122dc91", "g": "a3043505f409dd12", "name": "Activación - Exportación de los datos de SQL", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 230, "y": 60, "wires": [ [ "40b5904a3022e5eb" ] ] }, { "id": "101adc2199c9c4ef", "type": "function", "z": "1a4b40705122dc91", "name": "Filtrado", "func": "// Filtrar el array para eliminar elementos donde Calle2 sea \"SIN DETERMINAR\"\nif (Array.isArray(msg.result)) {\n msg.result = msg.result.filter(item => item.Calle2 !== \"SIN DETERMINAR\"\n && item.Calle2 !== \"SIN CALLE\"\n && item.Calle2 !== \"MEDIODIA 2\"\n && item.Calle2 !== \"COMISARIA SAN BLAS - VICALVARO\"\n && item.Calle2 !== \"PASEO IMPERIAL\"\n && item.Calle2 !== \"No Codificada\"\n && item.Calle2 !== \"COMISARIA HORTALEZA\"\n && item.Calle2 !== \"CENTRO\"\n && item.Calle2 !== \"MEDIODIA 3\"\n && item.Calle2 !== \"MEDIODIA 3\"\n && item.Calle2 !== \"COLON\"\n && item.Calle2 !== \"BARCELO\"\n && item.Calle2 !== \"EL RECUERDO\"\n && item.Calle2 !== null);\n} else {\n // Si no es un array, mantener el result original\n node.warn(\"El result no es un array, no se puede filtrar\");\n}\n\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 160, "y": 1000, "wires": [ [ "d647c9286ddb06ce" ] ] }, { "id": "9a78cfa134973f38", "type": "inject", "z": "1a4b40705122dc91", "name": "Recuperamos Servicios", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 200, "y": 1060, "wires": [ [ "a5d5ef751185e3e9" ] ] }, { "id": "3acef3e43d0415d4", "type": "function", "z": "1a4b40705122dc91", "name": "Recuperar servicios y calcular número por año", "func": "// Recuperar en contexto persistente\nconst servicios_fecha = \"servicios_\" + msg.payload;\nmsg.servicios = flow.get(servicios_fecha, \"file\");\nmsg.resultado = {}\nmsg.resultado.fecha = msg.payload\nmsg.resultado.servicios = msg.servicios.length;\n\nreturn msg", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 300, "y": 1120, "wires": [ [ "495d54abe840ccc9" ] ] }, { "id": "a5d5ef751185e3e9", "type": "function", "z": "1a4b40705122dc91", "name": "2005 - 2025", "func": "const start = 2005;\nconst end = 2025;\n\nfor (let year = start; year <= end; year++) {\n setTimeout(() => {\n node.send({ payload: year });\n }, (year - start) * 2000);\n};\n\n// No devolvemos msg porque los mensajes ya se envían con setTimeout\nreturn null;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 1060, "wires": [ [ "3acef3e43d0415d4" ] ] }, { "id": "495d54abe840ccc9", "type": "debug", "z": "1a4b40705122dc91", "name": "Primer cálculo de valores", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "resultado", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 610, "y": 1120, "wires": [] }, { "id": "535b18bcfc71f9cd", "type": "debug", "z": "1a4b40705122dc91", "name": "debug 3", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 680, "y": 1000, "wires": [] }, { "id": "2a46f606e21ec6b3", "type": "debug", "z": "1a4b40705122dc91", "g": "a3043505f409dd12", "name": "Debug inserción Mongo", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 750, "y": 180, "wires": [] }, { "id": "08e53863f9d0559f", "type": "mongodb4", "z": "1a4b40705122dc91", "g": "a3043505f409dd12", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "Importación Mongo", "x": 530, "y": 180, "wires": [ [ "2a46f606e21ec6b3" ] ] }, { "id": "6eb9b5543808fedb", "type": "function", "z": "1a4b40705122dc91", "g": "a3043505f409dd12", "name": "Añadimos valores para la importación a mongo", "func": "let msg_new = {};\nmsg_new.payload = [msg.payload];\nmsg_new.collection = \"servicios_sin_filtrar\";\nmsg_new.operation = \"insertMany\";\n\nreturn msg_new;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 240, "y": 180, "wires": [ [ "08e53863f9d0559f" ] ] }, { "id": "acae736839e9942c", "type": "postgresql", "z": "1a4b40705122dc91", "name": "", "query": "SELECT * FROM ;", "postgreSQLConfig": "748b5921246ec468", "split": false, "rowsPerMsg": 1, "outputs": 1, "x": 770, "y": 1060, "wires": [ [] ] }, { "id": "683191909606de5f", "type": "inject", "z": "1a4b40705122dc91", "name": "Activación - Consulta valores sin geoposición", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 230, "y": 280, "wires": [ [ "b8576a74c9e3cc75" ] ] }, { "id": "c8a4cd4a752e245e", "type": "mongodb4", "z": "1a4b40705122dc91", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "Consulta", "x": 720, "y": 280, "wires": [ [ "3f28cc2972ec801e" ] ] }, { "id": "3f28cc2972ec801e", "type": "debug", "z": "1a4b40705122dc91", "name": "Resultado", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 860, "y": 280, "wires": [] }, { "id": "b8576a74c9e3cc75", "type": "function", "z": "1a4b40705122dc91", "name": "Prepación de la Consulta", "func": "// aggregation pipeline\nconst pipeline = [{\"$group\": {\n \"_id\": { \"year\": { \"$year\": \"$fecha_servicio\" } },\n \"totalRegistros\": { \"$sum\": 1 },\n \"latitudNoNull\": {\n \"$sum\": {\n \"$cond\": [{ \"$ne\": [\"$latitud\", null] }, 1, 0]\n }\n },\n \"longitudNoNull\": {\n \"$sum\": {\n \"$cond\": [{ \"$ne\": [\"$longitud\", null] }, 1, 0]\n }\n }\n }},\n {\n \"$sort\": { \"_id.year\": 1 }\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, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 530, "y": 280, "wires": [ [ "c8a4cd4a752e245e" ] ] }, { "id": "0f7838df86c0daa7", "type": "inject", "z": "1a4b40705122dc91", "name": "Activación - Consolidación calles (Coalescing)", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 230, "y": 340, "wires": [ [ "75602bbc0592e19f" ] ] }, { "id": "75602bbc0592e19f", "type": "function", "z": "1a4b40705122dc91", "name": "Prepación de la Consulta", "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, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 530, "y": 340, "wires": [ [ "0fc524aa3713e49b" ] ] }, { "id": "0fc524aa3713e49b", "type": "mongodb4", "z": "1a4b40705122dc91", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "Consulta", "x": 720, "y": 340, "wires": [ [ "3b087174de36c2d9" ] ] }, { "id": "3b087174de36c2d9", "type": "debug", "z": "1a4b40705122dc91", "name": "Resultado", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 860, "y": 340, "wires": [] }, { "id": "2c04e52c4cba3c98", "type": "inject", "z": "1a4b40705122dc91", "name": "Activación - Eliminar servicios sin calle", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 210, "y": 400, "wires": [ [ "df02d3cd352aff6f" ] ] }, { "id": "df02d3cd352aff6f", "type": "function", "z": "1a4b40705122dc91", "name": "Prepación de la Consulta", "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, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 530, "y": 400, "wires": [ [ "693f1f1fcfc09699" ] ] }, { "id": "693f1f1fcfc09699", "type": "mongodb4", "z": "1a4b40705122dc91", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "Consulta", "x": 720, "y": 400, "wires": [ [ "9cc523b662f53ded" ] ] }, { "id": "9cc523b662f53ded", "type": "debug", "z": "1a4b40705122dc91", "name": "Resultado", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 860, "y": 400, "wires": [] }, { "id": "4250b98e85f30aa3", "type": "change", "z": "1a4b40705122dc91", "name": "Preparación de la Consulta", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "find", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "servicios_consolidado_calle_filtrado", "tot": "str" }, { "t": "set", "p": "limit", "pt": "msg", "to": "100", "tot": "num" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[{ \"geocodingProcesado\": { \"$ne\": true } }, { \"limit\" : msg.limit }]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 620, "y": 700, "wires": [ [ "4af6fd0defd481ea" ] ] }, { "id": "4af6fd0defd481ea", "type": "mongodb4", "z": "1a4b40705122dc91", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 830, "y": 700, "wires": [ [ "4644d386e752575d" ] ] }, { "id": "b8fbe1c9e468142d", "type": "debug", "z": "1a4b40705122dc91", "name": "Resultado", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 840, "y": 1000, "wires": [] }, { "id": "c29fc5be5de649c4", "type": "inject", "z": "1a4b40705122dc91", "name": "Activación - Recuperar geoposiciones de CartoCiudad", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": "1", "topic": "", "payload": "", "payloadType": "date", "x": 260, "y": 700, "wires": [ [ "4250b98e85f30aa3" ] ] }, { "id": "4644d386e752575d", "type": "link out", "z": "1a4b40705122dc91", "name": "link out 1", "mode": "link", "links": [ "ec0a560685f299d8" ], "x": 935, "y": 700, "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": 480, "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": 500, "y": 480, "wires": [ [ "004948a143b907dd" ] ] }, { "id": "004948a143b907dd", "type": "mongodb4", "z": "1a4b40705122dc91", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "Consulta", "x": 720, "y": 480, "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": 900, "y": 480, "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": 490, "y": 520, "wires": [ [ "004948a143b907dd" ] ] }, { "id": "5e1954f3ba4bce4b", "type": "link in", "z": "1a4b40705122dc91", "name": "link in 3", "links": [ "0c8361e1ffd8995c", "3105cb58919fe886" ], "x": 445, "y": 660, "wires": [ [ "4250b98e85f30aa3" ] ] }, { "id": "7b7214ea354e3b74", "type": "inject", "z": "1a4b40705122dc91", "name": "Activación - Recuperar geoposiciones de CartoCiudad tratamiento rapido", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": "1", "topic": "", "payload": "", "payloadType": "date", "x": 320, "y": 800, "wires": [ [ "664bb290fa751036" ] ] }, { "id": "664bb290fa751036", "type": "change", "z": "1a4b40705122dc91", "name": "Preparación de la Consulta", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "find", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "servicios_consolidado_calle_filtrado", "tot": "str" }, { "t": "set", "p": "limit", "pt": "msg", "to": "1", "tot": "num" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[{ \"cartociudad\": { \"$exists\": false } }, { \"limit\" : msg.limit }]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 720, "y": 800, "wires": [ [ "ae75d79916e0a333" ] ] }, { "id": "ae75d79916e0a333", "type": "mongodb4", "z": "1a4b40705122dc91", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 930, "y": 800, "wires": [ [ "d1035ff8c39cd84c" ] ] }, { "id": "d1035ff8c39cd84c", "type": "link out", "z": "1a4b40705122dc91", "name": "Limpieza Rápida", "mode": "link", "links": [ "a66d44720bfed89d" ], "x": 1035, "y": 800, "wires": [] }, { "id": "1fd044cbc45e1620", "type": "function", "z": "a796bfad8ab76fe4", "name": "Generamos la consulta a Cartociudad", "func": "// msg.payload debe contener la dirección, ej. \"Calle Gran Vía 28, Madrid\"\nconst direccion = msg.consulta_calle;\nconst encoded = encodeURIComponent(direccion);\n\nmsg.original = msg.payload\n// API de CartoCiudad (gratuita España)\nmsg.method = \"GET\";\nmsg.url = `https://www.cartociudad.es/geocoder/api/geocoder/findJsonp?q=${encoded}`;\nreturn msg;\n", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 590, "y": 860, "wires": [ [ "c58559633003fc35" ] ] }, { "id": "c58559633003fc35", "type": "http request", "z": "a796bfad8ab76fe4", "name": "", "method": "use", "ret": "txt", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 830, "y": 860, "wires": [ [ "c2879b84c754c37d" ] ] }, { "id": "c2879b84c754c37d", "type": "function", "z": "a796bfad8ab76fe4", "name": "Filtramos el resultado", "func": "// Limpia la respuesta JSONP (callback(...))\nlet text = msg.payload.trim();\n\n// Detecta y elimina el formato \"callback(...)\" o \"callback123(...)\" u otros\ntext = text.replace(/^[a-zA-Z0-9_]+\\(/, '').replace(/\\);?$/, '');\n\nlet data;\ntry {\n data = JSON.parse(text);\n} catch (e) {\n node.error(\"Error al parsear JSON de CartoCiudad: \" + e.message);\n msg.payload = { error: \"Formato no válido de respuesta CartoCiudad\" };\n return msg;\n}\n\n// La API devuelve un solo objeto, no un array\nif (data && data.lat && data.lng) {\n msg.payload = {\n lat: data.lat,\n lon: data.lng,\n address: data.address || \"\",\n postalCode: data.postalCode || \"\",\n muni: data.muni || \"\",\n province: data.province || \"\",\n source: \"CartoCiudad\",\n raw: data\n };\n} else {\n msg.payload = { error: \"No se encontraron coordenadas en CartoCiudad\" };\n}\nreturn msg;\n", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1020, "y": 860, "wires": [ [ "3a02a4797e73bfe2" ] ] }, { "id": "ec0a560685f299d8", "type": "link in", "z": "a796bfad8ab76fe4", "name": "link in 1", "links": [ "4644d386e752575d" ], "x": 165, "y": 20, "wires": [ [ "5621fbd41709d68e" ] ] }, { "id": "1c10577fa4beb771", "type": "delay", "z": "a796bfad8ab76fe4", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 400, "y": 20, "wires": [ [ "d3881558e6fef33f" ] ] }, { "id": "5621fbd41709d68e", "type": "split", "z": "a796bfad8ab76fe4", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "property": "payload", "x": 250, "y": 20, "wires": [ [ "1c10577fa4beb771" ] ] }, { "id": "d3881558e6fef33f", "type": "change", "z": "a796bfad8ab76fe4", "name": "Generamos referencia_geocache y consulta_calle", "rules": [ { "t": "set", "p": "referencia_geocache", "pt": "msg", "to": "$join(\t $filter(\t [\t payload.TipoVia,\t payload.Calle,\t payload.numero_retirada,\t payload.Poblacion,\t payload.CP\t ],\t function($v){ $v != null and $v != \"\" }\t ),\t \",\"\t)", "tot": "jsonata" }, { "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 = \"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" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 390, "y": 80, "wires": [ [ "065d8956ac11a589" ] ] }, { "id": "3112772543b09bd9", "type": "change", "z": "a796bfad8ab76fe4", "name": "Creamos la consulta de referencia_geocache", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "find", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "geocache", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[{ \"referencia_geocache\": { \"$eq\": msg.referencia_geocache }}]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 370, "y": 160, "wires": [ [ "67310a0b495f77a2" ] ] }, { "id": "67310a0b495f77a2", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 630, "y": 160, "wires": [ [ "304f30478bb9e954" ] ] }, { "id": "304f30478bb9e954", "type": "switch", "z": "a796bfad8ab76fe4", "name": "Existe la calle en el cache?", "property": "$count(payload)", "propertyType": "jsonata", "rules": [ { "t": "eq", "v": "0", "vt": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 840, "y": 160, "wires": [ [ "039fe8c413696211" ], [ "ea5fca57029b791a" ] ], "outputLabels": [ "NO", "SI" ] }, { "id": "3a02a4797e73bfe2", "type": "switch", "z": "a796bfad8ab76fe4", "name": "Existen datos?", "property": "payload.lat", "propertyType": "msg", "rules": [ { "t": "istype", "v": "undefined", "vt": "undefined" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1220, "y": 860, "wires": [ [ "b5d1699d2f623f08" ], [ "5d8fed0824f5d590" ] ], "outputLabels": [ "NO", "SI" ] }, { "id": "2c1d536a860b099e", "type": "change", "z": "a796bfad8ab76fe4", "name": "Guardamos lo datos de la referencia de cache en mongo", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "insertOne", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "geocache", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\t \"referencia_geocache\": referencia_geocache,\t \"lat\": actualizar.lat,\t \"lon\": actualizar.lon,\t \"address\": actualizar.address,\t \"muni\": actualizar.muni,\t \"province\": actualizar.province,\t \"accion\" : \"validado\"\t}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 1380, "wires": [ [ "aa8980407983e089" ] ] }, { "id": "aa8980407983e089", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 890, "y": 1380, "wires": [ [ "22e91d97b48287ac" ] ] }, { "id": "a37d6875203d3cef", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 890, "y": 1440, "wires": [ [ "183f81d1ad8abb3f" ] ] }, { "id": "ee3b382fec9125f9", "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\": 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 {\t \"$set\": {\t \"latitud\": msg.payload.lat,\t \"longitud\": msg.payload.lon,\t \"geocodingProcesado\": true\t } \t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 580, "y": 1440, "wires": [ [ "a37d6875203d3cef" ] ] }, { "id": "92e5a359bb49899f", "type": "function", "z": "a796bfad8ab76fe4", "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 === \"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\nif (msg.consulta_calle === \"CALLE GENERAL GARCIA DE LA HERRANZ MADRID\") {\n msg.cambio.calle = \"DE LA COOPERACION\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE GENERAL VARELA 3 MADRID\") {\n msg.cambio.calle = \"JULIÁN BESTEIRO\";\n return msg;\n}\n\nif (msg.consulta_calle === \"AVENIDA GENERAL FANJUL 2 MADRID\") {\n msg.cambio.calle = \"DE LAS AGUILAS\";\n return msg;\n}\n\nif (msg.consulta_calle === \"PLAZA HERMANOS FALCO Y ALVAREZ DE TOLEDO 15 MADRID\") {\n msg.cambio.calle = \"MAYOR DE BARAJAS\";\n return msg;\n}\n\nif (msg.consulta_calle === \"PASAJE GENERAL MOLA 4 MADRID\") {\n msg.cambio.calle = \"ENRIQUE RUANO\";\n return msg;\n}\n\nif (msg.consulta_calle === \"PASEO DOCTOR VALLEJO NAJERA 44 MADRID\" ||\n msg.consulta_calle === \"PASEO JUAN ANTONIO VALLEJO NAJERA BOTAS 44 MADRID\") {\n msg.cambio.calle = \"JUAN ANTONIO VALLEJO-NAJERA BOTAS\";\n return msg;\n}\n\nif (msg.consulta_calle === \"CALLE GENERAL ROMERO BASART 86 MADRID\") {\n msg.cambio.calle = \"BLAS CABRERA\";\n return msg;\n}", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1000, "y": 2280, "wires": [ [] ] }, { "id": "a1f0210367ec78c3", "type": "debug", "z": "a796bfad8ab76fe4", "name": "CACHE", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 940, "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 msg.consulta_calle === \"ACCESO CALZADA 1 PK 880 MADRID\" ||\n msg.consulta_calle === \"BASE ESCUADRON MADRID\" ||\n msg.consulta_calle === \"BASE VELAZQUEZ MADRID\" ||\n msg.consulta_calle === \"PASEO PINOS MADRID\" ||\n msg.consulta_calle === \"CALLE HERMANOS FERNANDEZ SHAW 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": 960, "y": 2240, "wires": [ [], [] ] }, { "id": "4eee84ac85459806", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 830, "y": 1620, "wires": [ [ "237facc4aaef9d97" ] ] }, { "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": 480, "y": 260, "wires": [ [ "f33442e9c3fb97aa" ] ] }, { "id": "f33442e9c3fb97aa", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 790, "y": 260, "wires": [ [ "a1f0210367ec78c3" ] ] }, { "id": "385c8170afd1861c", "type": "debug", "z": "a796bfad8ab76fe4", "name": "ACTUALIZADOS", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1530, "y": 2980, "wires": [] }, { "id": "ae0ccf49a164192f", "type": "change", "z": "a796bfad8ab76fe4", "name": "Insertar", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "insertOne", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "consulta_calle", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\t \"consulta_calle\": $flowContext(\"consulta_calle\"),\t \"tipovia\": $flowContext(\"tipovia\"),\t \"calle\": $flowContext(\"calle\"),\t \"numero_retirada\": $flowContext(\"numero_retirada\"),\t \"extra_calle\": $flowContext(\"extra_calle\"),\t \"accion\": \"validado\"\t}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 920, "y": 2940, "wires": [ [ "cf7d08b21478be85" ] ] }, { "id": "76d0610e0cf4a848", "type": "ui-text-input", "z": "a796bfad8ab76fe4", "group": "2365cb156242b3e6", "name": "consulta_calle", "label": "consulta_calle", "order": 2, "width": 0, "height": 0, "topic": "topic", "topicType": "msg", "mode": "text", "tooltip": "", "delay": 300, "passthru": false, "sendOnDelay": false, "sendOnBlur": true, "sendOnEnter": true, "className": "", "clearable": false, "sendOnClear": false, "icon": "", "iconPosition": "left", "iconInnerPosition": "inside", "x": 780, "y": 2340, "wires": [ [ "3d08fca02fbfdc13" ] ] }, { "id": "13a8bf685ef1303b", "type": "ui-text-input", "z": "a796bfad8ab76fe4", "group": "2365cb156242b3e6", "name": "tipocalle", "label": "tipocalle", "order": 3, "width": 0, "height": 0, "topic": "topic", "topicType": "msg", "mode": "text", "tooltip": "", "delay": 300, "passthru": false, "sendOnDelay": false, "sendOnBlur": true, "sendOnEnter": true, "className": "", "clearable": false, "sendOnClear": false, "icon": "", "iconPosition": "left", "iconInnerPosition": "inside", "x": 760, "y": 2380, "wires": [ [ "a403b6e0d3b62351" ] ] }, { "id": "5a4e60652aab552c", "type": "ui-text-input", "z": "a796bfad8ab76fe4", "group": "2365cb156242b3e6", "name": "calle", "label": "calle", "order": 4, "width": 0, "height": 0, "topic": "topic", "topicType": "msg", "mode": "text", "tooltip": "", "delay": 300, "passthru": true, "sendOnDelay": false, "sendOnBlur": true, "sendOnEnter": true, "className": "", "clearable": false, "sendOnClear": false, "icon": "", "iconPosition": "left", "iconInnerPosition": "inside", "x": 750, "y": 2420, "wires": [ [ "2bb29b85114ff2c3" ] ] }, { "id": "a97aaad7209e3953", "type": "ui-text-input", "z": "a796bfad8ab76fe4", "group": "2365cb156242b3e6", "name": "numero_retirada", "label": "numero_retirada", "order": 5, "width": 0, "height": 0, "topic": "topic", "topicType": "msg", "mode": "text", "tooltip": "", "delay": 300, "passthru": true, "sendOnDelay": false, "sendOnBlur": true, "sendOnEnter": true, "className": "", "clearable": false, "sendOnClear": false, "icon": "", "iconPosition": "left", "iconInnerPosition": "inside", "x": 780, "y": 2460, "wires": [ [ "eae675ed8219e086" ] ] }, { "id": "2e1a6699fd10a0d0", "type": "ui-text-input", "z": "a796bfad8ab76fe4", "group": "2365cb156242b3e6", "name": "extra_calle", "label": "extra_calle", "order": 6, "width": 0, "height": 0, "topic": "topic", "topicType": "msg", "mode": "text", "tooltip": "", "delay": 300, "passthru": true, "sendOnDelay": false, "sendOnBlur": true, "sendOnEnter": true, "className": "", "clearable": false, "sendOnClear": false, "icon": "", "iconPosition": "left", "iconInnerPosition": "inside", "x": 770, "y": 2500, "wires": [ [ "bc7269f08c168a0b" ] ] }, { "id": "3dbbc9b098e37e96", "type": "ui-button", "z": "a796bfad8ab76fe4", "group": "2365cb156242b3e6", "name": "Insertar datos", "label": "Insertar Datos", "order": 7, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "ultima_validacion", "payloadType": "flow", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 360, "y": 2680, "wires": [ [ "ee0c6a9d7d1aa05c", "a75d78af573442dc" ] ] }, { "id": "3d08fca02fbfdc13", "type": "change", "z": "a796bfad8ab76fe4", "name": "", "rules": [ { "t": "set", "p": "consulta_calle", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1000, "y": 2340, "wires": [ [] ] }, { "id": "a403b6e0d3b62351", "type": "change", "z": "a796bfad8ab76fe4", "name": "", "rules": [ { "t": "set", "p": "tipovia", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 980, "y": 2380, "wires": [ [] ] }, { "id": "2bb29b85114ff2c3", "type": "change", "z": "a796bfad8ab76fe4", "name": "", "rules": [ { "t": "set", "p": "calle", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 970, "y": 2420, "wires": [ [] ] }, { "id": "eae675ed8219e086", "type": "change", "z": "a796bfad8ab76fe4", "name": "", "rules": [ { "t": "set", "p": "numero_retirada", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1010, "y": 2460, "wires": [ [] ] }, { "id": "bc7269f08c168a0b", "type": "change", "z": "a796bfad8ab76fe4", "name": "", "rules": [ { "t": "set", "p": "extra_calle", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 990, "y": 2500, "wires": [ [] ] }, { "id": "cf7d08b21478be85", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 1070, "y": 2940, "wires": [ [ "f521d21d39f94c81" ] ] }, { "id": "65929efb1b36beb0", "type": "change", "z": "a796bfad8ab76fe4", "name": "Buscar", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "findOne", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "consulta_calle", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[{ \"consulta_calle\": { \"$eq\": $flowContext(\"consulta_calle\") }}]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 460, "y": 2960, "wires": [ [ "acf35447afb95d83" ] ] }, { "id": "acf35447afb95d83", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 610, "y": 2960, "wires": [ [ "d004b5eb8f81d4f5" ] ] }, { "id": "d004b5eb8f81d4f5", "type": "switch", "z": "a796bfad8ab76fe4", "name": "¿Existe?", "property": "payload", "propertyType": "msg", "rules": [ { "t": "null" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 760, "y": 2960, "wires": [ [ "ae0ccf49a164192f" ], [ "376d12f46845ec84", "a91e0f85d9f57fb2" ] ], "outputLabels": [ "NO", "SI" ] }, { "id": "376d12f46845ec84", "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\": $flowContext(\"tipovia_original\"),\t \"Calle\": $flowContext(\"calle_original\"),\t \"numero_retirada\": $flowContext(\"numero_retirada_original\"),\t \"Poblacion\": $flowContext(\"poblacion_original\"),\t \"CP\": $flowContext(\"cp_original\")\t },\t {\t \"$set\": {\t \"TipoVia\": $flowContext(\"tipovia\"),\t \"Calle\": $flowContext(\"calle\"),\t \"numero_retirada\": $flowContext(\"numero_retirada\"),\t \"extra_calle\": $flowContext(\"extra_calle\"),\t \"geocodingProcesado\": \"false\"\t }\t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1060, "y": 2980, "wires": [ [ "54cfdd34c936f6b8" ] ] }, { "id": "11f1b5cccc45d206", "type": "change", "z": "a796bfad8ab76fe4", "name": "Actualizamos la consulta_calle", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "updateMany", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "consulta_calle", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[\t {\t \"consulta_calle\": $flowContext(\"consulta_calle\")\t },\t {\t \"$set\": {\t \"tipovia\": $flowContext(\"tipovia\"),\t \"calle\": $flowContext(\"calle\"),\t \"numero_retirada\": $flowContext(\"numero_retirada\"),\t \"extra_calle\": $flowContext(\"extra_calle\")\t }\t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 990, "y": 3100, "wires": [ [ "397b758c268fcfe3" ] ] }, { "id": "54cfdd34c936f6b8", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 1350, "y": 2980, "wires": [ [ "385c8170afd1861c" ] ] }, { "id": "397b758c268fcfe3", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 1210, "y": 3100, "wires": [ [ "01486ff2b815efdc" ] ] }, { "id": "929680815ce51af8", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 1370, "y": 3040, "wires": [ [ "be21eaa7c3594803" ] ] }, { "id": "a91e0f85d9f57fb2", "type": "change", "z": "a796bfad8ab76fe4", "name": "Borramos los datos de la referencia de cache en mongo", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "deleteMany", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "geocache", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[{ \"referencia_geocache\": { \"$eq\": $flowContext(\"referencia_geocache\") }}]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1070, "y": 3040, "wires": [ [ "929680815ce51af8" ] ] }, { "id": "d6116b226cfad9d6", "type": "trigger", "z": "a796bfad8ab76fe4", "name": "", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "0", "extend": false, "overrideDelay": false, "units": "ms", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 770, "y": 2280, "wires": [ [] ] }, { "id": "5c95290ed28a98cc", "type": "change", "z": "a796bfad8ab76fe4", "name": "Pongo consulta calle", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "consulta_calle", "tot": "msg" }, { "t": "set", "p": "referencia_geocache", "pt": "flow", "to": "referencia_geocache", "tot": "msg" }, { "t": "set", "p": "tipovia_original", "pt": "flow", "to": "msg.direccion.TipoVia", "tot": "msg" }, { "t": "set", "p": "calle_original", "pt": "flow", "to": "direccion.Calle", "tot": "msg" }, { "t": "set", "p": "numero_retirada_original", "pt": "flow", "to": "direccion.numero_retirada", "tot": "msg" }, { "t": "set", "p": "poblacion_original", "pt": "flow", "to": "direccion.Poblacion", "tot": "msg" }, { "t": "set", "p": "cp_original", "pt": "flow", "to": "direccion.CP", "tot": "msg" }, { "t": "set", "p": "ultima_validacion", "pt": "flow", "to": "msg", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 560, "y": 2340, "wires": [ [ "76d0610e0cf4a848" ] ] }, { "id": "ee0c6a9d7d1aa05c", "type": "change", "z": "a796bfad8ab76fe4", "name": "", "rules": [ { "t": "set", "p": "trigger", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 380, "y": 2620, "wires": [ [ "0579fe31ed7de68e" ] ] }, { "id": "237facc4aaef9d97", "type": "debug", "z": "a796bfad8ab76fe4", "name": "BORRADO CACHE", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1020, "y": 1620, "wires": [] }, { "id": "065d8956ac11a589", "type": "change", "z": "a796bfad8ab76fe4", "name": "Copiamos la dirección en dirección para consultas posteriores", "rules": [ { "t": "set", "p": "direccion", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 430, "y": 120, "wires": [ [ "3112772543b09bd9" ] ] }, { "id": "039fe8c413696211", "type": "link out", "z": "a796bfad8ab76fe4", "name": "OUT - Consulta referencia_geocache - No existe", "mode": "link", "links": [ "362dad96d3acb433" ], "x": 995, "y": 140, "wires": [] }, { "id": "ea5fca57029b791a", "type": "link out", "z": "a796bfad8ab76fe4", "name": "OUT - Consulta referencia_geocache - Si existe", "mode": "link", "links": [ "8e600a2622518a91" ], "x": 995, "y": 180, "wires": [] }, { "id": "8e600a2622518a91", "type": "link in", "z": "a796bfad8ab76fe4", "name": "IN - Consulta referencia_geocache - Si existe", "links": [ "ea5fca57029b791a" ], "x": 215, "y": 260, "wires": [ [ "2432622b4a8371d9" ] ] }, { "id": "a2728ad52fcd926b", "type": "debug", "z": "a796bfad8ab76fe4", "name": "IGUALES - VALIDADO", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1160, "y": 540, "wires": [] }, { "id": "4320d2d03e53a85c", "type": "comment", "z": "a796bfad8ab76fe4", "name": "Si existe la referencia se actualiza", "info": "", "x": 340, "y": 220, "wires": [] }, { "id": "45cf835dcdbd1a3a", "type": "comment", "z": "a796bfad8ab76fe4", "name": "No existe la referencia", "info": "", "x": 300, "y": 380, "wires": [] }, { "id": "7e1ef1bd33f94522", "type": "link in", "z": "a796bfad8ab76fe4", "name": "IN - Consulta referencia_geocache - No existe", "links": [], "x": 215, "y": 420, "wires": [ [ "203e1085c0c47c13" ] ] }, { "id": "203e1085c0c47c13", "type": "change", "z": "a796bfad8ab76fe4", "name": "Buscarmos la calle en la base de datos de consulta_calle", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "find", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "consulta_calle", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[{ \"consulta_calle \": { \"$eq\": msg.consulta_calle }}]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 470, "y": 420, "wires": [ [ "87e7bd9dc902fc8d" ] ] }, { "id": "87e7bd9dc902fc8d", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 770, "y": 420, "wires": [ [ "5fc42487deb4834e" ] ] }, { "id": "5fc42487deb4834e", "type": "switch", "z": "a796bfad8ab76fe4", "name": "Existe la calle en consulta_calle?", "property": "$count(payload)", "propertyType": "jsonata", "rules": [ { "t": "eq", "v": "0", "vt": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1000, "y": 420, "wires": [ [ "ed849af6a3bc7f94" ], [ "3ef05c3f5e8cf598" ] ], "outputLabels": [ "NO", "SI" ] }, { "id": "ed849af6a3bc7f94", "type": "link out", "z": "a796bfad8ab76fe4", "name": "OUT - Consulta consulta_calle - No existe", "mode": "link", "links": [ "362dad96d3acb433" ], "x": 1185, "y": 400, "wires": [] }, { "id": "3ef05c3f5e8cf598", "type": "link out", "z": "a796bfad8ab76fe4", "name": "OUT - Consulta consulta_calle - Si existe", "mode": "link", "links": [ "34d799f171e47da5" ], "x": 1185, "y": 440, "wires": [] }, { "id": "34d799f171e47da5", "type": "link in", "z": "a796bfad8ab76fe4", "name": "IN - Consulta consulta_calle - Si existe", "links": [ "3ef05c3f5e8cf598" ], "x": 215, "y": 580, "wires": [ [ "ea176a490b716f31" ] ] }, { "id": "fa5477b702141436", "type": "comment", "z": "a796bfad8ab76fe4", "name": "Si existe la calle", "info": "", "x": 280, "y": 520, "wires": [] }, { "id": "8a3bbd2c812a3210", "type": "comment", "z": "a796bfad8ab76fe4", "name": "No existe la calle", "info": "", "x": 280, "y": 800, "wires": [] }, { "id": "362dad96d3acb433", "type": "link in", "z": "a796bfad8ab76fe4", "name": "IN - Consulta consulta_calle - No existe", "links": [ "ed849af6a3bc7f94", "039fe8c413696211" ], "x": 215, "y": 860, "wires": [ [ "f824743db6a45636" ] ] }, { "id": "8fea8c90dd9194ec", "type": "inject", "z": "a796bfad8ab76fe4", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": "1", "topic": "", "payload": "", "payloadType": "date", "x": 710, "y": 800, "wires": [ [ "3105cb58919fe886" ] ] }, { "id": "3105cb58919fe886", "type": "link out", "z": "a796bfad8ab76fe4", "name": "link out 2", "mode": "link", "links": [ "5e1954f3ba4bce4b" ], "x": 835, "y": 800, "wires": [] }, { "id": "ea176a490b716f31", "type": "switch", "z": "a796bfad8ab76fe4", "name": "Accion que se hace según la consulta", "property": "payload.accion", "propertyType": "msg", "rules": [ { "t": "eq", "v": "validado", "vt": "str" }, { "t": "eq", "v": "eliminar", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 410, "y": 580, "wires": [ [ "1f77c5f90a3ffb63" ], [ "a5a82ce094a9262a" ], [ "22cab22ef894585c" ] ], "outputLabels": [ "Se actuliza el valor de la calle", "Se borra la calle", "Se estudia" ] }, { "id": "1f77c5f90a3ffb63", "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\": 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 {\t \"$set\": {\t \"latitud\": msg.payload.lat,\t \"longitud\": msg.payload.lon,\t \"geocodingProcesado\": true\t } \t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 820, "y": 540, "wires": [ [ "a2728ad52fcd926b" ] ] }, { "id": "a5a82ce094a9262a", "type": "debug", "z": "a796bfad8ab76fe4", "name": "ELIMINAR", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1130, "y": 580, "wires": [] }, { "id": "22cab22ef894585c", "type": "debug", "z": "a796bfad8ab76fe4", "name": "TRATAR", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1120, "y": 620, "wires": [] }, { "id": "f824743db6a45636", "type": "delay", "z": "a796bfad8ab76fe4", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 340, "y": 860, "wires": [ [ "1fd044cbc45e1620" ] ] }, { "id": "5d8fed0824f5d590", "type": "link out", "z": "a796bfad8ab76fe4", "name": "OUT - Catociudad con datos", "mode": "link", "links": [ "267efedbc42eb1dc" ], "x": 1345, "y": 880, "wires": [] }, { "id": "b5d1699d2f623f08", "type": "link out", "z": "a796bfad8ab76fe4", "name": "OUT - Cartociudad sin datos", "mode": "link", "links": [ "629bb3d5189f7e53", "37f1c5b138623383" ], "x": 1345, "y": 840, "wires": [] }, { "id": "407bef05d919bd52", "type": "comment", "z": "a796bfad8ab76fe4", "name": "Cartociudad con datos", "info": "", "x": 300, "y": 940, "wires": [] }, { "id": "412a0aa8b5a7a677", "type": "comment", "z": "a796bfad8ab76fe4", "name": "Cartociudad sin datos", "info": "", "x": 480, "y": 2240, "wires": [] }, { "id": "267efedbc42eb1dc", "type": "link in", "z": "a796bfad8ab76fe4", "name": "IN - Cartociudad con datos", "links": [ "5d8fed0824f5d590" ], "x": 215, "y": 980, "wires": [ [ "8f57171dbb68e9cc" ] ] }, { "id": "629bb3d5189f7e53", "type": "link in", "z": "a796bfad8ab76fe4", "name": "IN - Cartociudad sin datos", "links": [ "b5d1699d2f623f08", "f9145f1a463f19ec" ], "x": 405, "y": 2280, "wires": [ [ "0579fe31ed7de68e" ] ] }, { "id": "dcc5a797823a45a1", "type": "ui-text", "z": "a796bfad8ab76fe4", "group": "29e5d13e29bfbb4b", "order": 1, "width": 0, "height": 0, "name": "consulta_calle", "label": "Consulta Calle: ", "format": "{{msg.payload}}", "layout": "row-left", "style": false, "font": "", "fontSize": 16, "color": "#717171", "wrapText": false, "className": "", "value": "consulta_calle", "valueType": "msg", "x": 900, "y": 1060, "wires": [] }, { "id": "d0df21d0eea0830f", "type": "change", "z": "a796bfad8ab76fe4", "name": "Genera resultado_cartociudad", "rules": [ { "t": "set", "p": "resultado_cartociudad", "pt": "msg", "to": "payload.address& \" \" &payload.raw.portalNumber& \" \" &payload.muni& \" \" &payload.province& \" \" &payload.postalCode", "tot": "jsonata" }, { "t": "set", "p": "actualizar", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "validando_direccion", "pt": "flow", "to": "msg", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 650, "y": 1100, "wires": [ [ "4255d678e6b1a913", "dcc5a797823a45a1", "bec1c77eb24511de", "5ebdb2911c7f8cec", "3dd3ba5f79fbf5a7" ] ] }, { "id": "4255d678e6b1a913", "type": "ui-text", "z": "a796bfad8ab76fe4", "group": "29e5d13e29bfbb4b", "order": 12, "width": 0, "height": 0, "name": "resultado_cartociudad", "label": "Resultado Cartociudad: ", "format": "{{msg.payload}}", "layout": "row-left", "style": false, "font": "", "fontSize": 16, "color": "#717171", "wrapText": false, "className": "", "value": "resultado_cartociudad", "valueType": "msg", "x": 920, "y": 1100, "wires": [] }, { "id": "bec1c77eb24511de", "type": "ui-button", "z": "a796bfad8ab76fe4", "group": "29e5d13e29bfbb4b", "name": "Validar", "label": "Validar", "order": 11, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "validando_direccion", "payloadType": "flow", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 870, "y": 1140, "wires": [ [ "36c4d29cd8bb931c" ] ] }, { "id": "5ebdb2911c7f8cec", "type": "ui-button", "z": "a796bfad8ab76fe4", "group": "29e5d13e29bfbb4b", "name": "Eliminar", "label": "Eliminar", "order": 9, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "validando_direccion", "payloadType": "flow", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 880, "y": 1180, "wires": [ [ "282609e0a8a595e7" ] ] }, { "id": "931dfde533b77924", "type": "change", "z": "a796bfad8ab76fe4", "name": "reset", "rules": [ { "t": "set", "p": "trigger", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 330, "y": 1160, "wires": [ [ "1d6863142aee9387" ] ] }, { "id": "36c4d29cd8bb931c", "type": "link out", "z": "a796bfad8ab76fe4", "name": "OUT - Validado", "mode": "link", "links": [ "9e2a81ef52b0c2d2", "0f4165650f826238" ], "x": 955, "y": 1140, "wires": [] }, { "id": "9e2a81ef52b0c2d2", "type": "link in", "z": "a796bfad8ab76fe4", "name": "IN - Validado", "links": [ "36c4d29cd8bb931c", "c1a6d3e32d669058" ], "x": 285, "y": 1420, "wires": [ [ "2c1d536a860b099e", "ee3b382fec9125f9" ] ] }, { "id": "22e91d97b48287ac", "type": "debug", "z": "a796bfad8ab76fe4", "name": "GUARDA geocache", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1080, "y": 1380, "wires": [] }, { "id": "183f81d1ad8abb3f", "type": "debug", "z": "a796bfad8ab76fe4", "name": "ACTUALIZA Calles", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1070, "y": 1440, "wires": [] }, { "id": "f521d21d39f94c81", "type": "debug", "z": "a796bfad8ab76fe4", "name": "INSERTADO EN SIN DATOS", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1280, "y": 2940, "wires": [] }, { "id": "be21eaa7c3594803", "type": "debug", "z": "a796bfad8ab76fe4", "name": "BORRADOS", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1530, "y": 3040, "wires": [] }, { "id": "01486ff2b815efdc", "type": "debug", "z": "a796bfad8ab76fe4", "name": "CONSULTA CALLE", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1390, "y": 3100, "wires": [] }, { "id": "45bf0a36274043c1", "type": "debug", "z": "a796bfad8ab76fe4", "name": "ELIMINAR CALLES", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1020, "y": 1580, "wires": [] }, { "id": "a75d78af573442dc", "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\": $uppercase($flowContext(\"tipovia_original\")),\t \"Calle\": $uppercase($flowContext(\"calle_original\")),\t \"numero_retirada\": $flowContext(\"numero_retirada_original\"),\t \"Poblacion\": $uppercase($flowContext(\"poblacion_original\")),\t \"CP\": $flowContext(\"cp_original\")\t },\t {\t \"$set\": {\t \"TipoVia\": $uppercase($flowContext(\"tipovia\")),\t \"Calle\": $uppercase($flowContext(\"calle\")),\t \"numero_retirada\": $flowContext(\"numero_retirada\"),\t \"extra_calle\": $uppercase($flowContext(\"extra_calle\")),\t \"geocodingProcesado\": \"false\"\t }\t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 680, "y": 2680, "wires": [ [ "71e6a918e85cbd07", "94f0347ee6f32d6b" ] ] }, { "id": "71e6a918e85cbd07", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 970, "y": 2680, "wires": [ [ "19418aad3da76453" ] ] }, { "id": "19418aad3da76453", "type": "debug", "z": "a796bfad8ab76fe4", "name": "ACTUALIZADOS", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1150, "y": 2680, "wires": [] }, { "id": "282609e0a8a595e7", "type": "link out", "z": "a796bfad8ab76fe4", "name": "OUT - Cartociudad Eliminar", "mode": "link", "links": [ "c741abf63475207c", "0f4165650f826238" ], "x": 975, "y": 1180, "wires": [] }, { "id": "c741abf63475207c", "type": "link in", "z": "a796bfad8ab76fe4", "name": "IN - Eliminar", "links": [ "282609e0a8a595e7" ], "x": 225, "y": 1580, "wires": [ [ "e2ddb79b71bb9c44", "4a449c21d82898f9" ] ] }, { "id": "e2ddb79b71bb9c44", "type": "change", "z": "a796bfad8ab76fe4", "name": "Actualizamos los datos de todas las calles que sean iguales", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "deleteMany", "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]", "tot": "jsonata" }, { "t": "set", "p": "consulta_realizada", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 520, "y": 1580, "wires": [ [ "2246878e7d3d7af2" ] ] }, { "id": "2246878e7d3d7af2", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 830, "y": 1580, "wires": [ [ "45bf0a36274043c1" ] ] }, { "id": "4a449c21d82898f9", "type": "change", "z": "a796bfad8ab76fe4", "name": "Guardamos lo datos de la referencia de cache en mongo", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "insertOne", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "geocache", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\t \"referencia_geocache\": referencia_geocache,\t \"accion\" : \"eliminar\"\t}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 510, "y": 1620, "wires": [ [ "4eee84ac85459806" ] ] }, { "id": "3dd3ba5f79fbf5a7", "type": "ui-button", "z": "a796bfad8ab76fe4", "group": "29e5d13e29bfbb4b", "name": "Tratar", "label": "Tratar", "order": 10, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "validando_direccion", "payloadType": "flow", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 870, "y": 1220, "wires": [ [ "f9145f1a463f19ec" ] ] }, { "id": "f9145f1a463f19ec", "type": "link out", "z": "a796bfad8ab76fe4", "name": "link out 3", "mode": "link", "links": [ "629bb3d5189f7e53", "0f4165650f826238" ], "x": 975, "y": 1220, "wires": [] }, { "id": "41c4984165a1b830", "type": "ui-button", "z": "a796bfad8ab76fe4", "group": "29e5d13e29bfbb4b", "name": "Liberar", "label": "Liberar", "order": 8, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "", "payloadType": "date", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 880, "y": 1260, "wires": [ [ "3341669b8aca5958" ] ] }, { "id": "3341669b8aca5958", "type": "link out", "z": "a796bfad8ab76fe4", "name": "OUT - Liberar", "mode": "link", "links": [ "0f4165650f826238" ], "x": 975, "y": 1260, "wires": [] }, { "id": "0f4165650f826238", "type": "link in", "z": "a796bfad8ab76fe4", "name": "IN - Liberar siguiente", "links": [ "36c4d29cd8bb931c", "282609e0a8a595e7", "f9145f1a463f19ec", "3341669b8aca5958" ], "x": 235, "y": 1160, "wires": [ [ "931dfde533b77924" ] ] }, { "id": "2b215b7870143e56", "type": "ui-button", "z": "a796bfad8ab76fe4", "group": "2365cb156242b3e6", "name": "Mostrar", "label": "Mostrar", "order": 8, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "ultima_validacion", "payloadType": "flow", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 340, "y": 2800, "wires": [ [ "fbc6b6e11099f864", "ee0c6a9d7d1aa05c" ] ] }, { "id": "fbc6b6e11099f864", "type": "debug", "z": "a796bfad8ab76fe4", "name": "Mostrar datos", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 540, "y": 2800, "wires": [] }, { "id": "f399ed6d081a0343", "type": "ui-button", "z": "a796bfad8ab76fe4", "group": "2365cb156242b3e6", "name": "Borrar", "label": "Borrar", "order": 1, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "ultima_validacion", "payloadType": "flow", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 330, "y": 2860, "wires": [ [ "ee0c6a9d7d1aa05c", "23d65be42ea9f363" ] ] }, { "id": "23d65be42ea9f363", "type": "change", "z": "a796bfad8ab76fe4", "name": "Borramos los datos de las calles mal codificadas", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "deleteMany", "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\": payload.direccion.TipoVia,\t \"Calle\": payload.direccion.Calle,\t \"numero_retirada\": payload.direccion.numero_retirada,\t \"Poblacion\": payload.direccion.Poblacion,\t \"CP\": payload.direccion.CP \t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 640, "y": 2860, "wires": [ [ "95b1dd4f471bf039" ] ] }, { "id": "95b1dd4f471bf039", "type": "mongodb4", "z": "a796bfad8ab76fe4", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 970, "y": 2860, "wires": [ [ "2d79b1d9949e3dd0" ] ] }, { "id": "2d79b1d9949e3dd0", "type": "debug", "z": "a796bfad8ab76fe4", "name": "BORRADOS", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1150, "y": 2860, "wires": [] }, { "id": "94f0347ee6f32d6b", "type": "file", "z": "a796bfad8ab76fe4", "name": "", "filename": "actualizacion_direcciones", "filenameType": "str", "appendNewline": true, "createDir": false, "overwriteFile": "false", "encoding": "none", "x": 1010, "y": 2640, "wires": [ [] ] }, { "id": "0579fe31ed7de68e", "type": "simple-queue", "z": "a796bfad8ab76fe4", "name": "", "firstMessageBypass": false, "bypassInterval": "0", "x": 250, "y": 1020, "wires": [ [ "5c95290ed28a98cc" ] ] }, { "id": "1d6863142aee9387", "type": "simple-queue", "z": "a796bfad8ab76fe4", "name": "", "firstMessageBypass": false, "bypassInterval": "0", "x": 450, "y": 1020, "wires": [ [ "d0df21d0eea0830f" ] ] }, { "id": "356eeecb9e7fc0e3", "type": "trigger", "z": "a796bfad8ab76fe4", "name": "Solo uno a tratar a la vez", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "0", "extend": false, "overrideDelay": false, "units": "ms", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 670, "y": 1060, "wires": [ [] ] }, { "id": "8f57171dbb68e9cc", "type": "function", "z": "a796bfad8ab76fe4", "name": "Eliminamos los que son coincidentes para no tener que tratarlos manualmente", "func": "// Función para normalizar texto (elimina acentos y convierte a mayúsculas)\nfunction normalizarTexto(texto) {\n return texto.toString()\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .toUpperCase()\n .trim();\n}\n\n// Comparación con normalización de address y province\nconst addressCoincide = normalizarTexto(msg.payload.address) === normalizarTexto(msg.direccion.Calle);\nconst provinceCoincide = normalizarTexto(msg.payload.province) === normalizarTexto(msg.direccion.Poblacion);\n\nif (addressCoincide && provinceCoincide) {\n return [null, msg]; // Salida 2 - coinciden\n} else {\n return [msg, null]; // Salida 1 - no coinciden\n}", "outputs": 2, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 540, "y": 980, "wires": [ [ "1d6863142aee9387" ], [ "c1a6d3e32d669058" ] ] }, { "id": "c1a6d3e32d669058", "type": "link out", "z": "a796bfad8ab76fe4", "name": "link out 4", "mode": "link", "links": [ "9e2a81ef52b0c2d2" ], "x": 895, "y": 1020, "wires": [] }, { "id": "a66d44720bfed89d", "type": "link in", "z": "6e1ee0f06e75580d", "name": "Entrada Cartociudad 2", "links": [ "d1035ff8c39cd84c" ], "x": 205, "y": 40, "wires": [ [ "88517c37afc36dd8" ] ] }, { "id": "3bb66c22727588c3", "type": "switch", "z": "6e1ee0f06e75580d", "name": "Accion que se hace según la consulta", "property": "payload.accion", "propertyType": "msg", "rules": [ { "t": "eq", "v": "validado", "vt": "str" }, { "t": "eq", "v": "eliminar", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 530, "y": 500, "wires": [ [ "a23bb95e94319218" ], [ "3e23306582382edc" ], [ "fd8b53ea98c67e93" ] ], "outputLabels": [ "Se actuliza el valor de la calle", "Se borra la calle", "Se estudia" ] }, { "id": "88517c37afc36dd8", "type": "split", "z": "6e1ee0f06e75580d", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "property": "payload", "x": 290, "y": 40, "wires": [ [ "022364dc0148870e" ] ] }, { "id": "022364dc0148870e", "type": "delay", "z": "6e1ee0f06e75580d", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 440, "y": 40, "wires": [ [ "65d4baca6edf0fbd" ] ] }, { "id": "65d4baca6edf0fbd", "type": "change", "z": "6e1ee0f06e75580d", "name": "Generamos referencia_geocache y consulta_calle", "rules": [ { "t": "set", "p": "referencia_geocache", "pt": "msg", "to": "$join(\t $filter(\t [\t payload.TipoVia,\t payload.Calle,\t payload.numero_retirada,\t payload.Poblacion,\t payload.CP\t ],\t function($v){ $v != null and $v != \"\" }\t ),\t \",\"\t)", "tot": "jsonata" }, { "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 = \"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" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 430, "y": 100, "wires": [ [ "c106948998237652" ] ] }, { "id": "c106948998237652", "type": "change", "z": "6e1ee0f06e75580d", "name": "Copiamos la dirección en dirección para consultas posteriores", "rules": [ { "t": "set", "p": "direccion", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 470, "y": 140, "wires": [ [ "45144d8953fb168a" ] ] }, { "id": "45144d8953fb168a", "type": "change", "z": "6e1ee0f06e75580d", "name": "Creamos la consulta de referencia_geocache", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "find", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "geocache", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[{ \"referencia_geocache\": { \"$eq\": msg.referencia_geocache }}]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 410, "y": 180, "wires": [ [ "d4531a5b62fccd5a" ] ] }, { "id": "d4531a5b62fccd5a", "type": "mongodb4", "z": "6e1ee0f06e75580d", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 670, "y": 180, "wires": [ [ "c6d1ee72149ef4da" ] ] }, { "id": "c6d1ee72149ef4da", "type": "switch", "z": "6e1ee0f06e75580d", "name": "Existe la calle en el cache?", "property": "$count(payload)", "propertyType": "jsonata", "rules": [ { "t": "eq", "v": "0", "vt": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 180, "y": 240, "wires": [ [ "fe421b6180fe2f15" ], [ "f04f31bb7e647ab7" ] ], "outputLabels": [ "NO", "SI" ] }, { "id": "ff1fa52c7fb6436d", "type": "comment", "z": "6e1ee0f06e75580d", "name": "Si existe la referencia se actualiza", "info": "", "x": 480, "y": 240, "wires": [] }, { "id": "f04f31bb7e647ab7", "type": "change", "z": "6e1ee0f06e75580d", "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 },\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": 560, "y": 280, "wires": [ [ "2142cf292ba4dece" ] ] }, { "id": "2142cf292ba4dece", "type": "mongodb4", "z": "6e1ee0f06e75580d", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 870, "y": 280, "wires": [ [ "1be09b79f432c626" ] ] }, { "id": "1be09b79f432c626", "type": "debug", "z": "6e1ee0f06e75580d", "name": "CACHE", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1020, "y": 280, "wires": [] }, { "id": "a5cf9bb1543ccbdf", "type": "comment", "z": "6e1ee0f06e75580d", "name": "No existe la referencia", "info": "", "x": 440, "y": 320, "wires": [] }, { "id": "fe421b6180fe2f15", "type": "change", "z": "6e1ee0f06e75580d", "name": "Buscarmos la calle en la base de datos de consulta_calle", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "find", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "consulta_calle", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[{ \"consulta_calle \": { \"$eq\": msg.consulta_calle }}]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 550, "y": 360, "wires": [ [ "f98d50aac4fce670" ] ] }, { "id": "f98d50aac4fce670", "type": "mongodb4", "z": "6e1ee0f06e75580d", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 850, "y": 360, "wires": [ [ "385b936f30611065" ] ] }, { "id": "385b936f30611065", "type": "switch", "z": "6e1ee0f06e75580d", "name": "Existe la calle en consulta_calle?", "property": "$count(payload)", "propertyType": "jsonata", "rules": [ { "t": "eq", "v": "0", "vt": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 200, "y": 460, "wires": [ [ "d6db349d1646634d" ], [ "3bb66c22727588c3" ] ], "outputLabels": [ "NO", "SI" ] }, { "id": "841cb88a7b666a63", "type": "comment", "z": "6e1ee0f06e75580d", "name": "Si existe la calle", "info": "", "x": 460, "y": 440, "wires": [] }, { "id": "a23bb95e94319218", "type": "change", "z": "6e1ee0f06e75580d", "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\": 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 {\t \"$set\": {\t \"latitud\": msg.payload.lat,\t \"longitud\": msg.payload.lon,\t \"geocodingProcesado\": true\t } \t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 940, "y": 460, "wires": [ [ "041c57934c647e2c" ] ] }, { "id": "041c57934c647e2c", "type": "debug", "z": "6e1ee0f06e75580d", "name": "IGUALES - VALIDADO", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1280, "y": 460, "wires": [] }, { "id": "3e23306582382edc", "type": "debug", "z": "6e1ee0f06e75580d", "name": "ELIMINAR", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 790, "y": 500, "wires": [] }, { "id": "fd8b53ea98c67e93", "type": "debug", "z": "6e1ee0f06e75580d", "name": "TRATAR", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 780, "y": 540, "wires": [] }, { "id": "4d69a180d5f58f10", "type": "comment", "z": "6e1ee0f06e75580d", "name": "No existe la calle", "info": "", "x": 140, "y": 680, "wires": [] }, { "id": "d6db349d1646634d", "type": "delay", "z": "6e1ee0f06e75580d", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 140, "y": 720, "wires": [ [ "007603e6138d3767" ] ] }, { "id": "007603e6138d3767", "type": "function", "z": "6e1ee0f06e75580d", "name": "Generamos la consulta a Cartociudad", "func": "// msg.payload debe contener la dirección, ej. \"Calle Gran Vía 28, Madrid\"\nconst direccion = msg.consulta_calle;\nconst encoded = encodeURIComponent(direccion);\n\nmsg.original = msg.payload\n// API de CartoCiudad (gratuita España)\nmsg.method = \"GET\";\nmsg.url = `https://www.cartociudad.es/geocoder/api/geocoder/findJsonp?q=${encoded}`;\nreturn msg;\n", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 720, "wires": [ [ "1eb4a654a71a42b1" ] ] }, { "id": "1eb4a654a71a42b1", "type": "http request", "z": "6e1ee0f06e75580d", "name": "", "method": "use", "ret": "txt", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 630, "y": 720, "wires": [ [ "ea87880ca13d9dcb" ] ] }, { "id": "ea87880ca13d9dcb", "type": "function", "z": "6e1ee0f06e75580d", "name": "Filtramos el resultado", "func": "// Limpia la respuesta JSONP (callback(...))\nlet text = msg.payload.trim();\n\n// Detecta y elimina el formato \"callback(...)\" o \"callback123(...)\" u otros\ntext = text.replace(/^[a-zA-Z0-9_]+\\(/, '').replace(/\\);?$/, '');\n\nlet data;\ntry {\n data = JSON.parse(text);\n} catch (e) {\n node.error(\"Error al parsear JSON de CartoCiudad: \" + e.message);\n msg.payload = { error: \"Formato no válido de respuesta CartoCiudad\" };\n return msg;\n}\n\n// La API devuelve un solo objeto, no un array\nif (data && data.lat && data.lng) {\n msg.payload = {\n lat: data.lat,\n lon: data.lng,\n address: data.address || \"\",\n postalCode: data.postalCode || \"\",\n muni: data.muni || \"\",\n province: data.province || \"\",\n source: \"CartoCiudad\",\n raw: data\n };\n} else {\n msg.payload = { error: \"No se encontraron coordenadas en CartoCiudad\" };\n}\nreturn msg;\n", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 820, "y": 720, "wires": [ [ "6c45fdd52d5b4bd3" ] ] }, { "id": "6c45fdd52d5b4bd3", "type": "switch", "z": "6e1ee0f06e75580d", "name": "Existen datos?", "property": "payload.lat", "propertyType": "msg", "rules": [ { "t": "istype", "v": "undefined", "vt": "undefined" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1020, "y": 720, "wires": [ [ "9c7e15d6d339c983" ], [ "98b02584803dbcbb" ] ], "outputLabels": [ "NO", "SI" ] }, { "id": "98b02584803dbcbb", "type": "function", "z": "6e1ee0f06e75580d", "name": "Eliminamos los que son coincidentes para no tener que tratarlos manualmente", "func": "// Función para normalizar texto (elimina acentos y convierte a mayúsculas)\nfunction normalizarTexto(texto) {\n return texto.toString()\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .toUpperCase()\n .trim();\n}\n\n// Comparación con normalización de address y province\nconst addressCoincide = normalizarTexto(msg.payload.address) === normalizarTexto(msg.direccion.Calle);\nconst provinceCoincide = normalizarTexto(msg.payload.province) === normalizarTexto(msg.direccion.Poblacion);\n\nif (addressCoincide && provinceCoincide) {\n return [null, msg]; // Salida 2 - coinciden\n} else {\n return [msg, null]; // Salida 1 - no coinciden\n}", "outputs": 2, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 520, "y": 840, "wires": [ [ "5eccd6a9a750b549" ], [ "3f24b62573b3963b", "c3ce306882f3d6ab" ] ], "outputLabels": [ "NO ", "SI" ] }, { "id": "3f24b62573b3963b", "type": "change", "z": "6e1ee0f06e75580d", "name": "Guardamos lo datos de la referencia de cache en mongo", "rules": [ { "t": "set", "p": "operation", "pt": "msg", "to": "insertOne", "tot": "str" }, { "t": "set", "p": "collection", "pt": "msg", "to": "geocache", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\t \"referencia_geocache\": referencia_geocache,\t \"lat\": payload.lat,\t \"lon\": payload.lon,\t \"address\": payload.address,\t \"muni\": payload.muni,\t \"province\": payload.province\t}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1110, "y": 860, "wires": [ [ "78c4804a3d71aca2" ] ] }, { "id": "78c4804a3d71aca2", "type": "mongodb4", "z": "6e1ee0f06e75580d", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 1430, "y": 860, "wires": [ [ "08ef481b73ada20e" ] ] }, { "id": "ac3e7005ee6ca8b4", "type": "mongodb4", "z": "6e1ee0f06e75580d", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 1430, "y": 920, "wires": [ [ "27fbbc6c04034efc" ] ] }, { "id": "c3ce306882f3d6ab", "type": "change", "z": "6e1ee0f06e75580d", "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\": msg.direccion.TipoVia,\t \"Calle\": msg.direccion.Calle\t },\t {\t \"$set\": {\t \"latitud\": msg.payload.lat,\t \"longitud\": msg.payload.lon,\t \"geocodingProcesado\": true,\t \"cartociudad\": \"coincidente\"\t } \t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1120, "y": 920, "wires": [ [ "ac3e7005ee6ca8b4" ] ] }, { "id": "08ef481b73ada20e", "type": "debug", "z": "6e1ee0f06e75580d", "name": "GUARDA geocache", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1620, "y": 860, "wires": [] }, { "id": "27fbbc6c04034efc", "type": "debug", "z": "6e1ee0f06e75580d", "name": "ACTUALIZA Calles", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1610, "y": 920, "wires": [] }, { "id": "5eccd6a9a750b549", "type": "change", "z": "6e1ee0f06e75580d", "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\": 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 \"cartociudad\": \"no-coincidente\"\t } \t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1120, "y": 800, "wires": [ [ "31a9908c794f385c" ] ] }, { "id": "31a9908c794f385c", "type": "mongodb4", "z": "6e1ee0f06e75580d", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 1430, "y": 800, "wires": [ [ "1fac0a438c4df552" ] ] }, { "id": "1fac0a438c4df552", "type": "debug", "z": "6e1ee0f06e75580d", "name": "Pone no coincidente en cartociudad", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1660, "y": 800, "wires": [] }, { "id": "9c7e15d6d339c983", "type": "change", "z": "6e1ee0f06e75580d", "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\": 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 \"cartociudad\": \"no-coincidente\"\t } \t }\t]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1360, "y": 700, "wires": [ [ "819f4993eed99959" ] ] }, { "id": "819f4993eed99959", "type": "mongodb4", "z": "6e1ee0f06e75580d", "clientNode": "648a51546e4dadc6", "mode": "collection", "collection": "", "operation": "", "output": "toArray", "maxTimeMS": "0", "handleDocId": false, "name": "", "x": 1670, "y": 700, "wires": [ [ "711cd5bb325a7107" ] ] }, { "id": "711cd5bb325a7107", "type": "debug", "z": "6e1ee0f06e75580d", "name": "Pone no coincidente en cartociudad", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1900, "y": 700, "wires": [] }, { "id": "99e57e3e0c9feda3", "type": "change", "z": "6e1ee0f06e75580d", "name": "reset", "rules": [ { "t": "set", "p": "trigger", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 590, "y": 1080, "wires": [ [ "c91b4ba4c01b3d11" ] ] }, { "id": "c91b4ba4c01b3d11", "type": "simple-queue", "z": "6e1ee0f06e75580d", "name": "", "firstMessageBypass": false, "bypassInterval": "0", "x": 610, "y": 1040, "wires": [ [ "374eb1d0ce2a0c27" ] ] }, { "id": "374eb1d0ce2a0c27", "type": "change", "z": "6e1ee0f06e75580d", "name": "Genera resultado_cartociudad", "rules": [ { "t": "set", "p": "resultado_cartociudad", "pt": "msg", "to": "payload.address& \" \" &payload.raw.portalNumber& \" \" &payload.muni& \" \" &payload.province& \" \" &payload.postalCode", "tot": "jsonata" }, { "t": "set", "p": "actualizar", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "validando_direccion", "pt": "flow", "to": "msg", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 830, "y": 1040, "wires": [ [ "dc1aec7696d95a97", "843fbe4881603a6c", "faacde234e5acc0e", "abccb8a853c9f234", "426c5e09624cff47" ] ] }, { "id": "843fbe4881603a6c", "type": "ui-text", "z": "6e1ee0f06e75580d", "group": "29e5d13e29bfbb4b", "order": 2, "width": 0, "height": 0, "name": "consulta_calle", "label": "Consulta Calle: ", "format": "{{msg.payload}}", "layout": "row-left", "style": false, "font": "", "fontSize": 16, "color": "#717171", "wrapText": false, "className": "", "value": "consulta_calle", "valueType": "msg", "x": 1080, "y": 1040, "wires": [] }, { "id": "dc1aec7696d95a97", "type": "ui-text", "z": "6e1ee0f06e75580d", "group": "29e5d13e29bfbb4b", "order": 3, "width": 0, "height": 0, "name": "resultado_cartociudad", "label": "Resultado Cartociudad: ", "format": "{{msg.payload}}", "layout": "row-left", "style": false, "font": "", "fontSize": 16, "color": "#717171", "wrapText": false, "className": "", "value": "resultado_cartociudad", "valueType": "msg", "x": 1100, "y": 1080, "wires": [] }, { "id": "faacde234e5acc0e", "type": "ui-button", "z": "6e1ee0f06e75580d", "group": "29e5d13e29bfbb4b", "name": "Validar", "label": "Validar", "order": 4, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "validando_direccion", "payloadType": "flow", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 1050, "y": 1120, "wires": [ [] ] }, { "id": "abccb8a853c9f234", "type": "ui-button", "z": "6e1ee0f06e75580d", "group": "29e5d13e29bfbb4b", "name": "Eliminar", "label": "Eliminar", "order": 6, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "validando_direccion", "payloadType": "flow", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 1060, "y": 1160, "wires": [ [] ] }, { "id": "426c5e09624cff47", "type": "ui-button", "z": "6e1ee0f06e75580d", "group": "29e5d13e29bfbb4b", "name": "Tratar", "label": "Tratar", "order": 5, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "validando_direccion", "payloadType": "flow", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 1050, "y": 1200, "wires": [ [] ] }, { "id": "5af76acc28d81750", "type": "ui-button", "z": "6e1ee0f06e75580d", "group": "29e5d13e29bfbb4b", "name": "Liberar", "label": "Liberar", "order": 7, "width": 0, "height": 0, "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "iconPosition": "left", "payload": "", "payloadType": "date", "topic": "topic", "topicType": "msg", "buttonColor": "", "textColor": "", "iconColor": "", "enableClick": true, "enablePointerdown": false, "pointerdownPayload": "", "pointerdownPayloadType": "str", "enablePointerup": false, "pointerupPayload": "", "pointerupPayloadType": "str", "x": 1060, "y": 1240, "wires": [ [] ] }, { "id": "0d6f32bdc24ffd32", "type": "link in", "z": "6e1ee0f06e75580d", "name": "link in 2", "links": [], "x": 505, "y": 1080, "wires": [ [ "99e57e3e0c9feda3" ] ] } ]