diff --git a/README.md b/README.md index bf52c41..bf3c1b0 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,14 @@ -# Tapyr - Shiny for Python Application TemplateTapyr logo +# Respiratory Disease: Tapyr Version -> Create and deploy enterprise-ready PyShiny dashboards with ease. +This repository contains the tapyr migration of [the pure PyShiny Respiratory Disease dashboard](https://github.com/Appsilon/respiratory_disease_pyshiny), which originates from the R/Shiny version [Respiratory Disease app](https://connect.appsilon.com/respiratory_disease_app_sprint/). +The `main` branch contains the migrated and updated version of the app, while the `original` branch contains the original version of the app migrated to the Tapyr template with minimal effort. -# WIP: Not the final version of README. +## Explore the app +The app is deployed at [Appsilon Posit Connect](https://connect.appsilon.com/respiratory_disease_pyshiny/). -## Introduction +## How to run -Tapyr is designed for data scientists and developers seeking a seamless transition from development to deployment, this template uses `poetry` for dependency management and `pytest`/`playwright` for comprehensive app validation/testing/quality assurance. -Ideal for projects aiming for high-quality code and efficient deployment on Posit Connect. - -## Docs - -For comprehensive documentation, please visit our [documentation TODO](TODO). - -## Getting Started - -Check out our get started with `tapyr` [blog post TODO](TOOD). +(This section is copied from the tapyr template) ### Using Devcontainer diff --git a/respiratory_disease_tapyr/helpers/map_utils.py b/respiratory_disease_tapyr/helpers/map_utils.py index 12d14f6..b3278cc 100644 --- a/respiratory_disease_tapyr/helpers/map_utils.py +++ b/respiratory_disease_tapyr/helpers/map_utils.py @@ -57,14 +57,14 @@ def add_circles(geodata: DataFrame, circle_layer: LayerGroup) -> None: circle_layer.clear_layers() circle_markers = [] for _, row in geodata.iterrows(): - popup = HTML(f"{row.Entity}:
" + str(round(row["Death.Rate"], 2))) + popup = HTML(f"{row.Entity}:
" + str(round(float(row["Death.Rate"]), 2))) circle_marker = CircleMarker( location=[row["lat"], row["lng"]], - radius=determine_circle_radius(row["Death.Rate"]), + radius=determine_circle_radius(float(row["Death.Rate"])), weight=1, color="white", opacity=0.7, - fill_color=determine_circle_color(row["PM2.5"]), + fill_color=determine_circle_color(float(row["PM2.5"])), fill_opacity=0.5, popup=popup, ) @@ -107,7 +107,7 @@ def add_polygons( def filter_data(data: DataFrame, year: int) -> DataFrame: - return data[data["Year"] == year] + return data.loc[data["Year"] == year] def dataframe_to_geojson(df: DataFrame) -> dict: diff --git a/respiratory_disease_tapyr/helpers/plot_utils.py b/respiratory_disease_tapyr/helpers/plot_utils.py index cd257d7..d8f3c7a 100644 --- a/respiratory_disease_tapyr/helpers/plot_utils.py +++ b/respiratory_disease_tapyr/helpers/plot_utils.py @@ -11,8 +11,8 @@ def create_figure( title: str, labels: dict, ) -> go.FigureWidget: - plot_data = data[data["Year"].between(year_range[0], year_range[1])] - plot_data = plot_data[plot_data["Entity"].isin(country)] + plot_data = data.loc[data["Year"].between(year_range[0], year_range[1])] + plot_data = plot_data.loc[plot_data["Entity"].isin(country)] fig = px.line( data_frame=plot_data,