-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathICD10Search.py
More file actions
34 lines (26 loc) · 1.05 KB
/
ICD10Search.py
File metadata and controls
34 lines (26 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pandas as pd
import streamlit as st
import re
url = f"https://raw.githubusercontent.com/AMohabeer/DataScienceColabRepo/main/ICD-10_Medical_Code.csv"
df = pd.read_csv(url, dtype=str, header=None).fillna("")
# Show the dataframe
#st.write(df)
st.title('Find ICD10 Codes & Descriptions')
# Use a text_input to get the keywords to filter the dataframe
text_search1 = st.text_input("Enter a single keyword or ICD10 code (without dots)", value="")
# Filter the dataframe
m1 = df[2].str.contains(text_search1, flags=re.IGNORECASE, regex=True)
m2 = df[1].str.contains(text_search1, flags=re.IGNORECASE, regex=True)
df_search = df[m1 | m2]
# Show the results, if you have a text_search
#if text_search1:
# st.write(df_search)
N_results_per_row = 1
if text_search1:
for n_row, row in df_search.reset_index().iterrows():
i = n_row
if i==0:
st.write("---")
cols = st.columns(N_results_per_row)
with cols[n_row%N_results_per_row]:
st.markdown(f" ICD10 Code: {row[1].strip()} - {row[2].strip()}")