摘要
Day 28 把 Day 27 的 SMART/OAuth sandbox token flow evidence 往之後所需的 live read/search evidence 推進:report 現在不只顯示 sandbox/metadataCapabilityStatement readiness 和 request-scoped token boundary evidence,也會顯示 synthetic/non-PHI workflow evidence 與 policy-only 的 sandbox live read/search execution evidence rows。
Day 27 可以回答:
這個 sandbox preflight 有沒有可檢查的 token boundary evidence?
但需要先回答更接近 exchange execution 的問題:
如果要做 allowlisted sandbox read/search evidence,前置條件和拒絕條件是否已經可稽核?
如果一個 quality gate 只知道 token endpoint 是否安全,卻沒有固定 live resource interaction policy,那下一步很容易直接變成不受控的 live executor。Day 28 的重點就是把 live read/search 拆成 policy evidence:
例如同一份 Bundle 進來時,Day 28 的判斷會是:
| 情境 | 結果 |
|---|---|
| validation 尚未執行 | live read/search execution evidence NOT_EVALUATED |
| 使用者未確認 synthetic/non-PHI | read/search policy rows NOT_EVALUATED,resource endpoint 不呼叫 |
| Bundle 含 Patient identifier / name / telecom / address / birthDate | non-PHI preflight FAILED,resource endpoint 不呼叫 |
| sandbox base URL 未 allowlist | read/search policy rows blocked,resource endpoint 不呼叫 |
sandbox auth mode 是 none |
read/search policy rows blocked,resource endpoint 不呼叫 |
| CapabilityStatement 未宣告 interaction | 對應 resource/operation policy blocked,resource endpoint 不呼叫 |
| OAuth token evidence 啟用但未通過 | read/search policy rows blocked,resource endpoint 不呼叫 |
| 所有前置條件通過 | read / search-type policy allowed,但 Day 28 仍不呼叫 endpoint |
create / update / delete / Bundle submit |
永遠 policy blocked |
這讓 report 可以明確說明:
Sandbox live read/search policy readiness 已能 request-scoped 產生。
但目前只展示 policy boundary evidence,不執行 live Patient / Observation / DiagnosticReport read/search。
Day 28 的 request / report flow 變成:
使用者上傳、貼上 Bundle,或選擇 built-in synthetic sandbox lab fixture
│
├─ 執行原本 JSON / FHIR / TW Core / contract rules
│
├─ terminology server evidence
│ ├─ ValueSet/$expand
│ └─ ValueSet/$validate-code
│
├─ live FHIR metadata evidence
│ └─ GET {FHIR_BASE_URL}/metadata
│
├─ sandbox readiness evidence
│ ├─ non-PHI workflow evidence
│ │ ├─ workflow id
│ │ ├─ fixture source
│ │ ├─ user confirmation
│ │ ├─ direct Patient identifier scan result
│ │ ├─ sensitive findings
│ │ └─ live-check eligibility reason
│ ├─ sandbox auth boundary
│ ├─ CapabilityStatement interaction declarations
│ ├─ SMART/OAuth sandbox token evidence
│ └─ sandbox live read/search execution evidence
│ ├─ resource type
│ ├─ operation
│ ├─ policy allowed
│ ├─ endpoint called = false
│ ├─ HTTP status = N/A
│ ├─ response retention policy
│ └─ evidence statement
│
├─ PHI masking / privacy evidence
│ ├─ masking policy version
│ ├─ masked field categories
│ ├─ masking check result
│ ├─ raw Bundle policy
│ └─ retention policy = request-scoped only / no persistent history
│
└─ AuditEvent / Provenance resource preview
├─ input SHA-256
├─ selected contract id/version
├─ gate outcome
├─ rule count
├─ terminology status
├─ metadata status
├─ sandbox status
├─ PHI masking status
└─ generation policy = generated request-scoped only; not persisted; not submitted
最後 Quality Test Report 的 evidence layer 變成:
Quality Gate blocking result
├─ FHIR / TW Core / contract local rules
├─ Terminology server evidence
├─ Live FHIR metadata evidence
├─ Sandbox readiness evidence
│ ├─ Non-PHI workflow evidence
│ ├─ CapabilityStatement interaction declarations
│ ├─ SMART/OAuth token flow evidence
│ └─ Live read/search execution policy evidence
├─ PHI masking / privacy evidence
└─ AuditEvent / Provenance resource preview evidence
├─ AuditEvent JSON preview
├─ Provenance JSON preview
└─ generation policy
Day 28 新增的是 synthetic/non-PHI workflow evidence,不是 production de-identification。
它會記錄:
目前支援的 fixture source 包含:
user_uploaded_bundle
builtin_sandbox_lab_fixture
UI 新增:
Use built-in synthetic sandbox lab fixture
但這個選項不會自動通過 live sandbox guard。使用者仍然必須勾選:
Confirm this Bundle is synthetic/non-PHI test data

