Improve dynamic question learning loop
This commit is contained in:
@@ -119,6 +119,63 @@ public sealed class DynamicQuestionTests
|
||||
Assert.Equal(1800, DynamicDifficultyPolicy.Clamp(5000));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReviewPolicy_UsesFixedIntervals_AndResetsAfterAMiss()
|
||||
{
|
||||
var now = new DateTime(2026, 7, 23, 12, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
Assert.Equal(now.AddDays(1), DynamicReviewPolicy.FirstDue(now));
|
||||
Assert.Equal((1, now.AddDays(3), false), DynamicReviewPolicy.AfterReview(0, true, now));
|
||||
Assert.Equal((2, now.AddDays(7), false), DynamicReviewPolicy.AfterReview(1, true, now));
|
||||
Assert.Equal((3, now.AddDays(21), false), DynamicReviewPolicy.AfterReview(2, true, now));
|
||||
Assert.Equal((4, now.AddDays(45), false), DynamicReviewPolicy.AfterReview(3, true, now));
|
||||
Assert.Equal((5, null, true), DynamicReviewPolicy.AfterReview(4, true, now));
|
||||
Assert.Equal((0, now.AddDays(1), false), DynamicReviewPolicy.AfterReview(3, false, now));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void QualityStandardFour_RequiresCoverageReviewAndMisconceptionMetadata()
|
||||
{
|
||||
var options = new System.Text.Json.JsonSerializerOptions(System.Text.Json.JsonSerializerDefaults.Web)
|
||||
{ PropertyNameCaseInsensitive = true };
|
||||
var root = Path.GetFullPath(Path.Combine(
|
||||
AppContext.BaseDirectory, "..", "..", "..", "..", "..", "content", "dynamic_questions"));
|
||||
var source = Directory.EnumerateFiles(root, "*.json")
|
||||
.SelectMany(file => System.Text.Json.JsonSerializer.Deserialize<List<DynamicQuestionBlueprint>>(
|
||||
File.ReadAllText(file), options) ?? [])
|
||||
.ToList();
|
||||
var blueprint = DynamicBlueprintResolver.ResolveAll(source)
|
||||
.First(value => value.QualityStandardVersion == 3);
|
||||
blueprint.QualityStandardVersion = 4;
|
||||
blueprint.BlueprintWeight = 6;
|
||||
|
||||
Assert.Contains("encounterFrame", DynamicQuestionGenerator.Validate(blueprint));
|
||||
|
||||
blueprint.System = "Endocrine";
|
||||
blueprint.PhysicianTask = "Pharmacotherapy";
|
||||
blueprint.EncounterFrame = "Urgent Intervention";
|
||||
blueprint.SiteOfCare = "Emergency Department";
|
||||
blueprint.ConceptIds = ["test.concept"];
|
||||
blueprint.MedicallyReviewedUtc = DateTime.UtcNow.AddDays(-1);
|
||||
blueprint.MedicalReviewExpiresUtc = DateTime.UtcNow.AddYears(1);
|
||||
blueprint.MedicalReviewer = "Medical editor";
|
||||
foreach (var distractor in blueprint.Distractors)
|
||||
distractor.MisconceptionId = $"misconception.{distractor.Id}";
|
||||
|
||||
Assert.Null(DynamicQuestionGenerator.Validate(blueprint));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CoveragePolicy_UsesOfficialDefaults_AndAllowsVersionedOverrides()
|
||||
{
|
||||
Assert.Equal(12, DynamicBlueprintCoveragePolicy.Weight(
|
||||
new DynamicQuestionBlueprint { System = "Biostatistics" }));
|
||||
Assert.Equal(10, DynamicBlueprintCoveragePolicy.Weight(
|
||||
new DynamicQuestionBlueprint { System = "Cardiovascular" }));
|
||||
Assert.Equal(2.5, DynamicBlueprintCoveragePolicy.Weight(
|
||||
new DynamicQuestionBlueprint { System = "Cardiovascular", BlueprintWeight = 2.5 }));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AdaptiveContent_ResolvesToFourCompleteTiers()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user