erayman09 commited on
Commit
b97a1bd
·
verified ·
1 Parent(s): 47e5b46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -49,8 +49,9 @@ def clean_and_parse_extracted_text(raw_text):
49
  elif value > max_val:
50
  flag = "H"
51
 
52
- # Append structured data
53
- data.append([component, value, min_val, max_val, unit, flag])
 
54
 
55
  # Create a DataFrame
56
  df = pd.DataFrame(data, columns=["Component", "Your Value", "Min", "Max", "Units", "Flag"])
@@ -70,7 +71,7 @@ def clean_and_parse_extracted_text(raw_text):
70
 
71
  def display_results(df):
72
  """
73
- Display the parsed data in a table format.
74
  """
75
  st.dataframe(df, use_container_width=True)
76
 
@@ -95,8 +96,8 @@ if uploaded_file is not None:
95
  # Parse the extracted text into a structured format
96
  parsed_data = clean_and_parse_extracted_text(extracted_text)
97
 
98
- # Display the structured data
99
- st.subheader("Parsed Blood Test Results")
100
  display_results(parsed_data)
101
 
102
  except Exception as e:
 
49
  elif value > max_val:
50
  flag = "H"
51
 
52
+ # Only append the data if the flag is abnormal (L or H)
53
+ if flag != "Normal":
54
+ data.append([component, value, min_val, max_val, unit, flag])
55
 
56
  # Create a DataFrame
57
  df = pd.DataFrame(data, columns=["Component", "Your Value", "Min", "Max", "Units", "Flag"])
 
71
 
72
  def display_results(df):
73
  """
74
+ Display the flagged abnormalities in a table format.
75
  """
76
  st.dataframe(df, use_container_width=True)
77
 
 
96
  # Parse the extracted text into a structured format
97
  parsed_data = clean_and_parse_extracted_text(extracted_text)
98
 
99
+ # Display the structured data (only abnormalities)
100
+ st.subheader("Flagged Abnormalities")
101
  display_results(parsed_data)
102
 
103
  except Exception as e: