Implement nested question remediation and review content

This commit is contained in:
hz
2026-07-16 21:46:56 -05:00
parent 0f5a1122d4
commit c8bfc26645
14 changed files with 1339 additions and 245 deletions
+19
View File
@@ -652,6 +652,9 @@ func _normalize_api_question(item: Variant) -> Dictionary:
"choices": item.get("choices", []),
"correct_choice_id": str(item.get("correctChoiceId", item.get("correct_choice_id", ""))),
"explanation": str(item.get("explanation", "")),
"key_takeaway": str(item.get("keyTakeaway", item.get("key_takeaway", ""))),
"usmle_pearl": str(item.get("usmlePearl", item.get("usmle_pearl", ""))),
"review_followups": _normalize_review_followups(item.get("reviewFollowups", item.get("review_followups", []))),
"choice_explanations": item.get("choiceExplanations", item.get("choice_explanations", {})),
"wrong_answer_followups": item.get("wrongAnswerFollowups", item.get("wrong_answer_followups", {})),
"choice_selection_percentages": item.get("choiceSelectionPercentages", item.get("choice_selection_percentages", {})),
@@ -668,6 +671,22 @@ func _normalize_api_question(item: Variant) -> Dictionary:
return normalized
func _normalize_review_followups(raw_followups: Variant) -> Array:
var normalized: Array = []
if typeof(raw_followups) != TYPE_ARRAY:
return normalized
for raw_followup in raw_followups:
if typeof(raw_followup) != TYPE_DICTIONARY:
continue
normalized.append({
"prompt": str(raw_followup.get("prompt", "")).strip_edges(),
"choices": raw_followup.get("choices", []),
"correct_choice_id": str(raw_followup.get("correctChoiceId", raw_followup.get("correct_choice_id", ""))),
"teaching_point": str(raw_followup.get("teachingPoint", raw_followup.get("teaching_point", ""))).strip_edges()
})
return normalized
func _normalize_references(raw_references: Variant) -> Array:
var normalized: Array = []
if typeof(raw_references) != TYPE_ARRAY: