jkushwaha commited on
Commit
1ef9904
·
verified ·
1 Parent(s): 13c0631

Create csv_display.py

Browse files
Files changed (1) hide show
  1. csv_display.py +49 -0
csv_display.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ inbound_df_path = 'inbound_issues_tempus_2_q2.csv'
2
+ display_cols = ['Biomarker Name Source', 'Biomarker Test Type', 'NLP Result','NLP Value', 'NLP Variant',
3
+ 'Biomarker Test Result Value Numeric 1', 'Biomarker Test Result Value Unit 1',
4
+ 'Biomarker Test Result Value Numeric 2', 'Biomarker Test Result Value Unit 2',
5
+ 'Biomarker Test Threshold Value Numeric 1', 'Biomarker Test Threshold Value Unit1',
6
+ 'Biomarker Test Threshold Value Numeric 2', 'Biomarker Test Threshold Value Unit2']
7
+ pif_list, auto_csv_path = path_setting(inbound_df_path)
8
+
9
+ st.set_page_config(layout="wide") # Set layout to wide
10
+
11
+ # Display DataFrame Panel
12
+ st.write("### Display DataFrame")
13
+ selected_document_index = st.select_slider("Select Document Index", options=range(len(pif_list)))
14
+ document_id = pif_list[selected_document_index]
15
+ page_number = st.number_input("Page Number", min_value=1, step=1, value=1)
16
+ df = load_dataframe(auto_csv_path, document_id, page_number, display_cols)
17
+ if df is not None:
18
+ columns_to_display = st.multiselect("Select Columns to Display", df.columns)
19
+ if len(columns_to_display) > 0:
20
+ st.write(df[columns_to_display])
21
+
22
+ # Select comment from a predefined list
23
+ st.subheader("Comments and Suggestions")
24
+ comment_options = ['a', 'b', 'c', 'f', 'd', 'g']
25
+ selected_comment = st.selectbox("Select Comment", options=comment_options)
26
+ st.text_area("Comment", value=selected_comment, height=100)
27
+
28
+ # Input area for suggestions
29
+ suggestions = st.text_area("Add your suggestions here")
30
+
31
+ # Save comments and suggestions to CSV when submitted
32
+ if st.button("Submit"):
33
+ data = {
34
+ "Document ID": [document_id],
35
+ "Page": [page_number],
36
+ "Comment": [selected_comment],
37
+ "Suggestions": [suggestions]
38
+ }
39
+ comments_df = pd.DataFrame(data)
40
+ comments_csv = "comments.csv"
41
+ if os.path.exists(comments_csv):
42
+ comments_df.to_csv(comments_csv, mode="a", header=False, index=False)
43
+ else:
44
+ comments_df.to_csv(comments_csv, index=False)
45
+
46
+ else:
47
+ st.write("No columns selected")
48
+ else:
49
+ st.write("DataFrame not found")