|
|
|
"""Copy of Visa_decision.ipynb |
|
|
|
Automatically generated by Colab. |
|
|
|
Original file is located at |
|
https://colab.research.google.com/drive/1adoBwMAeDiJsePxTmnMcatkjYw3RyJpm |
|
""" |
|
|
|
|
|
|
|
|
|
|
|
import requests |
|
import pandas as pd |
|
from io import BytesIO |
|
from bs4 import BeautifulSoup |
|
|
|
|
|
|
|
|
|
|
|
|
|
def display_application_decision(): |
|
"""Displays the application decision in an HTML table based on user input.""" |
|
|
|
application_number = input("Enter your Application Number: ") |
|
|
|
try: |
|
application_number = int(application_number) |
|
except ValueError: |
|
print("Invalid input. Please enter a valid application number.") |
|
return |
|
|
|
|
|
row = df[df['Application Number'] == application_number] |
|
|
|
if not row.empty: |
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
</tr> |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
</table> |
|
</body> |
|
</html> |
|
""".format(row['Application Number'].iloc[0], row['Decision'].iloc[0]) |
|
|
|
|
|
from IPython.display import HTML |
|
display(HTML(html_table)) |
|
else: |
|
print("Application number not found in the data.") |
|
|
|
|
|
|
|
display_application_decision() |
|
|
|
|
|
|
|
import requests |
|
import pandas as pd |
|
from io import BytesIO |
|
from bs4 import BeautifulSoup |
|
from IPython.display import HTML |
|
|
|
|
|
|
|
|
|
|
|
|
|
def display_application_decision(): |
|
"""Displays the application decision in an HTML table based on user input.""" |
|
|
|
application_number = input("Enter your Application Number: ") |
|
|
|
try: |
|
application_number = int(application_number) |
|
except ValueError: |
|
print("Invalid input. Please enter a valid application number.") |
|
return |
|
|
|
|
|
row = df[df['Application Number'] == application_number] |
|
|
|
if not row.empty: |
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
</tr> |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
</table> |
|
</body> |
|
</html> |
|
""".format(row['Application Number'].iloc[0], row['Decision'].iloc[0]) |
|
|
|
|
|
display(HTML(html_table)) |
|
else: |
|
|
|
df['Difference'] = abs(df['Application Number'] - application_number) |
|
nearest_records = df.nsmallest(2, 'Difference') |
|
|
|
if not nearest_records.empty: |
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<h3>Application number not found. Showing nearest records:</h3> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
<th>Difference</th> |
|
</tr> |
|
""" |
|
for _, row in nearest_records.iterrows(): |
|
html_table += """ |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
""".format(row['Application Number'], row['Decision'], row['Difference']) |
|
|
|
html_table += """ |
|
</table> |
|
</body> |
|
</html> |
|
""" |
|
|
|
display(HTML(html_table)) |
|
else: |
|
print("Application number not found, and no nearest records found in the data.") |
|
|
|
|
|
|
|
display_application_decision() |
|
|
|
import requests |
|
import pandas as pd |
|
from io import BytesIO |
|
from bs4 import BeautifulSoup |
|
from IPython.display import HTML |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def display_application_decision(): |
|
"""Displays the application decision in an HTML table based on user input.""" |
|
|
|
application_number = input("Enter your Application Number: ") |
|
|
|
try: |
|
application_number = int(application_number) |
|
except ValueError: |
|
print("Invalid input. Please enter a valid application number.") |
|
return |
|
|
|
|
|
row = df[df['Application Number'] == application_number] |
|
|
|
if not row.empty: |
|
|
|
if row['Decision'].iloc[0] == 'Approved': |
|
print("Congratulations! Your Visa application has been approved.") |
|
|
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
</tr> |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
</table> |
|
</body> |
|
</html> |
|
""".format(row['Application Number'].iloc[0], row['Decision'].iloc[0]) |
|
|
|
|
|
display(HTML(html_table)) |
|
else: |
|
print("Application number", application_number, "not found in the data.") |
|
|
|
|
|
df['Difference'] = abs(df['Application Number'] - application_number) |
|
nearest_records = df.nsmallest(2, 'Difference') |
|
|
|
if not nearest_records.empty: |
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<h3>Application number not found. Showing nearest records:</h3> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
<th>Difference</th> |
|
</tr> |
|
""" |
|
for _, row in nearest_records.iterrows(): |
|
html_table += """ |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
""".format(row['Application Number'], row['Decision'], row['Difference']) |
|
|
|
html_table += """ |
|
</table> |
|
</body> |
|
</html> |
|
""" |
|
|
|
display(HTML(html_table)) |
|
else: |
|
print("Application number not found, and no nearest records found in the data.") |
|
|
|
|
|
|
|
display_application_decision() |
|
|
|
|
|
|
|
import requests |
|
import pandas as pd |
|
from io import BytesIO |
|
from bs4 import BeautifulSoup |
|
from IPython.display import HTML |
|
|
|
|
|
|
|
|
|
|
|
|
|
def display_application_decision(): |
|
"""Displays the application decision in an HTML table based on user input.""" |
|
|
|
while True: |
|
application_number = input("Enter your Application Number (maximum 8 digits): ") |
|
|
|
if not application_number.isdigit() or len(application_number) > 8: |
|
print("Invalid input. Please enter a valid application number with maximum 8 digits.") |
|
continue |
|
else: |
|
break |
|
|
|
try: |
|
application_number = int(application_number) |
|
except ValueError: |
|
print("Invalid input. Please enter a valid application number.") |
|
return |
|
|
|
|
|
row = df[df['Application Number'] == application_number] |
|
|
|
if not row.empty: |
|
|
|
if row['Decision'].iloc[0] == 'Approved': |
|
print("Congratulations! Your Visa application has been approved.") |
|
|
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
</tr> |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
</table> |
|
</body> |
|
</html> |
|
""".format(row['Application Number'].iloc[0], row['Decision'].iloc[0]) |
|
|
|
|
|
display(HTML(html_table)) |
|
else: |
|
print("Application number", application_number, "not found in the data.") |
|
|
|
|
|
df['Difference'] = abs(df['Application Number'] - application_number) |
|
nearest_records = df.nsmallest(2, 'Difference') |
|
|
|
if not nearest_records.empty: |
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<h3>Application number not found. Showing nearest records:</h3> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
<th> Difference </th> |
|
</tr> |
|
""" |
|
for _, row in nearest_records.iterrows(): |
|
html_table += """ |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
""".format(row['Application Number'], row['Decision'], row['Difference']) |
|
|
|
html_table += """ |
|
</table> |
|
</body> |
|
</html> |
|
""" |
|
|
|
display(HTML(html_table)) |
|
else: |
|
print("Application number not found, and no nearest records found in the data.") |
|
|
|
|
|
|
|
display_application_decision() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def display_application_decision(): |
|
"""Displays the application decision in an HTML table based on user input.""" |
|
|
|
while True: |
|
application_number_input = input("Enter your Application Number (including IRL if applicable): ") |
|
if "irl" in application_number_input.lower(): |
|
try: |
|
application_number = int("".join(filter(str.isdigit, application_number_input.lower().split("irl")[-1]))) |
|
if len(str(application_number)) < 8: |
|
print("Please enter a valid application number with minimum 8 digits after IRL.") |
|
continue |
|
break |
|
except ValueError: |
|
print("Invalid input after IRL. Please enter only digits.") |
|
continue |
|
|
|
else: |
|
if not application_number_input.isdigit(): |
|
print("Invalid input. Please enter only digits.") |
|
continue |
|
elif len(application_number_input) < 8: |
|
print("Please enter at least 8 digits for your VISA application number.") |
|
continue |
|
else: |
|
application_number = int(application_number_input) |
|
break |
|
|
|
|
|
row = df[df['Application Number'] == application_number] |
|
|
|
if not row.empty: |
|
|
|
if row['Decision'].iloc[0] == 'Approved': |
|
print("Congratulations! Your Visa application has been approved.") |
|
|
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
</tr> |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
</table> |
|
</body> |
|
</html> |
|
""".format(row['Application Number'].iloc[0], row['Decision'].iloc[0]) |
|
|
|
|
|
from IPython.display import clear_output |
|
clear_output(wait=True) |
|
display(HTML(html_table)) |
|
else: |
|
print("Application number", application_number, "not found in the data.") |
|
|
|
|
|
df['Difference'] = abs(df['Application Number'] - application_number) |
|
nearest_records = df.nsmallest(2, 'Difference') |
|
|
|
if not nearest_records.empty: |
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<h3>Application number not found. Showing nearest records:</h3> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
<th> Difference </th> |
|
</tr> |
|
""" |
|
for _, row in nearest_records.iterrows(): |
|
html_table += """ |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
""".format(row['Application Number'], row['Decision'], row['Difference']) |
|
|
|
html_table += """ |
|
</table> |
|
</body> |
|
</html> |
|
""" |
|
|
|
from IPython.display import clear_output |
|
clear_output(wait=True) |
|
display(HTML(html_table)) |
|
else: |
|
print("Application number not found, and no nearest records found in the data.") |
|
|
|
|
|
|
|
display_application_decision() |
|
|
|
|
|
|
|
import requests |
|
import pandas as pd |
|
from io import BytesIO |
|
from bs4 import BeautifulSoup |
|
from IPython.display import HTML |
|
from IPython.display import clear_output |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def display_application_decision(): |
|
"""Displays the application decision in an HTML table based on user input.""" |
|
|
|
while True: |
|
application_number_input = input("Enter your Application Number (including IRL if applicable): ") |
|
if "irl" in application_number_input.lower(): |
|
try: |
|
application_number = int("".join(filter(str.isdigit, application_number_input.lower().split("irl")[-1]))) |
|
if len(str(application_number)) < 8: |
|
print("Please enter a valid application number with minimum 8 digits after IRL.") |
|
continue |
|
break |
|
except ValueError: |
|
print("Invalid input after IRL. Please enter only digits.") |
|
continue |
|
|
|
else: |
|
if not application_number_input.isdigit(): |
|
print("Invalid input. Please enter only digits.") |
|
continue |
|
elif len(application_number_input) < 8: |
|
print("Please enter at least 8 digits for your VISA application number.") |
|
continue |
|
else: |
|
application_number = int(application_number_input) |
|
break |
|
|
|
|
|
row = df[df['Application Number'] == application_number] |
|
|
|
if not row.empty: |
|
|
|
if row['Decision'].iloc[0] == 'Approved': |
|
print("Congratulations! Your Visa application has been approved.") |
|
|
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
</tr> |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
</table> |
|
</body> |
|
</html> |
|
""".format(row['Application Number'].iloc[0], row['Decision'].iloc[0]) |
|
|
|
|
|
clear_output(wait=True) |
|
display(HTML(html_table)) |
|
else: |
|
print("Application number", application_number, "not found in the data.") |
|
|
|
|
|
df['Difference'] = abs(df['Application Number'] - application_number) |
|
nearest_records = df.nsmallest(2, 'Difference') |
|
|
|
if not nearest_records.empty: |
|
|
|
html_table = """ |
|
<html> |
|
<body> |
|
<h3>Application number not found. Showing nearest records:</h3> |
|
<table> |
|
<tr> |
|
<th>Application Number</th> |
|
<th>Decision</th> |
|
<th> Difference </th> |
|
</tr> |
|
""" |
|
for _, row in nearest_records.iterrows(): |
|
html_table += """ |
|
<tr> |
|
<td>{}</td> |
|
<td>{}</td> |
|
<td>{}</td> |
|
</tr> |
|
""".format(row['Application Number'], row['Decision'], row['Difference']) |
|
|
|
html_table += """ |
|
</table> |
|
</body> |
|
</html> |
|
""" |
|
|
|
clear_output(wait=True) |
|
display(HTML(html_table)) |
|
else: |
|
print("Application number not found, and no nearest records found in the data.") |
|
|
|
|
|
|
|
display_application_decision() |