Skip to content

Commit

Permalink
include teams with no games
Browse files Browse the repository at this point in the history
  • Loading branch information
sborms committed Oct 17, 2023
1 parent b4b98c2 commit e96c485
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.ruff_cache/
.streamlit/
data/
spielerei/
logs/
zzz.ipynb

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

:mega: Do you desire to receive jolly tactical advice?

**Futsal Friend** is a small web application built using player and competition data from [Liefhebbers Zaalvoetbal Cup](https://www.lzvcup.be/) (LZV Cup), a Belgian futsal organisation counting over 900 teams. Its usefulness is not limited to players from one of the LZV Cup leagues.
**Futsal Friend** is a small [web application](https://futsalfriend.streamlit.app) built using player and competition data from [Liefhebbers Zaalvoetbal Cup](https://www.lzvcup.be) (LZV Cup), a Belgian futsal organisation counting over 900 teams. Its usefulness is not limited to players from one of the LZV Cup leagues.

## Scraping

The data comes from the [lzvcup.be](https://www.lzvcup.be/) website. Scraping it goes according to the steps defined here.
The data comes from the [lzvcup.be](https://www.lzvcup.be) website. Scraping it goes according to the steps defined here.
- **Step 1** - Define a set of main URLs in a config file. Each URL represents a region, which will serve as the starting point. See the `config.json` file.
- **Step 2** - For each of the areas, go to the URL and grab the so-called region cards which list the competitions and sportshalls in every region. Then extract the URLs for the respective _competitions_ pages (e.g. 2e Klasse) and the single URL for the overview of sportshalls page.
- **Step 3** - Go to each competition's URL and gather following information:
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scraper/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
"standings": [["area", "region", "competition", "team"], []],
"palmares": [["team", "seizoen", "reeks", "positie"], ["area", "region", "competition"]]
},
"database": "webapp/futsalfriend.db"
"database": "database/futsalfriend.db"
}
8 changes: 5 additions & 3 deletions webapp/ui/friendly.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def make_page_spot_friendly(conn, df_teams):
step=1.0,
format="%.1f",
)
level = col4.selectbox("Level", levels.keys())
level = col4.selectbox("Level", levels.keys(), index=2)
horizon = col5.number_input("When (< days)?", value=14, min_value=3, max_value=30)

today = datetime.today().strftime("%Y-%m-%d")
Expand All @@ -65,8 +65,10 @@ def make_page_spot_friendly(conn, df_teams):
df_out = filter_teams(df_teams, city, address, km)

# join tables together
df_out = df_out.merge(df_n_games, on="team", how="inner").merge(
df_levels, on="team", how="inner"
df_out = (
df_out.merge(df_n_games, on="team", how="left")
.fillna(0) # set no games to 0
.merge(df_levels, on="team", how="inner")
)
if len(df_out) == 0:
st.warning("No teams found for the specified parameters. Try something else!")
Expand Down
2 changes: 1 addition & 1 deletion webapp/ui/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def make_page_join_team(df_teams):
address = col2.text_input("Address", "Nieuwstraat")
km = col3.number_input(
"Distance (in km)",
value=5.0,
value=2.0,
min_value=1.0,
max_value=50.0,
step=1.0,
Expand Down

0 comments on commit e96c485

Please sign in to comment.