這個 layer 的定位是:
report-visible synthetic/non-PHI workflow evidence
不是 production PHI de-identification / pseudonymization engine

Day 28 新增的是 policy-only execution evidence rows,不是 live execution。
它會記錄:
Day 28 支援的 future execution target 只包含:
Patient read
Patient search-type
Observation read
Observation search-type
DiagnosticReport read
DiagnosticReport search-type
Day 28 明確 blocked 的 operation 包含:
Patient create
Patient update
Patient delete
Observation create
Observation update
Observation delete
DiagnosticReport create
DiagnosticReport update
DiagnosticReport delete
Bundle submit
今天所有 execution rows 都維持:
status = NOT_EVALUATED
endpointCalled = false
httpStatus = N/A

之後才能實作 live resource execution client、read/search URL builder、response masking policy enforcement、operator intent confirmation、或 server response evidence extraction。
Day 28 不顯示、不保存、不提交 raw server response。
report 使用:
它不輸出:
Response retention policy 明確顯示:
request-scoped only; raw server response is not displayed, persisted, or submitted
這表示目前版本仍然不會把 uploaded Bundle、token value、client secret、terminology response、FHIR metadata response、sandbox response、AuditEvent、Provenance 或 PHI 寫進資料庫,也不會送出 Bundle。
SandboxLiveInteractionExecutionEvidence
NonPhiPreflightResult 新增:
workflowId
fixtureSource
directIdentifierScanResult
liveCheckEligibilityReason
NonPhiPreflightService 調整:
NOT_EVALUATED。SandboxFhirPreflightResult 新增:
liveInteractionExecutionEvidence
SandboxFhirPreflightService 調整:
read / search-type 只有在前置條件通過且 CapabilityStatement 宣告時才標示 policy allowed。create / update / delete / Bundle submit 永遠 blocked。endpointCalled 都是 false。ParseController 調整:
useSyntheticFixture request parameter。index.html 調整:
Use built-in synthetic sandbox lab fixture。Sandbox live read/search policy evidence。Sandbox live read/search execution evidence table。Day 28 沒有新增 endpoint 設定。
既有 sandbox endpoint 設定仍然控制 /metadata 和 OAuth token evidence:
qualitygate.fhir.sandbox.allowed-base-urls=
qualitygate.fhir.sandbox.allow-private-network=false
qualitygate.fhir.sandbox.auth-mode=none
qualitygate.fhir.sandbox.allowed-oauth-token-urls=
qualitygate.fhir.sandbox.oauth-token-url=
qualitygate.fhir.sandbox.oauth-token-request-enabled=false
qualitygate.fhir.sandbox.oauth-client-auth-mode=none
qualitygate.fhir.sandbox.oauth-client-id=
qualitygate.fhir.sandbox.oauth-client-secret=
qualitygate.fhir.sandbox.oauth-scopes=
Day 28 的預設狀態是:
Sandbox live read/search execution evidence = NOT_EVALUATED
HTTP Patient / Observation / DiagnosticReport endpoint = not called
HTTP search endpoint = not called
HTTP Bundle submit endpoint = not called
若要讓 Day 28 的 read/search policy rows 顯示 future execution policy allowed,至少需要:
none。今天新增 / 更新測試確認:
PASSED。NOT_EVALUATED。user_uploaded_bundle。name、identifier.value、telecom、address、birthDate 仍然會 block live checks。none 時,所有 execution rows 都 policy blocked,HTTP client 不被呼叫。read / search-type 時,對應 future policy row 可以 policy allowed,但 endpointCalled=false。create / update / delete / Bundle submit 永遠 policy blocked。/metadata preflight 仍然只呼叫 /metadata,不呼叫 Patient / Observation / DiagnosticReport endpoint。目前測試結果:
Tests run: 114, Failures: 0, Errors: 0, Skipped: 0

完成後,專案的定位變成:
pre-exchange quality gate
├─ FHIR / TW Core validation
├─ partner contract rules
├─ contract lifecycle / compatibility
├─ unit normalization evidence
├─ terminology server evidence
├─ metadata preflight
├─ sandbox readiness evidence
│ ├─ non-PHI workflow evidence
│ ├─ CapabilityStatement interaction declarations
│ ├─ SMART/OAuth token flow evidence
│ └─ live read/search policy readiness evidence
├─ formal PHI masking / privacy evidence
└─ request-scoped AuditEvent / Provenance preview
但它不是:
預計從 Day 28 的 policy-only live read/search evidence 往下做:
read evidence。search-type evidence。Repository:twcore-data-quality-gate