awacke1 commited on
Commit
cd18b19
·
1 Parent(s): fe640f7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +102 -0
app.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+
5
+ # Define the states and their populations and health concerns
6
+ states = {
7
+ 'Minnesota': {
8
+ 'population': 5700000,
9
+ 'health_concerns': ['obesity', 'diabetes', 'heart disease']
10
+ },
11
+ 'Wisconsin': {
12
+ 'population': 5850000,
13
+ 'health_concerns': ['cancer', 'alcoholism', 'depression']
14
+ },
15
+ 'Texas': {
16
+ 'population': 29000000,
17
+ 'health_concerns': ['obesity', 'diabetes', 'heart disease']
18
+ },
19
+ 'Florida': {
20
+ 'population': 21500000,
21
+ 'health_concerns': ['cancer', 'alcoholism', 'depression']
22
+ },
23
+ 'California': {
24
+ 'population': 39500000,
25
+ 'health_concerns': ['obesity', 'diabetes', 'heart disease']
26
+ },
27
+ 'New York': {
28
+ 'population': 19500000,
29
+ 'health_concerns': ['cancer', 'alcoholism', 'depression']
30
+ }
31
+ }
32
+
33
+ # Augment the data by adding random noise and additional columns
34
+ for state in states:
35
+ states[state]['population'] += int(np.random.normal(0, 500000))
36
+ states[state]['climate'] = np.random.choice(['cold', 'moderate', 'hot'])
37
+ states[state]['geography'] = np.random.choice(['coastal', 'inland', 'mountainous'])
38
+ states[state]['economy'] = np.random.choice(['agriculture', 'manufacturing', 'services'])
39
+
40
+ # Create a pandas dataframe from the augmented data
41
+ df = pd.DataFrame.from_dict(states, orient='index')
42
+ df = df[['population', 'climate', 'geography', 'economy', 'health_concerns']]
43
+
44
+ # Define the top 3 health concerns by state
45
+ top_health_concerns = {
46
+ 'Minnesota': ['obesity', 'diabetes', 'heart disease'],
47
+ 'Wisconsin': ['cancer', 'alcoholism', 'depression'],
48
+ 'Texas': ['obesity', 'diabetes', 'heart disease'],
49
+ 'Florida': ['cancer', 'alcoholism', 'depression'],
50
+ 'California': ['obesity', 'diabetes', 'heart disease'],
51
+ 'New York': ['cancer', 'alcoholism', 'depression']
52
+ }
53
+
54
+ # Define the statistics for each health concern and cite references
55
+ statistics = {
56
+ 'obesity': {
57
+ 'prevalence': '32.4%',
58
+ 'source': 'https://www.cdc.gov/obesity/data/prevalence-maps.html'
59
+ },
60
+ 'diabetes': {
61
+ 'prevalence': '10.7%',
62
+ 'source': 'https://www.cdc.gov/diabetes/data/statistics-report/index.html'
63
+ },
64
+ 'heart disease': {
65
+ 'prevalence': '12.1%',
66
+ 'source': 'https://www.cdc.gov/heartdisease/facts.htm'
67
+ },
68
+ 'cancer': {
69
+ 'prevalence': '38.4%',
70
+ 'source': 'https://www.cdc.gov/cancer/dcpc/data/types.htm'
71
+ },
72
+ 'alcoholism': {
73
+ 'prevalence': '14.5%',
74
+ 'source': 'https://www.niaaa.nih.gov/publications/brochures-and-fact-sheets/alcohol-facts-and-statistics'
75
+ },
76
+ 'depression': {
77
+ 'prevalence': '7.6%',
78
+ 'source': 'https://www.nimh.nih.gov/health/statistics/major-depression.shtml'
79
+ }
80
+ }
81
+
82
+ # Define the streamlit app
83
+ def app():
84
+ st.title('Data Augmentation Example')
85
+ st.write('This app demonstrates data augmentation by adding random noise and additional columns to a short python dictionary list of the states.')
86
+
87
+ # Display the augmented data
88
+ st.header('Augmented Data')
89
+ st.write(df)
90
+
91
+ # Display the top 3 health concerns by state and their statistics
92
+ st.header('Top 3 Health Concerns by State')
93
+ for state in top_health_concerns:
94
+ st.subheader(state)
95
+ for health_concern in top_health_concerns[state]:
96
+ st.write(health_concern)
97
+ st.write('Prevalence:', statistics[health_concern]['prevalence'])
98
+ st.write('Source:', statistics[health_concern]['source'])
99
+ st.write('---')
100
+ Run the streamlit app
101
+ if name == 'main':
102
+ app()