|
import pandas as pd |
|
from dataframe import precomputed_df |
|
import streamlit as st |
|
|
|
def search_application(application_number): |
|
if precomputed_df is None: |
|
st.error("Data not available. Please try again later.") |
|
return None |
|
|
|
|
|
exact_match = precomputed_df[precomputed_df["Application Number"] == application_number] |
|
if not exact_match.empty: |
|
return exact_match.iloc[0] |
|
|
|
|
|
precomputed_df["Difference"] = abs(precomputed_df["Application Number"] - application_number) |
|
nearest_records = precomputed_df.nsmallest(2, "Difference") |
|
return nearest_records.reset_index(drop=True) |
|
|