DocUA Claude Opus 4.7 (1M context) commited on
Commit
e90d802
Β·
1 Parent(s): 251ab3e

feat: verification panel always-visible flow + docs for v2.3.3

Browse files

- Conversation Verification: show the "Select Correct Classification" +
comment panel by default for every exchange (hidden only once marked
Correct), so reviewers can give feedback without first clicking Incorrect.
Generate now also primes the panel for the first exchange. Fixes latent
output-arity mismatches in the generate functions' early-return paths.
- Docs: README -> v2.3.3, sdk_version 6.1.0, new "Latest Updates (v2.3.3)"
section; CHANGELOG [2.3.3]; in-interface Help updated (verification flow,
comment-only Provider Summary step, Clear Chat resets verification).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

CHANGELOG.md CHANGED
@@ -2,6 +2,35 @@
2
 
3
  All notable changes to the Medical Assistant with Spiritual Support project.
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  ## [2.1.0] - 2025-12-18
6
 
7
  ### Added
@@ -47,6 +76,7 @@ All notable changes to the Medical Assistant with Spiritual Support project.
47
 
48
  ## Version History
49
 
 
50
  - **v2.1.0** (2025-12-18): Spiritual Care Message customization features
51
  - **v2.0.0** (2024-12-18): Prompt optimization system and comprehensive testing
52
  - **v1.0.0** (2024-09-01): Initial release with core functionality
 
2
 
3
  All notable changes to the Medical Assistant with Spiritual Support project.
4
 
5
+ ## [2.3.3] - 2026-05-27
6
+
7
+ Conversation Verification usability fixes from Or's follow-up feedback.
8
+
9
+ ### Fixed
10
+ - **Provider Summary save error**: Saving feedback on the final Provider Summary
11
+ step without selecting a flag raised an error and showed "Error" badges across
12
+ the whole tab. The classification Radio received an empty string, which Gradio 6
13
+ rejects (value not in choices). Now the flag is hidden on the Provider Summary
14
+ step and the Radio value is normalized to `None` across all verification handlers.
15
+ - **Stale verification on Clear Chat**: "Clear Chat" cleared the chat but left the
16
+ Conversation Verification tab showing the previous scenario. It now also resets
17
+ the verification state and displayed components.
18
+ - **Latent output-arity mismatches** in the verification handlers' empty-session and
19
+ early-return paths.
20
+
21
+ ### Changed
22
+ - **Verification feedback panel**: The "Select Correct Classification" + comment
23
+ panel is now visible by default for every exchange (hidden only once marked
24
+ βœ… Correct), so reviewers can give feedback without first clicking "Incorrect".
25
+ - **Help content**: Updated the Conversation Verification section to describe the
26
+ new flow, the comment-only Provider Summary step, and Clear Chat behavior.
27
+ - **Gradio**: Pinned to 6.1.0 (README `sdk_version` aligned).
28
+
29
+ ### Added
30
+ - **Latency diagnostics**: Lightweight per-stage `[PERF]` timing in the message
31
+ path (env `PERF_TIMING`, on by default) to diagnose slow (>10s) responses. No
32
+ model changes.
33
+
34
  ## [2.1.0] - 2025-12-18
35
 
36
  ### Added
 
76
 
77
  ## Version History
78
 
79
+ - **v2.3.3** (2026-05-27): Conversation Verification usability fixes (Or follow-up)
80
  - **v2.1.0** (2025-12-18): Spiritual Care Message customization features
81
  - **v2.0.0** (2024-12-18): Prompt optimization system and comprehensive testing
82
  - **v1.0.0** (2024-09-01): Initial release with core functionality
README.md CHANGED
@@ -1,10 +1,10 @@
1
  ---
2
- title: Medical Assistant with Spiritual Support v.2.3.2
3
  emoji: 🩺
4
  colorFrom: blue
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 6.0.2
8
  app_file: src/interface/simplified_gradio_app.py
9
  pinned: false
10
  ---
@@ -486,12 +486,38 @@ The Medical Assistant with Spiritual Support system is **fully functional and pr
486
 
487
  ---
