awacke1 commited on
Commit
f0de933
Β·
verified Β·
1 Parent(s): 5f7c227

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +110 -0
app.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # How can I add row to an iterable dataset
2
+ #πŸ€—Datasets
3
+ #This is the first time xbilek25 has posted β€” let’s welcome them to our community!
4
+
5
+
6
+ #xbilek25
7
+
8
+ #2
9
+ #9h
10
+ #I need any working option to add row to a dataset, where streaming=True. While working with normal dataset I define new item and use code like this:
11
+ #tmp_dataset = tmp_dataset.add_item(new_item), but i can’t figure out how to do this while my dataset is streaming=True.
12
+ #Can anyone help me to find solution, please?
13
+
14
+
15
+ if st.checkbox('Show Anatomy Table'):
16
+ st.markdown("""
17
+ ## Anatomy Head to Toe Table with Body Organs Costly Conditions, Spending, CPT Codes and Frequency
18
+
19
+ | Table Num | Body Part | Organ/Part | Description | πŸ“ˆ Costly Condition | πŸ’° Spending (billions) | CPT Range Start | CPT Range Finish | Frequency |
20
+ |-----------|------------------|----------------------|-------------------------------|------------------------------|------------------------|-----------------|------------------|----------------|
21
+ | 1 | 🧠 Head | 🧠 Brain | Controls mental processes | 😨 Anxiety & Depression | 210 | 90791 | 90899 | 1 in 5 |
22
+ | 2 | πŸ‘€ Eyes | πŸ‘οΈ Optic Nerve | Vision | πŸ‘“ Cataracts | 10.7 | 92002 | 92499 | 1 in 6 (over 40 years) |
23
+ | 3 | πŸ‘‚ Ears | 🐚 Cochlea | Hearing | πŸ“’ Hearing Loss | 7.1 | 92502 | 92700 | 1 in 8 (over 12 years) |
24
+ | 4 | πŸ‘ƒ Nose | πŸ‘ƒ Olfactory Bulb | Smell | 🀧 Allergies | 25 | 31231 | 31294 | 1 in 3 |
25
+ | 5 | πŸ‘„ Mouth | πŸ‘… Tongue | Taste | 🦷 Dental Issues | 130 | 00100 | 00192 | 1 in 2 |
26
+ | 6 | 🫁 Neck | πŸ¦‹ Thyroid | Metabolism | 🦠 Hypothyroidism | 3.1 | 60210 | 60271 | 1 in 20 |
27
+ | 7 | πŸ’ͺ Upper Body | ❀️ Heart | Circulation | πŸ’” Heart Disease | 230 | 92920 | 93799 | 1 in 4 (over 65 years) |
28
+ | 8 | πŸ’ͺ Upper Body | 🫁 Lungs | Respiration | 😷 Chronic Obstructive Pulmonary Disease | 70 | 94002 | 94799 | 1 in 20 (over 45 years) |
29
+ | 9 | πŸ’ͺ Upper Body | 🍷 Liver | Detoxification | 🍺 Liver Disease | 40 | 47000 | 47999 | 1 in 10 |
30
+ | 10 | πŸ’ͺ Upper Body | 🍹 Kidneys | Filtration | 🌊 Chronic Kidney Disease | 110 | 50010 | 50999 | 1 in 7 |
31
+ | 11 | πŸ’ͺ Upper Body | πŸ’‰ Pancreas | Insulin secretion | 🍬 Diabetes | 327 | 48100 | 48999 | 1 in 10 |
32
+ | 12 | πŸ’ͺ Upper Body | 🍽️ Stomach | Digestion | πŸ”₯ Gastroesophageal Reflux Disease | 17 | 43200 | 43289 | 1 in 5 |
33
+ | 13 | πŸ’ͺ Upper Body | πŸ›‘οΈ Spleen | Immune functions | 🩸 Anemia | 5.6 | 38100 | 38199 | 1 in 6 |
34
+ | 14 | πŸ’ͺ Upper Body | πŸ«€ Blood Vessels | Circulation of blood | πŸš‘ Hypertension | 55 | 40110 | 40599 | 1 in 3 |
35
+ | 15 | 🦡 Lower Body | 🍝 Colon | Absorption of water, minerals | 🌟 Colorectal Cancer | 14 | 45378 | 45378 | 1 in 23 |
36
+ | 16 | 🦡 Lower Body | 🚽 Bladder | Urine excretion | πŸ’§ Urinary Incontinence | 8 | 51700 | 51798 | 1 in 4 (over 65 years) |
37
+ | 17 | 🦡 Lower Body | πŸ’ž Reproductive Organs | Sex hormone secretion | πŸŽ—οΈ Endometriosis | 22 | 56405 | 58999 | 1 in 10 (women) |
38
+ | 18 | 🦢 Feet | 🎯 Nerve endings | Balance and movement | πŸ€• Peripheral Neuropathy | 19 | 95900 | 96004 | 1 in 30 |
39
+ | 19 | 🦢 Feet | 🌑️ Skin | Temperature regulation | 🌞 Skin Cancer | 8.1 | 96910 | 96999 | 1 in 5 |
40
+ | 20 | 🦢 Feet | πŸ’ͺ Muscles | Movement and strength | πŸ‹οΈβ€β™‚οΈ Musculoskeletal Disorders | 176 | 97110 | 97799 | 1 in 2 |
41
+
42
+ """)
43
+
44
+ import streamlit as st
45
+ import pandas as pd
46
+
47
+ # Load dataset
48
+ def load_data():
49
+ return pd.read_csv('anatomy_dataset.csv')
50
+
51
+ # Save dataset
52
+ def save_data(df):
53
+ df.to_csv('anatomy_dataset.csv', index=False)
54
+
55
+ # CRUD Operations
56
+ def add_data(df):
57
+ # Add a row to the dataframe (Example)
58
+ # You can modify this function to take input from the user
59
+ new_row = {'Table Num': 21, 'Body Part': 'New Part', 'Organ/Part': 'New Organ', 'Description': 'New Description',
60
+ 'Costly Condition': 'New Condition', 'Spending (billions)': 0, 'CPT Range Start': 0, 'CPT Range Finish': 0,
61
+ 'Frequency': 'New Frequency'}
62
+ df = df.append(new_row, ignore_index=True)
63
+ return df
64
+
65
+ def update_data(df):
66
+ # Update a row in the dataframe (Example)
67
+ # Implement the update logic based on your requirements
68
+ if not df.empty:
69
+ df.at[0, 'Description'] = 'Updated Description'
70
+ return df
71
+
72
+ def delete_data(df):
73
+ # Delete a row from the dataframe (Example)
74
+ # Implement the delete logic based on your requirements
75
+ if not df.empty:
76
+ df = df.drop(df.index[0])
77
+ return df
78
+
79
+ # Streamlit UI
80
+ st.title("Anatomy Head to Toe CRUD Operations")
81
+
82
+ # Display the table if checkbox is checked
83
+ if st.checkbox('Show Anatomy Table'):
84
+ df = load_data()
85
+ st.markdown("## Anatomy Head to Toe Table with Body Organs Costly Conditions, Spending, CPT Codes and Frequency")
86
+ st.dataframe(df)
87
+
88
+ # CRUD operation buttons
89
+ col1, col2, col3, col4 = st.columns(4)
90
+ if col1.button('βž• Add'):
91
+ df = load_data()
92
+ df = add_data(df)
93
+ save_data(df)
94
+
95
+ if col2.button('πŸ”„ Update'):
96
+ df = load_data()
97
+ df = update_data(df)
98
+ save_data(df)
99
+
100
+ if col3.button('❌ Delete'):
101
+ df = load_data()
102
+ df = delete_data(df)
103
+ save_data(df)
104
+
105
+ if col4.button('πŸ’Ύ Save'):
106
+ df = load_data()
107
+ save_data(df)
108
+ st.success("Data saved to CSV!")
109
+
110
+