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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import streamlit.components.v1 as components
|
| 3 |
+
|
| 4 |
+
# HTML content (your provided HTML goes here)
|
| 5 |
+
html_content = """
|
| 6 |
+
<!DOCTYPE html>
|
| 7 |
+
<html lang="en">
|
| 8 |
+
<head>
|
| 9 |
+
<meta charset="UTF-8">
|
| 10 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 11 |
+
<title>Comprehensive Exam Data Analysis with Pandas - 30 Industry Goals with Connections</title>
|
| 12 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.8.5/d3.min.js"></script>
|
| 13 |
+
<style>
|
| 14 |
+
body { font-family: Arial, sans-serif; margin: 20px; }
|
| 15 |
+
#goalSpace { border: 1px solid #ccc; }
|
| 16 |
+
.goal { cursor: pointer; }
|
| 17 |
+
#info { margin-top: 20px; font-weight: bold; }
|
| 18 |
+
#selectedGoal { margin-top: 10px; padding: 10px; border: 1px solid #ccc; background-color: #f0f0f0; }
|
| 19 |
+
#hoverInfo {
|
| 20 |
+
position: absolute;
|
| 21 |
+
padding: 10px;
|
| 22 |
+
background-color: rgba(255, 255, 255, 0.9);
|
| 23 |
+
border: 1px solid #ccc;
|
| 24 |
+
border-radius: 5px;
|
| 25 |
+
font-size: 14px;
|
| 26 |
+
max-width: 300px;
|
| 27 |
+
display: none;
|
| 28 |
+
}
|
| 29 |
+
</style>
|
| 30 |
+
</head>
|
| 31 |
+
<body>
|
| 32 |
+
<h1>Comprehensive Exam Data Analysis with Pandas - 30 Industry Goals with Connections</h1>
|
| 33 |
+
<div id="goalSpace"></div>
|
| 34 |
+
<div id="info"></div>
|
| 35 |
+
<div id="selectedGoal"></div>
|
| 36 |
+
<div id="hoverInfo"></div>
|
| 37 |
+
|
| 38 |
+
<script>
|
| 39 |
+
const width = 1200;
|
| 40 |
+
const height = 800;
|
| 41 |
+
const goals = [
|
| 42 |
+
{ id: 1, x: 100, y: 400, name: "Automate Data Import", description: "Develop scripts to automate exam data extraction from various sources (CSV, Excel, databases) using Pandas read_* functions." },
|
| 43 |
+
{ id: 2, x: 200, y: 300, name: "Data Cleaning", description: "Implement robust data cleaning processes to handle missing values, outliers, and inconsistencies in exam data using Pandas methods like dropna(), fillna(), and apply()." },
|
| 44 |
+
{ id: 3, x: 300, y: 200, name: "Data Transformation", description: "Utilize Pandas for complex data transformations such as pivoting exam results, melting question-wise scores, and creating derived features for analysis." },
|
| 45 |
+
{ id: 4, x: 400, y: 300, name: "Statistical Analysis", description: "Develop functions to automate statistical analysis of exam results, including descriptive statistics, hypothesis testing, and correlation analysis using Pandas and SciPy." },
|
| 46 |
+
{ id: 5, x: 500, y: 400, name: "Performance Metrics", description: "Create custom functions to calculate industry-standard exam performance metrics like item difficulty, discrimination index, and reliability coefficients using Pandas operations." },
|
| 47 |
+
{ id: 6, x: 200, y: 500, name: "Data Filtering", description: "Implement advanced filtering techniques to segment exam data based on various criteria (e.g., demographic info, score ranges) using boolean indexing and query() method in Pandas." },
|
| 48 |
+
{ id: 7, x: 300, y: 600, name: "Reporting Automation", description: "Develop automated reporting systems that use Pandas groupby() and agg() functions to generate summary statistics and performance reports for different exam cohorts." },
|
| 49 |
+
{ id: 8, x: 400, y: 500, name: "Data Visualization", description: "Create interactive dashboards for exam data visualization using Pandas with Plotly or Bokeh, allowing stakeholders to explore results dynamically." },
|
| 50 |
+
{ id: 9, x: 500, y: 600, name: "Time Series Analysis", description: "Implement time series analysis techniques using Pandas datetime functionality to track and forecast exam performance trends over multiple test administrations." },
|
| 51 |
+
{ id: 10, x: 300, y: 400, name: "Data Integration", description: "Develop processes to merge exam data with other relevant datasets (e.g., student information systems, learning management systems) using Pandas merge() and join() operations." },
|
| 52 |
+
{ id: 11, x: 600, y: 300, name: "Performance Optimization", description: "Improve the efficiency of Pandas operations on large exam datasets by utilizing techniques like chunking, multiprocessing, and query optimization." },
|
| 53 |
+
{ id: 12, x: 700, y: 400, name: "Machine Learning Integration", description: "Integrate machine learning models with Pandas for predictive analytics, such as predicting exam success or identifying at-risk students based on historical data." },
|
| 54 |
+
{ id: 13, x: 800, y: 500, name: "Custom Indexing", description: "Implement custom indexing strategies in Pandas to efficiently handle hierarchical exam data structures and improve data access patterns." },
|
| 55 |
+
{ id: 14, x: 900, y: 400, name: "Data Anonymization", description: "Develop Pandas-based workflows to anonymize sensitive exam data, ensuring compliance with privacy regulations while maintaining data utility for analysis." },
|
| 56 |
+
{ id: 15, x: 1000, y: 300, name: "Exam Item Analysis", description: "Create specialized functions using Pandas to perform detailed item analysis, including distractor analysis and reliability calculations for individual exam questions." },
|
| 57 |
+
{ id: 16, x: 600, y: 500, name: "Longitudinal Analysis", description: "Implement Pandas-based methods for tracking student performance across multiple exams over time, identifying learning trends and progress patterns." },
|
| 58 |
+
{ id: 17, x: 700, y: 600, name: "Adaptive Testing Analysis", description: "Develop analysis pipelines using Pandas to evaluate and optimize adaptive testing algorithms, including item selection strategies and scoring methods." },
|
| 59 |
+
{ id: 18, x: 800, y: 700, name: "Exam Equating", description: "Create Pandas workflows to perform exam equating, ensuring comparability of scores across different versions or administrations of an exam." },
|
| 60 |
+
{ id: 19, x: 900, y: 600, name: "Response Time Analysis", description: "Utilize Pandas to analyze exam response times, identifying patterns that may indicate guessing, test-taking strategies, or item difficulty." },
|
| 61 |
+
{ id: 20, x: 1000, y: 500, name: "Collaborative Filtering", description: "Implement collaborative filtering techniques using Pandas to recommend study materials or practice questions based on exam performance patterns." },
|
| 62 |
+
{ id: 21, x: 400, y: 700, name: "Exam Fraud Detection", description: "Develop anomaly detection algorithms using Pandas to identify potential exam fraud or unusual response patterns in large-scale testing programs." },
|
| 63 |
+
{ id: 22, x: 500, y: 800, name: "Standard Setting", description: "Create Pandas-based tools to assist in standard setting processes, analyzing expert judgments and examinee data to establish performance standards." },
|
| 64 |
+
{ id: 23, x: 600, y: 700, name: "Automated Reporting", description: "Implement automated report generation using Pandas and libraries like Jinja2 to create customized, data-driven exam reports for various stakeholders." },
|
| 65 |
+
{ id: 24, x: 700, y: 800, name: "Cross-validation", description: "Develop cross-validation frameworks using Pandas to assess the reliability and generalizability of predictive models in educational assessment contexts." },
|
| 66 |
+
{ id: 25, x: 800, y: 300, name: "API Integration", description: "Create Pandas-based interfaces to integrate exam data analysis workflows with external APIs, facilitating real-time data exchange and reporting." },
|
| 67 |
+
{ id: 26, x: 900, y: 200, name: "Natural Language Processing", description: "Implement NLP techniques using Pandas and libraries like NLTK to analyze free-text responses in exams, enabling automated scoring and content analysis." },
|
| 68 |
+
{ id: 27, x: 1000, y: 100, name: "Exam Blueprint Analysis", description: "Develop Pandas workflows to analyze exam blueprints, ensuring content coverage and alignment with learning objectives across multiple test forms." },
|
| 69 |
+
{ id: 28, x: 100, y: 600, name: "Differential Item Functioning", description: "Implement statistical methods using Pandas to detect and analyze differential item functioning (DIF) in exams, ensuring fairness across different demographic groups." },
|
| 70 |
+
{ id: 29, x: 200, y: 700, name: "Automated Feedback Generation", description: "Create Pandas-based systems to generate personalized feedback for test-takers based on their exam performance and identified areas for improvement." },
|
| 71 |
+
{ id: 30, x: 300, y: 800, name: "Exam Security Analysis", description: "Develop analytical tools using Pandas to assess and enhance exam security, including analysis of item exposure rates and detection of potential security breaches." }
|
| 72 |
+
];
|
| 73 |
+
const connections = [
|
| 74 |
+
{ source: 1, target: 2 },
|
| 75 |
+
{ source: 2, target: 3 },
|
| 76 |
+
{ source: 3, target: 4 },
|
| 77 |
+
{ source: 4, target: 5 },
|
| 78 |
+
{ source: 5, target: 7 },
|
| 79 |
+
{ source: 6, target: 7 },
|
| 80 |
+
{ source: 7, target: 8 },
|
| 81 |
+
{ source: 8, target: 9 },
|
| 82 |
+
{ source: 9, target: 16 },
|
| 83 |
+
{ source: 10, target: 13 },
|
| 84 |
+
{ source: 11, target: 12 },
|
| 85 |
+
{ source: 12, target: 20 },
|
| 86 |
+
{ source: 13, target: 16 },
|
| 87 |
+
{ source: 14, target: 21 },
|
| 88 |
+
{ source: 15, target: 17 },
|
| 89 |
+
{ source: 16, target: 18 },
|
| 90 |
+
{ source: 17, target: 19 },
|
| 91 |
+
{ source: 18, target: 22 },
|
| 92 |
+
{ source: 19, target: 21 },
|
| 93 |
+
{ source: 20, target: 29 },
|
| 94 |
+
{ source: 21, target: 30 },
|
| 95 |
+
{ source: 22, target: 23 },
|
| 96 |
+
{ source: 23, target: 25 },
|
| 97 |
+
{ source: 24, target: 12 },
|
| 98 |
+
{ source: 25, target: 23 },
|
| 99 |
+
{ source: 26, target: 15 },
|
| 100 |
+
{ source: 27, target: 15 },
|
| 101 |
+
{ source: 28, target: 22 },
|
| 102 |
+
{ source: 29, target: 23 },
|
| 103 |
+
{ source: 30, target: 21 },
|
| 104 |
+
// Additional connections for more interconnectivity
|
| 105 |
+
{ source: 1, target: 10 },
|
| 106 |
+
{ source: 2, target: 6 },
|
| 107 |
+
{ source: 3, target: 13 },
|
| 108 |
+
{ source: 4, target: 15 },
|
| 109 |
+
{ source: 5, target: 28 },
|
| 110 |
+
{ source: 8, target: 23 },
|
| 111 |
+
{ source: 11, target: 25 },
|
| 112 |
+
{ source: 14, target: 30 },
|
| 113 |
+
{ source: 24, target: 17 },
|
| 114 |
+
{ source: 26, target: 29 }
|
| 115 |
+
];
|
| 116 |
+
const svg = d3.select("#goalSpace")
|
| 117 |
+
.append("svg")
|
| 118 |
+
.attr("width", width)
|
| 119 |
+
.attr("height", height);
|
| 120 |
+
const links = svg.selectAll("line")
|
| 121 |
+
.data(connections)
|
| 122 |
+
.enter()
|
| 123 |
+
.append("line")
|
| 124 |
+
.attr("x1", d => goals.find(g => g.id === d.source).x)
|
| 125 |
+
.attr("y1", d => goals.find(g => g.id === d.source).y)
|
| 126 |
+
.attr("x2", d => goals.find(g => g.id === d.target).x)
|
| 127 |
+
.attr("y2", d => goals.find(g => g.id === d.target).y)
|
| 128 |
+
.attr("stroke", "#999")
|
| 129 |
+
.attr("stroke-width", 1)
|
| 130 |
+
.attr("stroke-opacity", 0.6);
|
| 131 |
+
const goalNodes = svg.selectAll("circle")
|
| 132 |
+
.data(goals)
|
| 133 |
+
.enter()
|
| 134 |
+
.append("circle")
|
| 135 |
+
.attr("cx", d => d.x)
|
| 136 |
+
.attr("cy", d => d.y)
|
| 137 |
+
.attr("r", 10)
|
| 138 |
+
.attr("fill", d => {
|
| 139 |
+
if (d.id <= 10) return "blue";
|
| 140 |
+
if (d.id <= 20) return "green";
|
| 141 |
+
return "orange";
|
| 142 |
+
})
|
| 143 |
+
.attr("class", "goal");
|
| 144 |
+
const goalLabels = svg.selectAll("text")
|
| 145 |
+
.data(goals)
|
| 146 |
+
.enter()
|
| 147 |
+
.append("text")
|
| 148 |
+
.attr("x", d => d.x + 15)
|
| 149 |
+
.attr("y", d => d.y)
|
| 150 |
+
.text(d => d.name)
|
| 151 |
+
.attr("font-size", "12px");
|
| 152 |
+
const hoverInfo = d3.select("#hoverInfo");
|
| 153 |
+
goalNodes.on("mouseover", function(event, d) {
|
| 154 |
+
d3.select(this).attr("r", 15);
|
| 155 |
+
hoverInfo.style("display", "block")
|
| 156 |
+
.style("left", (event.pageX + 10) + "px")
|
| 157 |
+
.style("top", (event.pageY - 10) + "px")
|
| 158 |
+
.html(`<strong>${d.name}</strong><br>${d.description}`);
|
| 159 |
+
}).on("mouseout", function() {
|
| 160 |
+
d3.select(this).attr("r", 10);
|
| 161 |
+
hoverInfo.style("display", "none");
|
| 162 |
+
});
|
| 163 |
+
goalNodes.on("click", function(event, d) {
|
| 164 |
+
updateSelectedGoalInfo(d);
|
| 165 |
+
});
|
| 166 |
+
function updateSelectedGoalInfo(goal) {
|
| 167 |
+
const selectedGoalDiv = d3.select("#selectedGoal");
|
| 168 |
+
selectedGoalDiv.html(`
|
| 169 |
+
<h3>${goal.name}</h3>
|
| 170 |
+
<p>${goal.description}</p>
|
| 171 |
+
`);
|
| 172 |
+
}
|
| 173 |
+
svg.on("mousemove", function(event) {
|
| 174 |
+
const [x, y] = d3.pointer(event);
|
| 175 |
+
const closest = findClosestGoal(x, y);
|
| 176 |
+
highlightClosestGoal(closest);
|
| 177 |
+
});
|
| 178 |
+
function findClosestGoal(x, y) {
|
| 179 |
+
return goals.reduce((closest, goal) => {
|
| 180 |
+
const distance = Math.sqrt(Math.pow(goal.x - x, 2) + Math.pow(goal.y - y, 2));
|
| 181 |
+
return distance < closest.distance ? { goal, distance } : closest;
|
| 182 |
+
}, { goal: null, distance: Infinity }).goal;
|
| 183 |
+
}
|
| 184 |
+
function highlightClosestGoal(goal) {
|
| 185 |
+
d3.select("#info").html(`Closest goal: ${goal.name}`);
|
| 186 |
+
}
|
| 187 |
+
</script>
|
| 188 |
+
</body>
|
| 189 |
+
</html>
|
| 190 |
+
"""
|
| 191 |
+
|
| 192 |
+
# Streamlit app
|
| 193 |
+
def main():
|
| 194 |
+
st.set_page_config(page_title="Exam Data Analysis Goals", layout="wide")
|
| 195 |
+
|
| 196 |
+
st.title("Comprehensive Exam Data Analysis with Pandas")
|
| 197 |
+
st.write("This visualization shows 30 industry goals with connections for exam data analysis using Pandas.")
|
| 198 |
+
|
| 199 |
+
# Render the HTML content
|
| 200 |
+
components.html(html_content, height=900, scrolling=True)
|
| 201 |
+
|
| 202 |
+
st.write("Hover over the nodes to see more information about each goal.")
|
| 203 |
+
st.write("Click on a node to see its details in the visualization.")
|
| 204 |
+
|
| 205 |
+
if __name__ == "__main__":
|
| 206 |
+
main()
|