Spaces:
Running
Running
added confidence bars
Browse files- overview.py +43 -7
overview.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from matplotlib.cm import get_cmap
|
2 |
import plotly.graph_objects as go
|
|
|
3 |
|
4 |
about_blurb = '''
|
5 |
### About the QuAL Score
|
@@ -47,8 +48,21 @@ class NQDOverview(object):
|
|
47 |
self.cmap = get_cmap(dial_cmap)
|
48 |
|
49 |
def _get_color(self):
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
return color
|
53 |
|
54 |
def _build_figure(self):
|
@@ -63,7 +77,7 @@ class NQDOverview(object):
|
|
63 |
'bar': {'color': color, 'thickness': 1.0}
|
64 |
}
|
65 |
),
|
66 |
-
layout=go.Layout(margin=dict(t=
|
67 |
)
|
68 |
return fig
|
69 |
|
@@ -78,6 +92,8 @@ class NQDOverview(object):
|
|
78 |
cols = st.columns([7, 3])
|
79 |
with cols[0]:
|
80 |
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
81 |
with cols[1]:
|
82 |
q1lab = self.results['q1']['label']
|
83 |
if q1lab == 0:
|
@@ -88,21 +104,41 @@ class NQDOverview(object):
|
|
88 |
md_str = 'π Medium'
|
89 |
elif q1lab == 3:
|
90 |
md_str = 'π High'
|
91 |
-
|
|
|
|
|
92 |
help='Q1 - Evidence - Does the rater provide sufficient evidence about resident performance? (0-no comment at all, 1-no, but comment present, 2-somewhat, 3-yes/full description)')
|
|
|
|
|
93 |
|
94 |
q2lab = self.results['q2i']['label']
|
95 |
if q2lab == 0:
|
96 |
md_str = 'β
Yes'
|
97 |
else:
|
98 |
md_str = 'β No'
|
99 |
-
|
100 |
help='Q2 - Suggestion - Does the rater provide a suggestion for improvement? (0-no/1-yes)')
|
|
|
|
|
101 |
|
102 |
q3lab = self.results['q3i']['label']
|
103 |
if q3lab == 0:
|
104 |
md_str = 'β
Yes'
|
105 |
else:
|
106 |
md_str = 'β No'
|
107 |
-
|
108 |
-
help='Q3 - Connection - Is the raterβs suggestion linked to the behavior described? (0-no/1-yes)')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from matplotlib.cm import get_cmap
|
2 |
import plotly.graph_objects as go
|
3 |
+
import hydralit_components as hc
|
4 |
|
5 |
about_blurb = '''
|
6 |
### About the QuAL Score
|
|
|
48 |
self.cmap = get_cmap(dial_cmap)
|
49 |
|
50 |
def _get_color(self):
|
51 |
+
lab = self.results['qual']['label']
|
52 |
+
if lab == 0:
|
53 |
+
color = '#ffffff'
|
54 |
+
elif lab == 1:
|
55 |
+
color = '#dc3545'
|
56 |
+
elif lab == 2:
|
57 |
+
color = '#f60'
|
58 |
+
elif lab == 3:
|
59 |
+
color = '#ffc107'
|
60 |
+
elif lab == 4:
|
61 |
+
color = '#6ea728'
|
62 |
+
elif lab == 5:
|
63 |
+
color = '#28a745'
|
64 |
+
# color = self.cmap(self.results['qual']['label'] / 6.0)
|
65 |
+
# color = f'rgba({int(color[0]*256)}, {int(color[1]*256)}, {int(color[2]*256)}, {int(color[3]*256)})'
|
66 |
return color
|
67 |
|
68 |
def _build_figure(self):
|
|
|
77 |
'bar': {'color': color, 'thickness': 1.0}
|
78 |
}
|
79 |
),
|
80 |
+
layout=go.Layout(margin=dict(t=100, b=100))
|
81 |
)
|
82 |
return fig
|
83 |
|
|
|
92 |
cols = st.columns([7, 3])
|
93 |
with cols[0]:
|
94 |
st.plotly_chart(fig, use_container_width=True)
|
95 |
+
# prog_score, prog_theme = self.get_prog_setup('qual')
|
96 |
+
# hc.progress_bar(prog_score, f'{prog_score:.2f}% confident', override_theme=prog_theme)
|
97 |
with cols[1]:
|
98 |
q1lab = self.results['q1']['label']
|
99 |
if q1lab == 0:
|
|
|
104 |
md_str = 'π Medium'
|
105 |
elif q1lab == 3:
|
106 |
md_str = 'π High'
|
107 |
+
# prog_score, prog_theme = self.get_prog_setup('q1')
|
108 |
+
# hc.info_card(title='Level of Detail', content=md_str, sentiment='good', bar_value=prog_score)
|
109 |
+
st.metric('Level of Detail', md_str,
|
110 |
help='Q1 - Evidence - Does the rater provide sufficient evidence about resident performance? (0-no comment at all, 1-no, but comment present, 2-somewhat, 3-yes/full description)')
|
111 |
+
prog_score, prog_theme = self.get_prog_setup('q1')
|
112 |
+
hc.progress_bar(prog_score, f'{prog_score:.2f}% confident', override_theme=prog_theme)
|
113 |
|
114 |
q2lab = self.results['q2i']['label']
|
115 |
if q2lab == 0:
|
116 |
md_str = 'β
Yes'
|
117 |
else:
|
118 |
md_str = 'β No'
|
119 |
+
st.metric('Suggestion Given', (md_str),
|
120 |
help='Q2 - Suggestion - Does the rater provide a suggestion for improvement? (0-no/1-yes)')
|
121 |
+
prog_score, prog_theme = self.get_prog_setup('q2i')
|
122 |
+
hc.progress_bar(prog_score, f'{prog_score:.2f}% confident', override_theme=prog_theme)
|
123 |
|
124 |
q3lab = self.results['q3i']['label']
|
125 |
if q3lab == 0:
|
126 |
md_str = 'β
Yes'
|
127 |
else:
|
128 |
md_str = 'β No'
|
129 |
+
st.metric('Suggestion Linked', md_str,
|
130 |
+
help='Q3 - Connection - Is the raterβs suggestion linked to the behavior described? (0-no/1-yes)')
|
131 |
+
prog_score, prog_theme = self.get_prog_setup('q3i')
|
132 |
+
hc.progress_bar(prog_score, f'{prog_score:.2f}% confident', override_theme=prog_theme)
|
133 |
+
|
134 |
+
|
135 |
+
def get_prog_setup(self, q):
|
136 |
+
prog_score = self.results[q]['scores'][self.results[q]['label']] * 100
|
137 |
+
if prog_score > 75:
|
138 |
+
prog_sent = '#28a745'
|
139 |
+
elif (prog_score > 25) and (prog_score <= 75):
|
140 |
+
prog_sent = '#ffc107'
|
141 |
+
else:
|
142 |
+
prog_sent = '#dc3545'
|
143 |
+
prog_theme = {'content_color': 'white', 'progress_color': '#aaa'}
|
144 |
+
return prog_score, prog_theme
|