Skip to content

Commit

Permalink
refactor: make pyright happy
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorozenko committed Apr 29, 2024
1 parent 165a605 commit ea0b4c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# Tapyr - Shiny for Python Application Template<a href="https://appsilon.github.io/tapyr-template/"><img src="www/images/tapyr.png" align="right" alt="Tapyr logo" style="height: 140px;"></a>
# 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

Expand Down
8 changes: 4 additions & 4 deletions respiratory_disease_tapyr/helpers/map_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"<b>{row.Entity}:</b></br>" + str(round(row["Death.Rate"], 2)))
popup = HTML(f"<b>{row.Entity}:</b></br>" + 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,
)
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions respiratory_disease_tapyr/helpers/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ea0b4c2

Please sign in to comment.