georad commited on
Commit
f2657bd
·
verified ·
1 Parent(s): cbb5134

Update pages/chapter_index.py

Browse files
Files changed (1) hide show
  1. pages/chapter_index.py +4 -33
pages/chapter_index.py CHANGED
@@ -4,14 +4,12 @@ import pandas as pd
4
  for k, v in st.session_state.items():
5
  st.session_state[k] = v
6
 
7
- #st.title("📘SBS mapper")
8
  st.header("Map internal descriptions to SBS codes V2.0")
9
- #st.image("images/SBS_Chapter_Index.png", use_container_width=True)
10
  st.subheader("Select specific Chapter for quicker results")
11
  st.subheader("Demo currently limited to Chapter 20: Imaging services; (Work in progress)")
12
  df_chapters = pd.read_csv("SBS_V2_Chapter_Index.csv")
13
  df_chapters.iloc[25] = {"Chapter": 26, "Chapter title": "ALL CHAPTERS (will take more time)", "Blocks": "Total", "No. Codes": 10081}
14
- #st.dataframe(df_chapters, hide_index=True) # redundant, as dataframe will be displayed by below function
15
 
16
  def dataframe_with_selections(df_chapters: pd.DataFrame, init_value: bool = False) -> pd.DataFrame:
17
  df_with_selections = df_chapters.copy()
@@ -31,40 +29,13 @@ def dataframe_with_selections(df_chapters: pd.DataFrame, init_value: bool = Fals
31
 
32
  if "selected_chapters" not in st.session_state:
33
  st.session_state['selected_chapters'] = []
34
-
35
  selected_chapters_list = st.session_state.selected_chapters
36
 
37
  selected_chapters = dataframe_with_selections(df_chapters)
38
  st.write("Your selection:")
39
  st.write(selected_chapters)
40
- selected_chapters_list = selected_chapters.iloc[:,0].tolist()
41
- #st.write("ZZZZZZZZZZ: ", selected_chapters_list)
42
 
43
  if selected_chapters is not None:
44
- st.session_state.selected_chapters = selected_chapters_list
45
-
46
- #'Procedures on nervous system'
47
- #'Procedures on endocrine system'
48
- #'Procedures on eye and adnexa'
49
- #'Procedures on ear and mastoid process'
50
- #'Procedures on nose, mouth and pharynx'
51
- #'Dental services'
52
- #'Procedures on respiratory system'
53
- #'Procedures on cardiovascular system'
54
- #'Procedures on blood and blood-forming organs'
55
- #'Procedures on digestive system'
56
- #'Procedures on urinary system'
57
- #'Procedures on male genital organs'
58
- #'Gynaecological procedures'
59
- #'Obstetric procedures'
60
- #'Procedures on musculoskeletal system'
61
- #'Dermatological and plastic procedures'
62
- #'Procedures on breast'
63
- #'Radiation oncology procedures'
64
- #'Non-invasive, cognitive and other interventions, not elsewhere classified'
65
- #'Imaging services'
66
- #'Laboratory and Pathology Services'
67
- #'Ambulance and Transport Services'
68
- #'KSA Service Codes'
69
- #'Emergency Medical Services (EMS)'
70
- #'Mortuary Services'
 
4
  for k, v in st.session_state.items():
5
  st.session_state[k] = v
6
 
7
+ st.title("📘SBS mapper")
8
  st.header("Map internal descriptions to SBS codes V2.0")
 
9
  st.subheader("Select specific Chapter for quicker results")
10
  st.subheader("Demo currently limited to Chapter 20: Imaging services; (Work in progress)")
11
  df_chapters = pd.read_csv("SBS_V2_Chapter_Index.csv")
12
  df_chapters.iloc[25] = {"Chapter": 26, "Chapter title": "ALL CHAPTERS (will take more time)", "Blocks": "Total", "No. Codes": 10081}
 
13
 
14
  def dataframe_with_selections(df_chapters: pd.DataFrame, init_value: bool = False) -> pd.DataFrame:
15
  df_with_selections = df_chapters.copy()
 
29
 
30
  if "selected_chapters" not in st.session_state:
31
  st.session_state['selected_chapters'] = []
 
32
  selected_chapters_list = st.session_state.selected_chapters
33
 
34
  selected_chapters = dataframe_with_selections(df_chapters)
35
  st.write("Your selection:")
36
  st.write(selected_chapters)
37
+ #selected_chapters_listdisplay = selected_chapters.iloc[:,0].tolist()
38
+ #st.write("SELECTED CHAPTERS: ", selected_chapters_listdisplay)
39
 
40
  if selected_chapters is not None:
41
+ st.session_state.selected_chapters = selected_chapters_list