488
 
489
- **Version:** 2.3
490
- **Last Updated:** January 7, 2026
491
  **Status:** βœ… Production Ready with Enhanced Provider Summary
492
  **Test Coverage:** 65/65 tests passing
493
 
494
- ### πŸ†• Latest Updates (v2.3) - January 2026
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
 
496
  #### Provider Summary Improvements
497
  Based on medical professional feedback from `review/Or_3.txt`:
 
1
  ---
2
+ title: Medical Assistant with Spiritual Support v.2.3.3
3
  emoji: 🩺
4
  colorFrom: blue
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 6.1.0
8
  app_file: src/interface/simplified_gradio_app.py
9
  pinned: false
10
  ---
 
486
 
487
  ---
488
 
489
+ **Version:** 2.3.3
490
+ **Last Updated:** May 27, 2026
491
  **Status:** βœ… Production Ready with Enhanced Provider Summary
492
  **Test Coverage:** 65/65 tests passing
493
 
494
+ ### πŸ†• Latest Updates (v2.3.3) - May 2026
495
+
496
+ Based on medical professional follow-up feedback from Or (Conversation Verification usability):
497
+
498
+ **βœ… Fixed "Error" when saving Provider Summary feedback:**
499
+ - **Issue:** On the final Provider Summary step, saving a comment without picking a
500
+ green/yellow/red flag raised an error and showed "Error" badges on the whole tab.
501
+ - **Root cause:** the classification Radio received an empty string, which Gradio 6
502
+ rejects (value not in choices), failing the entire event response.
503
+ - **Solution:** the flag is now **hidden on the Provider Summary final step** (it was
504
+ already chosen earlier), and the Radio value is normalized to `None` across all
505
+ verification handlers. Text-only feedback now saves cleanly.
506
+
507
+ **βœ… "Clear Chat" now also clears the Conversation Verification tab:**
508
+ - Starting a new scenario no longer leaves the previous scenario's verification
509
+ visible. Chat history and verification state/displays reset together.
510
+
511
+ **βœ… Classification panel always available while reviewing:**
512
+ - The "Select Correct Classification" + comment panel is now shown by default for
513
+ every exchange (until it is marked βœ… Correct), so reviewers can give feedback
514
+ immediately after navigating β€” no need to click "Incorrect" first.
515
+
516
+ **βœ… Latency diagnostics:**
517
+ - Added lightweight per-stage `[PERF]` timing in the message path (env `PERF_TIMING`,
518
+ on by default) to help diagnose occasional slow (>10s) responses. No model changes.
519
+
520
+ ### πŸ†• Previous Updates (v2.3) - January 2026
521
 
522
  #### Provider Summary Improvements
523
  Based on medical professional feedback from `review/Or_3.txt`:
src/interface/gradio_app.py CHANGED
@@ -660,7 +660,12 @@ def create_simplified_interface():
660
  generate_conv_verification_btn.click(
661
  verification_handlers._generate_conv_verification,
662
  inputs=[session_data],
663
- outputs=[conv_verify_state, conv_verify_records, conv_verify_index, conv_verify_status, conv_verify_exchange, conv_position, conv_stats]
 
 
 
 
 
664
  )
665
 
