LakshmiHarika commited on
Commit
bc21413
·
verified ·
1 Parent(s): 81dd206

Update pages/Data Collection.py

Browse files
Files changed (1) hide show
  1. pages/Data Collection.py +81 -232
pages/Data Collection.py CHANGED
@@ -26,52 +26,39 @@ st.markdown("""
26
  </style>
27
  """, unsafe_allow_html=True)
28
 
29
- st.markdown(
30
- """
31
- <style>
32
- .stApp {
33
- background-image: url("https://huggingface.co/spaces/LakshmiHarika/MachineLearning/resolve/main/DALL%C2%B7E%202024-12-03%2023.34.47%20-%20A%20simple%20and%20elegant%20background%20image%20for%20an%20AI-themed%20web%20application.%20The%20background%20should%20feature%20a%20soft%20gradient%20transitioning%20from%20white%20to%20ligh.webp");
34
- background-size: cover;
35
- background-repeat: no-repeat;
36
- background-attachment: fixed;
37
- }
38
- </style>
39
- """,
40
- unsafe_allow_html=True
41
- )
42
 
43
- # Page Title
44
- st.markdown("""
45
- <div style="text-align: left; margin-top: 20px;">
46
- <h2 style="color: #BB3385;">What is Data?📊✨</h2>
47
- </div>
48
- """, unsafe_allow_html=True)
49
 
50
- # Introduction Text
51
- st.write("""
52
- **Data** is the measurements that are collected as a source of Information.
53
- It refers raw facts, figures, and observations that can be collected, stored, and processed.
54
- It has no meaning on its own until it is organized or analyzed to derive useful information.""")
 
 
55
 
56
- # Types of Data Section
57
- st.markdown("""
58
- <div style="text-align: left; margin-top: 20px;">
59
- <h2 style="color: #2a52be;">Types of Data</h2>
60
- </div>
61
- """, unsafe_allow_html=True)
62
 
63
- # Radio Button for Data Type Selection
64
- data_type = st.radio(
65
- "Select the type of Data:",
66
- ("Structured Data", "Unstructured Data", "Semi-Structured Data")
67
- )
68
 
69
- # Ensure session state is initialized
70
- if "explore_excel" not in st.session_state:
71
- st.session_state.explore_excel = False
 
72
 
73
- # Main Structured Data Content
74
- if not st.session_state.explore_excel:
75
  if data_type == "Structured Data":
76
  st.markdown("""
77
  <div style="text-align: left; margin-top: 20px;">
@@ -79,66 +66,57 @@ if not st.session_state.explore_excel:
79
  </div>
80
  """, unsafe_allow_html=True)
81
 
82
- st.markdown("""
83
- <div style="text-align: left; margin-top: 20px;">
84
- <h4 style="color: #5b2c6f;">Definition:</h4>
85
- </div>
86
- """, unsafe_allow_html=True)
87
  st.write("""
88
  **Structured data** refers to information that is organized and formatted in a predefined manner, making it easy to store, retrieve, and analyze.
89
- It is typically stored in tabular formats like rows and columns, where each field contains a specific type of information.
90
  """)
91
 
92
- st.markdown("""
93
- <div style="text-align: left; margin-top: 20px;">
94
- <h4 style="color: #5b2c6f;">Characteristics:</h4>
95
- </div>
96
- """, unsafe_allow_html=True)
97
  st.write("""
98
- - Follows a fixed schema.
99
- - Can be easily searched using query languages like SQL.
100
- - Suitable for quantitative analysis.
101
  """)
102
 
 
 
 
 
103
  st.markdown("""
104
  <div style="text-align: left; margin-top: 20px;">
105
- <h4 style="color: #5b2c6f;">Examples:</h4>
106
  </div>
107
  """, unsafe_allow_html=True)
 
 
 
 
 
 
108
  st.write("""
109
- A database of students with fields like ID, name, age, and gender:
110
  """)
111
 
112
- student_data = {
113
- "Id": [100, 101, 102, 103],
114
- "Name": ["Lakshmi Harika", "Varshitha", "Hari Chandan", "Shamitha"],
115
- "Age": [22, 23, 22, 23],
116
- "Gender": ["Female", "Female", "Male", "Female"]
117
- }
118
- df = pd.DataFrame(student_data)
119
- st.markdown(df.style.set_table_styles(
120
- [{'selector': 'thead th', 'props': 'font-weight: bold;'}]
121
- ).hide(axis="index").to_html(), unsafe_allow_html=True)
122
 
 
123
  st.markdown("""
124
  <div style="text-align: left; margin-top: 20px;">
125
- <h4 style="color: #5b2c6f;">Data Formats in Structured Data:</h4>
126
  </div>
127
  """, unsafe_allow_html=True)
128
 
