diff --git a/examples/startup_funding_tracker/README.md b/examples/startup_funding_tracker/README.md new file mode 100644 index 00000000..f70bc17f --- /dev/null +++ b/examples/startup_funding_tracker/README.md @@ -0,0 +1,16 @@ +# 🚀 Startup Funding Tracker with Preswald + +This interactive dashboard visualizes startup funding data, offering insights into funding distribution across industries, funding rounds, and years. + +## 🔧 Setup Instructions + +1. **Add your data** + Place the `funding.csv` file inside the `data/` directory. + +2. **Configure the data source** + Open the `preswald.toml` file and set the data source to point to your CSV. + +3. **Run the dashboard** + Use the following command to start the app: + ```bash + preswald run hello.py \ No newline at end of file diff --git a/examples/startup_funding_tracker/data/funding.csv b/examples/startup_funding_tracker/data/funding.csv new file mode 100644 index 00000000..b7d02902 --- /dev/null +++ b/examples/startup_funding_tracker/data/funding.csv @@ -0,0 +1,21 @@ +startup,round,amount_million,industry,year +Notion,Series B,50,Productivity,2019 +Figma,Series C,100,Design,2020 +Zapier,Series A,20,Automation,2016 +Miro,Series D,250,Collaboration,2022 +OpenAI,Series A,1000,AI,2023 +Stripe,Series E,600,Fintech,2021 +Linear,Seed,5,Developer Tools,2020 +Runway,Series A,35,AI,2021 +Replit,Series B,80,Developer Tools,2022 +Anthropic,Series B,450,AI,2023 +ClickUp,Series C,200,Productivity,2021 +Vercel,Series B,150,Developer Tools,2022 +Airtable,Series D,270,Collaboration,2020 +Cohere,Series A,125,AI,2022 +Plaid,Series C,425,Fintech,2019 +Loom,Series B,60,Collaboration,2019 +Coda,Series C,110,Productivity,2021 +Runpod,Seed,2,Infrastructure,2023 +Hugging Face,Series C,235,AI,2022 +Segment,Series B,64,Data Tools,2017 \ No newline at end of file diff --git a/examples/startup_funding_tracker/hello.py b/examples/startup_funding_tracker/hello.py new file mode 100644 index 00000000..b22cf19d --- /dev/null +++ b/examples/startup_funding_tracker/hello.py @@ -0,0 +1,70 @@ +import pandas as pd +import plotly.express as px + +from preswald import get_df, plotly, table, text + + +# Title & Intro +text("# 🚀 Startup Funding Tracker") +text("Visualize startup funding trends across industries and years.") + +# Load data +df = get_df("startup_data") + +# Show sample data +table(df) + +# 📊 Summary statistics +df["amount_million"] = pd.to_numeric(df["amount_million"], errors="coerce") +total_funding = df["amount_million"].sum() +unique_startups = df["startup"].nunique() +years = f"{df['year'].min()} - {df['year'].max()}" + +text(f"**Total Funding:** ${total_funding:,.2f}M") +text(f"**Unique Startups:** {unique_startups}") +text(f"**Years Covered:** {years}") + +# 💼 Funding Amount by Industry +text("## 💼 Funding Amount by Industry") +df_industry = df.groupby("industry", as_index=False)["amount_million"].sum() +fig1 = px.bar( + df_industry, + x="industry", + y="amount_million", + color="industry", + title="Total Funding by Industry", + labels={"amount_million": "Funding (in $M)"}, + color_discrete_sequence=px.colors.qualitative.Safe, +) +fig1.update_layout(template="plotly_white", title_x=0.5) +fig1.update_yaxes(tickprefix="$", separatethousands=True) +plotly(fig1) + +# 📈 Funding Trends Over Time +text("## 📈 Funding Trends Over Time") +df_trend = df.groupby(["year", "industry"], as_index=False)["amount_million"].sum() +fig2 = px.line( + df_trend, + x="year", + y="amount_million", + color="industry", + markers=True, + title="Annual Funding by Industry", + labels={"amount_million": "Funding (in $M)"}, + color_discrete_sequence=px.colors.qualitative.Safe, +) +fig2.update_layout(template="plotly_white", title_x=0.5) +fig2.update_yaxes(tickprefix="$", separatethousands=True) +plotly(fig2) + +# 🌀 Funding Round Distribution +text("## 🌀 Funding Rounds Distribution") +fig3 = px.pie( + df, + names="round", + values="amount_million", + title="Distribution of Funding Rounds", + color_discrete_sequence=px.colors.qualitative.Safe, +) +fig3.update_traces(textinfo="percent+label") +plotly(fig3) diff --git a/examples/startup_funding_tracker/images/favicon.ico b/examples/startup_funding_tracker/images/favicon.ico new file mode 100644 index 00000000..5a787152 Binary files /dev/null and b/examples/startup_funding_tracker/images/favicon.ico differ diff --git a/examples/startup_funding_tracker/images/logo.png b/examples/startup_funding_tracker/images/logo.png new file mode 100644 index 00000000..b777479c Binary files /dev/null and b/examples/startup_funding_tracker/images/logo.png differ diff --git a/examples/startup_funding_tracker/preswald.toml b/examples/startup_funding_tracker/preswald.toml new file mode 100644 index 00000000..5447385f --- /dev/null +++ b/examples/startup_funding_tracker/preswald.toml @@ -0,0 +1,20 @@ +[project] +title = "Startup Funding Tracker" +version = "0.1.0" +port = 8501 +slug = "startup-funding" +entrypoint = "hello.py" + +[branding] +name = "Startup Funding Tracker" +logo = "images/logo.png" +favicon = "images/favicon.ico" +primaryColor = "#4CAF50" + +[data.startup_data] +type = "csv" +path = "data/funding.csv" + +[logging] +level = "INFO" +format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" diff --git a/examples/startup_funding_tracker/pyproject.toml b/examples/startup_funding_tracker/pyproject.toml new file mode 100644 index 00000000..fb8d95cb --- /dev/null +++ b/examples/startup_funding_tracker/pyproject.toml @@ -0,0 +1,24 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "startup-tracker" +version = "0.1.0" +description = "A Preswald dashboard for startup funding insights" +requires-python = ">=3.8" +dependencies = [ + "preswald==0.1.33", + "duckdb==1.1.3" +] + +[tool.black] +line-length = 88 +target-version = ['py38'] + +[tool.isort] +profile = "black" +multi_line_output = 3 + +[tool.hatch.build.targets.wheel] +packages = ["."]