Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions data/sample.csv
Original file line number Diff line number Diff line change
@@ -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
83 changes: 83 additions & 0 deletions hello.py
Original file line number Diff line number Diff line change
@@ -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)
Binary file added images/favicon.ico
Binary file not shown.
Binary file added images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions preswald.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions secrets.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Store your sensitive configuration here
# This file is gitignored by default