129
- st.write("Click to explore Structured Data Formats:")
130
- if st.button("Structured Data Formats"):
131
- st.write("Select a format to explore:")
 
132
 
133
- # Sub-buttons for specific formats
134
- col1, = st.columns(1)
 
135
 
136
- with col1:
137
- if st.button("Explore Excel"):
138
- st.session_state.explore_excel = True
139
 
140
- # Excel Content Page
141
- if st.session_state.explore_excel:
142
  st.markdown("""
143
  <div style="text-align: left; margin-top: 20px;">
144
  <h3 style="color: #e25822;">Exploring Excel</h3>
@@ -146,25 +124,12 @@ if st.session_state.explore_excel:
146
  """, unsafe_allow_html=True)
147
 
148
  st.write("""
149
- Excel is one of the most widely used tools for handling structured data. It supports features like:
150
- - Tabular data representation.
151
- - Complex computations using formulas.
152
- - Data visualization with charts and graphs.
153
- - Seamless integration with other software.
154
  """)
155
 
156
- st.markdown("""
157
- <div style="text-align: left; margin-top: 20px;">
158
- <h4 style="color: #5b2c6f;">Why Learn Excel?</h4>
159
- </div>
160
- """, unsafe_allow_html=True)
161
- st.write("""
162
- - **Widely Used:** Excel is a powerful tool used across industries.
163
- - **Versatile:** It supports data entry, visualization, and complex calculations.
164
- - **Easy to Learn:** It has a user-friendly interface and a wealth of learning resources.
165
- """)
166
-
167
- # Add Excel file uploader and display content
168
  uploaded_file = st.file_uploader("Upload an Excel file", type=["xlsx", "xls"])
169
  if uploaded_file:
170
  try:
@@ -174,161 +139,45 @@ if st.session_state.explore_excel:
174
  except Exception as e:
175
  st.error("An error occurred while reading the file. Please ensure it is a valid Excel file.")
176
 
177
- st.markdown("""
178
- <div style="text-align: left; margin-top: 20px;">
179
- <h4 style="color: #5b2c6f;">Tips for Using Excel Effectively:</h4>
180
- </div>
181
- """, unsafe_allow_html=True)
182
- st.write("""
183
- - Use built-in functions like SUM, AVERAGE, and VLOOKUP to save time.
184
- - Utilize conditional formatting for better data visualization.
185
- - Leverage pivot tables to summarize and analyze large datasets.
186
- """)
187
-
188
- # Add a "Go Back" button
189
  if st.button("Go Back"):
190
- st.session_state.explore_excel = False
191
-
192
-
193
- elif data_type == "Unstructured Data":
194
- st.markdown("""
195
- <div style="text-align: left; margin-top: 20px;">
196
- <h3 style="color: #e25822;">What is Unstructured Data?</h3>
197
- </div>
198
- """, unsafe_allow_html=True)
199
-
200
- st.markdown("""
201
- <div style="text-align: left; margin-top: 20px;">
202
- <h4 style="color: #5b2c6f;">Definition:</h4>
203
- </div>
204
- """, unsafe_allow_html=True)
205
- st.write("""
206
- **Unstructured data** refers to information that does not follow a predefined format or structure.
207
- It is typically raw data that lacks a clear, organized schema, making it harder to store and analyze using traditional tools.
208
- Examples include multimedia files (images, videos, audio), emails, and social media posts.
209
- """)
210
 
 
 
211
  st.markdown("""
212
  <div style="text-align: left; margin-top: 20px;">
213
- <h4 style="color: #5b2c6f;">Characteristics:</h4>
214
  </div>
215
  """, unsafe_allow_html=True)
216
- st.write("""
217
- - Does not follow a specific schema or structure.
218
- - Cannot be stored in traditional tabular formats like rows and columns.
219
- - Requires advanced tools like machine learning or natural language processing (NLP) for analysis.
220
- """)
221
 
222
- st.markdown("""
223
- <div style="text-align: left; margin-top: 20px;">
224
- <h4 style="color: #5b2c6f;">Example:</h4>
225
- </div>
226
- """, unsafe_allow_html=True)
227
  st.write("""
228
- Examples of unstructured data include:
229
- - **Images**: Photos, screenshots, or scanned documents.
230
- - **Audio**: Podcasts, voice recordings, or music files.
231
- - **Videos**: Recorded lectures, surveillance footage, or YouTube videos.
232
- - **Text**: Emails, social media posts, and blog articles.
233
  """)
234
 
