import streamlit as st import pandas as pd #st.title("📘SBS mapper") st.header("Map internal descriptions to SBS codes V2.0") st.subheader("Work in progress; Demo currently limited to Chapter 20: Imaging services") #st.image("images/SBS_Chapter_Index.png", use_container_width=True) st.subheader("Select specific Chapter for quicker results") df_chapters = pd.read_csv("SBS_V2_Chapter_Index.csv") df_chapters.iloc[25] = {"Chapter": "ALL", "Chapter title": "ALL CHAPTERS (will take more time)", "Blocks": "Total", "No. Codes": 10081} #st.dataframe(df_chapters, hide_index=True) # redundant, as dataframe will be displayed by below function def dataframe_with_selections(df_chapters: pd.DataFrame, init_value: bool = False) -> pd.DataFrame: df_with_selections = df_chapters.copy() df_with_selections.insert(0, "Select", init_value) # Get dataframe row-selections from user with st.data_editor edited_df = st.data_editor( df_with_selections, hide_index=True, column_config={"Select": st.column_config.CheckboxColumn(required=True)}, disabled=df_chapters.columns, ) # Filter the dataframe using the temporary column, then drop the column selected_rows = edited_df[edited_df.Select] return selected_rows.drop('Select', axis=1) chapter_names = dataframe_with_selections(df_chapters) st.write("Your selection:") st.write(chapter_names) #'Procedures on nervous system' #'Procedures on endocrine system' #'Procedures on eye and adnexa' #'Procedures on ear and mastoid process' #'Procedures on nose, mouth and pharynx' #'Dental services' #'Procedures on respiratory system' #'Procedures on cardiovascular system' #'Procedures on blood and blood-forming organs' #'Procedures on digestive system' #'Procedures on urinary system' #'Procedures on male genital organs' #'Gynaecological procedures' #'Obstetric procedures' #'Procedures on musculoskeletal system' #'Dermatological and plastic procedures' #'Procedures on breast' #'Radiation oncology procedures' #'Non-invasive, cognitive and other interventions, not elsewhere classified' #'Imaging services' #'Laboratory and Pathology Services' #'Ambulance and Transport Services' #'KSA Service Codes' #'Emergency Medical Services (EMS)' #'Mortuary Services'