Spaces:
Runtime error
Runtime error
File size: 11,131 Bytes
da1dcab ad51853 da1dcab ecebf82 0f81f0a ecebf82 0f81f0a bc8b43a 0f81f0a bc8b43a 0f81f0a ecebf82 50f3518 78d0b85 50f3518 07b3869 78d0b85 07b3869 ecebf82 da1dcab ecebf82 0f81f0a 50f3518 07b3869 0f81f0a ecebf82 4651dc4 ecebf82 4651dc4 ecebf82 fa74ec8 ecebf82 da1dcab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
import streamlit as st
import pandas as pd
import base64
# Define function to read CSV file
def read_data():
data = pd.read_csv("health_conditions.csv")
return data
# Define function to update CSV file
def update_data(data):
data.to_csv("health_conditions.csv", index=False)
# Define function to display data
def display_data(data):
st.write(data)
# Define function to add new data
def add_data(data, new_data):
data = pd.concat([data, new_data], ignore_index=True)
return data
# Define function to delete data
def delete_data(data, indices):
data = data.drop(indices, axis=0)
data = data.reset_index(drop=True)
return data
# Define function to download data as CSV file
def download_data(data):
csv = data.to_csv(index=False)
href = f'<a href="data:file/csv;base64,{base64.b64encode(csv.encode()).decode()}" download="health_conditions.csv">Download CSV file</a>'
return href
def create_phq9_questions():
questions = [
{"question": "Little interest or pleasure in doing things", "icd10": "F32.1"},
{"question": "Feeling down, depressed, or hopeless", "icd10": "F32.1"},
{"question": "Trouble falling or staying asleep, or sleeping too much", "icd10": "F32.1"},
{"question": "Feeling tired or having little energy", "icd10": "F32.1"},
{"question": "Poor appetite or overeating", "icd10": "F32.1"},
{"question": "Feeling bad about yourself β or that you are a failure or have let yourself or your family down", "icd10": "F32.1"},
{"question": "Trouble concentrating on things, such as reading the newspaper or watching television", "icd10": "F32.1"},
{"question": "Moving or speaking so slowly that other people could have noticed? Or the opposite β being so fidgety or restless that you have been moving around a lot more than usual", "icd10": "F32.1"},
{"question": "Thoughts that you would be better off dead or of hurting yourself in some way", "icd10": "F32.1"}
]
return questions
def diabetes_code_lookup(code):
# LOINC codes related to diabetes
loinc_codes = {
'14771-0': 'Glucose [Mass/volume] in Blood',
'49642-8': 'Hemoglobin A1c/Hemoglobin.total in Blood',
'2345-7': 'Glucose [Mass/volume] in Serum or Plasma',
# Add more LOINC codes related to diabetes here
}
# SNOMED-CT codes related to diabetes
snomed_codes = {
'73211009': 'Diabetes mellitus (disorder)',
'15777000': 'Insulin-dependent diabetes mellitus (disorder)',
'44054006': 'Non-insulin dependent diabetes mellitus (disorder)',
# Add more SNOMED-CT codes related to diabetes here
}
# ICD-10 codes related to diabetes
icd_codes = {
'E10.9': 'Type 1 diabetes mellitus without complications',
'E11.9': 'Type 2 diabetes mellitus without complications',
'E08.9': 'Diabetes mellitus due to an underlying condition without complications',
# Add more ICD-10 codes related to diabetes here
}
# Look up the code in each dictionary
loinc_desc = loinc_codes.get(code, 'Code not found')
snomed_desc = snomed_codes.get(code, 'Code not found')
icd_desc = icd_codes.get(code, 'Code not found')
# Display the results
st.markdown(f'### LOINC code {code}: {loinc_desc}')
st.markdown(f'### SNOMED-CT code {code}: {snomed_desc}')
st.markdown(f'### ICD-10 code {code}: {icd_desc}')
st.markdown("""
# Diabetes ICD10 Codes:
1. E10.9 - Type 1 diabetes mellitus without complications
2. E11.9 - Type 2 diabetes mellitus without complications
3. E08.9 - Diabetes mellitus due to an underlying condition without complications
4. E13.9 - Other specified diabetes mellitus without complications
5. E10.65 - Type 1 diabetes mellitus with hyperglycemia
6. E11.65 - Type 2 diabetes mellitus with hyperglycemia
7. E08.65 - Diabetes mellitus due to an underlying condition with hyperglycemia
8. E13.65 - Other specified diabetes mellitus with hyperglycemia
# Diabetes standardized assessments
1. There are several standardized assessments that ask questions about diabetes, including:
2. The American Diabetes Association Risk Test: This is a free online test that asks about risk factors for diabetes, such as family history, weight, and physical activity.
3. The Diabetes Self-Management Assessment Report Tool (D-SMART): This is a tool used by healthcare professionals to assess a patient's knowledge, self-efficacy, and behaviors related to diabetes self-management.
4. The Summary of Diabetes Self-Care Activities (SDSCA): This is a questionnaire that asks about various aspects of diabetes self-care, including diet, exercise, medication adherence, and glucose monitoring.
5. The Problem Areas in Diabetes (PAID) scale: This is a questionnaire that assesses the emotional distress associated with diabetes, including feelings of guilt, frustration, and anxiety.
6. The Diabetes Distress Scale: This is a questionnaire that assesses the emotional burden of living with diabetes, including feelings of worry, frustration, and feeling overwhelmed.
7. It's important to note that these assessments are not diagnostic tools and should be used in conjunction with other assessments and evaluations conducted by healthcare professionals.
""")
def ShowDiabetesAssessment():
st.markdown("""
# Diabetes Assessment with Code Mapping:
## By asking these questions and conducting appropriate tests, healthcare professionals can determine the risk factors for diabetes and pre-diabetes and develop an appropriate treatment plan.
1. Medical History: Knowing a person's medical history is important in determining the risk factors for diabetes. Questions may include:
2. Have you ever been diagnosed with diabetes before? (ICD10 code: E11.-)
3. Have any of your family members been diagnosed with diabetes? (ICD10 code: Z83.3)
4. Have you been diagnosed with gestational diabetes during pregnancy? (ICD10 code: O24.4-)
5. Lifestyle Factors: Lifestyle factors such as physical activity, diet, and smoking can also play a role in determining the risk for diabetes. Questions may include:
6. How often do you engage in physical activity? (LOINC code: 8692-2)
7. What types of foods do you typically eat? (LOINC code: 62392-6)
8. Do you smoke or use tobacco products? (SNOMED code: 77176002)
9. Physical Exam: A physical exam can help identify risk factors for diabetes. Questions may include:
10. What is your body mass index (BMI)? (LOINC code: 39156-5)
11. Have you noticed any changes in your vision or eye health? (ICD10 code: H36.9)
12. Have you experienced any numbness or tingling in your hands or feet? (ICD10 code: R20.2)
13. Laboratory Tests: Laboratory tests can help diagnose diabetes and identify risk factors. Questions may include:
14. Have you had a recent blood test to check your blood sugar levels? (LOINC code: 14749-6)
15. Have you had a test to check your HbA1c levels? (LOINC code: 4548-4)
16. Have you had a lipid profile test to check your cholesterol levels? (LOINC code: 24331-1)
17. Other Medical Conditions: Certain medical conditions can increase the risk for diabetes. Questions may include:
18. Have you been diagnosed with polycystic ovary syndrome (PCOS)? (ICD10 code: E28.2)
19. Do you have a history of heart disease? (ICD10 code: I25.10)
20. Have you been diagnosed with sleep apnea? (ICD10 code: G47.33)
""")
def ShowIschemicHeartDisease():
st.markdown("""
1. Ischemic heart disease is a condition that occurs when the blood flow to the heart is reduced, causing damage to the heart muscle. There are several factors that can increase the risk of developing ischemic heart disease or pre-heart disease, including:
2. Age: As people get older, the risk of developing ischemic heart disease increases.
3. Gender: Men are more likely than women to develop ischemic heart disease, although the risk for women increases after menopause.
4. Family history: A family history of ischemic heart disease can increase a person's risk.
5. Smoking: Smoking is a major risk factor for ischemic heart disease.
6. High blood pressure: High blood pressure can damage the blood vessels and increase the risk of developing ischemic heart disease.
7. High cholesterol: High levels of cholesterol can cause plaque to build up in the arteries, which can lead to ischemic heart disease.
8. Diabetes: People with diabetes are at an increased risk of developing ischemic heart disease.
9. Obesity: Being overweight or obese can increase the risk of developing ischemic heart disease.
10. To assess a patient's risk of developing ischemic heart disease or pre-heart disease, healthcare providers may ask a series of questions about the patient's medical history, lifestyle, and family history. Some questions that map to specific LOINC, Snomed, or ICD10 codes include:
11. Have you ever been diagnosed with hypertension? (LOINC: 59621-4, Snomed: 38341003, ICD10: I10)
12. Have you ever been diagnosed with high cholesterol? (LOINC: 2093-3, Snomed: 166717004, ICD10: E78.0)
13. Do you have a family history of heart disease? (LOINC: 68703-1, Snomed: 408443003, ICD10: Z83.2)
14. Do you smoke? (LOINC: 72166-2, Snomed: 8517006, ICD10: F17.200)
15. Have you ever been diagnosed with diabetes? (LOINC: 4548-4, Snomed: 44054006, ICD10: E11.9)
16. What is your body mass index (BMI)? (LOINC: 39156-5, Snomed: 60621009, ICD10: Z68.39)
17. By assessing these and other factors, healthcare providers can determine a patient's risk of developing ischemic heart disease and recommend appropriate interventions to help reduce that risk.
""")
# Define main function
def main():
st.title("Health Condition Costs Visualization")
data = read_data()
display_data(data)
st.write("To add new data, please fill in the form below:")
condition = st.text_input("Condition")
icd10_code = st.text_input("ICD10 Code")
snomed_code = st.text_input("SNOMED Code")
loinc_code = st.text_input("LOINC Code")
assessment = st.text_input("Assessment")
if st.button("Add"):
new_data = pd.DataFrame({
"condition": [condition],
"ICD10_code": [icd10_code],
"SNOMED_code": [snomed_code],
"LOINC_code": [loinc_code],
"assessment": [assessment]
})
data = add_data(data, new_data)
update_data(data)
indices = []
for i, row in data.iterrows():
if st.checkbox(f"Delete row {i+1}"):
indices.append(i)
if len(indices) > 0:
data = delete_data(data, indices)
update_data(data)
st.markdown(download_data(data), unsafe_allow_html=True)
# Get the PHQ9 questions
questions = create_phq9_questions()
diabetes_code_lookup('E11.9')
ShowDiabetesAssessment()
ShowIschemicHeartDisease()
# Display each question and an input text field for the answer
keycount=0
for question in questions:
keycount+=1
st.markdown(question["question"])
answer = st.text_input("Your Answer:", key=str(keycount))
if __name__ == "__main__":
main()
|