From 80171da78d0aca4914f47642c1c749f9d3a0d8fa Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 20 Oct 2025 11:14:44 +0100 Subject: [PATCH] Enhance LLM import preview with improved question display and missing M2M handling --- sbas/templates/sbas/llm_prompt_view.html | 6 +- .../sbas/partials/import_preview.html | 107 +++++++++++++----- 2 files changed, 81 insertions(+), 32 deletions(-) diff --git a/sbas/templates/sbas/llm_prompt_view.html b/sbas/templates/sbas/llm_prompt_view.html index a1386b59..9475da0d 100644 --- a/sbas/templates/sbas/llm_prompt_view.html +++ b/sbas/templates/sbas/llm_prompt_view.html @@ -20,9 +20,9 @@ Please adhere to the following guidelines when creating each question: 7. Relevance: Ensure that the question is relevant to current radiological practices and guidelines. 8. Questions should feature metadata tags for finding, structure, condition, presentation, and subspecialty. 9. Each question output should be a json object with the following schema: -10. For article sources pleese reference the article doi within the explanation field in the format [doi:10.xxxx/xxxxx]. -11. For statdx sources please reference the article in the format [statdx:article_id]. -12. References should be included inline within the explanation field. +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. JSON Schema (draft-07 compatible) diff --git a/sbas/templates/sbas/partials/import_preview.html b/sbas/templates/sbas/partials/import_preview.html index ad703921..dbc45dd5 100644 --- a/sbas/templates/sbas/partials/import_preview.html +++ b/sbas/templates/sbas/partials/import_preview.html @@ -1,36 +1,85 @@ -{% for item in items %} -
-
-
Question {{ item.index|add:1 }}
- {% if item.payload %} -

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

-

Answers: -

    -
  • A: {{ item.payload.a_answer|default:''|safe }}
  • -
  • B: {{ item.payload.b_answer|default:''|safe }}
  • -
  • C: {{ item.payload.c_answer|default:''|safe }}
  • -
  • D: {{ item.payload.d_answer|default:''|safe }}
  • -
  • E: {{ item.payload.e_answer|default:''|safe }}
  • -
-

- {% endif %} -

Missing M2M: - {% if item.missing_m2m %} -

    - {% for m in item.missing_m2m %} -
  • {{ m.model }}: {{ m.values|join:", " }}
  • - {% endfor %} -
- {% else %} - None +
+ {% csrf_token %} + + {% for item in items %} +
+
+
Question {{ item.index }}
+ {% if item.payload %} +

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

+

Answers: +

    +
  • A: {{ item.payload.a_answer|default:''|safe }}
  • +
  • B: {{ item.payload.b_answer|default:''|safe }}
  • +
  • C: {{ item.payload.c_answer|default:''|safe }}
  • +
  • D: {{ item.payload.d_answer|default:''|safe }}
  • +
  • E: {{ item.payload.e_answer|default:''|safe }}
  • +
+

{% endif %} -

-
- +

Missing M2M: + {% if item.missing_m2m %} +

    + {% for m in item.missing_m2m %} +
  • + {{ m.model }}: + {% for val in m.values %} + + {% endfor %} +
  • + {% endfor %} +
+ {% else %} + None + {% endif %} +

+
+ +
+ +
+ {% endfor %} + +
+ + +
-{% endfor %} +
+ + +