99from sqlalchemy .orm import Session
1010
1111from mavedb .models .score_set import ScoreSet
12- from mavedb .view_models .score_range import ScoreSetRangesCreate , InvestigatorScoreRangesCreate , PillarProjectScoreRangesCreate , PillarProjectScoreRangeCreate
12+ from mavedb .view_models .score_range import ScoreSetRangesCreate , InvestigatorScoreRangesCreate , ZeibergCalibrationScoreRangesCreate , ZeibergCalibrationScoreRangeCreate
1313
1414
1515from mavedb .db .session import SessionLocal
@@ -47,11 +47,11 @@ def do_migration(db: Session):
4747 investigator_ranges = None
4848
4949 if score_set .score_calibrations is not None :
50- thresholds = score_set .score_calibrations .get ("pillar_project " , {}).get ("thresholds" , [])
51- evidence_strengths = score_set .score_calibrations .get ("pillar_project " , {}).get ("evidence_strengths" , [])
52- positive_likelihood_ratios = score_set .score_calibrations .get ("pillar_project " , {}).get ("positive_likelihood_ratios" , [])
53- prior_probability_pathogenicity = score_set .score_calibrations .get ("pillar_project " , {}).get ("prior_probability_pathogenicity" , None )
54- parameter_sets = score_set .score_calibrations .get ("pillar_project " , {}).get ("parameter_sets" , [])
50+ thresholds = score_set .score_calibrations .get ("zeiberg_calibration " , {}).get ("thresholds" , [])
51+ evidence_strengths = score_set .score_calibrations .get ("zeiberg_calibration " , {}).get ("evidence_strengths" , [])
52+ positive_likelihood_ratios = score_set .score_calibrations .get ("zeiberg_calibration " , {}).get ("positive_likelihood_ratios" , [])
53+ prior_probability_pathogenicity = score_set .score_calibrations .get ("zeiberg_calibration " , {}).get ("prior_probability_pathogenicity" , None )
54+ parameter_sets = score_set .score_calibrations .get ("zeiberg_calibration " , {}).get ("parameter_sets" , [])
5555
5656 ranges = []
5757 boundary_direction = - 1 # Start with a negative sign to indicate the first range has the lower boundary appearing prior to the threshold
@@ -60,7 +60,7 @@ def do_migration(db: Session):
6060
6161 if idx == 0 :
6262 calculated_range = (None , threshold )
63- ranges .append (PillarProjectScoreRangeCreate (
63+ ranges .append (ZeibergCalibrationScoreRangeCreate (
6464 range = (None , threshold ),
6565 classification = "normal" if evidence_strength < 0 else "abnormal" ,
6666 label = str (evidence_strength ),
@@ -71,7 +71,7 @@ def do_migration(db: Session):
7171 ))
7272 elif idx == len (thresholds ) - 1 :
7373 calculated_range = (threshold , None )
74- ranges .append (PillarProjectScoreRangeCreate (
74+ ranges .append (ZeibergCalibrationScoreRangeCreate (
7575 range = (threshold , None ),
7676 classification = "normal" if evidence_strength < 0 else "abnormal" ,
7777 evidence_strength = evidence_strength ,
@@ -86,7 +86,7 @@ def do_migration(db: Session):
8686 else :
8787 calculated_range = (threshold , thresholds [idx + 1 ])
8888
89- ranges .append (PillarProjectScoreRangeCreate (
89+ ranges .append (ZeibergCalibrationScoreRangeCreate (
9090 range = calculated_range ,
9191 classification = "normal" if evidence_strength < 0 else "abnormal" ,
9292 label = str (evidence_strength ),
@@ -100,17 +100,17 @@ def do_migration(db: Session):
100100 if idx != len (evidence_strengths ) - 1 and (evidence_strengths [idx + 1 ] * evidence_strength < 0 ):
101101 boundary_direction = - boundary_direction
102102
103- pillar_project_ranges = PillarProjectScoreRangesCreate (
103+ zeiberg_calibration_ranges = ZeibergCalibrationScoreRangesCreate (
104104 prior_probability_pathogenicity = prior_probability_pathogenicity ,
105105 parameter_sets = parameter_sets ,
106106 ranges = ranges ,
107107 )
108108 else :
109- pillar_project_ranges = None
109+ zeiberg_calibration_ranges = None
110110
111111 score_set .score_ranges = ScoreSetRangesCreate (
112112 investigator_provided = investigator_ranges if investigator_ranges else None ,
113- pillar_project = pillar_project_ranges if pillar_project_ranges else None ,
113+ zeiberg_calibration = zeiberg_calibration_ranges if zeiberg_calibration_ranges else None ,
114114 ).model_dump ()
115115 db .add (score_set )
116116
0 commit comments