📌 專案摘要與合規定位 📌 Executive Summary & Compliance Positioning
本儲存庫為一項企業管治示範專案,展示如何以輕量級 Streamlit 介面、動態 Secrets 隔離、JSON Schema 資料校驗與確定性「治理即代碼」(Governance-as-Code)構建新員工入職培訓考核與滿意度調研閉環。
This repository is an Enterprise Demo demonstrating a Zero-Data-Retention new-hire onboarding assessment, engagement survey, and controlled archiving workflow built with Streamlit, isolated Cloud Secrets, JSON Schemas, and deterministic Governance-as-Code.
EnterpriseDemo-OnboardingQuiz 依據國際管理體系(ISO 9001 / ISO 45001 / ISO/IEC 27001)設計,在不架設雲端資料庫、零個人資料持久化(Zero-Data-Retention)的前提下,整合「第一部分:20 分制規章考核(支援單選、多選與群組配對)」、「第二部分:培訓評估、運動與義工興趣及開放式意見調查」與「第三部分:記憶體動態合成受控繁體中文 PDF 報告(DEMO-HR-REC-2026-V1)並透過 TLS SMTP 一鍵直送 HR」。
EnterpriseDemo-OnboardingQuiz aligns with international standards (ISO 9001 / ISO 45001 / ISO/IEC 27001). Without provisioning any external database, employee data remains strictly in volatile memory across three guided stages: Part I (20-point single, multiple, and group-matching policy quiz), Part II (training evaluation, sports/volunteering engagement, and open-ended feedback), and Part III (in-memory synthesis of controlled PDF DEMO-HR-REC-2026-V1 with one-click TLS SMTP delivery to HR).
本系統完全採用確定性規則比對邏輯(Deterministic Rule-Based Logic),不含任何 AI / 機器學習模型或自動化人事決策演算法,明確排除於《歐盟人工智能法案》(EU AI Act)及 ISO/IEC 42001 強制範圍之外,並全面對齊香港《個人資料(私隱)條例》(第 486 章)保障資料原則(DPP 1–4)。
The system relies exclusively on deterministic exact-match logic (Non-AI) with zero machine learning or employment profiling—explicitly scoping out EU AI Act and ISO/IEC 42001 mandates while adhering to Hong Kong PDPO (Cap. 486) Data Protection Principles (DPP 1–4).
🏛️ 流程生命週期與治理閉環 🏛️ End-to-End Onboarding Lifecycle & Governance Closure
支援專屬連結 ?key=... 直入或通行碼核對,完全杜絕原始碼硬編碼明文密碼。Supports direct URL key (?key=...) or manual passcode verified solely against Cloud Secrets.
涵蓋單選、多選與群組配對題型,強制勾選誠信聲明,達 ≥15 分(75%)判定合格。Supports single, multiple, and group-matching items with mandatory consent and 15/20 (75%) pass gate.
即時顯示成績,引導填寫三組評估、運動/義工愛好及開放式文化建議。Displays instant score and collects training ratings, sports/volunteering preferences, and culture feedback.
嵌入 HKT (UTC+8) 時間戳、DEMO-HR-REC-2026-V1 編號與聲明,零磁碟落盤。Embeds HKT (UTC+8) timestamp, DEMO-HR-REC-2026-V1 ID, and notice strictly in RAM.
經 TLS SMTP 直寄 HR 並附防重複鎖;低於 75% 由 Flow2 自動觸發 7 天補考任務。Dispatches via TLS SMTP with dedup lock; scores below 75% trigger Flow2 7-day retraining follow-up.
🧪 互動式三部曲系統模擬器(1:1 還原 Streamlit 流程) 🧪 Interactive 3-Step App Simulator (1:1 Streamlit Workflow Replica)
以下完整重現 app.py 的三階段互動操作:包含 16 個組別、單選+多選+群組配對(滿分 20 分,15 分合格)、完整三節滿意度與興趣問卷、即時 DEMO-HR-REC-2026-V1 受控報告渲染及模擬 TLS SMTP 一鍵送出。
Experience the exact 3-step workflow of app.py: all 16 departments, single + multiple + group-matching questions (20 pts max, ≥15 pts pass), full 3-section survey, live DEMO-HR-REC-2026-V1 controlled report rendering, and simulated one-click TLS SMTP dispatch.
📋 業務治理與權限隔離矩陣 📋 Governance & Control Isolation Matrix
| 階段Stage | 責任角色Role | 承載技術Technology Stack | 處置動作與合規控制機制Action & Governance Control |
|---|---|---|---|
| 一、門禁核對1. Access Control | 新入職員工New Hire | Streamlit Secrets Gate | 以純後端 ACCESS_CODE 比對放行,杜絕開源代碼外洩通行密碼風險。Authenticates strictly via backend ACCESS_CODE with zero hardcoded fallback credentials. |
| 二、入職知識考核2. Policy Assessment | 新入職員工New Hire | 隔離題庫與確定性計分Isolated Bank & Scoring | 支援單選、多選與群組配對題型並強制勾選誠信聲明,即時判定 ≥75%(15/20 分)合格狀態,滿足 ISO 9001 Clause 7.2。Evaluates single, multiple, and group-matching items with mandatory consent and 75% (15/20) pass rule per ISO 9001 Clause 7.2. |
| 三、滿意度與 ESG 調研3. Engagement Survey | 新入職員工New Hire | Streamlit Form + Schema | 採樣培訓評價、運動及公益活動意願與 5 項開放建議,結構對應 onboarding_assessment_schema.json,支援 ISO 45001 與 ESG 指標。Captures training ratings, sports/volunteering interests, and 5 open suggestions validated against onboarding_assessment_schema.json. |
| 四、受控 PDF 存證4. PDF Synthesis | 無狀態引擎Stateless Engine | FPDF2 (Noto Sans TC) | 於記憶體即時生成 DEMO-HR-REC-2026-V1 受控報告,經 clean_text() 消毒並嵌入 HKT 時間戳與聲明,完畢即釋放暫存。Renders DEMO-HR-REC-2026-V1 vector PDF in RAM with clean_text() sanitization, HKT timestamp, and PDPO notice. |
| 五、加密送達與稽核5. Dispatch & Audit | 人力資源組 (HRD)HR Compliance Team | SMTP STARTTLS + Flows | 經 Port 587 TLS 直送 HR 郵箱(Flow1),依 Flow2 分流存入受控人事檔案庫或標記 7 個工作天內補考追蹤,另附本地下載與 WhatsApp 備用通知。Delivers over Port 587 TLS to HR (Flow1), routing via Flow2 to restricted IMS archive or 7-day retraining follow-up, plus local backup & WhatsApp fallback. |
⚙️ 技術亮點與合規工程實踐 ⚙️ Technical & Compliance Engineering Highlights
1. 零資料留存架構Zero-Data-Retention
無外置資料庫或雲端檔案桶,個人資料與問卷僅於記憶體暫存用於單次 PDF 渲染,發送完畢立即釋放,從根源杜絕外洩。No external DB or cloud bucket; PII and survey responses reside strictly in session RAM for one-time PDF rendering before purge.
2. 動態 Secrets 機密隔離Dynamic Secrets Isolation
題庫答案、門禁通行碼與 SMTP 憑證均嚴格封裝於雲端環境變數,公開倉庫 100% 零機密硬編碼,支援熱更新試題。Quiz answer keys, access tokens, and SMTP credentials live solely in Cloud Secrets—zero hardcoded secrets with hot-swappable banks.
3. JSON Schema 驗證與消毒JSON Schema & Sanitization
以標準 Draft-07 Schema 定義欄位型別與長度上限,並過濾換行及 \/*?:"<>| 危險字元,防範注入與路徑穿越。Enforces Draft-07 Schema type/length limits and sanitizes control/path characters to block injection and path traversal attacks.
4. 香港時區標準化存證HKT Timezone Normalization
底層統一鎖定 UTC+8 香港標準時間(HKT)蓋印 PDF 報告與審計紀錄,滿足 ISO 9001 及本地人力資源合規稽核要求。Standardizes all PDF timestamps to Hong Kong Time (UTC+8 HKT) to guarantee consistent IMS and local HR audit traceability.
5. 確定性非 AI 治理邊界Non-AI Regulatory Scope-Out
刻意採用透明確定性規則評分,不含任何 AI/ML 模型或員工剖析演算法,主動排除 EU AI Act 及 ISO/IEC 42001 監管負擔。Deliberately utilizes transparent deterministic scoring with zero AI/ML profiling, cleanly scoping out EU AI Act and ISO 42001.
6. 雙階段自動化工作流藍圖Dual-Stage Workflow Blueprints
配套 Flow1(TLS SMTP 加密直寄)與 Flow2(受控人事庫歸檔及不合格 7 天補考分流),建構端對端無紙化閉環。Pairs Flow1 (TLS SMTP dispatch) with Flow2 (restricted HR IMS archiving and 7-day fail retraining trigger) for full closure.