SR05 commited on
Commit
033f1de
1 Parent(s): df8b191

Update search.py

Browse files
Files changed (1) hide show
  1. search.py +6 -6
search.py CHANGED
@@ -1,12 +1,11 @@
1
  import pandas as pd
2
  import streamlit as st
3
 
4
-
5
  def search_application(user_application_number, df):
6
- # Convert Application Number to string for uniform comparison
7
  df['Application Number'] = df['Application Number'].astype(str)
8
 
9
- # Search for the user application number in the dataframe
10
  result = df[df['Application Number'] == user_application_number]
11
 
12
  if not result.empty:
@@ -18,13 +17,14 @@ def search_application(user_application_number, df):
18
  else:
19
  st.warning(f"Your visa application ({user_application_number}) has a status of '{decision}'.")
20
  else:
 
21
  st.warning(f"No record found for Application Number: {user_application_number}.")
22
 
23
- # Debugging: Display the first few rows to verify if data is loaded correctly
24
  st.write("First few rows of the dataset for verification:")
25
- st.write(df.head())
26
 
27
- # Convert Application Numbers to integers for comparison
28
  df['Application Number'] = df['Application Number'].astype(int)
29
  try:
30
  user_application_number_int = int(user_application_number)
 
1
  import pandas as pd
2
  import streamlit as st
3
 
 
4
  def search_application(user_application_number, df):
5
+ # Ensure the Application Number column is treated as string for consistent comparison
6
  df['Application Number'] = df['Application Number'].astype(str)
7
 
8
+ # Search for the application number in the dataframe
9
  result = df[df['Application Number'] == user_application_number]
10
 
11
  if not result.empty:
 
17
  else:
18
  st.warning(f"Your visa application ({user_application_number}) has a status of '{decision}'.")
19
  else:
20
+ # When no record is found, show a warning
21
  st.warning(f"No record found for Application Number: {user_application_number}.")
22
 
23
+ # Debugging: Show first few rows only when necessary
24
  st.write("First few rows of the dataset for verification:")
25
+ st.write(df.head()) # Display the data only for debugging purposes
26
 
27
+ # Convert application number to integer for the nearest calculation
28
  df['Application Number'] = df['Application Number'].astype(int)
29
  try:
30
  user_application_number_int = int(user_application_number)