From d37376d9988e65c47862adbc3dd5ee78cbc80a9d Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 20 Oct 2025 11:39:43 +0100 Subject: [PATCH] Enhance LLM question import and detail views with feedback display and source references --- sbas/templates/sbas/llm_prompt_view.html | 13 ++++++++++-- .../sbas/partials/import_preview.html | 19 +++++++++++++++++- sbas/templates/sbas/question_detail.html | 20 ++++++++++++++----- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/sbas/templates/sbas/llm_prompt_view.html b/sbas/templates/sbas/llm_prompt_view.html index 9475da0d..431a11df 100644 --- a/sbas/templates/sbas/llm_prompt_view.html +++ b/sbas/templates/sbas/llm_prompt_view.html @@ -23,7 +23,8 @@ Please adhere to the following guidelines when creating each question: 10. For article sources pleese reference the article doi within the explanation field in the format [doi:10.xxxx/xxxxx], if you do not know the doi please use the article name. 11. For statdx sources please reference the article name in the format [statdx:article_id]. 12. References should be included inline within the feedback fields. -13. Questions need to have a radiology focus, please avoid questions that are purely clinical or biochemical without imaging relevance. +13. Sources can also be included in the sources field as a list. +14. Questions need to have a radiology focus, please avoid questions that are purely clinical or biochemical without imaging relevance. JSON Schema (draft-07 compatible) { @@ -76,6 +77,12 @@ JSON Schema (draft-07 compatible) { "type": "string", "description": "Category name ('Central Nervous and Head & Neck', 'Paediatric', 'Genito-urinary, Adrenal, Obstetrics & Gynaecology and Breast', 'Gastro-intestinal', 'Musculoskeletal and Trauma', 'Cardiothoracic and Vascular')" } ] }, +"sources": { +"type": "array", +"description": "List of source references for the question (e.g. article DOIs or StatDx IDs or Source file names).", +"items": { "type": "string" }, +"uniqueItems": true +}, "finding": { "type": "array", "description": "References to Finding objects. Prefer numeric IDs; names allowed if importer resolves them.", @@ -130,4 +137,6 @@ JSON Schema (draft-07 compatible) } } - \ No newline at end of file + + +{% endblock %} \ No newline at end of file diff --git a/sbas/templates/sbas/partials/import_preview.html b/sbas/templates/sbas/partials/import_preview.html index dbc45dd5..e0dffc24 100644 --- a/sbas/templates/sbas/partials/import_preview.html +++ b/sbas/templates/sbas/partials/import_preview.html @@ -4,18 +4,35 @@ {% for item in items %}
-
Question {{ item.index }}
+
Question {{ item.index|add:1 }}
{% if item.payload %} +

Title: {{ item.payload.title|default:'(No title)'|safe }}

Stem: {{ item.payload.stem|default:''|safe }}

Answers:

  • A: {{ item.payload.a_answer|default:''|safe }}
  • + {% if item.payload.a_feedback %} +

    A Feedback: {{ item.payload.a_feedback|default:''|safe }}

    + {% endif %}
  • B: {{ item.payload.b_answer|default:''|safe }}
  • + {% if item.payload.b_feedback %} +

    B Feedback: {{ item.payload.b_feedback|default:''|safe }}

    + {% endif %}
  • C: {{ item.payload.c_answer|default:''|safe }}
  • + {% if item.payload.c_feedback %} +

    C Feedback: {{ item.payload.c_feedback|default:''|safe }}

    + {% endif %}
  • D: {{ item.payload.d_answer|default:''|safe }}
  • + {% if item.payload.d_feedback %} +

    D Feedback: {{ item.payload.d_feedback|default:''|safe }}

    + {% endif %}
  • E: {{ item.payload.e_answer|default:''|safe }}
  • + {% if item.payload.e_feedback %} +

    E Feedback: {{ item.payload.e_feedback|default:''|safe }}

    + {% endif %}

+

Feedback: {{ item.payload.feedback|default:''|safe }}

{% endif %}

Missing M2M: {% if item.missing_m2m %} diff --git a/sbas/templates/sbas/question_detail.html b/sbas/templates/sbas/question_detail.html index c0d2bf1e..7d1829ac 100644 --- a/sbas/templates/sbas/question_detail.html +++ b/sbas/templates/sbas/question_detail.html @@ -15,11 +15,21 @@ {{question.stem}}

    -
  1. {{ question.a_answer }}
  2. -
  3. {{ question.b_answer }}
  4. -
  5. {{ question.c_answer }}
  6. -
  7. {{ question.d_answer }}
  8. -
  9. {{ question.e_answer }}
  10. +
  11. {{ question.a_answer }} + {% if question.a_feedback %}

    Feedback:{{ question.a_feedback|default:''|safe }}

    {% endif %} +
  12. +
  13. {{ question.b_answer }} + {% if question.b_feedback %}

    Feedback:{{ question.b_feedback|default:''|safe }}

    {% endif %} +
  14. +
  15. {{ question.c_answer }} + {% if question.c_feedback %}

    Feedback:{{ question.c_feedback|default:''|safe }}

    {% endif %} +
  16. +
  17. {{ question.d_answer }} + {% if question.d_feedback %}

    Feedback:{{ question.d_feedback|default:''|safe }}

    {% endif %} +
  18. +
  19. {{ question.e_answer }} + {% if question.e_feedback %}

    Feedback:{{ question.e_feedback|default:''|safe }}

    {% endif %} +
Best answer: {{ question.best_answer }} ({{question.get_correct_answer_stripped}})