Update visualization.py
Browse files- visualization.py +6 -15
visualization.py
CHANGED
|
@@ -73,21 +73,7 @@ class Visualization:
|
|
| 73 |
st.pyplot(fig)
|
| 74 |
return fig
|
| 75 |
|
| 76 |
-
|
| 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
|
|
@@ -119,6 +105,11 @@ class Visualization:
|
|
| 119 |
dot.edge("Q2", "A3", label="Yes")
|
| 120 |
|
| 121 |
return dot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
def download_chart(self, fig, filename):
|
| 124 |
buffer = io.BytesIO()
|
|
|
|
| 73 |
st.pyplot(fig)
|
| 74 |
return fig
|
| 75 |
|
| 76 |
+
def build_tree_diagram(row):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
dot = Digraph()
|
| 78 |
|
| 79 |
# Add the student's name as the first node
|
|
|
|
| 105 |
dot.edge("Q2", "A3", label="Yes")
|
| 106 |
|
| 107 |
return dot
|
| 108 |
+
|
| 109 |
+
def download_tree_diagram(dot, filename):
|
| 110 |
+
# Render the diagram to a file
|
| 111 |
+
filepath = dot.render(filename, format='png', cleanup=True)
|
| 112 |
+
return filepath
|
| 113 |
|
| 114 |
def download_chart(self, fig, filename):
|
| 115 |
buffer = io.BytesIO()
|