- Add orchestration/directivas/ with TRIGGER-COHERENCIA-CAPAS.md and TRIGGER-INVENTARIOS.md adapted for dental domain - Add orchestration/agents/perfiles/ with specialized agents: - PERFIL-ODONTOLOGO-AGENT.yml (domain expert) - PERFIL-DDL-DENTAL-AGENT.yml (database specialist) - _INDEX.yml (agents catalog) - Add MAPA-DOCUMENTACION.yml with full heritage chain references: - template-saas (origin/PROVIDER) - erp-core (abuelo/INTERMEDIATE) - erp-clinicas (padre/CONSUMER) - Include normative references: NOM-013-SSA2-2015, NOM-004-SSA3-2012, COFEPRIS - Define @DENTAL_ prefixed aliases for project navigation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
250 lines
5.7 KiB
Markdown
250 lines
5.7 KiB
Markdown
# 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
|