Compare commits
No commits in common. "4d319000981878643b75fef57bf492af12c7bad7" and "5ba4a25182332497cfab36a5a022d7f089704ac9" have entirely different histories.
4d31900098
...
5ba4a25182
|
|
@ -28,4 +28,3 @@ Registro histórico de hitos y sesiones del proyecto.
|
|||
- Ejecutar migración masiva de protocolos.
|
||||
- Conectar renderer a la API de MongoDB.
|
||||
- Redacción de manuales prioritarios.
|
||||
- [2026-03-23] Migración YAML a MongoDB completada exitosamente.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import mongoose, { Schema, Document } from 'mongoose';
|
||||
import { ClinicalProtocol } from '../../../domain/entities/ClinicalProtocol';
|
||||
import { ClinicalProtocol } from '../../domain/entities/ClinicalProtocol';
|
||||
|
||||
const ProtocolStepSchema = new Schema({
|
||||
tipo: { type: String, enum: ['checklist', 'decision', 'tecnica', 'info'], required: true },
|
||||
|
|
@ -74,6 +74,6 @@ const ClinicalProtocolSchema = new Schema({
|
|||
collection: 'protocols'
|
||||
});
|
||||
|
||||
export interface ProtocolDocument extends Omit<ClinicalProtocol, 'id'>, Document {}
|
||||
export interface ProtocolDocument extends ClinicalProtocol, Document {}
|
||||
|
||||
export const ProtocolModel = mongoose.model<ProtocolDocument>('Protocol', ClinicalProtocolSchema);
|
||||
|
|
|
|||
|
|
@ -17,20 +17,6 @@ async function migrate() {
|
|||
await mongoose.connect(MONGODB_URI);
|
||||
console.log('✅ Conectado a MongoDB');
|
||||
|
||||
function normalizeItems(items: any[] | undefined): string[] {
|
||||
if (!items) return [];
|
||||
return items.map(item => {
|
||||
if (typeof item === 'string') return item;
|
||||
if (typeof item === 'object' && item !== null) {
|
||||
const entries = Object.entries(item);
|
||||
if (entries.length > 0) {
|
||||
const [key, value] = entries[0];
|
||||
return `${key}: ${value}`;
|
||||
}
|
||||
}
|
||||
return String(item);
|
||||
});
|
||||
}
|
||||
const folders = fs.readdirSync(PROTOCOLS_DIR);
|
||||
let totalMigrated = 0;
|
||||
|
||||
|
|
@ -43,33 +29,12 @@ async function migrate() {
|
|||
for (const file of files) {
|
||||
const filePath = path.join(folderPath, file);
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
const data = yaml.load(content) as any;
|
||||
const data = yaml.load(content) as ClinicalProtocol;
|
||||
|
||||
if (!data.id) {
|
||||
data.id = file.replace('.yaml', '');
|
||||
}
|
||||
|
||||
// Normalizar items en pasos
|
||||
if (data.pasos) {
|
||||
data.pasos = data.pasos.map((p: any) => ({
|
||||
...p,
|
||||
items: normalizeItems(p.items)
|
||||
}));
|
||||
}
|
||||
|
||||
// Normalizar items en fases
|
||||
if (data.fases) {
|
||||
data.fases = data.fases.map((f: any) => ({
|
||||
...f,
|
||||
items: normalizeItems(f.items)
|
||||
}));
|
||||
}
|
||||
|
||||
// Normalizar equipamiento
|
||||
if (data.equipamiento) {
|
||||
data.equipamiento = normalizeItems(data.equipamiento);
|
||||
}
|
||||
|
||||
// Upsert
|
||||
await ProtocolModel.findOneAndUpdate(
|
||||
{ id: data.id },
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ services:
|
|||
mongodb:
|
||||
image: mongo:latest
|
||||
container_name: codigo0-mongodb
|
||||
ports:
|
||||
- "27017:27017"
|
||||
restart: always
|
||||
volumes:
|
||||
- mongodb_data:/data/db
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ pasos:
|
|||
titulo: Valoración Clínica
|
||||
descripcion: Signos típicos de crisis.
|
||||
items:
|
||||
- "Valorar triada: Polidipsia (mucha sed), Poliuria, Polifagia"
|
||||
- "Evaluar hidratación: Mucosas secas, signo del pliegue (+)"
|
||||
- Valorar triada: Polidipsia (mucha sed), Poliuria, Polifagia
|
||||
- Evaluar hidratación: Mucosas secas, signo del pliegue (+)
|
||||
- Verificar nivel de consciencia (Glasgow)
|
||||
- Medir constantes vitales (TA, FC, Tª)
|
||||
|
||||
|
|
@ -45,11 +45,11 @@ pasos:
|
|||
- Monitorización continua del ritmo cardíaco (Riesgo de arritmias por potasio)
|
||||
|
||||
- tipo: info
|
||||
titulo: "Identificación: CAD vs EHH"
|
||||
titulo: Identificación: CAD vs EHH
|
||||
descripcion: Diferenciación rápida para el informe médico.
|
||||
items:
|
||||
- "Cetoacidosis (CAD): Más frecuente en DM1, inicio rápido, aliento cetósico y dolor abdominal."
|
||||
- "Estado Hiperosmolar (EHH): Más frecuente en DM2 (ancianos), inicio lento, deshidratación extrema y alteraciones neurológicas."
|
||||
- Cetoacidosis (CAD): Más frecuente en DM1, inicio rápido, aliento cetósico y dolor abdominal.
|
||||
- Estado Hiperosmolar (EHH): Más frecuente en DM2 (ancianos), inicio lento, deshidratación extrema y alteraciones neurológicas.
|
||||
|
||||
# ─── FÁRMACOS ──────────────────────────────────────────────────
|
||||
farmacos:
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ alertas:
|
|||
- tipo: danger
|
||||
texto: "Mantener alineación espinal en pacientes traumáticos."
|
||||
- tipo: warning
|
||||
text
|
||||
|
||||
#警戒
|
||||
texto: "Usar técnicasergonómicas para prevenir lesiones."
|
||||
|
||||
# ─── PRINCIPIOS ────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ pasos:
|
|||
descripcion: "Verificar respiración correcta a través de la cánula."
|
||||
|
||||
# ─── TÉCNICA NASOFARINGEA ────────────────────────────────────
|
||||
|
||||
pasos:
|
||||
- tipo: tecnica
|
||||
titulo: Preparación
|
||||
descripcion: "Lubricar cánula."
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ tecnicas:
|
|||
- titulo: Presión indirecta
|
||||
prioridad: 3
|
||||
descripcion: "Presionar arteria proximal."
|
||||
- titulo: Torniquete
|
||||
- torniquete
|
||||
prioridad: 4
|
||||
descripcion: "Último recurso para hemorragia masiva de extremidad."
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ actualizado: 2025-12-23
|
|||
# ─── ALERTAS GLOBALES ─────────────────────────────────────────
|
||||
alertas:
|
||||
- tipo: danger
|
||||
texto: '"¿Puede hablar?" - Es la pregunta diagnóstica clave.'
|
||||
texto: "¿Puede hablar?" - Es la pregunta diagnóstica clave.
|
||||
- tipo: danger
|
||||
texto: "Si puede hablar/toser bien: ANIMA A TOSER. Si no: ACTÚA."
|
||||
- tipo: warning
|
||||
|
|
|
|||
Loading…
Reference in a new issue