Skip to main content

The 5 CUIDO Modules

CUIDO Backend is organized into 5 specialized modules, each designed to address specific aspects of healthcare employee wellbeing and development:

Diagnóstico Inteligente

AI-powered wellbeing assessment and risk detection

Mentoría Virtual

24/7 AI mentor for healthcare professionals

Microformación

Personalized bite-sized learning courses

Reconocimiento

Gamified recognition and rewards system

Correlación

Strategic talent-performance analytics

Module Architecture Pattern

All CUIDO modules follow a consistent 3-layer architecture:

Layer Responsibilities

Defines API endpoints, applies middleware, and validates requests.Example:
// src/routes/diagnosticRoutes.js
import express from 'express';
import { authenticate, authorize } from '../middleware/auth.js';
import { validateRequest } from '../middleware/validation.js';

const router = express.Router();
router.use(authenticate);

router.post('/survey/quick', 
  validateRequest(quickSurveySchema), 
  processQuickSurvey
);
Handles HTTP requests/responses and orchestrates service calls.Example:
export const getEmployeeGameStats = asyncHandler(async (req, res) => {
  const { employeeId } = req.params;
  const stats = await recognitionService.getEmployeeGameStats(employeeId);
  sendSuccess(res, 'Estadísticas obtenidas', { stats });
});
Contains business logic, AI integration, and data processing.Example:
// src/services/diagnosticService.js
class DiagnosticService {
  async processQuickSurvey(employeeId, responses) {
    const riskAnalysis = await this.calculateRiskScore(responses);
    await this.updateEmployeeMetrics(employee, responses);
    await this.checkAndGenerateAlerts(employeeId, riskAnalysis);
    return survey;
  }
}

Module Routes Organization

Routes are mounted in src/app.js with consistent prefixes:
// src/app.js
import diagnosticRoutes from './routes/diagnosticRoutes.js';
import mentorshipRoutes from './routes/mentorshipRoutes.js';
import microLearningRoutes from './routes/microLearningRoutes.js';
import recognitionRoutes from './routes/recognitionRoutes.js';
import correlationRoutes from './routes/correlationRoutes.js';

// Module routes
app.use('/api/diagnostic', diagnosticRoutes);       // Module 1
app.use('/api/mentorship', mentorshipRoutes);       // Module 2
app.use('/api/microlearning', microLearningRoutes); // Module 3
app.use('/api/recognition', recognitionRoutes);     // Module 4
app.use('/api/correlation', correlationRoutes);     // Module 5

// Supporting routes
app.use('/api/employees', employeeRoutes);
app.use('/api/auth', authRoutes);

Module 1: Diagnóstico Inteligente

Purpose: Continuous wellbeing monitoring with AI-powered risk detection

Key Features

  • Quick daily surveys with sentiment analysis
  • Real-time wellness heatmaps by department
  • Automated alert generation for high-risk employees
  • Claude AI-powered text analysis
  • Gamified survey participation

Routes Structure

// src/routes/diagnosticRoutes.js
router.post('/survey/quick', validateRequest(quickSurveySchema), processQuickSurvey);
router.get('/survey/history/:employeeId', getEmployeeSurveyHistory);
router.get('/wellness-heatmap/:hospitalId', authorize('admin', 'user'), getWellnessHeatmap);
router.get('/alerts', authorize('admin'), getAlerts);
router.put('/alerts/:id/view', authorize('admin'), markAlertAsViewed);

Service Layer Capabilities

async calculateRiskScore(responses, employee) {
  const weights = {
    moodToday: 0.3,
    workloadLevel: 0.25,
    teamSupport: 0.2,
    jobSatisfaction: 0.25
  };
  
  // Calculate weighted risk score
  let riskScore = 0;
  Object.keys(weights).forEach(key => {
    riskScore += (1 - scores[key]) * weights[key];
  });
  
  // Adjust by employee factors
  const adjustments = await this.getEmployeeRiskAdjustments(employee);
  riskScore = Math.min(1, riskScore * adjustments);
  
  return {
    riskScore: Math.round(riskScore * 100),
    riskLevel: riskScore < 0.3 ? 'bajo' : riskScore < 0.7 ? 'medio' : 'alto'
  };
}

Module 2: Mentoría Virtual

Purpose: 24/7 AI-powered mentor for healthcare professionals

Routes Structure

// src/routes/mentorshipRoutes.js
router.use(authenticate);
router.post('/ask', validateRequest(mentorshipSchema), askMentor);
Simple, focused API - single endpoint for asking questions to the AI mentor

Module 3: Microformación

Purpose: Personalized bite-sized learning with AI recommendations

Key Features

  • Course creation and management
  • Smart course recommendations
  • Quiz system with instant feedback
  • Progress tracking
  • Enrollment management

Routes Structure

// src/routes/microLearningRoutes.js
// Course management
router.post('/courses', authorize('admin'), validateRequest(createMicroCourseSchema), createMicroCourse);
router.get('/courses', getAvailableCourses);
router.post('/courses/:courseId/enroll', enrollInCourse);

// Evaluation system
router.post('/courses/:courseId/quiz', validateRequest(submitQuizSchema), submitQuiz);

// Recommendations and progress
router.get('/recommendations/:employeeId', getCourseRecommendations);
router.get('/progress/:employeeId', getEmployeeProgress);

Module 4: Reconocimiento

Purpose: Gamified recognition system with points, badges, and rankings

Key Features

  • Recognition wall for public achievements
  • Points and badge system
  • Employee ranking by hospital
  • Gamification statistics
  • Multiple reward types (points, diplomas, mentions)

Routes Structure

// src/routes/recognitionRoutes.js
router.post('/grant', authorize('admin'), validateRequest(grantRecognitionSchema), grantRecognition);
router.get('/wall/:hospitalId', getRecognitionWall);
router.get('/stats/:employeeId', getEmployeeGameStats);
router.get('/ranking/:hospitalId', getEmployeeRanking);

Recognition Types

Survey Completion

5 pointsBadge: Participativo

Course Completion

20 pointsBadge: Aprendiz

Employee of Month

100 pointsBadge: Estrella

Service Implementation

// src/services/recognitionService.js
class RecognitionService {
  async grantRecognition(employeeId, type, data = {}) {
    const config = this.getRecognitionConfig(type);
    
    const recognition = new Recognition({
      employeeId,
      recognitionType: type,
      rewardType: config.rewardType,
      title: config.title,
      description: config.description,
      pointsAwarded: config.points,
      badgeEarned: config.badge
    });
    
    await recognition.save();
    return recognition;
  }
  
  calculateLevel(totalPoints) {
    if (totalPoints >= 500) return 5;
    if (totalPoints >= 300) return 4;
    if (totalPoints >= 150) return 3;
    if (totalPoints >= 50) return 2;
    return 1;
  }
}

Module 5: Correlación

Purpose: Strategic analytics connecting talent investment with organizational performance

Key Features

  • Monthly metrics generation
  • Historical trend analysis
  • Executive dashboards
  • Strategic reports
  • ROI calculations

Routes Structure

// src/routes/correlationRoutes.js
router.use(authenticate);
router.use(authorize('admin')); // Admin-only module

router.post('/metrics/:hospitalId', generateMonthlyMetrics);
router.get('/metrics/:hospitalId/history', getHistoricalMetrics);
router.get('/report/:hospitalId', generateStrategicReport);
router.get('/dashboard/:hospitalId', getExecutiveDashboard);
This module requires admin privileges as it contains sensitive strategic data

Shared Employee Model

All modules interact with the central Employee model:
// src/models/Employee.js
const employeeSchema = new mongoose.Schema({
  personalInfo: {
    name: String,
    email: String,
    identification: String,
    phoneNumber: String
  },
  jobInfo: {
    position: { type: String, enum: ['medico', 'enfermero', 'auxiliar_enfermeria', 'administrativo', 'otro'] },
    department: { type: String, enum: ['urgencias', 'hospitalizacion', 'consulta_externa', 'administracion', 'otro'] },
    startDate: Date,
    shift: { type: String, enum: ['mañana', 'tarde', 'noche', 'rotativo'] }
  },
  wellnessMetrics: {
    currentMoodScore: Number,
    averageWorkload: Number,
    teamSupportScore: Number,
    satisfactionScore: Number,
    riskLevel: { type: String, enum: ['bajo', 'medio', 'alto'] }
  },
  gamification: {
    totalPoints: { type: Number, default: 0 },
    currentStreak: { type: Number, default: 0 },
    maxStreak: { type: Number, default: 0 },
    level: { type: Number, default: 1 },
    badges: [{
      name: String,
      earnedAt: Date,
      description: String
    }]
  }
});

Cross-Module Integration

Integration Examples

When a survey is completed:
  1. Diagnostic module processes responses
  2. Awards 5 points to employee
  3. Recognition module checks for badge eligibility
  4. Updates streak counter

Service Layer Pattern

All modules follow this service pattern:
// Singleton service export
class ModuleService {
  async primaryOperation() {
    // Business logic
    // AI integration (if applicable)
    // Database operations
    // Alert generation
  }
  
  async helperMethod() {
    // Supporting functionality
  }
}

export default new ModuleService();

Next Steps

Gamification

Deep dive into the points, badges, and levels system

Module Details

Explore detailed documentation for each module

Build docs developers (and LLMs) love