Expand CCS patient history

This commit is contained in:
hz
2026-08-09 23:59:28 -05:00
parent d349998d12
commit 33b55753cb
8 changed files with 306 additions and 75 deletions
+32 -15
View File
@@ -65,19 +65,15 @@ func _run() -> void:
_assert(screen.current_view == "case_selection", "CCS Cases 2 should begin with compatible case selection")
_assert(screen.case_list.get_child_count() == 1, "legacy cases should be excluded from graphical selection")
var retired_attempt := {
"caseExternalId": "ccs-gastro-duodenal-ulcer-office-001"
"caseExternalId": "ccs-gastro-duodenal-ulcer-office-001",
"graphicalPresentation": {"interviewRevision": 1}
}
_assert(screen._is_retired_interview_revision(retired_attempt, {
"id": "fatigue_course", "patientText": "My stomach bothers me.", "choices": []
}), "the retired stomach response should trigger a current-revision restart")
_assert(screen._is_retired_interview_revision(retired_attempt, {
"id": "chief_concern", "patientText": "Dizzy.",
"choices": [{"id": "abdominal_symptoms", "text": "Ask about stomach pain"}]
}), "retired stomach-topic choices should trigger a current-revision restart")
_assert(not screen._is_retired_interview_revision(retired_attempt, {
"id": "chief_concern", "patientText": "Dizzy and tired.",
"choices": [{"id": "dizziness_character", "text": "Ask about dizziness"}]
}), "the focused dizziness and fatigue revision should remain active")
"id": "fatigue_course", "patientText": "I feel tired.", "choices": []
}), "an older authored interview revision should trigger a restart")
retired_attempt.graphicalPresentation.interviewRevision = 2
_assert(not screen._is_retired_interview_revision(retired_attempt, {}),
"the current authored interview revision should remain active")
service.attempt = _sample_attempt(false)
screen._render_state()
@@ -93,21 +89,41 @@ func _run() -> void:
_assert(screen.active_scene.computer_overlay.get_node("Screen").texture.resource_path.ends_with("computer-base.png"), "the overlay should render the supplied computer base")
_assert(screen.active_scene.computer_overlay.get_node("Screen").stretch_mode == TextureRect.STRETCH_SCALE, "the computer should fill the viewport without side bars")
_assert(screen.active_scene.vitals_launcher.visible, "the computer desktop should expose a Vitals app")
_assert(screen.active_scene.medical_history_launcher.visible, "the computer desktop should expose a Medical History app")
screen.active_scene.vitals_launcher.pressed.emit()
_assert(screen.active_scene.is_vitals_open(), "the Vitals app should open a nurse vital-sign window")
_assert(screen.active_scene.vitals_header.get_node("Title").text == "Vitals", "the vital window should use the concise Vitals heading")
_assert(_vital_values(screen.active_scene) == ["36.8 C (98.2 F)", "76/min", "14/min", "122 mm Hg", "76 mm Hg", "99% on room air"], "the Vitals app should render the active attempt data in clinical order")
_assert(_vital_values_fit(screen.active_scene), "vital values should retain a readable column without character-by-character wrapping")
screen.active_scene.medical_history_launcher.pressed.emit()
_assert(screen.active_scene.is_vitals_open() and screen.active_scene.is_medical_history_open(), "both chart windows should be able to remain open")
_assert(screen.active_scene.medical_history_text.text == "Hyperlipidemia", "Medical History should render the case-authored past medical history")
_assert(screen.active_scene.medical_history_window.z_index > screen.active_scene.vitals_window.z_index, "the most recently opened chart window should come to the front")
var original_history_position: Vector2 = screen.active_scene.medical_history_window.position
screen.active_scene._set_medical_history_window_position(Vector2(90.0, 70.0))
var moved_history_position: Vector2 = screen.active_scene.medical_history_window.position
_assert(not moved_history_position.is_equal_approx(original_history_position) \
and moved_history_position.x >= 0.0 and moved_history_position.y >= 0.0,
"Medical History should use the shared draggable-window behavior")
_assert(screen.close_transient_overlay(), "the first Escape should close the topmost Medical History app")
_assert(not screen.active_scene.is_medical_history_open() and screen.active_scene.is_vitals_open(), "closing Medical History should leave Vitals open")
screen.active_scene._set_vitals_window_position(Vector2(75.0, 55.0))
_assert(screen.active_scene.vitals_window.position.is_equal_approx(Vector2(75.0, 55.0)), "the Vitals window should support repositioning by its header")
screen.active_scene._set_vitals_window_position(Vector2(-500.0, 5000.0))
var max_vitals_position: Vector2 = screen.active_scene.size - screen.active_scene.vitals_window.size
_assert(screen.active_scene.vitals_window.position.is_equal_approx(Vector2(0.0, max_vitals_position.y)), "dragging should keep the Vitals window inside the computer viewport")
_assert(screen.close_transient_overlay(), "the first Escape should close the Vitals app")
_assert(screen.close_transient_overlay(), "the second Escape should close the Vitals app")
_assert(not screen.active_scene.is_vitals_open() and screen.active_scene.is_computer_open(), "closing Vitals should return to the computer desktop")
_assert(screen.close_transient_overlay(), "the second Escape should close the computer")
_assert(screen.close_transient_overlay(), "the third Escape should close the computer")
_assert(not screen.active_scene.is_computer_open(), "closing the transient overlay should restore the doctor office")
_assert(not screen.close_transient_overlay(), "the third Escape should be available to open the pause menu")
_assert(not screen.close_transient_overlay(), "the fourth Escape should be available to open the pause menu")
screen.active_scene.open_computer()
screen.active_scene.open_vitals()
screen.active_scene.open_medical_history()
screen.active_scene.computer_close_button.pressed.emit()
_assert(not screen.active_scene.is_computer_open() and not screen.active_scene.is_vitals_open() \
and not screen.active_scene.is_medical_history_open(),
"the computer close button should close every child chart window")
_assert(is_equal_approx(screen.DESIGN_SIZE.x / screen.DESIGN_SIZE.y, 16.0 / 9.0), "the graphical CCS stage should use a true 16:9 design canvas")
_assert(screen.stage_root.size.is_equal_approx(screen.size), "the graphical stage should fill the available viewport")
_assert(screen.stage_root.position.is_equal_approx(Vector2.ZERO), "the graphical stage should not introduce letterbox margins")
@@ -245,7 +261,8 @@ func _sample_attempt(completed: bool) -> Dictionary:
return {
"id": "attempt-1", "state": "active", "revision": 1,
"simulatedStartUtc": "2026-08-05T09:00:00Z", "simulatedMinute": 0,
"graphicalPresentation": {"sceneKey": "doctor_office", "patientAssetKey": "patient_44_white_male"},
"graphicalPresentation": {"sceneKey": "doctor_office", "patientAssetKey": "patient_44_white_male", "interviewRevision": 2},
"medicalHistory": "Hyperlipidemia",
"vitals": {
"temperature": "36.8 C (98.2 F)", "bloodPressure": "122/76 mm Hg",
"pulse": "76/min", "respirations": "14/min", "oxygenSaturation": "99% on room air"