awacke1 commited on
Commit
fdf429d
Β·
verified Β·
1 Parent(s): db0c61d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -61
app.py CHANGED
@@ -4,6 +4,19 @@ import os
4
  import glob
5
  import matplotlib.pyplot as plt
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  headers = [
8
  "NPI", "EntityTypeCode", "ReplacementNPI", "EmployerIdentificationNumberEIN",
9
  "ProviderOrganizationNameLegalBusinessName", "ProviderLastNameLegalName",
@@ -28,41 +41,6 @@ headers = [
28
  "HealthcareProviderPrimaryTaxonomySwitch"
29
  ]
30
 
31
- def process_files_new(specialty_codes, specific_state='MN', use_specific_state=True):
32
- results = []
33
- city_counts = {} # Dictionary to keep track of city counts
34
- file_to_process = f'./{specific_state}.csv' if use_specific_state else state_files
35
-
36
- for file in [file_to_process] if use_specific_state else state_files:
37
- # Now using the 'names' parameter to specify column names
38
- state_df = pd.read_csv(file, header=None, names=headers)
39
- for code in specialty_codes:
40
- filtered_df = state_df[state_df['HealthcareProviderTaxonomyCode'].isin([code])]
41
- if not filtered_df.empty:
42
- # Update city counts
43
- for city in filtered_df['ProviderBusinessPracticeLocationAddressCityName'].unique():
44
- city_counts[city] = city_counts.get(city, 0) + filtered_df[filtered_df['ProviderBusinessPracticeLocationAddressCityName'] == city].shape[0]
45
-
46
- # Prepare display information (assuming 'specialties' DataFrame exists)
47
- display_info = specialties[specialties['Code'] == code][['Code', 'Grouping', 'Classification']].iloc[0].to_dict()
48
- results.append((os.path.basename(file).replace('.csv', ''), display_info, filtered_df))
49
-
50
- # Plotting the city counts
51
- cities = list(city_counts.keys())
52
- counts = list(city_counts.values())
53
-
54
- #plt.figure(figsize=(10, 6))
55
- #plt.bar(cities, counts, color='skyblue')
56
- #plt.xlabel('City')
57
- #plt.ylabel('Count')
58
- #plt.xticks(rotation=45, ha='right')
59
- #plt.title('Counts per City')
60
- #plt.tight_layout()
61
- #plt.show()
62
-
63
- return results
64
-
65
-
66
  # Cache the loading of specialties for efficiency
67
  @st.cache_resource
68
  def load_specialties(csv_file='Provider-Specialty.csv'):
@@ -73,36 +51,10 @@ def load_specialties(csv_file='Provider-Specialty.csv'):
73
  def find_state_files():
74
  return [file for file in glob.glob('./*.csv') if len(os.path.basename(file).split('.')[0]) == 2]
75
 
76
- # Set page configuration with a title and favicon
77
- st.set_page_config(
78
- page_title="πŸ©ΊπŸ” Care Team Finder - Care Providers by Specialty and Location",
79
- page_icon="🩺",
80
- layout="wide",
81
- initial_sidebar_state="expanded",
82
- menu_items={
83
- 'Get Help': 'https://huggingface.co/awacke1',
84
- 'Report a bug': "https://huggingface.co/spaces/awacke1/WebDataDownload",
85
- 'About': "# πŸ©ΊπŸ” Care Team Finder By Aaron Wacker - https://huggingface.co/awacke1"
86
- }
87
- )
88
-
89
  specialties = load_specialties()
90
  st.markdown("# πŸ©ΊπŸ” Care Team Finder ")
91
  st.markdown("#### Search for Care Providers by Specialty and Location")
92
 
93
- if st.expander('🩺 Understand Provider Specialties πŸ“'):
94
- st.markdown('''
95
- ## Discover Care Providers by Specialty & Location: Quick Guide
96
- - **Code**: Unique ID identifies each specialty clearly. πŸ†”
97
- - **Grouping**: Broad category umbrella for general expertise area. 🏷️
98
- - **Classification**: Specifies type of practice within broader category. 🎯
99
- - **Specialization**: Details focus within classification for precise expertise. πŸ”
100
- - **Definition**: Concise overview of the specialty's scope. πŸ“–
101
- - **Notes**: Extra information or recent updates provided. πŸ—’οΈ
102
- - **Display Name**: Commonly recognized name of the specialty. 🏷️
103
- - **Section**: Healthcare segment the specialty belongs to. πŸ“š
104
- ''')
105
-
106
  # Allows users to select or search for a specialty
107
  specialty_options = specialties['Display Name'].unique()
108
  selected_specialty = st.selectbox('Select a Specialty 🩺', options=specialty_options)
 
4
  import glob
5
  import matplotlib.pyplot as plt
6
 
7
+ # Set page configuration with a title and favicon
8
+ st.set_page_config(
9
+ page_title="πŸ©ΊπŸ” Care Team Finder - Care Providers by Specialty and Location",
10
+ page_icon="🩺",
11
+ layout="wide",
12
+ initial_sidebar_state="expanded",
13
+ menu_items={
14
+ 'Get Help': 'https://huggingface.co/awacke1',
15
+ 'Report a bug': "https://huggingface.co/spaces/awacke1/WebDataDownload",
16
+ 'About': "# πŸ©ΊπŸ” Care Team Finder By Aaron Wacker - https://huggingface.co/awacke1"
17
+ }
18
+ )
19
+
20
  headers = [
21
  "NPI", "EntityTypeCode", "ReplacementNPI", "EmployerIdentificationNumberEIN",
22
  "ProviderOrganizationNameLegalBusinessName", "ProviderLastNameLegalName",
 
41
  "HealthcareProviderPrimaryTaxonomySwitch"
42
  ]
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  # Cache the loading of specialties for efficiency
45
  @st.cache_resource
46
  def load_specialties(csv_file='Provider-Specialty.csv'):
 
51
  def find_state_files():
52
  return [file for file in glob.glob('./*.csv') if len(os.path.basename(file).split('.')[0]) == 2]
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  specialties = load_specialties()
55
  st.markdown("# πŸ©ΊπŸ” Care Team Finder ")
56
  st.markdown("#### Search for Care Providers by Specialty and Location")
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # Allows users to select or search for a specialty
59
  specialty_options = specialties['Display Name'].unique()
60
  selected_specialty = st.selectbox('Select a Specialty 🩺', options=specialty_options)