nlp-qual-space / fullreport.py
maxspad's picture
finally figured out altair
f58c9c5
raw
history blame
1.75 kB
import streamlit as st
import altair as alt
import pandas as pd
from plots import altair_gauge
md_about_qual = '''
The Quality of Assessment for Learning (QuAL) score measures three
components of high-quality feedback via three subscores:
1. A detailed description of the behavior observed (rated 0-3 depending on detail level)
2. A suggestion for improvement is present (rated no = 0, yes = 1)
3. Linkage between the behavior and the suggestion is present (rated no = 0, yes = 1)
The final QuAL score is the sum of these subscores, so it ranges from 0 (lowest quality)
to 5 (highest quality).
'''
class NQDFullReport(object):
def __init__(self, parent : st, results : dict):
self.p = parent
self.results = results
def draw(self):
st = self.p
st.header('Understand Your Score')
st.subheader('About the QuAL Score')
# with st.expander('About the QuAL Score', True):
st.markdown(md_about_qual)
st.subheader('Your Level of Detail')
gauge = altair_gauge(self.results['q1']['label'], 3, 'Level of Detail')
c1, c2 = st.columns(2)
with c1:
st.altair_chart(gauge, use_container_width=True)
with c2:
# st.write(self.results)
bar_df = (pd.DataFrame(self.results['q1']['scores'])
.reset_index()
.rename(columns={'index': 'Rating', 0: 'Score'}))
bar = alt.Chart(bar_df).mark_bar().encode(
x='Rating:O', y='Score',
color=alt.Color('Rating', scale=alt.Scale(scheme='redyellowgreen'), legend=None)
).properties(height=225, title='Prediction Scores')
st.altair_chart(bar, use_container_width=True)