paperclip-plugin-autopilot-ops 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manifest.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/worker.js +87 -1
- package/package.json +1 -1
package/dist/manifest.js
CHANGED
package/dist/ui/index.js
CHANGED
package/dist/worker.js
CHANGED
|
@@ -39932,7 +39932,7 @@ function startWorkerRpcHost(options) {
|
|
|
39932
39932
|
|
|
39933
39933
|
// src/manifest.ts
|
|
39934
39934
|
var PLUGIN_ID = "alephoo.autopilot-ops";
|
|
39935
|
-
var PLUGIN_VERSION = "0.1.
|
|
39935
|
+
var PLUGIN_VERSION = "0.1.17";
|
|
39936
39936
|
var DB_NAMESPACE_SLUG = "autopilot_ops";
|
|
39937
39937
|
var PAGE_ROUTE = "autopilot";
|
|
39938
39938
|
var TOOL_NAMES = {
|
|
@@ -41445,6 +41445,90 @@ function poblacion(problemas, p) {
|
|
|
41445
41445
|
}
|
|
41446
41446
|
return out;
|
|
41447
41447
|
}
|
|
41448
|
+
var TODOS = ["orden_sin_turno", "solicitud_pendiente", "control_periodico"];
|
|
41449
|
+
var CAMPOS_CONDICION = {
|
|
41450
|
+
edad: { nombre: "Edad (a\xF1os)", tipo: "numero", operadores: ["mayor_que", "menor_que", "entre"], en: TODOS },
|
|
41451
|
+
sexo: { nombre: "Sexo", tipo: "opcion", operadores: ["es"], opciones: ["F", "M"], en: TODOS },
|
|
41452
|
+
obra_social: { nombre: "Obra social", tipo: "texto", operadores: ["contiene", "no_contiene"], en: ["orden_sin_turno", "control_periodico"] },
|
|
41453
|
+
estudio: { nombre: "Estudio", tipo: "texto", operadores: ["contiene", "no_contiene"], en: ["orden_sin_turno"] },
|
|
41454
|
+
especialidad: { nombre: "Especialidad", tipo: "texto", operadores: ["contiene", "no_contiene"], en: TODOS },
|
|
41455
|
+
profesional: { nombre: "Profesional", tipo: "texto", operadores: ["contiene", "no_contiene"], en: ["orden_sin_turno", "control_periodico"] },
|
|
41456
|
+
prioridad: { nombre: "Prioridad de la solicitud", tipo: "texto", operadores: ["contiene"], en: ["solicitud_pendiente"] },
|
|
41457
|
+
diagnostico: { nombre: "Diagn\xF3stico (CIE-10)", tipo: "codigo", operadores: ["empieza_con"], en: ["orden_sin_turno", "control_periodico"] },
|
|
41458
|
+
dias: { nombre: "D\xEDas pendiente", tipo: "numero", operadores: ["mayor_que", "menor_que", "entre"], en: TODOS }
|
|
41459
|
+
};
|
|
41460
|
+
var MAX_CONDICIONES = 10;
|
|
41461
|
+
function condiciones(problemas, tipo, p) {
|
|
41462
|
+
if (p.condiciones === void 0 || p.condiciones === null) return [];
|
|
41463
|
+
if (!Array.isArray(p.condiciones)) {
|
|
41464
|
+
problemas.push("condiciones: debe ser una lista");
|
|
41465
|
+
return [];
|
|
41466
|
+
}
|
|
41467
|
+
if (p.condiciones.length > MAX_CONDICIONES) problemas.push(`condiciones: como m\xE1ximo ${MAX_CONDICIONES}`);
|
|
41468
|
+
const out = [];
|
|
41469
|
+
p.condiciones.slice(0, MAX_CONDICIONES).forEach((cruda, i) => {
|
|
41470
|
+
const c = jsonb(cruda);
|
|
41471
|
+
const ref = `condiciones[${i + 1}]`;
|
|
41472
|
+
const campo = str(c.campo)?.toLowerCase() ?? "";
|
|
41473
|
+
const def2 = CAMPOS_CONDICION[campo];
|
|
41474
|
+
if (!def2) {
|
|
41475
|
+
problemas.push(`${ref}: campo desconocido \xAB${campo || "(vac\xEDo)"}\xBB; posibles: ${Object.keys(CAMPOS_CONDICION).join(", ")}`);
|
|
41476
|
+
return;
|
|
41477
|
+
}
|
|
41478
|
+
if (tipo && !def2.en.includes(tipo)) {
|
|
41479
|
+
problemas.push(`${ref}: \xAB${def2.nombre}\xBB no existe para el tipo ${tipo}`);
|
|
41480
|
+
return;
|
|
41481
|
+
}
|
|
41482
|
+
const operador = str(c.operador)?.toLowerCase() ?? "";
|
|
41483
|
+
if (!def2.operadores.includes(operador)) {
|
|
41484
|
+
problemas.push(`${ref}: \xAB${def2.nombre}\xBB admite ${def2.operadores.join(", ")}`);
|
|
41485
|
+
return;
|
|
41486
|
+
}
|
|
41487
|
+
if (def2.tipo === "numero") {
|
|
41488
|
+
const v2 = entero(c.valor);
|
|
41489
|
+
if (v2 === null || v2 < 0 || v2 > 3650) {
|
|
41490
|
+
problemas.push(`${ref}: \xAB${def2.nombre}\xBB necesita un n\xFAmero entero entre 0 y 3650`);
|
|
41491
|
+
return;
|
|
41492
|
+
}
|
|
41493
|
+
if (operador === "entre") {
|
|
41494
|
+
const v22 = entero(c.valor2);
|
|
41495
|
+
if (v22 === null || v22 <= v2 || v22 > 3650) {
|
|
41496
|
+
problemas.push(`${ref}: \xAB${def2.nombre}\xBB entre necesita un segundo valor mayor que ${v2}`);
|
|
41497
|
+
return;
|
|
41498
|
+
}
|
|
41499
|
+
out.push({ campo, operador: "entre", valor: v2, valor2: v22 });
|
|
41500
|
+
return;
|
|
41501
|
+
}
|
|
41502
|
+
out.push({ campo, operador, valor: v2 });
|
|
41503
|
+
return;
|
|
41504
|
+
}
|
|
41505
|
+
if (def2.tipo === "opcion") {
|
|
41506
|
+
const v2 = str(c.valor)?.toUpperCase() ?? "";
|
|
41507
|
+
if (!(def2.opciones ?? []).includes(v2)) {
|
|
41508
|
+
problemas.push(`${ref}: \xAB${def2.nombre}\xBB debe ser ${(def2.opciones ?? []).join(" o ")}`);
|
|
41509
|
+
return;
|
|
41510
|
+
}
|
|
41511
|
+
out.push({ campo, operador: "es", valor: v2 });
|
|
41512
|
+
return;
|
|
41513
|
+
}
|
|
41514
|
+
if (def2.tipo === "codigo") {
|
|
41515
|
+
const v2 = str(c.valor)?.toUpperCase() ?? "";
|
|
41516
|
+
if (!/^[A-Z][0-9]{1,2}(\.[0-9A-Z]{1,2})?$/.test(v2)) {
|
|
41517
|
+
problemas.push(`${ref}: \xAB${def2.nombre}\xBB espera un c\xF3digo CIE-10 o su prefijo (p. ej. E11)`);
|
|
41518
|
+
return;
|
|
41519
|
+
}
|
|
41520
|
+
out.push({ campo, operador: "empieza_con", valor: v2 });
|
|
41521
|
+
return;
|
|
41522
|
+
}
|
|
41523
|
+
const v = str(c.valor);
|
|
41524
|
+
if (!v || v.length > 80) {
|
|
41525
|
+
problemas.push(`${ref}: \xAB${def2.nombre}\xBB necesita un texto de hasta 80 caracteres`);
|
|
41526
|
+
return;
|
|
41527
|
+
}
|
|
41528
|
+
out.push({ campo, operador, valor: v });
|
|
41529
|
+
});
|
|
41530
|
+
return out;
|
|
41531
|
+
}
|
|
41448
41532
|
function diasHasta(problemas, parametros, p) {
|
|
41449
41533
|
if (p.dias_hasta === void 0 || p.dias_hasta === null || p.dias_hasta === "") return;
|
|
41450
41534
|
const hasta = numeroEn(problemas, "dias_hasta", p.dias_hasta);
|
|
@@ -41461,6 +41545,8 @@ function validarRegla(input2) {
|
|
|
41461
41545
|
if (!tipo) problemas.push(`tipo: debe ser ${TIPOS_REGLA_DEMANDA.join(", ")}`);
|
|
41462
41546
|
const p = jsonb(input2.parametros);
|
|
41463
41547
|
const parametros = poblacion(problemas, p);
|
|
41548
|
+
const conds = condiciones(problemas, tipo, p);
|
|
41549
|
+
if (conds.length > 0) parametros.condiciones = conds;
|
|
41464
41550
|
if (tipo === "orden_sin_turno") {
|
|
41465
41551
|
const estudio = textoCorto(problemas, "estudio", p.estudio, 80, false);
|
|
41466
41552
|
if (estudio) parametros.estudio = estudio;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paperclip-plugin-autopilot-ops",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Autopilot Care · operación autónoma gobernada para instituciones de salud: workflows determinísticos, validaciones, registro de negocio, políticas (observa/propone/ejecuta/corte) y tablero del director, como plugin de Paperclip.",
|
|
6
6
|
"files": [
|