{
 "name": "Estudio Paz · postulantes",
 "nodes": [
  {
   "id": "83b226e9-fb6e-4840-a7e4-193cd7bfcf79",
   "name": "Nota aeda",
   "type": "n8n-nodes-base.stickyNote",
   "typeVersion": 1,
   "position": [
    -40,
    -360
   ],
   "parameters": {
    "content": "## Postulantes: CV en PDF → ranking\nCada postulante sube su CV. La IA lo lee contra el perfil del puesto (experiencia, formación, impuestos, Excel, sistema, jornada) y el código calcula el puntaje con pesos fijos. Desde 70 puntos recibe la invitación a entrevista y RR. HH. el aviso por Telegram; si no, un mail de agradecimiento. Los viernes a las 18 llega el ranking de la semana.",
    "width": 620,
    "height": 210,
    "color": 6
   }
  },
  {
   "id": "32edc4b6-aa5c-4ecd-bc0a-47792f538609",
   "name": "Postulación",
   "type": "n8n-nodes-base.formTrigger",
   "typeVersion": 2.6,
   "position": [
    0,
    0
   ],
   "parameters": {
    "formTitle": "Estudio Paz · Asistente contable",
    "formDescription": "Sube tu CV en PDF. Te respondemos por mail en el día.",
    "formFields": {
     "values": [
      {
       "fieldLabel": "Nombre y apellido",
       "fieldName": "nombre",
       "fieldType": "text",
       "requiredField": true,
       "placeholder": "Camila Herrera"
      },
      {
       "fieldLabel": "Correo",
       "fieldName": "email",
       "fieldType": "email",
       "requiredField": true,
       "placeholder": "camila@correo.com"
      },
      {
       "fieldLabel": "CV (PDF)",
       "fieldName": "cv",
       "fieldType": "file",
       "requiredField": true,
       "multipleFiles": false,
       "acceptFileTypes": ".pdf"
      }
     ]
    },
    "responseMode": "onReceived",
    "options": {
     "appendAttribution": false,
     "buttonLabel": "Postularme",
     "path": "postulantes-estudio-paz",
     "respondWithOptions": {
      "values": {
       "respondWith": "text",
       "formSubmittedText": "¡Gracias! Recibimos tu CV."
      }
     }
    }
   },
   "webhookId": "96006937-7acc-47cc-b8cb-f8492283f128"
  },
  {
   "id": "e2a73aac-e3a8-4a72-a726-a8226582d972",
   "name": "Leer el CV",
   "type": "n8n-nodes-base.extractFromFile",
   "typeVersion": 1.1,
   "position": [
    240,
    0
   ],
   "parameters": {
    "operation": "pdf",
    "binaryPropertyName": "cv",
    "options": {}
   }
  },
  {
   "id": "42fd5841-d85c-458c-a5d6-a4ef70230c88",
   "name": "La IA lee el CV",
   "type": "@n8n/n8n-nodes-langchain.informationExtractor",
   "typeVersion": 1.2,
   "position": [
    480,
    0
   ],
   "parameters": {
    "text": "={{ $json.text }}",
    "schemaType": "fromAttributes",
    "attributes": {
     "attributes": [
      {
       "name": "experiencia",
       "type": "number",
       "description": "Años de experiencia en estudios contables o tareas contables/impositivas (0 si no tiene)",
       "required": true
      },
      {
       "name": "formacion",
       "type": "string",
       "description": "Uno de: contador recibido, estudiante avanzado (más de la mitad de la carrera de Contador), estudiante, afín (perito mercantil, administración), otra",
       "required": true
      },
      {
       "name": "impuestos",
       "type": "number",
       "description": "Manejo de IVA, Ingresos Brutos y Ganancias: 0 nada, 1 conoce, 2 liquida alguno, 3 liquida todos",
       "required": true
      },
      {
       "name": "excel",
       "type": "number",
       "description": "Excel: 0 no dice, 1 básico, 2 intermedio, 3 avanzado (tablas dinámicas, BUSCARV/XLOOKUP)",
       "required": true
      },
      {
       "name": "sistema_contable",
       "type": "string",
       "description": "Sistemas contables que usó (Tango, Bejerman, Holistor…); vacío si ninguno",
       "required": false
      },
      {
       "name": "jornada_completa",
       "type": "boolean",
       "description": "true si dice disponibilidad full time o no aclara lo contrario",
       "required": true
      },
      {
       "name": "resumen",
       "type": "string",
       "description": "El perfil en una oración, para el socio que decide",
       "required": true
      },
      {
       "name": "fortalezas",
       "type": "string",
       "description": "Hasta 3 puntos fuertes para el puesto, separados por punto y coma",
       "required": true
      },
      {
       "name": "faltantes",
       "type": "string",
       "description": "Lo que el perfil pide y el CV no muestra, separado por punto y coma; vacío si nada",
       "required": false
      }
     ]
    },
    "options": {
     "systemPromptTemplate": "Lees CV para este puesto: Asistente contable para Estudio Paz & Asociados (San Juan). Se busca: experiencia en estudio contable (ideal 3 años o más), estudios de Contador Público (avanzado o recibido), liquidación de IVA, Ingresos Brutos y Ganancias, Excel avanzado, algún sistema contable (Tango, Bejerman, Holistor u otro) y jornada completa. Sólo lo que el CV dice; no premies ni castigues por edad, género, foto, estado civil ni nacionalidad."
    }
   }
  },
  {
   "id": "ccfe99e0-6ba5-49af-9da0-976ddb1c59f3",
   "name": "Claude",
   "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
   "typeVersion": 1.6,
   "position": [
    500,
    220
   ],
   "parameters": {
    "model": {
     "__rl": true,
     "mode": "id",
     "value": "claude-sonnet-5-5"
    },
    "options": {
     "maxTokensToSample": 1200,
     "thinkingMode": "adaptive",
     "effort": "low"
    }
   },
   "credentials": {
    "anthropicApi": {
     "id": "",
     "name": "Claude (demos)"
    }
   }
  },
  {
   "id": "df6dbd19-27df-4aeb-ba17-4d636c66b810",
   "name": "Puntaje con el perfil",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    740,
    0
   ],
   "parameters": {
    "mode": "runOnceForEachItem",
    "jsCode": "\n// El PUNTAJE lo calcula el código con pesos fijos (la IA sólo lee el CV): 0 a 100, entrevista desde 70.\nconst d = $json.output || {};\nconst p = $('Postulación').first().json;\nconst FORMACION = { 'contador recibido': 20, 'estudiante avanzado': 15, 'estudiante': 8, 'afín': 5, 'otra': 0 };\nconst n = (x, max) => Math.max(0, Math.min(max, Number(x) || 0));\nconst si = (x) => x === true || String(x).toLowerCase() === 'true';\nconst partes = { experiencia: Math.round(n(d.experiencia, 3) / 3 * 30), formacion: FORMACION[d.formacion] ?? 0, impuestos: n(d.impuestos, 3) * 8,\n  excel: n(d.excel, 3) * 5, sistema: d.sistema_contable ? 6 : 0, jornada: si(d.jornada_completa) ? 5 : 0 };\nconst puntaje = Object.values(partes).reduce((a, b) => a + b, 0);\nreturn { nombre: p.nombre, email: p.email, ...d, experiencia: Number(d.experiencia) || 0, partes, puntaje, entrevista: puntaje >= 70,\n  detalle: Object.entries(partes).map(([k, v]) => `${k} ${v}`).join(' · ') };\n"
   }
  },
  {
   "id": "a2b75d9b-1ff3-46f9-a94a-fffa2c984c44",
   "name": "Planilla de postulantes",
   "type": "n8n-nodes-base.dataTable",
   "typeVersion": 1.1,
   "position": [
    980,
    0
   ],
   "parameters": {
    "resource": "row",
    "operation": "insert",
    "dataTableId": {
     "__rl": true,
     "mode": "id",
     "value": ""
    },
    "columns": {
     "mappingMode": "defineBelow",
     "value": {
      "fecha": "={{ $now.toISODate() }}",
      "nombre": "={{ $json.nombre }}",
      "email": "={{ $json.email }}",
      "puntaje": "={{ $json.puntaje }}",
      "experiencia": "={{ $json.experiencia }}",
      "formacion": "={{ $json.formacion }}",
      "resumen": "={{ $json.resumen }}",
      "fortalezas": "={{ $json.fortalezas }}",
      "faltantes": "={{ $json.faltantes }}",
      "estado": "={{ $json.entrevista ? 'entrevista' : 'no avanza' }}"
     },
     "matchingColumns": [],
     "schema": [
      {
       "id": "fecha",
       "displayName": "fecha",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "nombre",
       "displayName": "nombre",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "email",
       "displayName": "email",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "puntaje",
       "displayName": "puntaje",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "number",
       "canBeUsedToMatch": true
      },
      {
       "id": "experiencia",
       "displayName": "experiencia",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "number",
       "canBeUsedToMatch": true
      },
      {
       "id": "formacion",
       "displayName": "formacion",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "resumen",
       "displayName": "resumen",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "fortalezas",
       "displayName": "fortalezas",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "faltantes",
       "displayName": "faltantes",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "estado",
       "displayName": "estado",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      }
     ]
    },
    "options": {}
   }
  },
  {
   "id": "3aa7d85c-a9f2-4170-8049-e655c0252bbc",
   "name": "¿Pasa a entrevista?",
   "type": "n8n-nodes-base.if",
   "typeVersion": 2.3,
   "position": [
    1220,
    0
   ],
   "parameters": {
    "conditions": {
     "options": {
      "caseSensitive": true,
      "leftValue": "",
      "typeValidation": "loose",
      "version": 2
     },
     "conditions": [
      {
       "id": "6fec722e-c0a4-46bc-89df-10fa0763424e",
       "leftValue": "={{ $('Puntaje con el perfil').item.json.puntaje }}",
       "rightValue": 70,
       "operator": {
        "type": "number",
        "operation": "gte"
       }
      }
     ],
     "combinator": "and"
    },
    "options": {}
   }
  },
  {
   "id": "3085917f-3f71-48df-9716-08a1f981d746",
   "name": "Invitación a entrevista",
   "type": "n8n-nodes-base.emailSend",
   "typeVersion": 2.1,
   "position": [
    1460,
    -120
   ],
   "parameters": {
    "fromEmail": "Estudio Paz · Selección <seleccion@estudiopaz.demo>",
    "toEmail": "={{ $('Puntaje con el perfil').item.json.email }}",
    "subject": "Tu postulación en Estudio Paz: queremos conocerte",
    "emailFormat": "html",
    "html": "={{ `<div style=\"font-family:Arial,sans-serif;max-width:540px;color:#1F2A37\"><p>Hola, ${$('Puntaje con el perfil').item.json.nombre}:</p><p>Leímos tu CV para el puesto de <b>Asistente contable</b> y queremos conocerte. Elige un horario para una entrevista de 30 minutos respondiendo este correo.</p><p>Estudio Paz & Asociados</p><p style=\"font-size:11px;color:#777\">Demostración: Estudio Paz es ficticio y este correo quedó en un buzón de prueba.</p></div>` }}",
    "options": {
     "appendAttribution": false
    }
   },
   "credentials": {
    "smtp": {
     "id": "",
     "name": "Buzón de prueba (Mailpit)"
    }
   }
  },
  {
   "id": "90e6e395-8b74-4fe8-bca9-87baebb91c54",
   "name": "Aviso a RR. HH. por Telegram",
   "type": "n8n-nodes-base.telegram",
   "typeVersion": 1.2,
   "position": [
    1700,
    -120
   ],
   "parameters": {
    "resource": "message",
    "operation": "sendMessage",
    "chatId": "5550400",
    "text": "={{ '<b>Para entrevistar: ' + $('Puntaje con el perfil').item.json.nombre + ' (' + $('Puntaje con el perfil').item.json.puntaje + '/100)</b>\\n' + $('Puntaje con el perfil').item.json.resumen + '\\n+ ' + $('Puntaje con el perfil').item.json.fortalezas }}",
    "additionalFields": {
     "parse_mode": "HTML",
     "appendAttribution": false
    }
   },
   "credentials": {
    "telegramApi": {
     "id": "",
     "name": "Telegram (simulador)"
    }
   }
  },
  {
   "id": "a39959fd-1281-4615-9d52-7147a9b68e5d",
   "name": "Gracias por postularte",
   "type": "n8n-nodes-base.emailSend",
   "typeVersion": 2.1,
   "position": [
    1460,
    100
   ],
   "parameters": {
    "fromEmail": "Estudio Paz · Selección <seleccion@estudiopaz.demo>",
    "toEmail": "={{ $('Puntaje con el perfil').item.json.email }}",
    "subject": "Tu postulación en Estudio Paz",
    "emailFormat": "html",
    "html": "={{ `<div style=\"font-family:Arial,sans-serif;max-width:540px;color:#1F2A37\"><p>Hola, ${$('Puntaje con el perfil').item.json.nombre}:</p><p>Gracias por postularte para <b>Asistente contable</b>. Esta vez buscamos un perfil con más experiencia en liquidación de impuestos, pero guardamos tu CV para próximas búsquedas.</p><p>Estudio Paz & Asociados</p></div>` }}",
    "options": {
     "appendAttribution": false
    }
   },
   "credentials": {
    "smtp": {
     "id": "",
     "name": "Buzón de prueba (Mailpit)"
    }
   }
  },
  {
   "id": "0fe704bd-0770-4f91-992c-9632b1a65fb5",
   "name": "Viernes a las 18",
   "type": "n8n-nodes-base.scheduleTrigger",
   "typeVersion": 1.2,
   "position": [
    0,
    400
   ],
   "parameters": {
    "rule": {
     "interval": [
      {
       "field": "cronExpression",
       "expression": "0 18 * * 5"
      }
     ]
    }
   }
  },
  {
   "id": "49eafbe9-0128-4aea-b46c-e8b939367551",
   "name": "Postulantes",
   "type": "n8n-nodes-base.dataTable",
   "typeVersion": 1.1,
   "position": [
    240,
    400
   ],
   "parameters": {
    "resource": "row",
    "operation": "get",
    "dataTableId": {
     "__rl": true,
     "mode": "id",
     "value": ""
    },
    "matchType": "allConditions",
    "returnAll": true
   }
  },
  {
   "id": "51f9ea95-72a6-49bb-93ca-a24515906237",
   "name": "Armar el ranking",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    480,
    400
   ],
   "parameters": {
    "mode": "runOnceForAllItems",
    "jsCode": "\n// Ranking de la semana: los postulantes de los últimos 7 días, del mejor al peor puntaje. Sin postulantes, no manda nada.\nconst desde = new Date(); desde.setDate(desde.getDate() - 7);\nconst filas = $input.all().map(i => i.json).filter(f => f.nombre && new Date(String(f.fecha).slice(0, 10) + 'T00:00:00') >= desde)\n  .sort((a, b) => b.puntaje - a.puntaje);\nif (!filas.length) return [];\nconst fila = (f, i) => `<tr><td>${i + 1}</td><td>${f.nombre}</td><td style=\"text-align:right\"><b>${f.puntaje}</b></td><td>${f.estado}</td><td>${f.resumen}</td></tr>`;\nreturn [{ json: { cantidad: filas.length, asunto: `Ranking de postulantes · ${filas.length} esta semana · el mejor: ${filas[0].nombre} (${filas[0].puntaje})`,\n  html: `<p>Postulantes de la semana para <b>Asistente contable</b>:</p><table cellpadding=\"6\" style=\"border-collapse:collapse;font-family:Arial,sans-serif;font-size:13px\"><tr><th>#</th><th align=\"left\">Nombre</th><th>Puntaje</th><th align=\"left\">Estado</th><th align=\"left\">Resumen</th></tr>${filas.map(fila).join('')}</table>` } }];\n"
   }
  },
  {
   "id": "f4aa2d9c-b803-418b-8899-67de5a30d19a",
   "name": "Ranking a los socios",
   "type": "n8n-nodes-base.emailSend",
   "typeVersion": 2.1,
   "position": [
    720,
    400
   ],
   "parameters": {
    "fromEmail": "Estudio Paz · Selección <seleccion@estudiopaz.demo>",
    "toEmail": "socios@estudiopaz.demo",
    "subject": "={{ $json.asunto }}",
    "emailFormat": "html",
    "html": "={{ $json.html }}",
    "options": {
     "appendAttribution": false
    }
   },
   "credentials": {
    "smtp": {
     "id": "",
     "name": "Buzón de prueba (Mailpit)"
    }
   }
  }
 ],
 "connections": {
  "Postulación": {
   "main": [
    [
     {
      "node": "Leer el CV",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Leer el CV": {
   "main": [
    [
     {
      "node": "La IA lee el CV",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Claude": {
   "ai_languageModel": [
    [
     {
      "node": "La IA lee el CV",
      "type": "ai_languageModel",
      "index": 0
     }
    ]
   ]
  },
  "La IA lee el CV": {
   "main": [
    [
     {
      "node": "Puntaje con el perfil",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Puntaje con el perfil": {
   "main": [
    [
     {
      "node": "Planilla de postulantes",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Planilla de postulantes": {
   "main": [
    [
     {
      "node": "¿Pasa a entrevista?",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "¿Pasa a entrevista?": {
   "main": [
    [
     {
      "node": "Invitación a entrevista",
      "type": "main",
      "index": 0
     }
    ],
    [
     {
      "node": "Gracias por postularte",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Invitación a entrevista": {
   "main": [
    [
     {
      "node": "Aviso a RR. HH. por Telegram",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Viernes a las 18": {
   "main": [
    [
     {
      "node": "Postulantes",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Postulantes": {
   "main": [
    [
     {
      "node": "Armar el ranking",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Armar el ranking": {
   "main": [
    [
     {
      "node": "Ranking a los socios",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "settings": {
  "executionOrder": "v1",
  "timezone": "America/Argentina/Buenos_Aires",
  "saveManualExecutions": true
 }
}