| def calculate_vendor_score(delay_percent, qa_incidents, safety_compliance, feedback_score): |
| |
| quality_weight = 0.4 |
| timeliness_weight = 0.3 |
| safety_weight = 0.2 |
| communication_weight = 0.1 |
| |
| |
| quality_score = (1 - qa_incidents / 10) * 100 |
| timeliness_score = (1 - delay_percent / 100) * 100 |
| safety_score = safety_compliance * 100 |
| communication_score = feedback_score * 20 |
| |
| |
| final_score = ( |
| quality_score * quality_weight + |
| timeliness_score * timeliness_weight + |
| safety_score * safety_weight + |
| communication_score * communication_weight |
| ) |
| |
| |
| trend_deviation = 0 |
| |
| |
| alert_flag = final_score < 60 |
| |
| |
| return { |
| "quality_score": round(quality_score, 2), |
| "timeliness_score": round(timeliness_score, 2), |
| "safety_score": round(safety_score, 2), |
| "communication_score": round(communication_score, 2), |
| "final_score": round(final_score, 2), |
| "trend_deviation": trend_deviation, |
| "alert_flag": alert_flag |
| } |