Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -79,17 +79,27 @@ if uploaded_file:
|
|
| 79 |
st.subheader("Federal Registry Verification")
|
| 80 |
registry_data = get_nppes_data(data.npi_number)
|
| 81 |
|
| 82 |
-
if registry_data
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
basic_info = first_result.get('basic', {})
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
except Exception as e:
|
| 95 |
st.error(f"Processing Error: {e}")
|
|
|
|
| 79 |
st.subheader("Federal Registry Verification")
|
| 80 |
registry_data = get_nppes_data(data.npi_number)
|
| 81 |
|
| 82 |
+
if registry_data:
|
| 83 |
+
# Based on your st.json, registry_data is the single record dictionary
|
| 84 |
+
basic_info = registry_data.get('basic', {})
|
|
|
|
| 85 |
|
| 86 |
+
# Check if it's an Organization (NPI-2) or Individual (NPI-1)
|
| 87 |
+
if registry_data.get('enumeration_type') == 'NPI-2':
|
| 88 |
+
display_name = basic_info.get('organization_name', 'Unnamed Organization')
|
| 89 |
+
st.info(f"Verified as Organizational NPI: {display_name}")
|
| 90 |
+
else:
|
| 91 |
+
f_name = basic_info.get('first_name', '')
|
| 92 |
+
l_name = basic_info.get('last_name', '')
|
| 93 |
+
display_name = f"{f_name} {l_name}".strip()
|
| 94 |
+
st.success(f"Verified as Individual Provider: {display_name}")
|
| 95 |
+
|
| 96 |
+
st.write(f"**Registry Name:** {display_name}")
|
| 97 |
+
|
| 98 |
+
# Taxonomy parsing (based on your JSON structure)
|
| 99 |
+
taxonomies = registry_data.get('taxonomies', [])
|
| 100 |
+
if taxonomies:
|
| 101 |
+
st.write(f"**Primary Taxonomy:** {taxonomies[0].get('desc', 'N/A')}")
|
| 102 |
+
st.write(f"**Associated License:** {taxonomies[0].get('license', 'N/A')}")
|
| 103 |
|
| 104 |
except Exception as e:
|
| 105 |
st.error(f"Processing Error: {e}")
|