feature: Simulator Scenarios + Clinical Validation: SOFA/GCS

This commit is contained in:
voltsrage
2026-06-21 04:55:39 +08:00
parent bf46e6554a
commit 3638dd0669
39 changed files with 1619 additions and 213 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
echo "=== Phase 28 verification ==="
echo "1. Dashboard unit tests"
cd "${ROOT_DIR}/vigilcare-dashboard"
npm test
echo "2. Manual UI checks (requires running stack + dashboard dev server)"
BASE_URL="${BASE_URL:-http://localhost:5270}"
DASH_URL="${DASH_URL:-http://localhost:5173}"
ENCOUNTER_ID="${ENCOUNTER_ID:?Set ENCOUNTER_ID to an active encounter UUID}"
post_gcs() {
local eye="$1" verbal="$2" motor="$3"
curl -sf -X POST "${BASE_URL}/api/v1/encounters/${ENCOUNTER_ID}/observations" \
-H "Content-Type: application/json" \
-d "{\"observations\":[
{\"observationCode\":\"GCS_EYE\",\"value\":${eye},\"unit\":\"score\",\"source\":\"Manual\",\"recordedAt\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"},
{\"observationCode\":\"GCS_VERBAL\",\"value\":${verbal},\"unit\":\"score\",\"source\":\"Manual\",\"recordedAt\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"},
{\"observationCode\":\"GCS_MOTOR\",\"value\":${motor},\"unit\":\"score\",\"source\":\"Manual\",\"recordedAt\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}
]}"
}
post_gcs 3 4 5
curl -sf "${BASE_URL}/api/v1/encounters/${ENCOUNTER_ID}/gcs" | jq -e '.data.totalScore == 12'
curl -sf "${BASE_URL}/api/v1/encounters/${ENCOUNTER_ID}/sofa" || echo "(SOFA 404 OK if labs not yet ingested)"
echo "Open ${DASH_URL}/encounters/${ENCOUNTER_ID} and verify:"
echo " - ScoresPanel: NEWS2, GCS, SOFA, qSOFA Screen sections"
echo " - GCS form: E=3 V=4 M=5 → total 12 Moderate"
echo " - SofaScorePanel: 6-organ grid or Labs pending"
echo " - SepsisBundlePanel: SOFA trigger label or qSOFA screen message"
echo " - Alert Center: new alert type labels; no SIRS except legacy"
echo "Phase 28 verification complete."
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
SIM_DIR="${ROOT_DIR}/VigilCare.Simulator"
BASE_URL="${BASE_URL:-http://localhost:5270}"
echo "=== Phase 29 — Clinical Refactor Validation ==="
echo "1. Validate all scenario JSON files"
for scenario in "${SIM_DIR}"/Scenarios/List/*.json; do
dotnet run --project "${SIM_DIR}" -- validate "${scenario}"
done
echo "2. Integration tests"
dotnet test "${ROOT_DIR}/VigilCareClinicalAPI.Tests" \
--filter "FullyQualifiedName~ClinicalRefactorEndToEnd" \
--no-restore
echo "3. Replay new scenarios (requires running API at ${BASE_URL})"
cd "${SIM_DIR}"
dotnet run -- replay Scenarios/List/sepsis-sofa-progression-01.json --speed 0 --poll --base-url "${BASE_URL}"
dotnet run -- replay Scenarios/List/neurological-decline-gcs-01.json --speed 0 --poll --base-url "${BASE_URL}"
dotnet run -- replay Scenarios/List/sofa-partial-spo2-fallback-01.json --speed 0 --poll --base-url "${BASE_URL}"
echo "4. Replay-all backward compat"
dotnet run -- replay-all Scenarios/List --speed 0 --base-url "${BASE_URL}"
echo "5. Dashboard tests (Phase 28 UI)"
cd "${ROOT_DIR}/vigilcare-dashboard"
npm test
echo "Phase 29 verification complete."
echo "Manual: open patient detail after sepsis-sofa-progression replay — verify GCS/SOFA panels and SOFA-triggered bundle."