666
  conv_verify_download_btn.click(
 
660
  generate_conv_verification_btn.click(
661
  verification_handlers._generate_conv_verification,
662
  inputs=[session_data],
663
+ outputs=[
664
+ conv_verify_state, conv_verify_records, conv_verify_index,
665
+ conv_verify_status, conv_verify_exchange, conv_position, conv_stats,
666
+ # Show the classification/comment panel for the first exchange too
667
+ conv_incorrect_comment_row, conv_incorrect_comment, conv_correct_classification,
668
+ ]
669
  )
670
 
671
  conv_verify_download_btn.click(
src/interface/simplified_gradio_app.py CHANGED
@@ -535,7 +535,12 @@ def create_simplified_interface():
535
  generate_conv_verification_btn.click(
536
  verification_handlers._generate_conv_verification_with_summary,
537
  inputs=[session_data],
538
- outputs=[conv_verify_state, conv_verify_records, conv_verify_index, conv_verify_status, conv_verify_exchange, conv_position, conv_stats]
 
 
 
 
 
539
  )
540
 
541
  conv_verify_download_csv_btn.click(
 
535
  generate_conv_verification_btn.click(
536
  verification_handlers._generate_conv_verification_with_summary,
537
  inputs=[session_data],
538
+ outputs=[
539
+ conv_verify_state, conv_verify_records, conv_verify_index,
540
+ conv_verify_status, conv_verify_exchange, conv_position, conv_stats,
541
+ # Show the classification/comment panel for the first exchange too
542
+ conv_incorrect_comment_row, conv_incorrect_comment, conv_correct_classification,
543
+ ]
544
  )
545
 
546
  conv_verify_download_csv_btn.click(
src/interface/simplified_help_content.py CHANGED
@@ -43,18 +43,28 @@ Review and verify the accuracy of spiritual distress classifications.
43
  2. Review each exchange:
44
  - Read the user message and assistant response
45
  - Check the classification (GREEN/YELLOW/RED)
 
 
 
46
  - Mark as βœ… Correct or ❌ Incorrect
47
  3. For incorrect classifications:
48
- - Select the correct classification
49
  - Add a comment explaining why it's incorrect
50
  - Click "πŸ’Ύ Save comment"
51
- 4. Navigate with ⬅️ Previous / Next ➑️ buttons
 
52
  5. **Final step:** Review the Provider Summary
53
  - This is the message sent to the spiritual care team
54
- - Verify it's complete and accurate
55
- - Add feedback if needed
 
 
56
  6. Download results: "πŸ“„ Download CSV"
57
 
 
 
 
 
58
  **Statistics shown:**
59
  - Reviewed: How many exchanges you've checked
60
  - βœ… Correct: Accurate classifications
@@ -166,9 +176,10 @@ The Provider Summary is the **most important** part to verify:
166
  - βœ… Clear, professional narrative style
167
 
168
  **If incorrect or incomplete:**
169
- - Mark as ❌ Incorrect
170
- - Add detailed comment about what's missing or wrong
171
  - Specify what should be included
 
172
 
173
  ---
174
 
@@ -264,6 +275,14 @@ The CSV file includes:
264
  - Download CSV with your findings
265
  - Share with the development team
266
 
 
 
 
 
 
 
 
 
267
  ---
268
 
269
  ## πŸ“ž Support
 
43
  2. Review each exchange:
44
  - Read the user message and assistant response
45
  - Check the classification (GREEN/YELLOW/RED)
46
+ - The **"Select Correct Classification" + Comment** panel is shown by default
47
+ for every exchange, so you can give feedback right away β€” no need to click
48
+ "Incorrect" first. It hides only after you mark an exchange βœ… Correct.
49
  - Mark as βœ… Correct or ❌ Incorrect
50
  3. For incorrect classifications:
51
+ - Select the correct classification (🟒 / 🟑 / πŸ”΄)
52
  - Add a comment explaining why it's incorrect
53
  - Click "πŸ’Ύ Save comment"
54
+ 4. Navigate with ⬅️ Previous / Next ➑️ buttons (the panel stays visible on the
55
+ next exchange unless it is already marked Correct)
56
  5. **Final step:** Review the Provider Summary
57
  - This is the message sent to the spiritual care team
58
+ - **No flag selection here** β€” the classification was already decided in the
59
+ earlier exchanges, so this step shows a **comment box only**
60
+ - Verify the summary is complete and accurate; add a comment and click
61
+ "πŸ’Ύ Save comment" β€” text alone is enough
62
  6. Download results: "πŸ“„ Download CSV"
63
 
64
+ > πŸ’‘ **Starting a new scenario?** Press "πŸ—‘οΈ Clear Chat" on the Chat tab β€” it now
65
+ > also clears this Conversation Verification tab, so you never see a previous
66
+ > scenario's exchanges by mistake.
67
+
68
  **Statistics shown:**
69
  - Reviewed: How many exchanges you've checked
70
  - βœ… Correct: Accurate classifications
 
176
  - βœ… Clear, professional narrative style
177
 
178
  **If incorrect or incomplete:**
179
+ - Add a detailed comment about what's missing or wrong (no flag needed on this
180
+ final step β€” the comment box is all you need)
181
  - Specify what should be included
182
+ - Click "πŸ’Ύ Save comment"
183
 
184
  ---
185
 
 
275
  - Download CSV with your findings
276
  - Share with the development team
277
 
278
+ **Q: Do I have to pick a flag to save feedback on the Provider Summary?**
279
+ - No. On the final Provider Summary step there is no flag β€” just type your
280
+ comment and click "πŸ’Ύ Save comment". Text alone is saved.
281
+
282
+ **Q: I started a new scenario but still see the old verification. Why?**
283
+ - This is fixed: pressing "πŸ—‘οΈ Clear Chat" now also clears the Conversation
284
+ Verification tab. Clear the chat before starting a new scenario.
285
+
286
  ---
287
 
288
  ## πŸ“ž Support
src/interface/verification_handlers.py CHANGED
@@ -860,13 +860,19 @@ def _render_conv_exchange(records: list, index: int):
860
  return html, pos, stats
861
 
862
  def _comment_ui_state(records: list, idx: int):
863
- """Return (row_update, note_value) based on current record state."""
 
 
 
 
 
 
864
  if not records:
865
  return gr.update(visible=False), ""
866
  idx = max(0, min(idx, len(records) - 1))
867
  r = records[idx]
868
- is_incorrect = (r.get("is_correct") is False) if isinstance(r, dict) else (getattr(r, "is_correct", None) is False)
869
- if not is_incorrect:
870
  return gr.update(visible=False), ""
871
  note = (r.get("verifier_notes") or "") if isinstance(r, dict) else (getattr(r, "verifier_notes", "") or "")
872
  return gr.update(visible=True), str(note)
@@ -955,9 +961,9 @@ def _export_conv_records_to_csv(meta: dict, records: list):
955
 
956
  def _generate_conv_verification(session: SimplifiedSessionData):
957
  if session is None or not hasattr(session.app_instance, "conversation_logger"):
958
- return None, [], 0, "❌ No session/conversation found", "", ""
959
  if not session.app_instance.conversation_logger.entries:
960
- return None, [], 0, "⚠️ No exchanges to verify yet", "", ""
961
 
962
  manager = ConversationVerificationManager()
963
  vs = manager.create_verification_session(session.app_instance.conversation_logger, "Medical Professional")
@@ -1003,7 +1009,12 @@ def _generate_conv_verification(session: SimplifiedSessionData):
1003
  for r in vs.verification_records
1004
  ]
1005
  html, pos, stats = _render_conv_exchange(records_as_dicts, 0)
1006
- return meta, records_as_dicts, 0, f"βœ… Generated session `{vs.session_id}`", html, pos, stats
 
 
 
 
 
1007
 
1008
  # Display text for each classification flag (shared by the verification handlers).
1009
  _CLASSIFICATION_DISPLAY = {
@@ -1102,9 +1113,9 @@ def _generate_conv_verification_with_summary(session: SimplifiedSessionData):
1102
  "Provider Summary to be the final exchange presented in that tab"
1103
  """
1104
  if session is None or not hasattr(session.app_instance, "conversation_logger"):
1105
- return None, [], 0, "❌ No session/conversation found", "", "", ""
1106
  if not session.app_instance.conversation_logger.entries:
1107
- return None, [], 0, "⚠️ No exchanges to verify yet", "", "", ""
1108
 
1109
  manager = ConversationVerificationManager()
1110
  vs = manager.create_verification_session(session.app_instance.conversation_logger, "Medical Professional")
@@ -1197,9 +1208,15 @@ def _generate_conv_verification_with_summary(session: SimplifiedSessionData):
1197
  "provider_summary_html": provider_summary_html,
1198
  }
1199
  records_as_dicts.append(final_exchange)
1200
-
1201
  html, pos, stats = _render_conv_exchange(records_as_dicts, 0)
1202
- return meta, records_as_dicts, 0, f"βœ… Generated session with {len(records_as_dicts)} exchanges (Provider Summary as final step)", html, pos, stats
 
 
 
 
 
 
1203
 
1204
 
1205
  def _auto_save_verification_report(meta: dict, records: list, session: SimplifiedSessionData):
 
860
  return html, pos, stats
861
 
862
  def _comment_ui_state(records: list, idx: int):
863
+ """Return (row_update, note_value) based on current record state.
864
+
865
+ The classification + comment panel is shown unless the exchange is confirmed
866
+ Correct β€” i.e. it is visible for not-yet-reviewed (None) and Incorrect
867
+ exchanges, so a reviewer can give feedback right after navigating, without
868
+ first clicking "Incorrect".
869
+ """
870
  if not records:
871
  return gr.update(visible=False), ""
872
  idx = max(0, min(idx, len(records) - 1))
873
  r = records[idx]
874
+ is_correct = (r.get("is_correct") if isinstance(r, dict) else getattr(r, "is_correct", None))
875
+ if is_correct is True:
876
  return gr.update(visible=False), ""
877
  note = (r.get("verifier_notes") or "") if isinstance(r, dict) else (getattr(r, "verifier_notes", "") or "")
878
  return gr.update(visible=True), str(note)
 
961
 
962
  def _generate_conv_verification(session: SimplifiedSessionData):
963
  if session is None or not hasattr(session.app_instance, "conversation_logger"):
964
+ return None, [], 0, "❌ No session/conversation found", "", "", "", gr.update(visible=False), "", gr.update(value=None)
965
  if not session.app_instance.conversation_logger.entries:
966
+ return None, [], 0, "⚠️ No exchanges to verify yet", "", "", "", gr.update(visible=False), "", gr.update(value=None)
967
 
968
  manager = ConversationVerificationManager()
969
  vs = manager.create_verification_session(session.app_instance.conversation_logger, "Medical Professional")
 
1009
  for r in vs.verification_records
1010
  ]
1011
  html, pos, stats = _render_conv_exchange(records_as_dicts, 0)
1012
+ row_upd, note_val = _comment_ui_state(records_as_dicts, 0)
1013
+ radio_upd = _classification_update(records_as_dicts, 0)
1014
+ return (
1015
+ meta, records_as_dicts, 0, f"βœ… Generated session `{vs.session_id}`",
1016
+ html, pos, stats, row_upd, note_val, radio_upd,
1017
+ )
1018
 
1019
  # Display text for each classification flag (shared by the verification handlers).
1020
  _CLASSIFICATION_DISPLAY = {
 
1113
  "Provider Summary to be the final exchange presented in that tab"
1114
  """
1115
  if session is None or not hasattr(session.app_instance, "conversation_logger"):
1116
+ return None, [], 0, "❌ No session/conversation found", "", "", "", gr.update(visible=False), "", gr.update(value=None)
1117
  if not session.app_instance.conversation_logger.entries:
1118
+ return None, [], 0, "⚠️ No exchanges to verify yet", "", "", "", gr.update(visible=False), "", gr.update(value=None)
1119
 
1120
  manager = ConversationVerificationManager()
1121
  vs = manager.create_verification_session(session.app_instance.conversation_logger, "Medical Professional")
 
1208
  "provider_summary_html": provider_summary_html,
1209
  }
1210
  records_as_dicts.append(final_exchange)
1211
+
1212
  html, pos, stats = _render_conv_exchange(records_as_dicts, 0)
1213
+ row_upd, note_val = _comment_ui_state(records_as_dicts, 0)
1214
+ radio_upd = _classification_update(records_as_dicts, 0)
1215
+ return (
1216
+ meta, records_as_dicts, 0,
1217
+ f"βœ… Generated session with {len(records_as_dicts)} exchanges (Provider Summary as final step)",
1218
+ html, pos, stats, row_upd, note_val, radio_upd,
1219
+ )
1220
 
1221
 
1222
  def _auto_save_verification_report(meta: dict, records: list, session: SimplifiedSessionData):