feat(telemetry): Phase B/C/D · ClinicalEventBus + emit (cloud-mvp 6856a7b 이식)
Phase D · telemetry/ClinicalEvent + ClinicalEventBus 신규 (demo-final path): - sealed 계층 · schemaVersion · severity · isTransition · anonymized sessionId - MutableSharedFlow (replay=0, buffer=64, DROP_OLDEST · fire-and-forget) - PhiRedactor 없음 (demo-final) · TelemetryHash.sessionId (inline SHA-256) 사용 Phase A → BvEvent emit (AppState.updateLevelFromMeasurement): - 매 측정마다 emit · urgency 전이 시 isTransition=true - bvMethod 이름 · anonymized sessionId Phase B/C → PostureEvent/GaitEvent emit (PiezoMonitoringView): - composite posture 전이 시 PostureEvent (매 사이클 X · 트래픽 절약) - walkingTransitioned 시 GaitEvent (severity=WARN on WALKING 진입) - prevCompositePosture 상태 신규 추적 기존 SyncEvents/PostureEventLogger 와 병렬 · 서로 독립. Refs: GUARDIAN-01 §3-2 이벤트 스키마 · §5 Phase A~D Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -241,9 +241,34 @@ class AppState(private val context: Context) {
|
||||
}
|
||||
|
||||
val newUrgency = bladderLevel.urgency
|
||||
if (newUrgency != previousUrgency) {
|
||||
val urgencyChanged = newUrgency != previousUrgency
|
||||
if (urgencyChanged) {
|
||||
notificationService.sendUrgencyNotification(newUrgency, volumeMl.toInt())
|
||||
}
|
||||
|
||||
// Phase D (GUARDIAN-01 · 2026-08-03) — ClinicalEventBus emit.
|
||||
runCatching {
|
||||
com.medithings.vesiscan.telemetry.ClinicalEventBus.emit(
|
||||
com.medithings.vesiscan.telemetry.BvEvent(
|
||||
ts = System.currentTimeMillis(),
|
||||
sessionId = com.medithings.vesiscan.telemetry.TelemetryHash.sessionId(
|
||||
bleManager.connectedDeviceName.value.ifEmpty { "unknown" }
|
||||
),
|
||||
severity = when (newUrgency) {
|
||||
com.medithings.vesiscan.models.UrgencyLevel.URGENT ->
|
||||
com.medithings.vesiscan.telemetry.Severity.CRITICAL
|
||||
com.medithings.vesiscan.models.UrgencyLevel.WARNING ->
|
||||
com.medithings.vesiscan.telemetry.Severity.WARN
|
||||
else -> com.medithings.vesiscan.telemetry.Severity.INFO
|
||||
},
|
||||
volumeMl = volumeMl.toInt(),
|
||||
urgency = newUrgency,
|
||||
bvMethod = com.medithings.vesiscan.managers.GreenZoneConstants.bvMethod.name,
|
||||
isTransition = urgencyChanged,
|
||||
prevUrgency = previousUrgency.takeIf { urgencyChanged },
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun resetLevel() {
|
||||
|
||||
Reference in New Issue
Block a user