235
- st.markdown("""
236
- <div style="text-align: left; margin-top: 20px;">
237
- <h4 style="color: #5b2c6f;">Data Formats in Unstructured Data:</h4>
238
- </div>
239
- """, unsafe_allow_html=True)
240
-
241
- st.write("Click to explore Unstructured Data Formats:")
242
- if st.button("Unstructured Data Formats"):
243
- st.write("Select a format to explore:")
244
-
245
- # Sub-buttons for specific formats
246
- col1, col2, col3, col4 = st.columns(4)
247
-
248
- with col1:
249
- if st.button("Explore Images"):
250
- st.write("Redirecting to Images page...")
251
-
252
- with col2:
253
- if st.button("Explore Audio"):
254
- st.write("Redirecting to Audio page...")
255
-
256
- with col3:
257
- if st.button("Explore Video"):
258
- st.write("Redirecting to Video page...")
259
-
260
- with col4:
261
- if st.button("Explore Text"):
262
- st.write("Redirecting to Text page...")
263
-
264
-
265
- # Semi-Structured Data Section
266
- elif data_type == "Semi-Structured Data":
267
- st.markdown("""
268
- <div style="text-align: left; margin-top: 20px;">
269
- <h3 style="color: #e25822;">What is Semi-Structured Data?</h3>
270
- </div>
271
- """, unsafe_allow_html=True)
272
 
 
 
273
  st.markdown("""
274
  <div style="text-align: left; margin-top: 20px;">
275
- <h4 style="color: #5b2c6f;">Definition:</h4>
276
  </div>
277
  """, unsafe_allow_html=True)
278
- st.write("""
279
- **Semi-Structured data** refers to information that does not follow a strict tabular format but contains tags or markers to separate data elements.
280
- This type of data is more flexible than structured data but still organized enough to allow for easier analysis than unstructured data.
281
- """)
282
 
283
- st.markdown("""
284
- <div style="text-align: left; margin-top: 20px;">
285
- <h4 style="color: #5b2c6f;">Characteristics:</h4>
286
- </div>
287
- """, unsafe_allow_html=True)
288
  st.write("""
289
- - Contains markers or tags (e.g., XML, JSON keys) to provide structure.
290
- - More flexible than structured data, allowing for varying schemas.
291
- - Easier to process than unstructured data.
292
  """)
293
 
294
- st.markdown("""
295
- <div style="text-align: left; margin-top: 20px;">
296
- <h4 style="color: #5b2c6f;">Examples:</h4>
297
- </div>
298
- """, unsafe_allow_html=True)
299
- st.write("""
300
- Examples of semi-structured data include:
301
- - **CSV**: Comma-separated values in plain-text files.
302
- - **JSON**: A lightweight data-interchange format used in web applications.
303
- - **XML**: Extensible Markup Language for structured document encoding.
304
- - **HTML**: Markup language for web pages.
305
- """)
306
-
307
- st.markdown("""
308
- <div style="text-align: left; margin-top: 20px;">
309
- <h4 style="color: #5b2c6f;">Data Formats in Semi-Structured Data:</h4>
310
- </div>
311
- """, unsafe_allow_html=True)
312
-
313
- st.write("Click to explore Semi-Structured Data Formats:")
314
- if st.button("Semi-Structured Data Formats"):
315
- st.write("Select a format to explore:")
316
-
317
- # Sub-buttons for specific formats
318
- col1, col2, col3, col4 = st.columns(4)
319
-
320
- with col1:
321
- if st.button("Explore CSV"):
322
- st.write("Redirecting to CSV page...")
323
-
324
- with col2:
325
- if st.button("Explore JSON"):
326
- st.write("Redirecting to JSON page...")
327
-
328
- with col3:
329
- if st.button("Explore XML"):
330
- st.write("Redirecting to XML page...")
331
 
332
- with col4:
333
- if st.button("Explore HTML"):
334
- st.write("Redirecting to HTML page...")
 
26
  </style>
27
  """, unsafe_allow_html=True)
28
 
29
+ # Ensure session state for page tracking is initialized
30
+ if "current_page" not in st.session_state:
31
+ st.session_state.current_page = "main"
 
 
 
 
 
 
 
 
 
 
32
 
33
+ # Function to navigate between pages
34
+ def navigate_to(page_name):
35
+ st.session_state.current_page = page_name
 
 
 
36
 
37
+ # Main Page
38
+ if st.session_state.current_page == "main":
39
+ st.markdown("""
40
+ <div style="text-align: left; margin-top: 20px;">
41
+ <h2 style="color: #BB3385;">What is Data?\ud83d\udcca\u2728</h2>
42
+ </div>
43
+ """, unsafe_allow_html=True)
44
 
45
+ st.write("""
46
+ **Data** is the measurements that are collected as a source of Information.
47
+ It refers to raw facts, figures, and observations that can be collected, stored, and processed.
48
+ It has no meaning on its own until it is organized or analyzed to derive useful information.
49
+ """)
 
50
 
51
+ st.markdown("""
52
+ <div style="text-align: left; margin-top: 20px;">
53
+ <h2 style="color: #2a52be;">Types of Data</h2>
54
+ </div>
55
+ """, unsafe_allow_html=True)
56
 
57
+ data_type = st.radio(
58
+ "Select the type of Data:",
59
+ ("Structured Data", "Unstructured Data", "Semi-Structured Data")
60
+ )
61
 
 
 
62
  if data_type == "Structured Data":
63
  st.markdown("""
