Spaces:
Runtime error
Runtime error
some context
Browse files
app.R
CHANGED
|
@@ -22,6 +22,11 @@ ui <- page_sidebar(
|
|
| 22 |
fillable = FALSE, # do not squeeze to vertical screen space
|
| 23 |
tags$head(css),
|
| 24 |
titlePanel("Demo App"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
card(
|
| 26 |
layout_columns(
|
| 27 |
textInput("chat",
|
|
@@ -66,6 +71,29 @@ ui <- page_sidebar(
|
|
| 66 |
)
|
| 67 |
),
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
),
|
| 70 |
|
| 71 |
sidebar = sidebar(
|
|
@@ -178,8 +206,8 @@ server <- function(input, output, session) {
|
|
| 178 |
chart2 <- df |>
|
| 179 |
rename(social_vulnerability = y_axis) |>
|
| 180 |
ggplot(aes(social_vulnerability)) +
|
| 181 |
-
geom_density(fill="darkred") +
|
| 182 |
-
xlim(c(0,1)) +
|
| 183 |
ggtitle("Vulnerability of selected areas")
|
| 184 |
|
| 185 |
output$chart2 <- renderPlot(chart2)
|
|
|
|
| 22 |
fillable = FALSE, # do not squeeze to vertical screen space
|
| 23 |
tags$head(css),
|
| 24 |
titlePanel("Demo App"),
|
| 25 |
+
|
| 26 |
+
"This is a proof-of-principle for a simple chat-driven interface to dynamically explore geospatial data.
|
| 27 |
+
",
|
| 28 |
+
|
| 29 |
+
|
| 30 |
card(
|
| 31 |
layout_columns(
|
| 32 |
textInput("chat",
|
|
|
|
| 71 |
)
|
| 72 |
),
|
| 73 |
|
| 74 |
+
card(
|
| 75 |
+
card_header("Errata"),
|
| 76 |
+
markdown(
|
| 77 |
+
"
|
| 78 |
+
#### Credits
|
| 79 |
+
|
| 80 |
+
Developed by Carl Boettiger, UC Berkeley, 2025. BSD License.
|
| 81 |
+
|
| 82 |
+
Data from the US Census and CDC's [Social Vulnerability Index](https://www.atsdr.cdc.gov/place-health/php/svi/index.html)
|
| 83 |
+
|
| 84 |
+
#### Technical details
|
| 85 |
+
|
| 86 |
+
The app is written entirely in R using shiny. The app will translate natural language queries in SQL code using
|
| 87 |
+
a small open-weights language model. The SQL code is executed using the duckdb backend against cloud-native
|
| 88 |
+
geoparquet snapshot of the Social Vulnerability Index hosted on Source Cooperative. Summary chart data are also
|
| 89 |
+
computed in duckdb by streaming, providing responsive updates while needing minimal RAM or disk storage despite
|
| 90 |
+
the large size of the data sources.
|
| 91 |
+
|
| 92 |
+
The map is rendered and updated using MapLibre with PMTiles, which provides responsive rendering for large feature sets.
|
| 93 |
+
The PMTiles layer is also hosted on Source cooperative where it can be streamed efficiently.
|
| 94 |
+
")
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
),
|
| 98 |
|
| 99 |
sidebar = sidebar(
|
|
|
|
| 206 |
chart2 <- df |>
|
| 207 |
rename(social_vulnerability = y_axis) |>
|
| 208 |
ggplot(aes(social_vulnerability)) +
|
| 209 |
+
geom_density(fill = "darkred") +
|
| 210 |
+
xlim(c(0, 1)) +
|
| 211 |
ggtitle("Vulnerability of selected areas")
|
| 212 |
|
| 213 |
output$chart2 <- renderPlot(chart2)
|