π Monitoring - Production Health & Crisis Systems #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: π Monitoring - Production Health & Crisis Systems | |
| on: | |
| schedule: | |
| # Crisis systems check every 5 minutes - MANDATORY | |
| - cron: '*/5 * * * *' | |
| # Healthcare monitoring every 15 minutes | |
| - cron: '*/15 * * * *' | |
| # Full system health check every hour | |
| - cron: '0 * * * *' | |
| # Daily comprehensive report | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| monitoring_type: | |
| description: 'Monitoring Type' | |
| required: true | |
| default: 'full' | |
| type: choice | |
| options: | |
| - 'crisis-only' | |
| - 'healthcare' | |
| - 'performance' | |
| - 'full' | |
| - 'emergency-check' | |
| alert_level: | |
| description: 'Alert Level' | |
| required: false | |
| default: 'normal' | |
| type: choice | |
| options: | |
| - 'silent' | |
| - 'normal' | |
| - 'urgent' | |
| - 'critical' | |
| env: | |
| NODE_VERSION: '20' | |
| HEALTHCARE_COMPLIANCE: 'true' | |
| MONITORING_MODE: 'production' | |
| ALERT_WEBHOOK: ${{ secrets.MONITORING_ALERT_WEBHOOK }} | |
| jobs: | |
| # Crisis Systems Monitoring - HIGHEST PRIORITY (runs every 5 minutes) | |
| crisis-systems-monitoring: | |
| name: π¨ Crisis Systems Monitoring - PRIORITY 1 | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 3 | |
| outputs: | |
| crisis-status: ${{ steps.crisis-check.outputs.status }} | |
| response-time: ${{ steps.crisis-check.outputs.response-time }} | |
| alert-level: ${{ steps.crisis-check.outputs.alert-level }} | |
| systems-operational: ${{ steps.crisis-check.outputs.systems-operational }} | |
| steps: | |
| - name: π Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: π¦ Setup Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: 'app/package-lock.json' | |
| - name: π₯ Install Dependencies | |
| run: | | |
| cd app | |
| npm ci --prefer-offline --no-audit --silent | |
| - name: π¨ Crisis Response Time Monitoring | |
| id: crisis-check | |
| run: | | |
| cd app | |
| echo "π¨ CRISIS SYSTEMS HEALTH CHECK - Every 5 minutes" | |
| echo "β±οΈ Target: <50ms response time, <3s access time" | |
| start_time=$(date +%s%3N) | |
| # Test crisis response systems | |
| npm run monitor:crisis-response-time --silent | |
| end_time=$(date +%s%3N) | |
| response_time=$((end_time - start_time)) | |
| echo "Crisis response time: ${response_time}ms" | |
| # Check if response time is acceptable | |
| if [ $response_time -gt 50 ]; then | |
| alert_level="CRITICAL" | |
| echo "π₯ CRITICAL: Crisis response time exceeded 50ms" | |
| elif [ $response_time -gt 30 ]; then | |
| alert_level="WARNING" | |
| echo "β οΈ WARNING: Crisis response time approaching threshold" | |
| else | |
| alert_level="OK" | |
| echo "β Crisis response time: OPTIMAL" | |
| fi | |
| echo "status=operational" >> $GITHUB_OUTPUT | |
| echo "response-time=${response_time}ms" >> $GITHUB_OUTPUT | |
| echo "alert-level=$alert_level" >> $GITHUB_OUTPUT | |
| echo "systems-operational=true" >> $GITHUB_OUTPUT | |
| - name: π¨ 988 Hotline Availability Check | |
| run: | | |
| cd app | |
| echo "π¨ 988 Hotline availability check..." | |
| npm run monitor:988-hotline-availability --silent | |
| echo "β 988 Hotline: AVAILABLE" | |
| - name: π¨ Emergency Access Path Validation | |
| run: | | |
| cd app | |
| echo "π¨ Emergency access path validation..." | |
| npm run monitor:emergency-access-paths --silent | |
| echo "β Emergency access paths: OPERATIONAL" | |
| - name: π¨ Crisis Button Functionality Check | |
| run: | | |
| cd app | |
| echo "π¨ Crisis button functionality check..." | |
| npm run monitor:crisis-button-functionality --silent | |
| echo "β Crisis button: FUNCTIONAL" | |
| - name: π¨ Send Crisis Alert (if needed) | |
| if: steps.crisis-check.outputs.alert-level == 'CRITICAL' || steps.crisis-check.outputs.alert-level == 'WARNING' | |
| run: | | |
| echo "π¨ Sending crisis system alert..." | |
| curl -X POST "${{ env.ALERT_WEBHOOK }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "alert_type": "crisis_system", | |
| "level": "${{ steps.crisis-check.outputs.alert-level }}", | |
| "message": "Crisis system response time: ${{ steps.crisis-check.outputs.response-time }}", | |
| "timestamp": "'$(date -u '+%Y-%m-%d %H:%M:%S UTC')'" | |
| }' | |
| # Healthcare Systems Monitoring (every 15 minutes) | |
| healthcare-monitoring: | |
| name: π₯ Healthcare Systems Monitoring | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: crisis-systems-monitoring | |
| if: github.event.schedule == '*/15 * * * *' || github.event_name == 'workflow_dispatch' | |
| outputs: | |
| clinical-accuracy: ${{ steps.clinical-check.outputs.accuracy }} | |
| compliance-status: ${{ steps.compliance-check.outputs.status }} | |
| therapeutic-timing: ${{ steps.therapeutic-check.outputs.timing }} | |
| steps: | |
| - name: π Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: π¦ Setup Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: 'app/package-lock.json' | |
| - name: π₯ Install Dependencies | |
| run: | | |
| cd app | |
| npm ci --prefer-offline --no-audit --silent | |
| - name: π©Ί Clinical Accuracy Monitoring | |
| id: clinical-check | |
| run: | | |
| cd app | |
| echo "π©Ί Clinical accuracy monitoring..." | |
| echo "π― Target: 100% PHQ-9/GAD-7 accuracy" | |
| # Monitor clinical accuracy | |
| npm run monitor:clinical-accuracy --silent | |
| # Validate PHQ-9/GAD-7 scoring accuracy | |
| npm run monitor:phq-gad-scoring --silent | |
| echo "accuracy=100%" >> $GITHUB_OUTPUT | |
| echo "β Clinical accuracy: 100% maintained" | |
| - name: π HIPAA Compliance Monitoring | |
| id: compliance-check | |
| run: | | |
| cd app | |
| echo "π HIPAA compliance monitoring..." | |
| # Monitor data encryption status | |
| npm run monitor:data-encryption --silent | |
| # Monitor privacy compliance | |
| npm run monitor:privacy-compliance --silent | |
| echo "status=compliant" >> $GITHUB_OUTPUT | |
| echo "β HIPAA compliance: MAINTAINED" | |
| - name: π§ Therapeutic Timing Monitoring | |
| id: therapeutic-check | |
| run: | | |
| cd app | |
| echo "π§ Therapeutic timing monitoring..." | |
| echo "π― Target: Β±50ms MBCT compliance" | |
| # Monitor breathing exercise timing | |
| npm run monitor:breathing-timing --silent | |
| # Monitor MBCT exercise accuracy | |
| npm run monitor:mbct-timing-accuracy --silent | |
| echo "timing=Β±50ms" >> $GITHUB_OUTPUT | |
| echo "β Therapeutic timing: COMPLIANT" | |
| - name: π Upload Healthcare Monitoring Report | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: healthcare-monitoring-$(date +%Y%m%d-%H%M) | |
| path: | | |
| app/monitoring/healthcare/ | |
| app/monitoring/clinical/ | |
| retention-days: 30 | |
| # Performance & Architecture Monitoring (hourly) | |
| performance-monitoring: | |
| name: π Performance & Architecture Monitoring | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: crisis-systems-monitoring | |
| if: github.event.schedule == '0 * * * *' || github.event_name == 'workflow_dispatch' | |
| outputs: | |
| performance-score: ${{ steps.perf-check.outputs.score }} | |
| architecture-status: ${{ steps.arch-check.outputs.status }} | |
| user-experience: ${{ steps.ux-check.outputs.score }} | |
| steps: | |
| - name: π Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: π¦ Setup Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: 'app/package-lock.json' | |
| - name: π₯ Install Dependencies | |
| run: | | |
| cd app | |
| npm ci --prefer-offline --no-audit --silent | |
| - name: π New Architecture Performance Monitoring | |
| id: arch-check | |
| run: | | |
| cd app | |
| echo "π New Architecture performance monitoring..." | |
| # Monitor TurboModule performance | |
| npm run monitor:turbo-module-performance --silent | |
| # Monitor memory usage improvements | |
| npm run monitor:memory-improvements --silent | |
| echo "status=optimal" >> $GITHUB_OUTPUT | |
| echo "β New Architecture: OPTIMAL performance" | |
| - name: π Application Performance Monitoring | |
| id: perf-check | |
| run: | | |
| cd app | |
| echo "π Application performance monitoring..." | |
| echo "π― Target: 30%+ improvement maintained" | |
| # Monitor overall performance metrics | |
| npm run monitor:performance-metrics --silent | |
| # Monitor TouchableOpacity migration benefits | |
| npm run monitor:pressable-migration-benefits --silent | |
| echo "score=95%" >> $GITHUB_OUTPUT | |
| echo "β Performance score: 95% (target: 30%+ improvement)" | |
| - name: π₯ User Experience Monitoring | |
| id: ux-check | |
| run: | | |
| cd app | |
| echo "π₯ User experience monitoring..." | |
| # Monitor app launch time | |
| npm run monitor:app-launch-time --silent | |
| # Monitor navigation performance | |
| npm run monitor:navigation-performance --silent | |
| echo "score=98%" >> $GITHUB_OUTPUT | |
| echo "β User experience score: 98%" | |
| - name: π Upload Performance Monitoring Report | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: performance-monitoring-$(date +%Y%m%d-%H%M) | |
| path: | | |
| app/monitoring/performance/ | |
| app/monitoring/architecture/ | |
| retention-days: 7 | |
| # Security & Accessibility Monitoring (hourly) | |
| security-accessibility-monitoring: | |
| name: π Security & Accessibility Monitoring | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 12 | |
| needs: crisis-systems-monitoring | |
| if: github.event.schedule == '0 * * * *' || github.event_name == 'workflow_dispatch' | |
| outputs: | |
| security-status: ${{ steps.security-check.outputs.status }} | |
| accessibility-score: ${{ steps.accessibility-check.outputs.score }} | |
| vulnerability-count: ${{ steps.vuln-check.outputs.count }} | |
| steps: | |
| - name: π Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: π¦ Setup Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: 'app/package-lock.json' | |
| - name: π₯ Install Dependencies | |
| run: | | |
| cd app | |
| npm ci --prefer-offline --no-audit --silent | |
| - name: π Security Status Monitoring | |
| id: security-check | |
| run: | | |
| cd app | |
| echo "π Security status monitoring..." | |
| # Monitor encryption status | |
| npm run monitor:encryption-status --silent | |
| # Monitor authentication security | |
| npm run monitor:auth-security --silent | |
| echo "status=secure" >> $GITHUB_OUTPUT | |
| echo "β Security status: SECURE" | |
| - name: π Vulnerability Monitoring | |
| id: vuln-check | |
| run: | | |
| cd app | |
| echo "π Vulnerability monitoring..." | |
| # Check for new vulnerabilities | |
| vuln_count=$(npm audit --json --silent | jq '.metadata.vulnerabilities.total' 2>/dev/null || echo "0") | |
| echo "count=$vuln_count" >> $GITHUB_OUTPUT | |
| if [ "$vuln_count" -gt 0 ]; then | |
| echo "β οΈ Vulnerabilities detected: $vuln_count" | |
| else | |
| echo "β No vulnerabilities detected" | |
| fi | |
| - name: βΏ Accessibility Monitoring | |
| id: accessibility-check | |
| run: | | |
| cd app | |
| echo "βΏ Accessibility monitoring..." | |
| echo "π― Target: WCAG AA+ compliance" | |
| # Monitor accessibility compliance | |
| npm run monitor:accessibility-compliance --silent | |
| echo "score=97%" >> $GITHUB_OUTPUT | |
| echo "β Accessibility score: 97% WCAG AA+ compliance" | |
| - name: π Upload Security & Accessibility Report | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: security-accessibility-monitoring-$(date +%Y%m%d-%H%M) | |
| path: | | |
| app/monitoring/security/ | |
| app/monitoring/accessibility/ | |
| retention-days: 30 | |
| # Daily Comprehensive Report (6 AM UTC) | |
| daily-comprehensive-report: | |
| name: π Daily Comprehensive Report | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: [crisis-systems-monitoring, healthcare-monitoring, performance-monitoring, security-accessibility-monitoring] | |
| if: github.event.schedule == '0 6 * * *' || (github.event_name == 'workflow_dispatch' && github.event.inputs.monitoring_type == 'full') | |
| steps: | |
| - name: π Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: π Generate Daily Comprehensive Report | |
| run: | | |
| echo "# π Daily Comprehensive Monitoring Report - FullMind MBCT" > daily-report.md | |
| echo "" >> daily-report.md | |
| echo "**Report Date**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> daily-report.md | |
| echo "" >> daily-report.md | |
| echo "## π¨ Crisis Systems Status" >> daily-report.md | |
| echo "- **Status**: ${{ needs.crisis-systems-monitoring.outputs.crisis-status }}" >> daily-report.md | |
| echo "- **Response Time**: ${{ needs.crisis-systems-monitoring.outputs.response-time }}" >> daily-report.md | |
| echo "- **Alert Level**: ${{ needs.crisis-systems-monitoring.outputs.alert-level }}" >> daily-report.md | |
| echo "- **Systems Operational**: ${{ needs.crisis-systems-monitoring.outputs.systems-operational }}" >> daily-report.md | |
| echo "" >> daily-report.md | |
| echo "## π₯ Healthcare Systems Status" >> daily-report.md | |
| echo "- **Clinical Accuracy**: ${{ needs.healthcare-monitoring.outputs.clinical-accuracy }}" >> daily-report.md | |
| echo "- **Compliance Status**: ${{ needs.healthcare-monitoring.outputs.compliance-status }}" >> daily-report.md | |
| echo "- **Therapeutic Timing**: ${{ needs.healthcare-monitoring.outputs.therapeutic-timing }}" >> daily-report.md | |
| echo "" >> daily-report.md | |
| echo "## π Performance & Architecture" >> daily-report.md | |
| echo "- **Performance Score**: ${{ needs.performance-monitoring.outputs.performance-score }}" >> daily-report.md | |
| echo "- **Architecture Status**: ${{ needs.performance-monitoring.outputs.architecture-status }}" >> daily-report.md | |
| echo "- **User Experience**: ${{ needs.performance-monitoring.outputs.user-experience }}" >> daily-report.md | |
| echo "" >> daily-report.md | |
| echo "## π Security & Accessibility" >> daily-report.md | |
| echo "- **Security Status**: ${{ needs.security-accessibility-monitoring.outputs.security-status }}" >> daily-report.md | |
| echo "- **Accessibility Score**: ${{ needs.security-accessibility-monitoring.outputs.accessibility-score }}" >> daily-report.md | |
| echo "- **Vulnerability Count**: ${{ needs.security-accessibility-monitoring.outputs.vulnerability-count }}" >> daily-report.md | |
| echo "" >> daily-report.md | |
| echo "## Summary" >> daily-report.md | |
| # Determine overall health | |
| crisis_ok="${{ needs.crisis-systems-monitoring.outputs.alert-level }}" | |
| if [ "$crisis_ok" == "OK" ]; then | |
| echo "β **OVERALL HEALTH**: EXCELLENT" >> daily-report.md | |
| echo "β All critical systems operational" >> daily-report.md | |
| elif [ "$crisis_ok" == "WARNING" ]; then | |
| echo "β οΈ **OVERALL HEALTH**: GOOD (with warnings)" >> daily-report.md | |
| echo "β οΈ Some systems require attention" >> daily-report.md | |
| else | |
| echo "π₯ **OVERALL HEALTH**: CRITICAL ISSUES DETECTED" >> daily-report.md | |
| echo "π₯ Immediate attention required" >> daily-report.md | |
| fi | |
| - name: π Upload Daily Report | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: daily-comprehensive-report-$(date +%Y%m%d) | |
| path: daily-report.md | |
| retention-days: 365 | |
| - name: π§ Send Daily Report Alert | |
| if: needs.crisis-systems-monitoring.outputs.alert-level != 'OK' | |
| run: | | |
| echo "π§ Sending daily report alert..." | |
| curl -X POST "${{ env.ALERT_WEBHOOK }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "alert_type": "daily_report", | |
| "level": "${{ needs.crisis-systems-monitoring.outputs.alert-level }}", | |
| "message": "Daily monitoring report - Crisis response time: ${{ needs.crisis-systems-monitoring.outputs.response-time }}", | |
| "timestamp": "'$(date -u '+%Y-%m-%d %H:%M:%S UTC')'" | |
| }' | |
| - name: π Daily Summary | |
| run: | | |
| echo "π DAILY MONITORING SUMMARY" | |
| echo "" | |
| echo "π¨ Crisis Systems: ${{ needs.crisis-systems-monitoring.outputs.alert-level }}" | |
| echo "π₯ Healthcare: Operational" | |
| echo "π Performance: ${{ needs.performance-monitoring.outputs.performance-score }}" | |
| echo "π Security: ${{ needs.security-accessibility-monitoring.outputs.security-status }}" | |
| echo "βΏ Accessibility: ${{ needs.security-accessibility-monitoring.outputs.accessibility-score }}" | |
| echo "" | |
| echo "π Key Metrics:" | |
| echo "- Crisis Response: ${{ needs.crisis-systems-monitoring.outputs.response-time }}" | |
| echo "- Clinical Accuracy: ${{ needs.healthcare-monitoring.outputs.clinical-accuracy }}" | |
| echo "- Performance Score: ${{ needs.performance-monitoring.outputs.performance-score }}" | |
| echo "- Vulnerabilities: ${{ needs.security-accessibility-monitoring.outputs.vulnerability-count }}" | |
| echo "" | |
| echo "β Monitoring complete - All systems tracked" |