|
|
import streamlit as st
|
|
|
import pandas as pd
|
|
|
|
|
|
|
|
|
hackathon_csv = "Hackathon_Dataset.csv"
|
|
|
team_csv = "Team_Dataset.csv"
|
|
|
|
|
|
df_hackathons = pd.read_csv(hackathon_csv)
|
|
|
df_teams = pd.read_csv(team_csv)
|
|
|
|
|
|
|
|
|
df_hackathons["Event Date"] = pd.to_datetime(df_hackathons["Event Date"], errors='coerce')
|
|
|
df_hackathons["Registration Deadline"] = pd.to_datetime(df_hackathons["Registration Deadline"], errors='coerce')
|
|
|
|
|
|
|
|
|
df_hackathons["Prize Pool"] = pd.to_numeric(df_hackathons["Prize Pool"], errors='coerce')
|
|
|
|
|
|
|
|
|
team_list = df_teams["Team Name"].unique()
|
|
|
|
|
|
|
|
|
st.set_page_config(page_title="Hackathon Finder", layout="wide")
|
|
|
|
|
|
|
|
|
st.sidebar.header("π Filter Hackathons")
|
|
|
difficulty = st.sidebar.selectbox("Select Difficulty", ["All"] + df_hackathons["Difficulty Level"].dropna().unique().tolist())
|
|
|
mode = st.sidebar.selectbox("Select Mode", ["All", "Online", "Offline"])
|
|
|
date_range = st.sidebar.slider("Select Event Date Range",
|
|
|
min_value=df_hackathons["Event Date"].min().date(),
|
|
|
max_value=df_hackathons["Event Date"].max().date(),
|
|
|
value=(df_hackathons["Event Date"].min().date(), df_hackathons["Event Date"].max().date()))
|
|
|
|
|
|
|
|
|
sort_option = st.sidebar.selectbox("Sort Hackathons By:",
|
|
|
["Prize Pool (High to Low)", "Registration Deadline (Soonest First)"])
|
|
|
|
|
|
|
|
|
st.title("π Hackathon Recommendation System")
|
|
|
st.write("**Select your team to find the best hackathons for you!**")
|
|
|
selected_team = st.selectbox("Select Team:", team_list)
|
|
|
|
|
|
|
|
|
team_skills = df_teams[df_teams["Team Name"] == selected_team]["Skills"].tolist()
|
|
|
unique_skills = list(set(skill.strip() for sublist in team_skills for skill in sublist.split(",")))
|
|
|
|
|
|
|
|
|
def recommend_hackathons(skills, hackathon_data, difficulty, mode, date_range, sort_option):
|
|
|
recommendations = []
|
|
|
for _, row in hackathon_data.iterrows():
|
|
|
required_skills = row["Required Skills"].split(",")
|
|
|
required_skills = [skill.strip().title() for skill in required_skills]
|
|
|
|
|
|
matched_skills = [skill for skill in skills if skill in required_skills]
|
|
|
if matched_skills:
|
|
|
|
|
|
if difficulty != "All" and row["Difficulty Level"] != difficulty:
|
|
|
continue
|
|
|
if mode != "All" and row["Mode"] != mode:
|
|
|
continue
|
|
|
if not (date_range[0] <= row["Event Date"].date() <= date_range[1]):
|
|
|
continue
|
|
|
|
|
|
recommendations.append({
|
|
|
"Hackathon Name": row["Hackathon Name"],
|
|
|
"Organizer": row["Organizer"],
|
|
|
"Prize Pool ($)": f"${row['Prize Pool']:,.0f}",
|
|
|
"Registration Deadline": row["Registration Deadline"].strftime('%Y-%m-%d'),
|
|
|
"Matched Skills": len(matched_skills)
|
|
|
})
|
|
|
|
|
|
|
|
|
recommendations.sort(key=lambda x: x["Matched Skills"], reverse=True)
|
|
|
|
|
|
|
|
|
if sort_option == "Prize Pool (High to Low)":
|
|
|
recommendations.sort(key=lambda x: float(x["Prize Pool ($)"].replace("$", "").replace(",", "")), reverse=True)
|
|
|
elif sort_option == "Registration Deadline (Soonest First)":
|
|
|
recommendations.sort(key=lambda x: x["Registration Deadline"])
|
|
|
|
|
|
|
|
|
df_recommendations = pd.DataFrame(recommendations).drop(columns=["Matched Skills"])
|
|
|
|
|
|
|
|
|
return df_recommendations.head(10)
|
|
|
|
|
|
|
|
|
if unique_skills:
|
|
|
recommendations_df = recommend_hackathons(unique_skills, df_hackathons, difficulty, mode, date_range, sort_option)
|
|
|
if not recommendations_df.empty:
|
|
|
st.success(f"### β
Recommended Hackathons for **{selected_team}**")
|
|
|
st.dataframe(recommendations_df)
|
|
|
else:
|
|
|
st.warning("β οΈ No matching hackathons found. Try different filters.")
|
|
|
else:
|
|
|
st.warning("β οΈ No skills found for this team.")
|
|
|
|
|
|
|
|
|
st.markdown("---")
|
|
|
st.write("π― **Built with Streamlit | AI-Powered Hackathon Finder**")
|
|
|
|