coldn00dl3s commited on
Commit
d4955ac
1 Parent(s): 69f2dcb

clinical note conv ui added

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -9,7 +9,7 @@ st.title("FHIR Converter")
9
  # Dropdown for conversion type
10
  conversion_type = st.selectbox(
11
  "Select Conversion Type",
12
- ["CSV to FHIR", "CCDA to FHIR"]
13
  )
14
 
15
  # Dropdown for resource type
@@ -109,6 +109,32 @@ elif conversion_type == "CCDA to FHIR":
109
  st.error(f"An error occurred: {response.json().get('error', 'Unknown error')}")
110
  except Exception as e:
111
  st.error(f"An error occurred: {str(e)}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  # Display validator button
114
  if conversion_successful:
 
9
  # Dropdown for conversion type
10
  conversion_type = st.selectbox(
11
  "Select Conversion Type",
12
+ ["CSV to FHIR", "CCDA to FHIR","Clinical Notes to FHIR"]
13
  )
14
 
15
  # Dropdown for resource type
 
109
  st.error(f"An error occurred: {response.json().get('error', 'Unknown error')}")
110
  except Exception as e:
111
  st.error(f"An error occurred: {str(e)}")
112
+ if conversion_successful:
113
+ st.markdown("[Go to FHIR Validator](https://validator.fhir.org)", unsafe_allow_html=True)
114
+ elif conversion_type == "Clinical Notes to FHIR":
115
+
116
+ note_content = st.text_area("Copy and Paste your clinical notes for a patient")
117
+
118
+ # Variables to store the result and state
119
+ result = st.empty()
120
+ conversion_successful = False
121
+
122
+ # Button to trigger conversion
123
+ if st.button("Convert"):
124
+ try:
125
+ data = {"note_content": note_content}
126
+
127
+ response = requests.post("https://fhir-api-9jsn.onrender.com/convert_notes", json=data)
128
+ if response.status_code == 200:
129
+ result_text = response.json().get("output", "")
130
+ if result_text:
131
+ result.success("Conversion successful!")
132
+ result.text_area("FHIR Output", result_text, height=400)
133
+ conversion_successful = True
134
+ else:
135
+ st.error(f"An error occurred: {response.json().get('error', 'Unknown error')}")
136
+ except Exception as e:
137
+ st.error(f"An error occurred: {str(e)}")
138
 
139
  # Display validator button
140
  if conversion_successful: