11use std:: collections:: HashSet ;
22
3+ use serde:: de:: Unexpected ;
4+
5+
6+
7+ #[ derive( Debug , Clone , serde:: Serialize ) ]
8+ #[ serde( rename_all = "camelCase" ) ]
9+ enum RepoErrorType {
10+ UnexpectedFile ,
11+ MoiMismatch ,
12+ PpktExportError ,
13+ NoHpoTermError
14+ }
315
416
517#[ derive( Debug , Clone , serde:: Serialize ) ]
618#[ serde( rename_all = "camelCase" ) ]
719pub struct QcReport {
820 pub cohort_name : String ,
921 pub message : String ,
10- pub is_ok : bool ,
22+ pub error_type : RepoErrorType ,
1123}
1224
1325
@@ -20,7 +32,7 @@ impl QcReport {
2032 let msg = format ! ( "Unexpected file: {}" , unexpected) ;
2133 Self { cohort_name : cohort_name. to_string ( ) ,
2234 message : msg,
23- is_ok : false
35+ error_type : RepoErrorType :: UnexpectedFile
2436 }
2537 }
2638
@@ -36,7 +48,7 @@ impl QcReport {
3648 let message= format ! ( "Expected counts of {} but got {} for {}." , set, ac, ppkt_id) ;
3749 Self { cohort_name : cohort_name. to_string ( ) ,
3850 message,
39- is_ok : false
51+ error_type : RepoErrorType :: MoiMismatch
4052 }
4153 }
4254
@@ -45,7 +57,16 @@ impl QcReport {
4557 Self {
4658 cohort_name : cohort_name. to_string ( ) ,
4759 message,
48- is_ok : false ,
60+ error_type : RepoErrorType :: PpktExportError ,
61+ }
62+ }
63+
64+ pub fn no_hpo ( cohort_name : & str , ppkt_id : & str ) -> Self {
65+ let message = format ! ( "Phenopacket {} had no observed HPO terms" , ppkt_id) ;
66+ Self {
67+ cohort_name : cohort_name. to_string ( ) ,
68+ message,
69+ error_type : RepoErrorType :: NoHpoTermError
4970 }
5071 }
5172
0 commit comments