Skip to content

Health Declaration Integration

The Health Declaration integration connects the Stratpoint Timesheet Application with the Health Declaration System, enabling automated health status tracking, compliance monitoring, and workplace safety management in response to health protocols and regulations.

Integration Overview

Health Declaration System Architecture

graph TB
    A[Timesheet Application] --> B[Health Declaration Integration Layer]
    B --> C[Health Status Tracking]
    B --> D[Compliance Monitoring]
    B --> E[Workplace Safety]

    C --> F[Daily Health Checks]
    C --> G[Symptom Monitoring]
    C --> H[Vaccination Status]

    D --> I[Attendance Validation]
    D --> J[Policy Compliance]
    D --> K[Reporting Requirements]

    E --> L[Office Capacity Management]
    E --> M[Contact Tracing]
    E --> N[Risk Assessment]

    O[Health Declaration System] --> B

Key Integration Features

  • Automated Health Validation: Verify health declarations before office attendance
  • Attendance Correlation: Link health status with timesheet entries and office presence
  • Compliance Tracking: Monitor adherence to health and safety protocols
  • Risk Management: Assess and manage workplace health risks
  • Contact Tracing Support: Facilitate contact tracing when needed

Configuration and Setup

Health Declaration Integration Configuration

{
    "healthdec_config": {
        "api_endpoint": "https://api.healthdec.stratpoint.com/v1",
        "authentication": {
            "type": "api_key",
            "api_key": "${HEALTHDEC_API_KEY}",
            "secret_key": "${HEALTHDEC_SECRET_KEY}"
        },
        "sync_settings": {
            "health_check_frequency": "daily",
            "compliance_check_frequency": "hourly",
            "attendance_validation": "real_time",
            "batch_size": 100
        },
        "health_protocols": {
            "require_daily_declaration": true,
            "require_vaccination_proof": true,
            "temperature_check_required": true,
            "symptom_monitoring_enabled": true
        },
        "compliance_rules": {
            "office_attendance_requires_health_check": true,
            "health_check_validity_hours": 24,
            "quarantine_period_days": 14,
            "vaccination_requirement_enabled": true
        }
    }
}

Health Status Categories

// Health Status Definitions
const healthStatusCategories = {
    health_status: {
        "CLEARED": {
            name: "Health Cleared",
            description: "Passed all health checks, cleared for office attendance",
            office_access: true,
            color: "green"
        },
        "PENDING": {
            name: "Health Check Pending",
            description: "Health declaration not yet submitted for today",
            office_access: false,
            color: "yellow"
        },
        "RESTRICTED": {
            name: "Access Restricted",
            description: "Health concerns identified, office access restricted",
            office_access: false,
            color: "red"
        },
        "QUARANTINE": {
            name: "Quarantine Required",
            description: "In quarantine period, remote work only",
            office_access: false,
            color: "red"
        },
        "EXEMPTED": {
            name: "Health Check Exempted",
            description: "Exempted from health checks (remote work, etc.)",
            office_access: false,
            color: "blue"
        }
    },
    work_arrangements: {
        "OFFICE": "Office Work",
        "REMOTE": "Remote Work",
        "HYBRID": "Hybrid Work",
        "FIELD": "Field Work",
        "CLIENT_SITE": "Client Site Work"
    },
    risk_levels: {
        "LOW": { level: 1, description: "Low risk, standard protocols" },
        "MEDIUM": { level: 2, description: "Medium risk, enhanced monitoring" },
        "HIGH": { level: 3, description: "High risk, strict protocols" },
        "CRITICAL": { level: 4, description: "Critical risk, immediate action required" }
    }
};

Health Status Synchronization

Daily Health Check Integration

// Daily Health Check Synchronization
function syncDailyHealthCheck(employeeId, date = new Date()) {
    const employee = getEmployee(employeeId);
    const healthDeclaration = getHealthDeclaration(employee.health_id, date);

    if (!healthDeclaration) {
        // No health declaration found
        updateEmployeeHealthStatus(employeeId, {
            status: 'PENDING',
            date: date,
            office_access: false,
            message: 'Daily health declaration required'
        });

        // Send reminder notification
        sendHealthDeclarationReminder(employee);
        return;
    }

    // Process health declaration
    const healthStatus = processHealthDeclaration(healthDeclaration);

    // Update employee health status
    updateEmployeeHealthStatus(employeeId, {
        status: healthStatus.status,
        date: date,
        office_access: healthStatus.office_access,
        temperature: healthDeclaration.temperature,
        symptoms: healthDeclaration.symptoms,
        vaccination_status: healthDeclaration.vaccination_status,
        risk_level: healthStatus.risk_level,
        valid_until: addHours(date, 24)
    });

    // Validate existing timesheet entries
    validateTimesheetEntriesAgainstHealth(employeeId, date, healthStatus);

    return healthStatus;
}

