Jon Solow commited on
Commit
f18ed57
·
1 Parent(s): 5509410

Add multipage with rules

Browse files
README.md CHANGED
@@ -5,7 +5,7 @@ colorFrom: indigo
5
  colorTo: blue
6
  sdk: streamlit
7
  sdk_version: 1.25.0
8
- app_file: src/streamlit_app.py
9
  pinned: false
10
  ---
11
 
 
5
  colorTo: blue
6
  sdk: streamlit
7
  sdk_version: 1.25.0
8
+ app_file: src/Home.py
9
  pinned: false
10
  ---
11
 
src/Home.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ from config import LEAGUE_NAME
4
+
5
+
6
+ def get_app():
7
+ keeper_title = f"{LEAGUE_NAME}"
8
+ st.set_page_config(page_title=keeper_title, initial_sidebar_state="expanded")
9
+
10
+ st.markdown(f"""
11
+ Welcome {LEAGUE_NAME}!
12
+
13
+ Navigate between pages using the left sidebar.
14
+
15
+ """)
16
+
17
+
18
+ if __name__ == "__main__":
19
+ get_app()
src/config.py ADDED
@@ -0,0 +1 @@
 
 
1
+ LEAGUE_NAME = "LOFG"
src/{streamlit_app.py → pages/1_Keepers.py} RENAMED
@@ -1,15 +1,15 @@
1
  import os
2
- import streamlit as st
3
  import pandas as pd
 
4
 
 
5
 
6
- LEAGUE_NAME = "LOFG"
7
- DATA_URL = "../tests/mocks/2023_keepers.csv"
8
 
 
9
 
10
  @st.cache_data
11
  def load_data():
12
- data = pd.read_csv(os.path.join(os.path.dirname(__file__), DATA_URL), index_col=0)
13
  # Hack to get position, replace with better position from yahoo api in future
14
  data["position"] = data["eligible_positions"].apply(lambda x: eval(x)[0])
15
  data.columns = data.columns.str.lower()
@@ -38,8 +38,10 @@ def filtered_keeper_dataframe(data: pd.DataFrame, teams_list: list[str]):
38
  )
39
 
40
 
41
- def get_app():
42
- st.title(f"{LEAGUE_NAME} Keeper Options")
 
 
43
  data, teams_list = load_data()
44
 
45
  with st.container():
@@ -47,4 +49,4 @@ def get_app():
47
 
48
 
49
  if __name__ == "__main__":
50
- get_app()
 
1
  import os
 
2
  import pandas as pd
3
+ import streamlit as st
4
 
5
+ from config import LEAGUE_NAME
6
 
 
 
7
 
8
+ KEEPER_DATA_URL = "../../tests/mocks/2023_keepers.csv"
9
 
10
  @st.cache_data
11
  def load_data():
12
+ data = pd.read_csv(os.path.join(os.path.dirname(__file__), KEEPER_DATA_URL), index_col=0)
13
  # Hack to get position, replace with better position from yahoo api in future
14
  data["position"] = data["eligible_positions"].apply(lambda x: eval(x)[0])
15
  data.columns = data.columns.str.lower()
 
38
  )
39
 
40
 
41
+ def get_keeper_app():
42
+ keeper_title = f"{LEAGUE_NAME} Keeper Options"
43
+ st.set_page_config(page_title=keeper_title, initial_sidebar_state="collapsed")
44
+ st.title(keeper_title)
45
  data, teams_list = load_data()
46
 
47
  with st.container():
 
49
 
50
 
51
  if __name__ == "__main__":
52
+ get_keeper_app()
src/pages/2_Rules.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+
4
+ st.title("LOFG Keeper Rules")
5
+ st.markdown(
6
+ """
7
+ ***Note: First LOFG keeper season was 2019***
8
+
9
+ 1. Teams can keep up to 3 players from the prior season.
10
+ - Note: changed from 2 to 3 beginning with 2022 season
11
+ 2. Players are kept at the expense of a draft pick. The round of that draft pick will depend on when the player was drafted in the prior season.
12
+ 3. Players drafted in the 1st round of the prior season will not be eligible to keep.
13
+ 4. Players drafted in rounds 2 and after can be kept at the expense of one higher round (ex: player drafted in round 2 can be kept for your 1st round pick).
14
+ 5. Players who were not drafted and were picked up during the season can be kept for 10th round picks (Free Agent Keeper cost)
15
+ - Changed beginning 2022 from 9th round
16
+ 6.Free Agent Keeper Cost Minimum - Players drafted by other teams who were dropped and picked up are still considered to have been drafted at that position, but any picks later than the Free Agent Keeper cost as the Free Agent Keeper cost.
17
+ - (This is to reward people who actually drafted the players, versus those who picked them up off waivers).
18
+ 7. If you select 2 players who would both count as the same round in the draft, one of the players would count as one round higher. (For example, if you were to select two players who both counted as a 9th round pick, one of those players would instead be counted as your 8th round pick.)
19
+ 8. Players can not be kept for more than 2 consecutive seasons
20
+ - Example: player drafted in 2019 in 6th round, kept in 2020 for 5th round, and kept in 2021 for 4th round - can't be kept in 2022
21
+ - Exception to the above rule is that players originally drafted in 2nd round can only be kept for one season (since they count as 1st round picks in the following year and cannot be kept again by rule 3).
22
+ 9. Players traded in a season are not subject to the Free Agent Keeper Cost minimum cost
23
+ In other words, keeper rights transfer with the trade
24
+
25
+ """
26
+ )
src/start.sh CHANGED
@@ -1,3 +1,3 @@
1
  #!/bin/bash
2
 
3
- streamlit run streamlit_app.py --server.port=8501 --server.address=0.0.0.0
 
1
  #!/bin/bash
2
 
3
+ streamlit run Home.py --server.port=8501 --server.address=0.0.0.0