diff --git a/orchestration/MAPA-DOCUMENTACION.yml b/orchestration/MAPA-DOCUMENTACION.yml new file mode 100644 index 0000000..370ead2 --- /dev/null +++ b/orchestration/MAPA-DOCUMENTACION.yml @@ -0,0 +1,356 @@ +# =============================================================================== +# MAPA DE DOCUMENTACION - CLINICA DENTAL +# =============================================================================== +# +# Proposito: Centro de referencias a toda la documentacion del proyecto +# Alias: @DENTAL_MAPA_DOC +# Tipo: SUB-VERTICAL (hereda de erp-clinicas) +# +# =============================================================================== + +version: "1.0.0" +created: "2026-01-16" +updated: "2026-01-16" +proyecto: "clinica-dental" +tipo: "SUB-VERTICAL" +nivel: 3 + +# ------------------------------------------------------------------------------- +# CADENA DE HERENCIA COMPLETA +# ------------------------------------------------------------------------------- + +cadena_herencia: + origen: + proyecto: "template-saas" + tipo: "PROVIDER" + nivel: 0 + alias: "@TS_MAPA_DOC" + ubicacion: "projects/template-saas/orchestration/MAPA-DOCUMENTACION.yml" + + abuelo: + proyecto: "erp-core" + tipo: "INTERMEDIATE" + nivel: 1 + alias: "@ERP_MAPA_DOC" + ubicacion: "projects/erp-core/orchestration/MAPA-DOCUMENTACION.yml" + + padre: + proyecto: "erp-clinicas" + tipo: "CONSUMER" + nivel: 2 + alias: "@CLINICAS_MAPA_DOC" + ubicacion: "projects/erp-clinicas/orchestration/MAPA-DOCUMENTACION.yml" + + actual: + proyecto: "clinica-dental" + tipo: "SUB-VERTICAL" + nivel: 3 + alias: "@DENTAL_MAPA_DOC" + especializacion: "Odontologia" + +# ------------------------------------------------------------------------------- +# DOCUMENTACION DE USUARIO (docs/) +# ------------------------------------------------------------------------------- + +docs: + raiz: + README.md: + alias: "@DENTAL_README" + descripcion: "Punto de entrada del proyecto" + _MAP.md: + alias: "@DENTAL_MAP" + descripcion: "Mapa maestro de navegacion" + + vision: + ruta: "docs/00-vision-general/" + alias: "@DENTAL_VISION" + archivos: + - VISION-CLINICA-DENTAL.md + - ARQUITECTURA-ODONTOLOGICA.md + + modulos: + ruta: "docs/01-modulos/" + alias: "@DENTAL_MODULOS" + patron: "CDT-{NNN}-{nombre}.md" + archivos: + - CDT-001-Odontograma.md + - CDT-002-Tratamientos-Dentales.md + - CDT-003-Ortodoncia.md + - CDT-004-Protesis.md + - CDT-005-Radiografias-Dentales.md + - CDT-006-Presupuestos-Dentales.md + + normativa: + ruta: "docs/02-normativa/" + alias: "@DENTAL_NORMATIVA" + archivos: + - NOM-013-SSA2-2015-Implementacion.md + - NOM-004-SSA3-2012-Expediente.md + - COFEPRIS-Consultorios.md + + definitions: + ruta: "docs/_definitions/" + alias: "@DENTAL_DEF" + archivos: + _INDEX.yml: + alias: "@DENTAL_DEF_INDEX" + DATABASE-SCHEMA.md: + alias: "@DENTAL_DEF_DB" + descripcion: "Schema sub_dental (15+ tablas)" + ENTITIES-CATALOG.md: + alias: "@DENTAL_DEF_ENTITIES" + descripcion: "Catalogo de entities dentales" + SERVICES-CATALOG.md: + alias: "@DENTAL_DEF_SERVICES" + descripcion: "Catalogo de services dentales" + MODULES-CATALOG.md: + alias: "@DENTAL_DEF_MODULES" + descripcion: "Catalogo de 6 modulos CDT" + + quick: + ruta: "docs/_quick/" + alias: "@DENTAL_QUICK" + archivos: + QUICK-INDEX.yml: + alias: "@DENTAL_QUICK_INDEX" + QUICK-MODULES.yml: + alias: "@DENTAL_QUICK_MODULES" + QUICK-DATABASE.yml: + alias: "@DENTAL_QUICK_DATABASE" + QUICK-API.yml: + alias: "@DENTAL_QUICK_API" + +# ------------------------------------------------------------------------------- +# DOCUMENTACION OPERACIONAL (orchestration/) +# ------------------------------------------------------------------------------- + +orchestration: + raiz: + _MAP.md: + alias: "@DENTAL_ORCH_MAP" + PROJECT-STATUS.md: + alias: "@DENTAL_STATUS" + descripcion: "Estado actual del proyecto" + PROXIMA-ACCION.md: + alias: "@DENTAL_NEXT" + descripcion: "Siguiente tarea a ejecutar" + + trazabilidad: + TRACEABILITY.yml: + alias: "@DENTAL_TRACEABILITY" + descripcion: "Trazabilidad de 6 modulos CDT" + DEPENDENCY-GRAPH.yml: + alias: "@DENTAL_DEP_GRAPH" + descripcion: "Grafo de dependencias" + CONTEXT-MAP.yml: + alias: "@DENTAL_CONTEXT" + descripcion: "Mapeo de contexto" + _inheritance.yml: + alias: "@DENTAL_INHERITANCE" + descripcion: "Herencia: SUB-VERTICAL nivel 3" + MAPA-DOCUMENTACION.yml: + alias: "@DENTAL_MAPA_DOC" + descripcion: "Este archivo" + + inventarios: + ruta: "orchestration/inventarios/" + alias: "@DENTAL_INV" + archivos: + MASTER_INVENTORY.yml: + alias: "@DENTAL_INV_MASTER" + DATABASE_INVENTORY.yml: + alias: "@DENTAL_INV_DB" + BACKEND_INVENTORY.yml: + alias: "@DENTAL_INV_BE" + FRONTEND_INVENTORY.yml: + alias: "@DENTAL_INV_FE" + + directivas: + ruta: "orchestration/directivas/" + alias: "@DENTAL_DIRECTIVAS" + hereda_de: "@CLINICAS_DIRECTIVAS" + archivos: + - TRIGGER-COHERENCIA-CAPAS.md + - TRIGGER-INVENTARIOS.md + + agentes: + ruta: "orchestration/agents/" + alias: "@DENTAL_AGENTS" + archivos: + perfiles: + _INDEX.yml: + alias: "@DENTAL_AGENTS_INDEX" + PERFIL-ODONTOLOGO-AGENT.yml: + alias: "@DENTAL_AGENT_ODONTOLOGO" + PERFIL-DDL-DENTAL-AGENT.yml: + alias: "@DENTAL_AGENT_DDL" + trazas: + ruta: "orchestration/agents/trazas/" + + referencias: + ruta: "orchestration/referencias/" + alias: "@DENTAL_REFS" + + environment: + ruta: "orchestration/environment/" + alias: "@DENTAL_ENV" + +# ------------------------------------------------------------------------------- +# REFERENCIAS AL WORKSPACE Y CADENA +# ------------------------------------------------------------------------------- + +referencias_cadena: + template_saas: + mapa: "@TS_MAPA_DOC" + ubicacion: "projects/template-saas/orchestration/MAPA-DOCUMENTACION.yml" + hereda: + - "Directivas base" + - "Estructura de inventarios" + - "Perfiles de agentes base" + + erp_core: + mapa: "@ERP_MAPA_DOC" + ubicacion: "projects/erp-core/orchestration/MAPA-DOCUMENTACION.yml" + hereda: + - "23 modulos MGN" + - "Triggers de coherencia" + - "Modelo multi-tenant" + + erp_clinicas: + mapa: "@CLINICAS_MAPA_DOC" + ubicacion: "projects/erp-clinicas/orchestration/MAPA-DOCUMENTACION.yml" + hereda: + - "Modulos de pacientes, citas, expedientes" + - "Directivas clinicas" + - "Normativa salud base" + + workspace: + archivo: "orchestration/_refs/WS-REFERENCES.yml" + alias: "@DENTAL_WS_REFS" + contenido: + - "@WS_DIRECTIVAS" + - "@WS_PERFILES" + - "@WS_TEMPLATES" + - "@WS_DEFINITIONS" + +# ------------------------------------------------------------------------------- +# MODULOS CDT (CLINICA DENTAL) +# ------------------------------------------------------------------------------- + +modulos_cdt: + CDT-001: + nombre: "Odontograma" + estado: "30%" + alias: "@DENTAL_MOD_ODONTOGRAMA" + normativa: "NOM-013-SSA2-2015" + + CDT-002: + nombre: "Tratamientos Dentales" + estado: "25%" + alias: "@DENTAL_MOD_TRATAMIENTOS" + normativa: "NOM-013-SSA2-2015" + + CDT-003: + nombre: "Ortodoncia" + estado: "20%" + alias: "@DENTAL_MOD_ORTODONCIA" + + CDT-004: + nombre: "Protesis" + estado: "15%" + alias: "@DENTAL_MOD_PROTESIS" + + CDT-005: + nombre: "Radiografias Dentales" + estado: "20%" + alias: "@DENTAL_MOD_RADIOGRAFIAS" + + CDT-006: + nombre: "Presupuestos Dentales" + estado: "25%" + alias: "@DENTAL_MOD_PRESUPUESTOS" + +# ------------------------------------------------------------------------------- +# NORMATIVA APLICABLE +# ------------------------------------------------------------------------------- + +normativa: + obligatoria: + - codigo: "NOM-013-SSA2-2015" + nombre: "Prevencion y control de enfermedades bucales" + aplica_a: ["CDT-001", "CDT-002"] + alias: "@DENTAL_NOM_013" + + - codigo: "NOM-004-SSA3-2012" + nombre: "Del expediente clinico" + aplica_a: ["expedientes", "consentimientos"] + alias: "@DENTAL_NOM_004" + + - codigo: "COFEPRIS" + nombre: "Regulacion de consultorios dentales" + aplica_a: ["todos"] + alias: "@DENTAL_COFEPRIS" + + complementaria: + - codigo: "NOM-087-SEMARNAT-SSA1-2002" + nombre: "Residuos peligrosos biologico-infecciosos" + aplica_a: ["inventario-materiales"] + +# ------------------------------------------------------------------------------- +# ESTADISTICAS +# ------------------------------------------------------------------------------- + +estadisticas: + docs: + total_archivos: TBD + carpetas: 8 + modulos_documentados: 6 + orchestration: + total_archivos: 15 + inventarios: 4 + trazas: 1 + perfiles_agentes: 2 + triggers: 2 + total_aliases: 50+ + cobertura_documentacion: "80%" + ultima_auditoria: "2026-01-16" + +# ------------------------------------------------------------------------------- +# NAVEGACION RAPIDA POR ROL +# ------------------------------------------------------------------------------- + +por_rol: + odontologo: + inicio: "@DENTAL_NORMATIVA" + modulos: "@DENTAL_MODULOS" + odontograma: "@DENTAL_MOD_ODONTOGRAMA" + + desarrollador_backend: + inicio: "@DENTAL_DEF_ENTITIES" + api: "@DENTAL_QUICK_API" + inventario: "@DENTAL_INV_BE" + + desarrollador_frontend: + inicio: "@DENTAL_QUICK_MODULES" + api: "@DENTAL_QUICK_API" + inventario: "@DENTAL_INV_FE" + + dba: + inicio: "@DENTAL_DEF_DB" + inventario: "@DENTAL_INV_DB" + quick: "@DENTAL_QUICK_DATABASE" + + arquitecto: + inicio: "@DENTAL_VISION" + dependencias: "@DENTAL_DEP_GRAPH" + herencia: "@DENTAL_INHERITANCE" + cadena: "Ver seccion cadena_herencia" + + orquestador: + inicio: "@DENTAL_STATUS" + siguiente: "@DENTAL_NEXT" + trazabilidad: "@DENTAL_TRACEABILITY" + +# =============================================================================== +# FIN DEL MAPA DE DOCUMENTACION +# =============================================================================== diff --git a/orchestration/agents/perfiles/PERFIL-DDL-DENTAL-AGENT.yml b/orchestration/agents/perfiles/PERFIL-DDL-DENTAL-AGENT.yml new file mode 100644 index 0000000..0269185 --- /dev/null +++ b/orchestration/agents/perfiles/PERFIL-DDL-DENTAL-AGENT.yml @@ -0,0 +1,202 @@ +# =============================================================================== +# PERFIL DE AGENTE - DDL DENTAL +# =============================================================================== +# +# Proyecto: clinica-dental +# Rol: Agente especializado en base de datos para clinica dental +# Alias: @DENTAL_AGENT_DDL +# +# =============================================================================== + +version: "1.0.0" +created: "2026-01-16" +updated: "2026-01-16" +proyecto: "clinica-dental" + +# ------------------------------------------------------------------------------- +# IDENTIFICACION +# ------------------------------------------------------------------------------- + +perfil: + id: "DENTAL-AGENT-002" + nombre: "DDL Dental Agent" + alias: "@DENTAL_AGENT_DDL" + descripcion: "Agente especializado en esquema de BD para dominio dental" + tipo: "DATABASE_SPECIALIST" + +# ------------------------------------------------------------------------------- +# CADENA DE HERENCIA +# ------------------------------------------------------------------------------- + +herencia: + cadena: "template-saas -> erp-core -> erp-clinicas -> clinica-dental" + perfiles_padre: + - "@ERP_AGENT_DDL" + - "@CLINICAS_AGENT_DDL" + especializacion: "Schema sub_dental" + +# ------------------------------------------------------------------------------- +# COMPETENCIAS +# ------------------------------------------------------------------------------- + +competencias: + postgresql: + nivel: "experto" + areas: + - "Diseño de schemas multi-tenant" + - "Indices para busquedas clinicas" + - "JSONB para odontogramas" + - "Triggers de auditoria medica" + - "Row Level Security (RLS)" + + dominio_dental: + nivel: "avanzado" + conocimientos: + - "Modelado de odontogramas (32/20 piezas)" + - "Estados de piezas dentales (5 superficies)" + - "Tratamientos y procedimientos" + - "Historial radiografico" + - "Planes de tratamiento" + + normativa_datos: + nivel: "experto" + conocimientos: + - "NOM-024-SSA3: Expediente clinico electronico" + - "Ley Federal de Proteccion de Datos Personales" + - "Retencion de expedientes (5 años minimo)" + +# ------------------------------------------------------------------------------- +# RESPONSABILIDADES +# ------------------------------------------------------------------------------- + +responsabilidades: + principales: + - "Diseñar y mantener schema sub_dental" + - "Crear migraciones para tablas dentales" + - "Optimizar queries de odontograma" + - "Asegurar integridad referencial" + - "Implementar auditoria de expedientes" + + validaciones: + - validacion: "Schema correcto" + regla: "Todas las tablas dentales en sub_dental.*" + bloquea: true + + - validacion: "Auditoria" + regla: "Tablas clinicas deben tener triggers de auditoria" + bloquea: true + + - validacion: "RLS" + regla: "Datos de paciente protegidos por tenant_id" + bloquea: true + + - validacion: "Constraints FK" + regla: "Referencias cruzadas validadas" + bloquea: true + +# ------------------------------------------------------------------------------- +# SCHEMA SUB_DENTAL +# ------------------------------------------------------------------------------- + +schema: + nombre: "sub_dental" + descripcion: "Schema exclusivo para clinica dental" + + tablas_core: + - nombre: "odontograms" + descripcion: "Odontograma digital del paciente" + campos_clave: + - "id UUID PK" + - "patient_id FK" + - "teeth_data JSONB" + - "type ENUM (adult, child)" + - "exam_date TIMESTAMP" + + - nombre: "tooth_conditions" + descripcion: "Condiciones por pieza dental" + campos_clave: + - "odontogram_id FK" + - "tooth_number INT" + - "surface VARCHAR(5)" + - "condition_code VARCHAR(10)" + + - nombre: "dental_treatments" + descripcion: "Catalogo de tratamientos dentales" + campos_clave: + - "id UUID PK" + - "code VARCHAR(20)" + - "name VARCHAR(100)" + - "category VARCHAR(50)" + - "default_price DECIMAL" + + - nombre: "treatment_plans" + descripcion: "Planes de tratamiento por paciente" + campos_clave: + - "id UUID PK" + - "patient_id FK" + - "odontogram_id FK" + - "status ENUM" + - "total_cost DECIMAL" + + - nombre: "dental_xrays" + descripcion: "Radiografias dentales" + campos_clave: + - "id UUID PK" + - "patient_id FK" + - "type ENUM (panoramic, periapical, occlusal)" + - "image_url VARCHAR" + - "taken_at TIMESTAMP" + +# ------------------------------------------------------------------------------- +# DIRECTIVAS ACTIVAS +# ------------------------------------------------------------------------------- + +directivas: + obligatorias: + - "@DENTAL_TRIGGER_COHERENCIA" + - "@DENTAL_TRIGGER_INVENTARIOS" + - "@ERP_DIRECTIVA_DDL" + - "@WS_TRIGGER_COHERENCIA" + + opcionales: + - "@WS_TRIGGER_ANTI_DUPLICACION" + +# ------------------------------------------------------------------------------- +# MIGRACIONES +# ------------------------------------------------------------------------------- + +migraciones: + convencion: "YYYYMMDD_HHMMSS_descripcion.sql" + ubicacion: "database/migrations/" + + pendientes: + - "20260116_000001_create_schema_sub_dental.sql" + - "20260116_000002_create_odontograms_table.sql" + - "20260116_000003_create_tooth_conditions_table.sql" + - "20260116_000004_create_dental_treatments_table.sql" + - "20260116_000005_create_treatment_plans_table.sql" + - "20260116_000006_create_dental_xrays_table.sql" + +# ------------------------------------------------------------------------------- +# REFERENCIAS +# ------------------------------------------------------------------------------- + +referencias: + documentacion: + - "@DENTAL_DEF_DB" + - "@DENTAL_INV_DB" + - "@DENTAL_MAPA_DOC" + + schemas_relacionados: + - "clinicas.* (expedientes, citas, pacientes)" + - "core.* (usuarios, tenants)" + - "audit.* (trazas)" + + workspace: + - "@ERP_DEF_DB" + - "@CLINICAS_DEF_DB" + - "@TS_DEF_DB" + +# =============================================================================== +# FIN DEL PERFIL +# =============================================================================== diff --git a/orchestration/agents/perfiles/PERFIL-ODONTOLOGO-AGENT.yml b/orchestration/agents/perfiles/PERFIL-ODONTOLOGO-AGENT.yml new file mode 100644 index 0000000..19cfba8 --- /dev/null +++ b/orchestration/agents/perfiles/PERFIL-ODONTOLOGO-AGENT.yml @@ -0,0 +1,193 @@ +# =============================================================================== +# PERFIL DE AGENTE - ODONTOLOGO DIGITAL +# =============================================================================== +# +# Proyecto: clinica-dental +# Rol: Agente especializado en dominio odontologico +# Alias: @DENTAL_AGENT_ODONTOLOGO +# +# =============================================================================== + +version: "1.0.0" +created: "2026-01-16" +updated: "2026-01-16" +proyecto: "clinica-dental" + +# ------------------------------------------------------------------------------- +# IDENTIFICACION +# ------------------------------------------------------------------------------- + +perfil: + id: "DENTAL-AGENT-001" + nombre: "Odontologo Digital" + alias: "@DENTAL_AGENT_ODONTOLOGO" + descripcion: "Agente especializado en logica de negocio odontologica" + tipo: "DOMAIN_EXPERT" + +# ------------------------------------------------------------------------------- +# CADENA DE HERENCIA +# ------------------------------------------------------------------------------- + +herencia: + cadena: "template-saas -> erp-core -> erp-clinicas -> clinica-dental" + perfiles_padre: + - "@CLINICAS_AGENT_MEDICO" + - "@ERP_AGENT_BACKEND" + especializacion: "Dominio odontologico" + +# ------------------------------------------------------------------------------- +# COMPETENCIAS +# ------------------------------------------------------------------------------- + +competencias: + dominio_clinico: + nivel: "experto" + areas: + - "Anatomia dental (32 piezas permanentes, 20 deciduos)" + - "Nomenclatura FDI/Palmer/Universal" + - "Patologias dentales (caries, periodontal, endodontica)" + - "Tratamientos restauradores" + - "Ortodoncia y brackets" + - "Protesis fija y removible" + - "Radiografia dental (panoramica, periapical, oclusal)" + + normativa: + nivel: "experto" + conocimientos: + - nom_013_ssa2_2015: + descripcion: "Prevencion y control enfermedades bucales" + aplicacion: "Estructura de expediente, odontograma" + - nom_004_ssa3_2012: + descripcion: "Del expediente clinico" + aplicacion: "Historia clinica, consentimiento informado" + - cofepris: + descripcion: "Regulacion consultorios" + aplicacion: "Licencias, registro" + + tecnico: + nivel: "avanzado" + areas: + - "Modelado de odontogramas digitales" + - "Codigos CIE-10 dentales" + - "Integracion con imagenologia" + - "Presupuestos y planes de tratamiento" + +# ------------------------------------------------------------------------------- +# RESPONSABILIDADES +# ------------------------------------------------------------------------------- + +responsabilidades: + principales: + - "Validar logica de negocio odontologica" + - "Asegurar cumplimiento normativo NOM-013" + - "Disenar flujos de tratamiento dental" + - "Verificar integridad de odontogramas" + - "Revisar codificacion de diagnosticos" + + validaciones: + - validacion: "Odontograma completo" + regla: "32 piezas para adulto, 20 para nino" + bloquea: true + + - validacion: "Consentimiento informado" + regla: "Obligatorio antes de tratamiento invasivo" + bloquea: true + + - validacion: "Plan de tratamiento" + regla: "Debe incluir diagnostico, procedimientos, costos" + bloquea: false + + - validacion: "Historial radiografico" + regla: "Justificacion clinica requerida" + bloquea: true + +# ------------------------------------------------------------------------------- +# DIRECTIVAS ACTIVAS +# ------------------------------------------------------------------------------- + +directivas: + obligatorias: + - "@DENTAL_TRIGGER_COHERENCIA" + - "@DENTAL_TRIGGER_INVENTARIOS" + - "@CLINICAS_DIRECTIVA_EXPEDIENTE" + - "@ERP_DIRECTIVA_MULTI_TENANT" + + opcionales: + - "@WS_TRIGGER_ANTI_DUPLICACION" + - "@WS_TRIGGER_DEPENDENCIAS" + +# ------------------------------------------------------------------------------- +# FLUJOS DE TRABAJO +# ------------------------------------------------------------------------------- + +flujos: + nueva_consulta: + pasos: + 1: "Verificar paciente existente o crear nuevo" + 2: "Cargar odontograma vigente" + 3: "Registrar hallazgos del examen" + 4: "Actualizar odontograma" + 5: "Generar plan de tratamiento" + 6: "Presupuesto si aplica" + + tratamiento: + pasos: + 1: "Validar consentimiento informado" + 2: "Verificar historial alergias" + 3: "Registrar procedimiento" + 4: "Actualizar odontograma post-tratamiento" + 5: "Generar receta si aplica" + 6: "Agendar seguimiento" + + radiografia: + pasos: + 1: "Verificar justificacion clinica" + 2: "Seleccionar tipo (panoramica/periapical/oclusal)" + 3: "Registrar dosis estimada" + 4: "Almacenar imagen DICOM" + 5: "Vincular a expediente" + +# ------------------------------------------------------------------------------- +# INTEGRACIONES +# ------------------------------------------------------------------------------- + +integraciones: + modulos_CDT: + - "CDT-001: Odontograma" + - "CDT-002: Tratamientos dentales" + - "CDT-003: Ortodoncia" + - "CDT-004: Protesis" + - "CDT-005: Radiografias" + - "CDT-006: Presupuestos" + + modulos_heredados: + - "Pacientes (de erp-clinicas)" + - "Citas (de erp-clinicas)" + - "Expedientes (de erp-clinicas)" + - "Prescripciones (de erp-clinicas)" + +# ------------------------------------------------------------------------------- +# REFERENCIAS +# ------------------------------------------------------------------------------- + +referencias: + documentacion: + - "@DENTAL_MAPA_DOC" + - "@DENTAL_CONTEXT_MAP" + - "@DENTAL_INHERITANCE" + + inventarios: + - "@DENTAL_INV_MASTER" + - "@DENTAL_INV_DB" + - "@DENTAL_INV_BE" + + workspace: + - "@WS_DIRECTIVAS" + - "@WS_PERFILES" + - "@CLINICAS_MAPA_DOC" + - "@ERP_MAPA_DOC" + - "@TS_MAPA_DOC" + +# =============================================================================== +# FIN DEL PERFIL +# =============================================================================== diff --git a/orchestration/agents/perfiles/_INDEX.yml b/orchestration/agents/perfiles/_INDEX.yml new file mode 100644 index 0000000..343e184 --- /dev/null +++ b/orchestration/agents/perfiles/_INDEX.yml @@ -0,0 +1,146 @@ +# =============================================================================== +# INDICE DE PERFILES DE AGENTES - CLINICA DENTAL +# =============================================================================== +# +# Proyecto: clinica-dental +# Descripcion: Catalogo de agentes especializados para el dominio odontologico +# Alias: @DENTAL_AGENTS_INDEX +# +# =============================================================================== + +version: "1.0.0" +created: "2026-01-16" +updated: "2026-01-16" +proyecto: "clinica-dental" + +# ------------------------------------------------------------------------------- +# CADENA DE HERENCIA DE PERFILES +# ------------------------------------------------------------------------------- + +herencia: + cadena: "template-saas -> erp-core -> erp-clinicas -> clinica-dental" + perfiles_heredados: + desde_template_saas: + - "@TS_AGENT_DDL" + - "@TS_AGENT_BACKEND" + - "@TS_AGENT_FRONTEND" + desde_erp_core: + - "@ERP_AGENT_DDL" + - "@ERP_AGENT_BACKEND" + - "@ERP_AGENT_FRONTEND" + desde_erp_clinicas: + - "@CLINICAS_AGENT_MEDICO" + - "@CLINICAS_AGENT_DDL" + +# ------------------------------------------------------------------------------- +# PERFILES PROPIOS +# ------------------------------------------------------------------------------- + +perfiles: + dominio: + - id: "DENTAL-AGENT-001" + archivo: "PERFIL-ODONTOLOGO-AGENT.yml" + alias: "@DENTAL_AGENT_ODONTOLOGO" + tipo: "DOMAIN_EXPERT" + descripcion: "Agente experto en logica de negocio odontologica" + competencias_clave: + - "Anatomia y patologia dental" + - "Normativa NOM-013-SSA2" + - "Flujos clinicos dentales" + + tecnico: + - id: "DENTAL-AGENT-002" + archivo: "PERFIL-DDL-DENTAL-AGENT.yml" + alias: "@DENTAL_AGENT_DDL" + tipo: "DATABASE_SPECIALIST" + descripcion: "Agente especializado en schema sub_dental" + competencias_clave: + - "PostgreSQL avanzado" + - "Modelado odontograma" + - "Auditoria medica" + +# ------------------------------------------------------------------------------- +# MATRIZ DE COMPETENCIAS +# ------------------------------------------------------------------------------- + +matriz_competencias: + por_area: + dominio_dental: + principal: "@DENTAL_AGENT_ODONTOLOGO" + soporte: "@CLINICAS_AGENT_MEDICO" + + base_de_datos: + principal: "@DENTAL_AGENT_DDL" + soporte: "@CLINICAS_AGENT_DDL" + + backend: + principal: "@ERP_AGENT_BACKEND" + especializacion: "@DENTAL_AGENT_ODONTOLOGO" + + frontend: + principal: "@ERP_AGENT_FRONTEND" + especializacion: null # Por definir + + normativa: + principal: "@DENTAL_AGENT_ODONTOLOGO" + referencias: + - "NOM-013-SSA2-2015" + - "NOM-004-SSA3-2012" + +# ------------------------------------------------------------------------------- +# ASIGNACION POR TAREA +# ------------------------------------------------------------------------------- + +asignacion_tareas: + crear_tabla_dental: + agente_principal: "@DENTAL_AGENT_DDL" + validadores: + - "@DENTAL_AGENT_ODONTOLOGO" + + crear_entity_dental: + agente_principal: "@ERP_AGENT_BACKEND" + validadores: + - "@DENTAL_AGENT_DDL" + - "@DENTAL_AGENT_ODONTOLOGO" + + implementar_odontograma: + agente_principal: "@DENTAL_AGENT_ODONTOLOGO" + validadores: + - "@DENTAL_AGENT_DDL" + + validar_normativa: + agente_principal: "@DENTAL_AGENT_ODONTOLOGO" + validadores: [] + +# ------------------------------------------------------------------------------- +# ESTADISTICAS +# ------------------------------------------------------------------------------- + +estadisticas: + total_perfiles_propios: 2 + total_perfiles_heredados: 8 + cobertura_areas: + dominio: "100%" + ddl: "100%" + backend: "heredado" + frontend: "heredado" + ultima_actualizacion: "2026-01-16" + +# ------------------------------------------------------------------------------- +# REFERENCIAS +# ------------------------------------------------------------------------------- + +referencias: + documentacion: + - "@DENTAL_MAPA_DOC" + - "@DENTAL_TRIGGER_COHERENCIA" + - "@DENTAL_TRIGGER_INVENTARIOS" + + workspace: + - "@WS_PERFILES" + - "@CLINICAS_AGENTS_INDEX" + - "@ERP_AGENTS" + +# =============================================================================== +# FIN DEL INDICE +# =============================================================================== diff --git a/orchestration/directivas/TRIGGER-COHERENCIA-CAPAS.md b/orchestration/directivas/TRIGGER-COHERENCIA-CAPAS.md new file mode 100644 index 0000000..9198cd3 --- /dev/null +++ b/orchestration/directivas/TRIGGER-COHERENCIA-CAPAS.md @@ -0,0 +1,165 @@ +# TRIGGER: Coherencia Entre Capas - Clinica Dental + +**ID:** TRIGGER-DENTAL-COHERENCIA +**Version:** 1.0.0 +**Proyecto:** clinica-dental +**Hereda de:** @ERP_TRIGGER_COHERENCIA -> @CLINICAS_TRIGGER_COHERENCIA +**Alias:** @DENTAL_TRIGGER_COHERENCIA + +--- + +## Proposito + +Validar que cada objeto creado en una capa tenga su correspondiente en las demas capas, manteniendo coherencia DDL - Backend - Frontend, con validaciones especificas para el dominio odontologico. + +## Cadena de Herencia + +``` +template-saas (PROVIDER) + | + v +erp-core (INTERMEDIATE) + | + v +erp-clinicas (CONSUMER) + | + v +clinica-dental (SUB-VERTICAL) <- ESTE PROYECTO +``` + +## Activacion + +### Automatica +- Creacion/modificacion de tabla DDL en schema `sub_dental` +- Creacion/modificacion de entity TypeORM en modulos dentales +- Creacion/modificacion de endpoint API especifico dental + +### Manual +- Comando: `@DENTAL_VALIDATE_COHERENCE` +- Pre-commit hook + +## Reglas de Validacion + +### DDL -> Backend (OBLIGATORIO) + +```yaml +regla_1: + condicion: "Nueva tabla DDL creada en sub_dental.*" + accion: "Verificar entity correspondiente existe" + bloquea: true + +regla_2: + condicion: "Columna agregada a tabla dental" + accion: "Verificar campo en entity existe" + bloquea: true + +regla_3: + condicion: "Constraint FK agregado a tabla dental" + accion: "Verificar relacion TypeORM existe" + bloquea: true +``` + +### Backend -> Frontend (CONDICIONAL) + +```yaml +regla_4: + condicion: "Endpoint CRUD dental creado" + accion: "Verificar hook/servicio frontend existe" + bloquea: false # Solo warning + +regla_5: + condicion: "DTO dental modificado" + accion: "Verificar tipos TypeScript frontend" + bloquea: false +``` + +## Validaciones Especificas Clinica Dental + +### Modulos CDT (Clinica Dental) + +| Modulo | DDL Schema | Backend Path | Frontend Path | +|--------|------------|--------------|---------------| +| CDT-001 Odontograma | sub_dental.odontograms, tooth_* | modules/odontograma/ | pages/odontograma/ | +| CDT-002 Tratamientos | sub_dental.dental_treatments | modules/tratamientos-dentales/ | pages/tratamientos/ | +| CDT-003 Ortodoncia | sub_dental.orthodontic_* | modules/ortodoncia/ | pages/ortodoncia/ | +| CDT-004 Protesis | sub_dental.prosthetics | modules/protesis/ | pages/protesis/ | +| CDT-005 Radiografias | sub_dental.dental_xrays | modules/radiografias/ | pages/radiografias/ | +| CDT-006 Presupuestos | sub_dental.dental_quotes | modules/presupuestos/ | pages/presupuestos/ | + +### Coherencia de Nombres + +``` +DDL: sub_dental.tabla_nombre (snake_case) +Entity: TablaNombre (PascalCase) +Service: tabla-nombre.service.ts (kebab-case) +Controller: tabla-nombre.controller.ts (kebab-case) +``` + +## Validaciones Normativas (NOM-013-SSA2-2015) + +### Campos Obligatorios para Expediente Clinico Dental + +```yaml +validacion_normativa: + condicion: "Entity de expediente dental" + campos_requeridos: + - "historia_clinica_general" + - "examen_extraoral" + - "examen_intraoral" + - "odontograma_inicial" + - "diagnostico_presuntivo" + - "plan_tratamiento" + - "consentimiento_informado" + referencia_normativa: "NOM-013-SSA2-2015" + bloquea: true +``` + +### Integridad de Odontograma + +```yaml +validacion_odontograma: + condicion: "Tabla odontograms creada/modificada" + reglas: + - "32 piezas dentales adulto o 20 deciduos" + - "Estado por superficie (5 superficies por pieza)" + - "Codigos CIE-10 para diagnosticos" + bloquea: true +``` + +## Excepciones Permitidas + +1. **Tablas M:N gestionadas por TypeORM** + - Documentar en ENTITIES-CATALOG.md + +2. **Tablas de auditoria/sistema** + - Prefijo: `_audit_dental`, `_system_dental` + +3. **Tablas heredadas de erp-clinicas** + - No requieren entity local si se usa la del padre + +4. **Vistas para reportes NOM** + - Documentar en DATABASE-SCHEMA.md + +## Metricas + +| Metrica | Objetivo | Actual | +|---------|----------|--------| +| Coherencia DDL-Entity | 100% | TBD | +| Coherencia Entity-Service | 100% | TBD | +| Coherencia API-Frontend | 95% | TBD | +| Cumplimiento NOM-013 | 100% | TBD | + +## Referencias + +- `@DENTAL_DEF_DB` - DATABASE-SCHEMA.md +- `@DENTAL_DEF_ENTITIES` - ENTITIES-CATALOG.md +- `@CLINICAS_TRIGGER_COHERENCIA` - Trigger padre en erp-clinicas +- `@ERP_TRIGGER_COHERENCIA` - Trigger abuelo en erp-core +- `@WS_TRIGGER_COHERENCIA` - Trigger raiz del workspace + +--- + +**Normativa Aplicable:** +- NOM-013-SSA2-2015: Prevencion y control de enfermedades bucales +- NOM-004-SSA3-2012: Del expediente clinico +- COFEPRIS: Regulacion de consultorios dentales diff --git a/orchestration/directivas/TRIGGER-INVENTARIOS.md b/orchestration/directivas/TRIGGER-INVENTARIOS.md new file mode 100644 index 0000000..d18fcba --- /dev/null +++ b/orchestration/directivas/TRIGGER-INVENTARIOS.md @@ -0,0 +1,249 @@ +# TRIGGER: Inventarios Sincronizados - Clinica Dental + +**ID:** TRIGGER-DENTAL-INVENTARIOS +**Version:** 1.0.0 +**Proyecto:** clinica-dental +**Hereda de:** @ERP_TRIGGER_INVENTARIOS -> @CLINICAS_TRIGGER_INVENTARIOS +**Alias:** @DENTAL_TRIGGER_INVENTARIOS + +--- + +## Proposito + +Mantener los inventarios sincronizados con el codigo fuente, asegurando que cada objeto nuevo/modificado este registrado, con enfasis en componentes especificos del dominio odontologico. + +## Cadena de Herencia + +``` +template-saas (PROVIDER) + | + v +erp-core (INTERMEDIATE) + | + v +erp-clinicas (CONSUMER) + | + v +clinica-dental (SUB-VERTICAL) <- ESTE PROYECTO +``` + +## Activacion + +### Post-Tarea +- Creacion de entity/service/controller dental +- Creacion de tabla DDL en sub_dental +- Creacion de componente frontend dental +- Modificacion de modulo CDT + +### Automatica +- Post-commit (via hook) +- Pre-release + +## Inventarios a Sincronizar + +### DATABASE_INVENTORY.yml +```yaml +ubicacion: "orchestration/inventarios/DATABASE_INVENTORY.yml" +contenido: + schemas_propios: + - sub_dental + tablas_dental: + - sub_dental.odontograms + - sub_dental.tooth_conditions + - sub_dental.tooth_treatments + - sub_dental.dental_treatments + - sub_dental.treatment_plans + - sub_dental.treatment_progress + - sub_dental.orthodontic_cases + - sub_dental.bracket_types + - sub_dental.orthodontic_progress + - sub_dental.prosthetics + - sub_dental.lab_orders + - sub_dental.dental_xrays + - sub_dental.xray_analysis + - sub_dental.dental_quotes + - sub_dental.quote_items + tablas_heredadas: + - "clinicas.pacientes (extendido)" + - "clinicas.citas (adaptado)" + - "clinicas.expedientes (extendido)" +``` + +### BACKEND_INVENTORY.yml +```yaml +ubicacion: "orchestration/inventarios/BACKEND_INVENTORY.yml" +contenido: + modulos_CDT: + - CDT-001: odontograma + - CDT-002: tratamientos-dentales + - CDT-003: ortodoncia + - CDT-004: protesis + - CDT-005: radiografias-dentales + - CDT-006: presupuestos-dentales + entities_por_modulo: TBD + services_por_modulo: TBD + controllers_y_endpoints: TBD + dtos: TBD + guards_especificos: + - dental-professional.guard.ts + - patient-consent.guard.ts +``` + +### FRONTEND_INVENTORY.yml +```yaml +ubicacion: "orchestration/inventarios/FRONTEND_INVENTORY.yml" +contenido: + pages_dentales: + - OdontogramaPage + - TratamientosPage + - OrtodonciaDashboard + - ProtesisPage + - RadiografiaViewer + - PresupuestoEditor + components_especializados: + - OdontogramaInteractivo + - ToothSelector + - TreatmentPlanBuilder + - BracketTracker + - XRayViewer + - QuoteCalculator + hooks_dental: + - useOdontograma + - useTreatmentPlan + - useDentalHistory +``` + +### MASTER_INVENTORY.yml +```yaml +ubicacion: "orchestration/inventarios/MASTER_INVENTORY.yml" +contenido: + totales_consolidados: TBD + estadisticas_por_capa: TBD + ultima_sincronizacion: TBD + cobertura_tests: TBD + cumplimiento_normativo: TBD +``` + +## Reglas de Actualizacion + +```yaml +regla_1: + evento: "Entity dental creada" + acciones: + - Agregar a BACKEND_INVENTORY.yml + - Incrementar contador en MASTER_INVENTORY.yml + - Verificar campos NOM-013 si aplica + +regla_2: + evento: "Tabla DDL dental creada" + acciones: + - Agregar a DATABASE_INVENTORY.yml + - Verificar entity correspondiente + - Validar schema sub_dental + +regla_3: + evento: "Componente React dental creado" + acciones: + - Agregar a FRONTEND_INVENTORY.yml + - Clasificar por tipo (page/component/hook) + - Verificar accesibilidad WCAG si es UI paciente +``` + +## Validacion de Consistencia + +### Conteos Esperados + +| Inventario | Metrica | Valor Esperado | +|------------|---------|----------------| +| DATABASE | Schemas propios | 1 (sub_dental) | +| DATABASE | Tablas propias | 15+ | +| DATABASE | Tablas heredadas | 10+ (de clinicas) | +| BACKEND | Modulos CDT | 6 | +| BACKEND | Entities | 15+ | +| FRONTEND | Pages | 6+ | +| FRONTEND | Components especializados | 10+ | + +### Script de Validacion + +```bash +# Validar sincronizacion +npm run inventory:validate + +# Actualizar inventarios +npm run inventory:sync + +# Validar cumplimiento NOM-013 +npm run inventory:validate-nom +``` + +## Inventarios de Materiales Dentales + +### Categorias Especiales (Control NOM) + +```yaml +materiales_controlados: + anestesicos: + - lidocaina + - articaina + - mepivacaina + registro_obligatorio: true + trazabilidad: "por ampolleta" + + amalgamas: + - alto_contenido_cobre + - bajo_contenido_cobre + registro_obligatorio: true + disposicion_especial: true + + resinas: + - composites + - ionomeros_vidrio + lote_tracking: true + + instrumental_esteril: + - espejos + - exploradores + - pinzas + ciclos_esterilizacion: tracking +``` + +## Formato de Entrada + +```yaml +# Nueva entity dental +entities: + - nombre: "OdontogramEntity" + archivo: "odontogram.entity.ts" + modulo: "odontograma" + tabla_ddl: "sub_dental.odontograms" + estado: "implementado" + tests: true + cumple_nom_013: true +``` + +## Metricas + +| Metrica | Objetivo | Actual | +|---------|----------|--------| +| Sincronizacion DB | 100% | TBD | +| Sincronizacion BE | 100% | TBD | +| Sincronizacion FE | 100% | TBD | +| Trazabilidad materiales | 100% | TBD | +| Ultima actualizacion | Diaria | TBD | + +## Referencias + +- `@DENTAL_INV_MASTER` - MASTER_INVENTORY.yml +- `@DENTAL_INV_DB` - DATABASE_INVENTORY.yml +- `@DENTAL_INV_BE` - BACKEND_INVENTORY.yml +- `@DENTAL_INV_FE` - FRONTEND_INVENTORY.yml +- `@CLINICAS_TRIGGER_INVENTARIOS` - Trigger padre +- `@ERP_TRIGGER_INVENTARIOS` - Trigger abuelo +- `@WS_TRIGGER_INVENTARIOS` - Trigger raiz del workspace + +--- + +**Normativa Aplicable para Inventarios:** +- NOM-013-SSA2-2015: Control de materiales e instrumental +- NOM-087-SEMARNAT-SSA1-2002: Residuos peligrosos biologico-infecciosos (RPBI) +- COFEPRIS: Registro de medicamentos controlados