Typed, explainable neurosurgical scoring primitives for MoonBit
moon run cmd/main -- calc gcs 3 4 5
# {"name":"GCS","total":12,"band":"high",...}moon check --deny-warn
moon test
moon fmt --check
moon infomoon run cmd/main -- calc gcs 3 4 5
moon run cmd/main -- explain ich-score 1 1 1 1 0pub(all) suberror ScoreError {
UnknownScale(String)
InvalidField(label~ : String, value~ : String, reason~ : String)
MissingField(label~ : String)
InvalidRow(row~ : Int, reason~ : String)
InvalidColumn(row~ : Int, column~ : String, reason~ : String)
DuplicateField(label~ : String)
EmptyInput
UnsupportedVersion(scale~ : String, version~ : String)
} derive(Eq, Debug)pub struct BatchSummary {
total : Int
successes : Int
failures : Int
records : Array[EvaluationRecord]
} derive(Debug)pub struct EvaluationRecord {
case_id : String
scale : String
result : ScoreResult?
error : ScoreError?
} derive(Debug)pub struct ScoreResult {
name : String
total : Int
band : RiskBand
missing : Array[String]
explanation : String
evidence : Array[EvidenceNote]
} derive(Debug)fn audit_event(sequence~ : Int, kind~ : AuditKind, scale~ : String, case_id~ : String, detail~ : String) -> AuditEventfn evaluate_scale(case_id~ : String, scale~ : String, fields~ : Array[ScoreInput]) -> EvaluationRecordfn evaluation_success(case_id~ : String, scale~ : String, result~ : ScoreResult) -> EvaluationRecordfn ich_score(gcs_points : Int, age_points : Int, volume_points : Int, ivh_points : Int, infratentorial_points : Int) -> ScoreResultfn score_case(id~ : CaseId, scale~ : String, fields~ : Array[ScoreInput], expected_total? : Int, expected_band? : RiskBand, note~ : String) -> ScoreCaseInstall
Download zipTyped, explainable neurosurgical scoring primitives for MoonBit