Complete CCS results and rating flow
This commit is contained in:
@@ -45,9 +45,9 @@ public sealed class CcsCaseTests
|
||||
var definition = ValidImport().Cases[0];
|
||||
definition.ScoringCriteria =
|
||||
[
|
||||
new() { Id = "lab", ActionType = "order", TargetCode = "bmp", Points = 5, LatestMinute = 10, Rationale = "Check potassium." },
|
||||
new() { Id = "insulin", ActionType = "order", TargetCode = "insulin", AfterTargetCode = "bmp", Points = 10, Rationale = "Start after potassium assessment." },
|
||||
new() { Id = "bicarb", ActionType = "order", TargetCode = "bicarb", Points = -4, Rationale = "Avoid routine bicarbonate." }
|
||||
new() { Id = "lab", Title = "Check electrolytes", ActionType = "order", TargetCode = "bmp", Points = 5, LatestMinute = 10, Rationale = "Check potassium." },
|
||||
new() { Id = "insulin", Title = "Start insulin safely", ActionType = "order", TargetCode = "insulin", AfterTargetCode = "bmp", Points = 10, Rationale = "Start after potassium assessment." },
|
||||
new() { Id = "bicarb", Title = "Avoid bicarbonate", ActionType = "order", TargetCode = "bicarb", Points = -4, Rationale = "Avoid routine bicarbonate." }
|
||||
];
|
||||
var attempt = new CcsAttempt { Actions =
|
||||
[
|
||||
@@ -70,6 +70,31 @@ public sealed class CcsCaseTests
|
||||
Assert.Empty(CcsCaseValidator.ValidateImport(ValidImport(), new HashSet<string>()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CcsExpectedScoreUsesSeparateUserAndCaseElo()
|
||||
{
|
||||
Assert.Equal(0.5, CcsRatingStore.ExpectedScore(1000, 1000), 6);
|
||||
Assert.True(CcsRatingStore.ExpectedScore(1200, 1000) > 0.75);
|
||||
Assert.True(CcsRatingStore.ExpectedScore(800, 1000) < 0.25);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ScoringReviewIncludesExpectedAndObservedEvidence()
|
||||
{
|
||||
var definition = ValidImport().Cases[0];
|
||||
var attempt = new CcsAttempt
|
||||
{
|
||||
Actions = [new() { Type = "order", Code = "bmp", SimulatedMinute = 4 }]
|
||||
};
|
||||
|
||||
var criterion = CcsStore.CalculateScore(attempt, definition).Criteria.Single();
|
||||
|
||||
Assert.Equal("Check electrolytes", criterion.Title);
|
||||
Assert.Contains("Bmp", criterion.ExpectedAction, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Equal("bmp", criterion.ObservedAction);
|
||||
Assert.Equal(4, criterion.ObservedMinute);
|
||||
}
|
||||
|
||||
private static CcsImportRequest ValidImport() => new()
|
||||
{
|
||||
Orders =
|
||||
@@ -87,7 +112,7 @@ public sealed class CcsCaseTests
|
||||
IsPublished = true, RealTimeMinutes = 20, Difficulty = 2,
|
||||
InitialChart = new() { PatientSummary = "Adult with diabetes", ReasonForEncounter = "Vomiting" },
|
||||
OrderResponses = [new() { OrderCode = "bmp", Result = "Potassium 4.9 mEq/L" }],
|
||||
ScoringCriteria = [new() { Id = "lab", ActionType = "order", TargetCode = "bmp", Points = 5 }],
|
||||
ScoringCriteria = [new() { Id = "lab", Title = "Check electrolytes", ActionType = "order", TargetCode = "bmp", Points = 5 }],
|
||||
References = [new() { Title = "Consensus report", Publisher = "Example Society", Url = "https://example.org/consensus", Supports = "Case management and scoring", AccessedOn = "2026-07-15", Reviewer = "Question bank editorial review" }]
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user