Skip to content

Commit 3b4c3dd

Browse files
authored
Create Davita score
1 parent a3f14bf commit 3b4c3dd

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed

Davita score

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
import pandas as pd
2+
from datetime import datetime
3+
4+
class JanitorialScorecard:
5+
def __init__(self):
6+
# Define weights for different components
7+
self.weights = {
8+
'compliance': 0.40, # Critical for healthcare settings
9+
'quality': 0.35, # Direct inspection results
10+
'customer': 0.25 # Customer satisfaction and relationship
11+
}
12+
13+
# Score mappings
14+
self.letter_scores = {
15+
'G': 100, # Great
16+
'A': 80, # Average
17+
'P': 0 # Poor
18+
}
19+
20+
# Define critical areas for healthcare facilities
21+
self.critical_areas = [
22+
'Clean and Disinfect (All touchpoints)',
23+
'Clean and disinfect toilets and urinals',
24+
'Restock supplies and consumables',
25+
'Wet mop floors using disinfectant and clean water',
26+
'SDS sheets current',
27+
'Proper PPE',
28+
'Commercial grade chemicals'
29+
]
30+
31+
def calculate_compliance_score(self, inspection_data):
32+
"""Calculate compliance score based on critical healthcare requirements"""
33+
critical_items = sum(1 for item in inspection_data.get('compliance_items', [])
34+
if item['compliant'] is True)
35+
total_critical_items = len(inspection_data.get('compliance_items', []))
36+
37+
return (critical_items / total_critical_items) * 100 if total_critical_items > 0 else 0
38+
39+
def calculate_quality_score(self, inspection_results):
40+
"""Calculate quality score based on inspection results"""
41+
scores = []
42+
for area, grade in inspection_results.items():
43+
score = self.letter_scores.get(grade, 0)
44+
# Weight critical areas more heavily
45+
weight = 1.5 if area in self.critical_areas else 1.0
46+
scores.append(score * weight)
47+
48+
return sum(scores) / len(scores) if scores else 0
49+
50+
def calculate_customer_score(self, customer_feedback):
51+
"""Calculate customer satisfaction and relationship score"""
52+
metrics = {
53+
'communication': customer_feedback.get('communication', 0),
54+
'responsiveness': customer_feedback.get('responsiveness', 0),
55+
'consistency': customer_feedback.get('consistency', 0),
56+
'relationship': customer_feedback.get('relationship', 0)
57+
}
58+
59+
return sum(metrics.values()) / len(metrics)
60+
61+
def calculate_total_score(self, inspection_data, inspection_results, customer_feedback):
62+
"""Calculate final weighted score"""
63+
compliance_score = self.calculate_compliance_score(inspection_data)
64+
quality_score = self.calculate_quality_score(inspection_results)
65+
customer_score = self.calculate_customer_score(customer_feedback)
66+
67+
weighted_score = (
68+
compliance_score * self.weights['compliance'] +
69+
quality_score * self.weights['quality'] +
70+
customer_score * self.weights['customer']
71+
)
72+
73+
return {
74+
'total_score': round(weighted_score, 2),
75+
'compliance_score': round(compliance_score, 2),
76+
'quality_score': round(quality_score, 2),
77+
'customer_score': round(customer_score, 2),
78+
'date': datetime.now().strftime('%Y-%m-%d'),
79+
'status': self.get_status(weighted_score)
80+
}
81+
82+
def get_status(self, score):
83+
"""Determine status based on total score"""
84+
if score >= 90:
85+
return 'Excellent - Exceeds Standards'
86+
elif score >= 80:
87+
return 'Good - Meets Standards'
88+
elif score >= 70:
89+
return 'Fair - Needs Improvement'
90+
else:
91+
return 'Poor - Immediate Action Required'
92+
93+
def generate_report(self, scores):
94+
"""Generate a formatted report of the scores"""
95+
report = f"""
96+
Healthcare Facility Janitorial Scorecard
97+
Date: {scores['date']}
98+
99+
Overall Status: {scores['status']}
100+
Total Score: {scores['total_score']}%
101+
102+
Component Breakdown:
103+
1. Compliance Score: {scores['compliance_score']}%
104+
- Weight: {self.weights['compliance'] * 100}%
105+
- Focus: CMS/Dialysis requirements and safety standards
106+
107+
2. Quality Score: {scores['quality_score']}%
108+
- Weight: {self.weights['quality'] * 100}%
109+
- Based on direct inspection results
110+
111+
3. Customer Satisfaction: {scores['customer_score']}%
112+
- Weight: {self.weights['customer'] * 100}%
113+
- Measures relationship health and satisfaction
114+
115+
Action Items:
116+
{'- Immediate corrective action required' if scores['total_score'] < 70 else ''}
117+
{'- Schedule follow-up inspection' if 70 <= scores['total_score'] < 80 else ''}
118+
{'- Maintain current standards' if scores['total_score'] >= 80 else ''}
119+
"""
120+
return report
121+
122+
# Example usage
123+
if __name__ == "__main__":
124+
scorecard = JanitorialScorecard()
125+
126+
# Sample data
127+
inspection_data = {
128+
'compliance_items': [
129+
{'item': 'SDS sheets current', 'compliant': True},
130+
{'item': 'Proper PPE', 'compliant': True},
131+
{'item': 'Commercial grade chemicals', 'compliant': True}
132+
]
133+
}
134+
135+
inspection_results = {
136+
'Clean and Disinfect (All touchpoints)': 'G',
137+
'Clean and disinfect toilets and urinals': 'G',
138+
'Restock supplies and consumables': 'A',
139+
'Wet mop floors using disinfectant and clean water': 'G'
140+
}
141+
142+
customer_feedback = {
143+
'communication': 90,
144+
'responsiveness': 85,
145+
'consistency': 88,
146+
'relationship': 92
147+
}
148+
149+
scores = scorecard.calculate_total_score(
150+
inspection_data,
151+
inspection_results,
152+
customer_feedback
153+
)
154+
155+
print(scorecard.generate_report(scores))

0 commit comments

Comments
 (0)