ProfessorLeVesseur
commited on
Update visualization.py
Browse files- visualization.py +38 -5
visualization.py
CHANGED
@@ -73,18 +73,51 @@ class Visualization:
|
|
73 |
st.pyplot(fig)
|
74 |
return fig
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
def build_tree_diagram(self, row):
|
77 |
dot = Digraph()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
dot.node("Q1", "Has the student attended ≥ 90% of interventions?")
|
79 |
-
|
80 |
-
dot.node("A1", "Address Attendance", shape="box")
|
81 |
-
dot.node("A2", "Address Engagement", shape="box")
|
82 |
-
dot.node("A3", "Consider barriers, fidelity, and progress monitoring", shape="box")
|
83 |
if row["Attended ≥ 90%"] == "No":
|
|
|
|
|
84 |
dot.edge("Q1", "A1", label="No")
|
85 |
else:
|
|
|
|
|
86 |
dot.edge("Q1", "Q2", label="Yes")
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
return dot
|
89 |
|
90 |
def download_chart(self, fig, filename):
|
|
|
73 |
st.pyplot(fig)
|
74 |
return fig
|
75 |
|
76 |
+
# def build_tree_diagram(self, row):
|
77 |
+
# dot = Digraph()
|
78 |
+
# dot.node("Q1", "Has the student attended ≥ 90% of interventions?")
|
79 |
+
# dot.node("Q2", "Has the student been engaged ≥ 80% of intervention time?")
|
80 |
+
# dot.node("A1", "Address Attendance", shape="box")
|
81 |
+
# dot.node("A2", "Address Engagement", shape="box")
|
82 |
+
# dot.node("A3", "Consider barriers, fidelity, and progress monitoring", shape="box")
|
83 |
+
# if row["Attended ≥ 90%"] == "No":
|
84 |
+
# dot.edge("Q1", "A1", label="No")
|
85 |
+
# else:
|
86 |
+
# dot.edge("Q1", "Q2", label="Yes")
|
87 |
+
# dot.edge("Q2", "A2" if row["Engagement ≥ 80%"] == "No" else "A3", label="Yes")
|
88 |
+
# return dot
|
89 |
+
|
90 |
def build_tree_diagram(self, row):
|
91 |
dot = Digraph()
|
92 |
+
|
93 |
+
# Add the student's name as the first node
|
94 |
+
student_name = row['Student'] # Assuming 'Student' is the column name for student names
|
95 |
+
dot.node("Student", student_name)
|
96 |
+
|
97 |
+
# Connect the student's name to the first question
|
98 |
+
dot.edge("Student", "Q1")
|
99 |
+
|
100 |
+
# Add the first question node
|
101 |
dot.node("Q1", "Has the student attended ≥ 90% of interventions?")
|
102 |
+
|
|
|
|
|
|
|
103 |
if row["Attended ≥ 90%"] == "No":
|
104 |
+
# If attendance is less than 90%, add the corresponding action node
|
105 |
+
dot.node("A1", "Address Attendance", shape="box")
|
106 |
dot.edge("Q1", "A1", label="No")
|
107 |
else:
|
108 |
+
# If attendance is 90% or more, proceed to the next question
|
109 |
+
dot.node("Q2", "Has the student been engaged ≥ 80% of intervention time?")
|
110 |
dot.edge("Q1", "Q2", label="Yes")
|
111 |
+
|
112 |
+
if row["Engagement ≥ 80%"] == "No":
|
113 |
+
# If engagement is less than 80%, add the corresponding action node
|
114 |
+
dot.node("A2", "Address Engagement", shape="box")
|
115 |
+
dot.edge("Q2", "A2", label="No")
|
116 |
+
else:
|
117 |
+
# If engagement is 80% or more, add the final action node
|
118 |
+
dot.node("A3", "Consider addressing logistical barriers", shape="box")
|
119 |
+
dot.edge("Q2", "A3", label="Yes")
|
120 |
+
|
121 |
return dot
|
122 |
|
123 |
def download_chart(self, fig, filename):
|