// Health Declaration Processing
function processHealthDeclaration(declaration) {
    const healthStatus = {
        status: 'CLEARED',
        office_access: true,
        risk_level: 'LOW',
        restrictions: []
    };

    // Check temperature
    if (declaration.temperature > 37.5) {
        healthStatus.status = 'RESTRICTED';
        healthStatus.office_access = false;
        healthStatus.risk_level = 'HIGH';
        healthStatus.restrictions.push('Elevated temperature detected');
    }

    // Check symptoms
    const criticalSymptoms = ['fever', 'cough', 'difficulty_breathing', 'loss_of_taste_smell'];
    const reportedCriticalSymptoms = declaration.symptoms.filter(s => criticalSymptoms.includes(s));

    if (reportedCriticalSymptoms.length > 0) {
        healthStatus.status = 'RESTRICTED';
        healthStatus.office_access = false;
        healthStatus.risk_level = 'HIGH';
        healthStatus.restrictions.push(`Critical symptoms reported: ${reportedCriticalSymptoms.join(', ')}`);
    }

    // Check vaccination status
    if (!declaration.vaccination_status.fully_vaccinated && isVaccinationRequired()) {
        healthStatus.status = 'RESTRICTED';
        healthStatus.office_access = false;
        healthStatus.risk_level = 'MEDIUM';
        healthStatus.restrictions.push('Vaccination requirement not met');
    }

    // Check recent exposure
    if (declaration.recent_exposure) {
        healthStatus.status = 'QUARANTINE';
        healthStatus.office_access = false;
        healthStatus.risk_level = 'HIGH';
        healthStatus.restrictions.push('Recent COVID-19 exposure reported');
    }

    return healthStatus;
}

Attendance Validation

// Attendance Validation Against Health Status
function validateTimesheetEntriesAgainstHealth(employeeId, date, healthStatus) {
    const timeEntries = getEmployeeTimeEntriesForDate(employeeId, date);
    const violations = [];

    timeEntries.forEach(entry => {
        // Check if office work is allowed
        if (entry.work_location === 'OFFICE' && !healthStatus.office_access) {
            violations.push({
                entry_id: entry.id,
                violation_type: 'unauthorized_office_access',
                description: `Office work logged without health clearance`,
                severity: 'high',
                health_status: healthStatus.status
            });

            // Flag the time entry
            flagTimeEntry(entry.id, {
                flag_type: 'health_violation',
                description: 'Office attendance without health clearance',
                requires_review: true
            });
        }

        // Check client site work restrictions
        if (entry.work_location === 'CLIENT_SITE' && healthStatus.risk_level === 'HIGH') {
            violations.push({
                entry_id: entry.id,
                violation_type: 'high_risk_client_exposure',
                description: `Client site work with high health risk`,
                severity: 'medium',
                health_status: healthStatus.status
            });
        }
    });

    if (violations.length > 0) {
        // Notify managers and HR
        notifyHealthViolations(employeeId, violations);

        // Log compliance issue
        logComplianceIssue({
            employee_id: employeeId,
            date: date,
            violations: violations,
            health_status: healthStatus
        });
    }

    return violations;
}

