Make graphical CCS dialogue choice first

This commit is contained in:
hz
2026-08-06 02:48:44 -05:00
parent 58dd370149
commit a0dae8e478
6 changed files with 66 additions and 16 deletions
+7 -3
View File
@@ -229,11 +229,15 @@ public sealed class CcsCaseTests
definition.InitialInterview = TopicInterview();
var attempt = new CcsAttempt { InterviewNodeId = "opening", OpeningCompleted = false };
Assert.Equal(["chief_concern"], CcsStore.CurrentInterviewNode(attempt, definition)!.Choices.Select(value => value.Id));
var opening = CcsStore.CurrentInterviewNode(attempt, definition)!;
Assert.True(opening.SuppressPatientText);
Assert.Equal(["chief_concern"], opening.Choices.Select(value => value.Id));
Assert.Throws<ArgumentException>(() => CcsStore.ApplyDialogueChoice(attempt, definition, "required_history", DateTime.UtcNow));
CcsStore.ApplyDialogueChoice(attempt, definition, "chief_concern", DateTime.UtcNow);
Assert.Equal(["required_history", "optional_history"],
CcsStore.CurrentInterviewNode(attempt, definition)!.Choices.Select(value => value.Id));
var chiefConcern = CcsStore.CurrentInterviewNode(attempt, definition)!;
Assert.False(chiefConcern.SuppressPatientText);
Assert.Equal("I feel tired.", chiefConcern.PatientText);
Assert.Equal(["required_history", "optional_history"], chiefConcern.Choices.Select(value => value.Id));
Assert.Throws<ArgumentException>(() => CcsStore.ApplyDialogueChoice(attempt, definition, "finish_interview", DateTime.UtcNow));
CcsStore.ApplyDialogueChoice(attempt, definition, "required_history", DateTime.UtcNow);
+1
View File
@@ -120,6 +120,7 @@ public class CcsDialogueNode
{
public string Id { get; set; } = "";
public string PatientText { get; set; } = "";
public bool SuppressPatientText { get; set; }
public bool IsTerminal { get; set; }
public List<CcsDialogueChoice> Choices { get; set; } = [];
}
+4 -2
View File
@@ -793,7 +793,9 @@ public sealed class CcsStore
});
return new CcsDialogueNode
{
Id = attempt.InterviewNodeId, PatientText = patientText, Choices = choices
Id = attempt.InterviewNodeId, PatientText = patientText,
SuppressPatientText = attempt.InterviewNodeId.Equals("opening", StringComparison.OrdinalIgnoreCase),
Choices = choices
};
}
var interview = EffectiveInterview(definition);
@@ -848,7 +850,7 @@ public sealed class CcsStore
{
new()
{
Id = "opening", PatientText = "Hello, doctor.",
Id = "opening", PatientText = "Hello, doctor.", SuppressPatientText = true,
Choices = [new() { Id = "ask_reason", Text = "What brings you in today?", NextNodeId = "reason" }]
},
new()