James McCool commited on
Commit
85f2b5f
·
1 Parent(s): 8e0da46

Add unmatched names warning in app.py: implement logic to identify and display portfolio names without matches in projections, enhancing user feedback and improving data validation during the matching process.

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -148,6 +148,7 @@ with tab1:
148
 
149
  # Create match dictionary for portfolio names to projection names
150
  portfolio_match_dict = {}
 
151
  for portfolio_name in st.session_state['portfolio_names']:
152
  match = process.extractOne(
153
  portfolio_name,
@@ -158,6 +159,7 @@ with tab1:
158
  portfolio_match_dict[portfolio_name] = match[0]
159
  else:
160
  portfolio_match_dict[portfolio_name] = portfolio_name
 
161
 
162
  # Update portfolio with matched names
163
  portfolio = st.session_state['portfolio'].copy()
@@ -216,7 +218,12 @@ with tab1:
216
  projections['upload_match'] = projections['player_names'].map(match_dict)
217
  st.session_state['export_dict'] = match_dict
218
 
219
- st.write(st.session_state['export_dict'])
 
 
 
 
 
220
  st.session_state['origin_portfolio'] = st.session_state['portfolio'].copy()
221
 
222
  # with tab2:
 
148
 
149
  # Create match dictionary for portfolio names to projection names
150
  portfolio_match_dict = {}
151
+ unmatched_names = []
152
  for portfolio_name in st.session_state['portfolio_names']:
153
  match = process.extractOne(
154
  portfolio_name,
 
159
  portfolio_match_dict[portfolio_name] = match[0]
160
  else:
161
  portfolio_match_dict[portfolio_name] = portfolio_name
162
+ unmatched_names.append(portfolio_name)
163
 
164
  # Update portfolio with matched names
165
  portfolio = st.session_state['portfolio'].copy()
 
218
  projections['upload_match'] = projections['player_names'].map(match_dict)
219
  st.session_state['export_dict'] = match_dict
220
 
221
+ if unmatched_names:
222
+ st.warning(f"Found {len(unmatched_names)} names in portfolio without matches in projections:")
223
+ for name in unmatched_names:
224
+ st.write(f"- {name}")
225
+ else:
226
+ st.success("All portfolio names were matched to projections!")
227
  st.session_state['origin_portfolio'] = st.session_state['portfolio'].copy()
228
 
229
  # with tab2: