Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import base64
|
4 |
+
|
5 |
+
# Define the list of questions with their corresponding codes and URLs
|
6 |
+
questions = [
|
7 |
+
{"question": "Do you have any symptoms of COVID-19?", "code": "U07.1", "code_type": "ICD10", "url": "https://www.cdc.gov/nchs/icd/icd10cm.htm"},
|
8 |
+
{"question": "Have you had any surgeries in the past year?", "code": "0JH60ZZ", "code_type": "ICD10-PCS", "url": "https://www.cms.gov/Medicare/Coding/ICD10/2022-ICD-10-PCS-Codes-Version-110"},
|
9 |
+
{"question": "Have you been diagnosed with any chronic conditions?", "code": "443.9", "code_type": "ICD9-CM", "url": "https://www.cms.gov/Medicare/Coding/ICD9ProviderDiagnosticCodes/codes"},
|
10 |
+
{"question": "Have you had any diagnostic imaging tests in the past year?", "code": "70450", "code_type": "CPT", "url": "https://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets/Alpha-Numeric-HCPCS"},
|
11 |
+
{"question": "Have you had any lab tests done in the past year?", "code": "19710-4", "code_type": "LOINC", "url": "https://loinc.org/"},
|
12 |
+
{"question": "Have you used any medical equipment in the past year?", "code": "E1399", "code_type": "HCPCS", "url": "https://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets/Alpha-Numeric-HCPCS"}
|
13 |
+
]
|
14 |
+
|
15 |
+
# Define a function to create a DataFrame with the user's responses
|
16 |
+
def create_survey_df(questions):
|
17 |
+
survey_dict = {"Assess Topic": [], "Assess Metric": [], "Code Emoji": [], "Code Topic": [], "Code Type": [], "Code": [], "Response": [], "Comment": []}
|
18 |
+
for q in questions:
|
19 |
+
survey_dict["Assess Topic"].append("Medical History")
|
20 |
+
survey_dict["Assess Metric"].append(q["question"])
|
21 |
+
survey_dict["Code Emoji"].append("💊")
|
22 |
+
survey_dict["Code Topic"].append(q["code"])
|
23 |
+
survey_dict["Code Type"].append(q["code_type"])
|
24 |
+
survey_dict["Code"].append(q["code"])
|
25 |
+
survey_dict["Response"].append(st.radio("Answer", ["Yes", "No"]))
|
26 |
+
survey_dict["Comment"].append(st.text_input("Comment (optional)"))
|
27 |
+
return pd.DataFrame(survey_dict)
|
28 |
+
|
29 |
+
# Define the Streamlit app
|
30 |
+
def app():
|
31 |
+
st.title("Medical History Survey")
|
32 |
+
st.markdown("Please answer the following questions about your medical history.")
|
33 |
+
survey_df = create_survey_df(questions)
|
34 |
+
st.write(survey_df)
|
35 |
+
|
36 |
+
# Allow the user to download the survey results as a CSV file
|
37 |
+
if st.button("Download CSV"):
|
38 |
+
csv = survey_df.to_csv(index=False)
|
39 |
+
b64 = base64.b64encode(csv.encode()).decode()
|
40 |
+
st.markdown(f'<a href="data:file/csv;base64,{b64}" download="survey_results.csv">Download CSV File</a>', unsafe_allow_html=True)
|