64
  <div style="text-align: left; margin-top: 20px;">
 
66
  </div>
67
  """, unsafe_allow_html=True)
68
 
 
 
 
 
 
69
  st.write("""
70
  **Structured data** refers to information that is organized and formatted in a predefined manner, making it easy to store, retrieve, and analyze.
 
71
  """)
72
 
 
 
 
 
 
73
  st.write("""
74
+ Click below to explore structured data formats:
 
 
75
  """)
76
 
77
+ if st.button("Explore Excel"):
78
+ navigate_to("explore_excel")
79
+
80
+ elif data_type == "Unstructured Data":
81
  st.markdown("""
82
  <div style="text-align: left; margin-top: 20px;">
83
+ <h3 style="color: #e25822;">What is Unstructured Data?</h3>
84
  </div>
85
  """, unsafe_allow_html=True)
86
+
87
+ st.write("""
88
+ **Unstructured data** refers to information that does not follow a predefined format or structure.
89
+ It includes raw data such as images, videos, audio, and social media posts.
90
+ """)
91
+
92
  st.write("""
93
+ Click below to explore unstructured data formats:
94
  """)
95
 
96
+ if st.button("Explore Images"):
97
+ navigate_to("explore_images")
 
 
 
 
 
 
 
 
98
 
99
+ elif data_type == "Semi-Structured Data":
100
  st.markdown("""
101
  <div style="text-align: left; margin-top: 20px;">
102
+ <h3 style="color: #e25822;">What is Semi-Structured Data?</h3>
103
  </div>
104
  """, unsafe_allow_html=True)
105
 
106
+ st.write("""
107
+ **Semi-Structured data** refers to information that does not follow a strict tabular format but contains tags or markers to separate data elements.
108
+ Examples include JSON, XML, and CSV.
109
+ """)
110
 
111
+ st.write("""
112
+ Click below to explore semi-structured data formats:
113
+ """)
114
 
115
+ if st.button("Explore JSON"):
116
+ navigate_to("explore_json")
 
117
 
118
+ # Excel Page
119
+ elif st.session_state.current_page == "explore_excel":
120
  st.markdown("""
121
  <div style="text-align: left; margin-top: 20px;">
122
  <h3 style="color: #e25822;">Exploring Excel</h3>
 
124
  """, unsafe_allow_html=True)
125
 
126
  st.write("""
127
+ Excel is one of the most widely used tools for handling structured data. It supports features like:
128
+ - Tabular data representation.
129
+ - Complex computations using formulas.
130
+ - Data visualization with charts and graphs.
 
131
  """)
132
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  uploaded_file = st.file_uploader("Upload an Excel file", type=["xlsx", "xls"])
134
  if uploaded_file:
135
  try:
 
139
  except Exception as e:
140
  st.error("An error occurred while reading the file. Please ensure it is a valid Excel file.")
141
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  if st.button("Go Back"):
143
+ navigate_to("main")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
+ # Images Page
146
+ elif st.session_state.current_page == "explore_images":
147
  st.markdown("""
148
  <div style="text-align: left; margin-top: 20px;">
149
+ <h3 style="color: #e25822;">Exploring Images</h3>
150
  </div>
151
  """, unsafe_allow_html=True)
 
 
 
 
 
152
 
 
 
 
 
 
153
  st.write("""
154
+ Images are a form of unstructured data often used in visual applications like facial recognition and medical imaging.
155
+ Common formats include JPEG, PNG, and BMP.
 
 
 
156
  """)
157
 
158
+ if st.button("Go Back"):
159
+ navigate_to("main")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
+ # JSON Page
162
+ elif st.session_state.current_page == "explore_json":
163
  st.markdown("""
164
  <div style="text-align: left; margin-top: 20px;">
165
+ <h3 style="color: #e25822;">Exploring JSON</h3>
166
  </div>
167
  """, unsafe_allow_html=True)
 
 
 
 
168
 
 
 
 
 
 
169
  st.write("""
170
+ JSON (JavaScript Object Notation) is a lightweight data-interchange format often used in web applications.
171
+ It is easy for humans to read and write and easy for machines to parse and generate.
 
172
  """)
173
 
174
+ st.code("""
175
+ {
176
+ "name": "John Doe",
177
+ "age": 30,
178
+ "city": "New York"
179
+ }
180
+ """, language="json")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
+ if st.button("Go Back"):
183
+ navigate_to("main")