diff --git a/data/sample.csv b/data/sample.csv new file mode 100644 index 000000000..6adab346b --- /dev/null +++ b/data/sample.csv @@ -0,0 +1,11 @@ +decimalLatitude,decimalLongitude,speciesQueried,country,year,lifeStage +-3.4653,-62.2159,Callithrix jacchus,Brazil,2018,Adult +-4.2121,-63.0012,Callithrix penicillata,Brazil,2019,Juvenile +5.0000,-74.0000,Cebuella pygmaea,Colombia,2017,Adult +-1.4563,-78.9874,Leontopithecus rosalia,Ecuador,2020,Subadult +-12.4634,-55.6658,Saguinus oedipus,Brazil,2016,Adult +2.0500,-75.2500,Saguinus mystax,Colombia,2021,Juvenile +-9.1900,-67.8280,Leontopithecus chrysomelas,Brazil,2015,Adult +0.0000,-60.0000,Callithrix geoffroyi,Venezuela,2019,Subadult +4.5709,-74.2973,Cebuella pygmaea,Colombia,2022,Adult +-15.7797,-47.9297,Callithrix jacchus,Brazil,2023,Juvenile diff --git a/hello.py b/hello.py new file mode 100644 index 000000000..4f191c861 --- /dev/null +++ b/hello.py @@ -0,0 +1,83 @@ +import pandas as pd +import plotly.express as px +import preswald + +# Load dataset +df = pd.read_csv('data/sample.csv') + +# Geographic Scatter Plot +fig = px.scatter_geo( + df, + lat="decimalLatitude", + lon="decimalLongitude", + hover_name="speciesQueried", + color="country", + title="Geographical Distribution of Callitrichidae Specimens", + projection="natural earth" +) + +# Density Heatmap +hotspot_map = px.density_mapbox( + df, + lat="decimalLatitude", + lon="decimalLongitude", + radius=8, + zoom=3, + color_continuous_scale="Viridis", + mapbox_style="carto-positron", + title="Spatial Density Analysis of Callitrichidae Populations" +) + +# Species Richness Bar Chart +richness = df.groupby("country")["speciesQueried"].nunique().reset_index(name="richness") +richness_plot = px.bar( + richness.sort_values("richness", ascending=False), + x="country", + y="richness", + title="Callitrichidae Species Richness by Geographic Region" +) + +# Hierarchical Distribution TreeMap +df_treemap = df.groupby(["country", "speciesQueried"]).size().reset_index(name="count") +treemap_plot = px.treemap( + df_treemap, + path=["country", "speciesQueried"], + values="count", + color="count", + title="Taxonomic and Geographic Distribution of Callitrichidae Specimens" +) + +# Life Stage Trend Line Plot +life_stage_trend = df[df["lifeStage"].notna() & (df["lifeStage"].str.lower() != "unknown")] +life_stage_plot_data = life_stage_trend.groupby(["year", "lifeStage"]).size().reset_index(name="count") +life_stage_plot = px.line( + life_stage_plot_data, + x="year", + y="count", + color="lifeStage", + title="Ontogenetic Distribution of Callitrichidae Observations: Temporal Analysis" +) + +# ───────────────────── Display on Preswald UI ───────────────────── + +preswald.text("# 🐒 Biogeographical Analysis of Callitrichidae Distribution Patterns") + +preswald.text("## 📍 Spatial Distribution Analysis") +preswald.text("Figure 1 shows the global locations of documented Callitrichidae specimens by country.") +preswald.plotly(fig) + +preswald.text("## 🌐 Population Density Assessment") +preswald.text("Figure 2 estimates specimen density and helps identify biodiversity hotspots.") +preswald.plotly(hotspot_map) + +preswald.text("## 🌱 Species Richness Evaluation") +preswald.text("Figure 3 shows how many unique species were observed per country.") +preswald.plotly(richness_plot) + +preswald.text("## 🧬 Taxonomic Distribution by Region") +preswald.text("Figure 4 illustrates taxonomic and geographic spread using a hierarchical treemap.") +preswald.plotly(treemap_plot) + +preswald.text("## 📈 Ontogenetic Temporal Distribution") +preswald.text("Figure 5 tracks specimen counts by life stage over time.") +preswald.plotly(life_stage_plot) diff --git a/images/favicon.ico b/images/favicon.ico new file mode 100644 index 000000000..5a7871528 Binary files /dev/null and b/images/favicon.ico differ diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 000000000..b777479c2 Binary files /dev/null and b/images/logo.png differ diff --git a/preswald.toml b/preswald.toml new file mode 100644 index 000000000..be86e1824 --- /dev/null +++ b/preswald.toml @@ -0,0 +1,20 @@ +[project] +title = "Preswald Project" +version = "0.1.0" +port = 8501 +slug = "my-app-839952" +entrypoint = "hello.py" + +[branding] +name = "Preswald Project" +logo = "images/logo.png" +favicon = "images/favicon.ico" +primaryColor = "#F89613" + +[data.sample_csv] +type = "csv" +path = "data/sample.csv" + +[logging] +level = "INFO" +format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" diff --git a/secrets.toml b/secrets.toml new file mode 100644 index 000000000..688f4e3ca --- /dev/null +++ b/secrets.toml @@ -0,0 +1,2 @@ +# Store your sensitive configuration here +# This file is gitignored by default \ No newline at end of file