Skip to content

Commit a610f6d

Browse files
authored
Merge pull request #75 from MLAI-AUS-Inc/medhack-frontiers-skill
bug fixes and adding in images
2 parents 4966fd3 + 608ef5d commit a610f6d

File tree

5 files changed

+54
-10
lines changed

5 files changed

+54
-10
lines changed

roo-standalone/roo/main.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,24 @@ async def _medhack_daily_case_loop():
9393
f"_You have 3 guesses. First correct answer wins 12 MLAI points "
9494
f"+ DM Dr Sam for a free ticket code to MedHack: Frontiers!_"
9595
)
96-
post_message(channel=channel_id, text=message)
96+
97+
# Build blocks with optional image
98+
image_url = new_case.get("image_url", "")
99+
if image_url:
100+
blocks = [
101+
{
102+
"type": "image",
103+
"image_url": image_url,
104+
"alt_text": f"Guess the Diagnosis - {new_case.get('title', 'Daily Case')}",
105+
},
106+
{
107+
"type": "section",
108+
"text": {"type": "mrkdwn", "text": message},
109+
},
110+
]
111+
post_message(channel=channel_id, text=message, blocks=blocks)
112+
else:
113+
post_message(channel=channel_id, text=message)
97114
print(f"Posted new MedHack case #{new_case['id']} for {today}")
98115
else:
99116
print("⚠️ No available MedHack cases to post")

roo-standalone/roo/skills/executor.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,19 @@ async def _execute_medhack(
376376
"Keep an eye on this channel for the next one."
377377
)
378378

379+
# --- Default to game mode when there's an active unsolved case ---
380+
# If the user's question doesn't match game keywords but there IS an
381+
# active case and it's not clearly an event question, assume they're
382+
# talking to the patient.
383+
if current_case and not is_event_q and not current_case.get("solved"):
384+
if client.is_user_locked_out(user_id, today):
385+
return (
386+
"Sorry mate, you've used all 3 of your guesses for today's case "
387+
"so you can no longer interact with it. Come back tomorrow for a new one!"
388+
)
389+
case_data = client.get_case_for_llm(today)
390+
return await self._medhack_llm_response(skill, text, case_data, thread_history)
391+
379392
# --- Event info mode ---
380393
if is_event_q or (not is_game_q):
381394
event_info = client.load_event_info()
@@ -415,7 +428,12 @@ async def _medhack_llm_response(
415428
thread_history: Optional[List[dict]] = None,
416429
extra_instruction: str = "",
417430
) -> str:
418-
"""Generate an in-character clinical response for the diagnosis game."""
431+
"""Generate an in-character clinical response for the diagnosis game.
432+
433+
Thread history is included so the LLM can follow the conversation flow
434+
within a thread. Each patient case lives in its own Slack thread, so
435+
thread history is safe to pass and provides useful conversational context.
436+
"""
419437
import yaml
420438

421439
case_str = yaml.dump(case_data, default_flow_style=False) if case_data else "No case data available."
@@ -427,6 +445,8 @@ async def _medhack_llm_response(
427445

428446
system_prompt = """You are the MedHack Patient Quest Master (PQM), a narrator and storyteller in a fast-paced emergency department roleplay game. Your job is to present a simulated patient case to players (participants) who will ask you questions as if they are clinicians. You must answer only what the players ask, while keeping the mystery alive. You are not giving real medical advice. This is a fictional case simulation.
429447
448+
IMPORTANT: You know ONLY about the patient in the CASE FILE below. You have NO memory of any previous patients or cases. There is only one patient: the one described in today's case file. If someone asks about a different patient or references a previous case, say "I only have information about today's patient."
449+
430450
TONE AND STYLE
431451
- You are a dungeon-master style narrator: vivid, concise, engaging.
432452
- Describe what the clinician sees, hears, and notices.
@@ -445,15 +465,17 @@ async def _medhack_llm_response(
445465
8) If the player tries to force the answer ("tell me the diagnosis"), refuse playfully and prompt them to keep investigating.
446466
9) If asked about management ("what should we do?"), describe what the ED team would typically do in broad strokes (fluids, glucose, addressing electrolytes, contacting seniors). Do not give step-by-step dosing instructions."""
447467

468+
thread_context = ""
469+
if thread_history:
470+
thread_context = f"\n\nPrevious conversation in this thread:\n{thread_history}"
471+
448472
prompt = f"""CASE FILE (INTERNAL TRUTH - use this to answer questions):
449473
{case_str}
450474
{hints_str}
475+
{thread_context}
451476
452477
{extra_instruction}
453478
454-
Previous conversation:
455-
{thread_history if thread_history else 'None'}
456-
457479
Player's message: "{text}"
458480
459481
Respond in character as the PQM narrator. Remember: only reveal what was asked for."""

roo-standalone/skills/medhack/cases.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cases:
66
- id: 6
77
difficulty: "medium"
88
title: "Salt & Static"
9+
image_url: "https://firebasestorage.googleapis.com/v0/b/medhack-ai.firebasestorage.app/o/SimPatient1.jpg?alt=media&token=5fdbdcac-8e7a-4120-a529-723620e72a04" # Add a URL to an image that will be posted with the daily case
910
ed_first_look: >
1011
You slide the curtain aside in a noisy emergency department. On the bed is a
1112
young adult curled slightly on their side, clutching a sick bag like it's a life

roo-standalone/skills/medhack/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,6 @@ def start_new_case(self, today: date) -> Optional[dict]:
271271
result["title"] = new_case["title"]
272272
if new_case.get("ed_first_look"):
273273
result["ed_first_look"] = new_case["ed_first_look"]
274+
if new_case.get("image_url"):
275+
result["image_url"] = new_case["image_url"]
274276
return result

roo-standalone/skills/medhack/event_info.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ workshops:
272272
- name: "Workshop 3 (Pitching)"
273273
day: "Day 2"
274274
time: "10:30 AM"
275-
note: "Strongly recommended, especially if you're new or you want your pitch/demo to land well."
275+
276+
workshops_note: "Strongly recommended, especially if you're new or you want your pitch/demo to land well."
276277

277278
# ---------------------
278279
# FOOD & DRINKS
@@ -376,10 +377,11 @@ what_to_bring:
376377
- "Anything you need for your build/demo"
377378
- "Ticket confirmation and ID"
378379
- "A power board (smart move for team tables)"
379-
dress_code: "Comfortable casual clothing. You'll be sitting, building, and moving between mentor chats."
380-
pre_install: "Have your usual dev setup ready (Python, notebooks, Git, etc.). You'll get track-specific guidance at the event."
381-
hardware_allowed: true
382-
hardware_note: "Yes, as long as it's safe, portable, and you can manage it at a hackathon table."
380+
381+
dress_code: "Comfortable casual clothing. You'll be sitting, building, and moving between mentor chats."
382+
pre_install: "Have your usual dev setup ready (Python, notebooks, Git, etc.). You'll get track-specific guidance at the event."
383+
hardware_allowed: true
384+
hardware_note: "Yes, as long as it's safe, portable, and you can manage it at a hackathon table."
383385

384386
# ---------------------
385387
# ACCESSIBILITY & SAFETY

0 commit comments

Comments
 (0)