Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ if search_keyword:
|
|
41 |
else:
|
42 |
filtered_specialties = specialties[specialties['Display Name'] == selected_specialty]
|
43 |
|
44 |
-
st.dataframe(filtered_specialties)
|
45 |
|
46 |
# State selection UI with default selection for testing
|
47 |
state_files = find_state_files()
|
@@ -58,9 +58,12 @@ def process_files(specialty_codes, specific_state='MN'):
|
|
58 |
|
59 |
for file in [file_to_process] if use_specific_state else state_files:
|
60 |
state_df = pd.read_csv(file, header=None) # Assuming no header for simplicity
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
64 |
|
65 |
return results
|
66 |
|
@@ -69,8 +72,9 @@ if st.button('Analyze Text Files for Selected Specialty π'):
|
|
69 |
specialty_codes = filtered_specialties['Code'].tolist()
|
70 |
state_data = process_files(specialty_codes, selected_state if use_specific_state else None)
|
71 |
if state_data:
|
72 |
-
for state, df in state_data:
|
73 |
st.subheader(f"Providers in {state} with Specialties related to '{search_keyword or selected_specialty}':")
|
|
|
74 |
st.dataframe(df)
|
75 |
else:
|
76 |
st.write("No matching records found in text files for the selected specialties.")
|
|
|
41 |
else:
|
42 |
filtered_specialties = specialties[specialties['Display Name'] == selected_specialty]
|
43 |
|
44 |
+
st.dataframe(filtered_specialties[['Code', 'Grouping', 'Classification', 'Specialization', 'Definition']])
|
45 |
|
46 |
# State selection UI with default selection for testing
|
47 |
state_files = find_state_files()
|
|
|
58 |
|
59 |
for file in [file_to_process] if use_specific_state else state_files:
|
60 |
state_df = pd.read_csv(file, header=None) # Assuming no header for simplicity
|
61 |
+
for code in specialty_codes:
|
62 |
+
filtered_df = state_df[state_df[47].isin([code])] # Match against 48th column, adjust as needed
|
63 |
+
if not filtered_df.empty:
|
64 |
+
# Enhance the display to include 'Code', 'Grouping', and 'Classification' information
|
65 |
+
display_info = specialties[specialties['Code'] == code][['Code', 'Grouping', 'Classification']].iloc[0].to_dict()
|
66 |
+
results.append((os.path.basename(file).replace('.csv', ''), display_info, filtered_df))
|
67 |
|
68 |
return results
|
69 |
|
|
|
72 |
specialty_codes = filtered_specialties['Code'].tolist()
|
73 |
state_data = process_files(specialty_codes, selected_state if use_specific_state else None)
|
74 |
if state_data:
|
75 |
+
for state, info, df in state_data:
|
76 |
st.subheader(f"Providers in {state} with Specialties related to '{search_keyword or selected_specialty}':")
|
77 |
+
st.markdown(f"**Code**: {info['Code']}, **Grouping**: {info['Grouping']}, **Classification**: {info['Classification']}")
|
78 |
st.dataframe(df)
|
79 |
else:
|
80 |
st.write("No matching records found in text files for the selected specialties.")
|