Hello,
i want to build a small app with streamlit to evaluate privacy metrics on health data.
Firstly, the user should be asked whether he wants to upload health data from a server or from his local device.
So i implemented two buttons. If user presses the “upload from server” button, he should be able to enter the server url. After pressing Enter on the keyboard some code should be executed and the user should see a success message. I cant get that working with streamlit.
After entering an URL (Screenshot 1) i just see the “start page” again, no success message (Screenshot 2).
This is my code:
import streamlit as st
import request_data
def main():
st.title("Privacy Analysis of FHIR Data")
st.header("Welcome. To start, select to load data from HAPI FHIR server or to upload FHIR Data in JSON format from your device")
if st.button("Load Data from Server"):
# Get server URL by user input
url_input = st.text_input(
'Upload FHIR Data from HAPI server',
placeholder='Enter server URL here',
help='(e.g. www.fhir.com/test)'
)
if url_input:
# Show success message after pressing Enter
st.success("URL erfolgreich eingegeben")
#process data
data = request_data.request_data(url_input)
st.write(data)
elif st.button("Load Data from Computer"):
st.write("tbd")
Im pretty sure im just misunderstanding the workflow mechanics in Streamlit, dont i?
Thank you in advance for your help.