// Office Capacity Management
function checkOfficeCapacityCompliance(date, location) {
    const officeCapacity = getOfficeCapacity(location);
    const plannedAttendance = getPlannedOfficeAttendance(date, location);
    const healthClearedEmployees = plannedAttendance.filter(emp => 
        emp.health_status === 'CLEARED' && emp.office_access === true
    );

    const capacityUtilization = (healthClearedEmployees.length / officeCapacity.max_capacity) * 100;

    if (capacityUtilization > officeCapacity.safe_capacity_percentage) {
        // Capacity exceeded, implement restrictions
        const excessCount = healthClearedEmployees.length - Math.floor(officeCapacity.max_capacity * officeCapacity.safe_capacity_percentage / 100);

        // Prioritize attendance based on business needs
        const prioritizedAttendance = prioritizeOfficeAttendance(healthClearedEmployees, excessCount);

        // Notify affected employees
        notifyCapacityRestrictions(prioritizedAttendance.restricted, date, location);

        return {
            status: 'capacity_exceeded',
            allowed_attendance: prioritizedAttendance.allowed,
            restricted_attendance: prioritizedAttendance.restricted,
            utilization_percentage: capacityUtilization
        };
    }

    return {
        status: 'within_capacity',
        allowed_attendance: healthClearedEmployees,
        utilization_percentage: capacityUtilization
    };
}

Contact Tracing Support

Contact Tracing Integration

// Contact Tracing Support
function initiateContactTracing(employeeId, exposureDate, exposureType = 'confirmed_case') {
    const employee = getEmployee(employeeId);
    const contactPeriod = {
        start: subtractDays(exposureDate, 14),
        end: addDays(exposureDate, 1)
    };

    // Find potential contacts based on timesheet data
    const potentialContacts = findPotentialContacts(employeeId, contactPeriod);

    // Categorize contacts by risk level
    const contactCategories = categorizePotentialContacts(potentialContacts, exposureDate);

    // Create contact tracing record
    const contactTracingRecord = {
        case_id: generateCaseId(),
        source_employee_id: employeeId,
        exposure_date: exposureDate,
        exposure_type: exposureType,
        contact_period: contactPeriod,
        potential_contacts: contactCategories,
        status: 'active',
        created_at: new Date()
    };

    // Save contact tracing record
    saveContactTracingRecord(contactTracingRecord);

    // Notify health authorities if required
    if (exposureType === 'confirmed_case') {
        notifyHealthAuthorities(contactTracingRecord);
    }

    // Implement contact protocols
    implementContactProtocols(contactCategories);

    return contactTracingRecord;
}

// Find Potential Contacts
function findPotentialContacts(employeeId, period) {
    const contacts = [];

    // Get timesheet entries for the period
    const timeEntries = getEmployeeTimeEntries(employeeId, period.start, period.end);

    timeEntries.forEach(entry => {
        if (entry.work_location === 'OFFICE' || entry.work_location === 'CLIENT_SITE') {
            // Find other employees at same location on same date
            const colocatedEmployees = getEmployeesAtLocation(
                entry.work_location,
                entry.date,
                entry.start_time,
                entry.end_time
            );

            colocatedEmployees.forEach(colocated => {
                if (colocated.employee_id !== employeeId) {
                    contacts.push({
                        contact_employee_id: colocated.employee_id,
                        contact_date: entry.date,
                        contact_location: entry.work_location,
                        contact_duration: calculateOverlapDuration(entry, colocated),
                        proximity_level: determineProximityLevel(entry, colocated)
                    });
                }
            });
        }

        // Check for meeting attendees
        if (entry.meeting_id) {
            const meetingAttendees = getMeetingAttendees(entry.meeting_id);
            meetingAttendees.forEach(attendee => {
                if (attendee.employee_id !== employeeId) {
                    contacts.push({
                        contact_employee_id: attendee.employee_id,
                        contact_date: entry.date,
                        contact_location: 'MEETING',
                        contact_duration: entry.hours * 60, // Convert to minutes
                        proximity_level: 'HIGH' // Meetings assume close proximity
                    });
                }
            });
        }
    });

    return contacts;
}

// Categorize Contacts by Risk Level
function categorizePotentialContacts(contacts, exposureDate) {
    const categories = {
        high_risk: [],
        medium_risk: [],
        low_risk: []
    };

    contacts.forEach(contact => {
        const daysSinceExposure = Math.abs(differenceInDays(contact.contact_date, exposureDate));
        let riskLevel = 'low_risk';

        // Risk assessment based on proximity, duration, and timing
        if (contact.proximity_level === 'HIGH' && contact.contact_duration >= 15) {
            if (daysSinceExposure <= 2) {
                riskLevel = 'high_risk';
            } else if (daysSinceExposure <= 7) {
                riskLevel = 'medium_risk';
            }
        } else if (contact.proximity_level === 'MEDIUM' && contact.contact_duration >= 60) {
            if (daysSinceExposure <= 5) {
                riskLevel = 'medium_risk';
            }
        }

        categories[riskLevel].push(contact);
    });

    return categories;
}

Health Analytics and Reporting

Health Compliance Analytics

// Health Compliance Analytics
function generateHealthComplianceReport(period, scope = 'all') {
    const employees = getEmployeesInScope(scope);
    const complianceData = [];

    employees.forEach(employee => {
        const healthRecords = getEmployeeHealthRecords(employee.id, period);
        const timesheetEntries = getEmployeeTimeEntries(employee.id, period);

        const compliance = {
            employee_id: employee.id,
            employee_name: employee.full_name,
            department: employee.department.name,
            total_work_days: getWorkDaysInPeriod(period),
            health_declarations_submitted: healthRecords.filter(r => r.declaration_submitted).length,
            office_attendance_days: timesheetEntries.filter(e => e.work_location === 'OFFICE').length,
            compliance_violations: getHealthViolations(employee.id, period).length,
            vaccination_status: getLatestVaccinationStatus(employee.id),
            risk_level: calculateEmployeeRiskLevel(employee.id, period)
        };

        compliance.compliance_rate = (compliance.health_declarations_submitted / compliance.total_work_days) * 100;
        compliance.violation_rate = (compliance.compliance_violations / compliance.total_work_days) * 100;

        complianceData.push(compliance);
    });

    const summary = {
        total_employees: complianceData.length,
        average_compliance_rate: complianceData.reduce((sum, emp) => sum + emp.compliance_rate, 0) / complianceData.length,
        total_violations: complianceData.reduce((sum, emp) => sum + emp.compliance_violations, 0),
        vaccination_coverage: (complianceData.filter(emp => emp.vaccination_status.fully_vaccinated).length / complianceData.length) * 100,
        high_risk_employees: complianceData.filter(emp => emp.risk_level === 'HIGH').length
    };

    return {
        period: period,
        summary: summary,
        employee_compliance: complianceData,
        generated_at: new Date()
    };
}

// Workplace Safety Metrics
function generateWorkplaceSafetyMetrics(period) {
    const metrics = {
        period: period,
        office_utilization: calculateOfficeUtilization(period),
        health_incidents: getHealthIncidents(period),
        contact_tracing_cases: getContactTracingCases(period),
        vaccination_trends: getVaccinationTrends(period),
        compliance_trends: getComplianceTrends(period)
    };

    metrics.safety_score = calculateWorkplaceSafetyScore(metrics);

    return metrics;
}

Integration Health and Monitoring

Health Declaration Integration Health Check

// Health Declaration Integration Health Monitoring
function performHealthDecIntegrationHealthCheck() {
    const healthStatus = {
        overall_status: 'healthy',
        components: {},
        last_check: new Date()
    };

    // Test API connectivity
    try {
        const apiTest = testHealthDecAPIConnection();
        healthStatus.components.api = {
            status: 'healthy',
            response_time: apiTest.response_time,
            last_sync: apiTest.last_sync
        };
    } catch (error) {
        healthStatus.components.api = {
            status: 'unhealthy',
            error: error.message
        };
        healthStatus.overall_status = 'degraded';
    }

    // Check health data synchronization
    const syncHealth = checkHealthDataSync();
    healthStatus.components.health_sync = syncHealth;

    // Check compliance monitoring
    const complianceHealth = checkComplianceMonitoring();
    healthStatus.components.compliance = complianceHealth;

    return healthStatus;
}

// Error Handling and Recovery
function handleHealthDecIntegrationError(error, context) {
    const errorLog = {
        timestamp: new Date(),
        error_type: error.type,
        message: error.message,
        context: context,
        severity: determineSeverity(error)
    };

    logHealthDecError(errorLog);

    switch (error.type) {
        case 'health_declaration_sync_failure':
            return retryHealthDeclarationSync(context);
        case 'compliance_validation_error':
            return revalidateCompliance(context);
        case 'contact_tracing_error':
            return escalateToHealthTeam(context, error);
        default:
            return escalateToSystemAdmin(errorLog);
    }
}

This comprehensive Health Declaration integration ensures workplace safety compliance, supports contact tracing efforts, and provides health analytics while maintaining employee privacy and regulatory compliance.