Charles De Dampierre commited on
Commit
916b870
1 Parent(s): ab855e2

changes website

Browse files
__pycache__/region_list.cpython-311.pyc CHANGED
Binary files a/__pycache__/region_list.cpython-311.pyc and b/__pycache__/region_list.cpython-311.pyc differ
 
app.py CHANGED
@@ -4,11 +4,17 @@ import os
4
  import pandas as pd
5
  import tomli
6
 
 
7
  pd.options.mode.chained_assignment = None
8
 
 
9
  st.set_page_config(layout="wide")
10
 
11
- # Test change
 
 
 
 
12
 
13
 
14
  @st.cache_data
@@ -41,135 +47,176 @@ def get_region_description(region_data, selected_region):
41
  region_data = load_region_descriptions()
42
 
43
 
44
- st.sidebar.title("Our History in Data")
45
- st.sidebar.write(
46
- "This project is led by Charles de Dampierre, Folgert Karsdorp, Mike Kestemont, Valentin Thouzeau and Nicolas Baumard"
 
 
47
  )
48
 
49
- # Set the global index path
50
- global_index_path = "data/immaterial_index/figures_trends_R/results"
51
- global_index_path_per_capita = (
52
- "data/immaterial_index/figures_trends_R/results_per_capita"
53
- )
54
- unseen_index_path = (
55
- "data/immaterial_index/figures_trends_R/figures_unseen/results_unseen"
56
- )
57
- unseen_capita_index_path = (
58
- "data/immaterial_index/figures_trends_R/figures_unseen/results_unseen/per_capita"
59
  )
60
 
61
 
62
- population_path = "data/population"
63
- maps_path = "data/map_figures"
64
-
65
-
66
- from region_list import region_list
67
-
68
- region_filtered = list(region_list.keys())
69
-
70
- index_paths = {}
71
-
72
- for region_key in region_list:
73
- # Create the index paths for the current region
74
- index_paths[region_key] = {
75
- "map": f"{maps_path}/map_{region_key}.png",
76
- "global_index": f"{global_index_path}/{region_key}.png",
77
- "global_index_per_capita": f"{global_index_path_per_capita}/{region_key}.png",
78
- "unseen_index": f"{unseen_index_path}/{region_key}.png",
79
- "unseen_index_capita": f"{unseen_capita_index_path}/{region_key}.png",
80
- "population_index": f"{population_path}/{region_key}.png",
81
- }
82
-
83
- # Get the region names (keys) from the index_paths dictionary
84
- regions = list(index_paths.keys())
85
-
86
- # Allow the user to select a region
87
- selected_region = st.sidebar.selectbox("Region:", regions, index=regions.index("Japan"))
88
-
89
- # Display the selected region's images vertically
90
- if selected_region in index_paths:
91
- col1, col2 = st.columns(2)
92
-
93
- df = df_ind[df_ind["region_name"] == selected_region]
94
- df = df.drop(["region_name", "decade"], axis=1)
95
- df = df[
96
- [
97
- "individual_name",
98
- "productive_year",
99
- "score",
100
- "individual_wikidata_id" "",
101
- ]
102
- ]
103
- df = df.sort_values("score", ascending=False)
104
- df = df.rename(columns={"score": "Number of Catalogs"})
105
-
106
- min_date = region_list[selected_region]["time_range"][0]
107
- max_date = region_list[selected_region]["time_range"][1]
108
- df = df[df["productive_year"] >= min_date]
109
- df = df[df["productive_year"] <= max_date]
110
- df["productive_year"] = df["productive_year"].astype(int)
111
- df = df.reset_index(drop=True)
112
-
113
- # Display the data in the left column
114
- with col1:
115
- st.header("Cultural Producers")
116
- st.dataframe(df)
117
- st.write(f"Number of Cultural producers active before 1800: {len(df)}")
118
-
119
- for key, path in index_paths[selected_region].items():
120
- if os.path.exists(path):
121
-
122
- if key == "global_index":
123
- st.subheader("Global Index")
124
- st.image(
125
- Image.open(path),
126
- caption=key.capitalize(),
127
- use_column_width=True,
128
- )
129
- elif key == "global_index_per_capita":
130
- st.subheader("Index per capita")
131
- st.image(
132
- Image.open(path),
133
- caption=key.capitalize(),
134
- use_column_width=True,
135
- )
136
- elif key == "unseen_index":
137
- st.subheader("Unsee-Species Index")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  st.image(
139
- Image.open(path),
140
- caption=key.capitalize(),
141
  use_column_width=True,
 
142
  )
143
- elif key == "unseen_index_capita":
144
- st.subheader("Unsee-Species per capita Index")
145
- st.image(
146
- Image.open(path),
147
- caption=key.capitalize(),
148
- use_column_width=True,
 
149
  )
150
- elif key == "population_index":
151
- st.subheader("Population Index")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  st.image(
153
  Image.open(path),
154
  caption=key.capitalize(),
155
  use_column_width=True,
156
  )
157
- elif key == "map":
158
- st.subheader("Maps")
159
- st.sidebar.image(
160
- Image.open(path),
161
- caption=key.capitalize(),
162
- use_column_width=True,
163
- )
164
- else:
165
- st.write(f"File for {key.capitalize()} does not exist.")
166
-
167
- with col2:
168
- try:
169
- region_description = get_region_description(
170
- region_data, selected_region
171
- )
172
- st.header("Analysis")
173
- st.write(f"{region_description}")
174
- except:
175
- st.write("Analysis not ready yet")
 
4
  import pandas as pd
5
  import tomli
6
 
7
+
8
  pd.options.mode.chained_assignment = None
9
 
10
+
11
  st.set_page_config(layout="wide")
12
 
13
+
14
+ st.markdown(
15
+ "<div style='background-color: lightblue; text-align: center; padding: 10px;'><h1 style='font-size: 70px;'>Our History in Data</h1></div>",
16
+ unsafe_allow_html=True,
17
+ )
18
 
19
 
20
  @st.cache_data
 
47
  region_data = load_region_descriptions()
48
 
49
 
50
+ # page = st.sidebar.selectbox("Navigate to:", ["Home", "Methodology", "Team"])
51
+ page = st.sidebar.radio(
52
+ "Menu",
53
+ ["Home", "Methodology", "Team", "About"],
54
+ key="navigation_radio",
55
  )
56
 
57
+
58
+ st.sidebar.success(
59
+ "This project is led by Charles de Dampierre, Folgert Karsdorp, Mike Kestemont, Valentin Thouzeau and Nicolas Baumard"
 
 
 
 
 
 
 
60
  )
61
 
62
 
63
+ # Test change
64
+ if page == "Home":
65
+
66
+ # Set the global index path
67
+ global_index_path = "data/immaterial_index/figures_trends_R/results"
68
+ global_index_path_per_capita = (
69
+ "data/immaterial_index/figures_trends_R/results_per_capita"
70
+ )
71
+ unseen_index_path = (
72
+ "data/immaterial_index/figures_trends_R/figures_unseen/results_unseen"
73
+ )
74
+ unseen_capita_index_path = "data/immaterial_index/figures_trends_R/figures_unseen/results_unseen/per_capita"
75
+
76
+ population_path = "data/population"
77
+ maps_path = "data/map_figures"
78
+
79
+ from region_list import region_list
80
+
81
+ region_filtered = list(region_list.keys())
82
+
83
+ index_paths = {}
84
+
85
+ for region_key in region_list:
86
+ # Create the index paths for the current region
87
+ index_paths[region_key] = {
88
+ "map": f"{maps_path}/map_{region_key}.png",
89
+ "global_index": f"{global_index_path}/{region_key}.png",
90
+ "global_index_per_capita": f"{global_index_path_per_capita}/{region_key}.png",
91
+ "unseen_index": f"{unseen_index_path}/{region_key}.png",
92
+ "unseen_index_capita": f"{unseen_capita_index_path}/{region_key}.png",
93
+ "population_index": f"{population_path}/{region_key}.png",
94
+ }
95
+
96
+ # Get the region names (keys) from the index_paths dictionary
97
+ regions = list(index_paths.keys())
98
+
99
+ # Allow the user to select a region
100
+ selected_region = st.sidebar.selectbox(
101
+ "Region:", regions, index=regions.index("Japan")
102
+ )
103
+
104
+ # Display the selected region's images vertically
105
+ if selected_region in index_paths:
106
+ st.markdown(
107
+ f"<h1 style='text-align: left; font-size: 50px;'>{selected_region}</h1>",
108
+ unsafe_allow_html=True,
109
+ )
110
+
111
+ try:
112
+ st.image(
113
+ f"image/{selected_region}.jpeg",
114
+ caption="Japan",
115
+ use_column_width=False,
116
+ width=1000,
117
+ )
118
+ except:
119
+ pass
120
+
121
+ col1, col2, col3 = st.columns([8, 1, 8])
122
+
123
+ # Display the data in the left column
124
+ with col1:
125
+ for key, path in index_paths[selected_region].items():
126
+ if os.path.exists(path):
127
+
128
+ if key == "global_index":
129
+ st.subheader("Cultural Index")
130
+ st.image(
131
+ Image.open(path),
132
+ caption=key.capitalize(),
133
+ use_column_width=True,
134
+ )
135
+ elif key == "global_index_per_capita":
136
+ st.subheader("Cultural Index per capita")
137
+ st.image(
138
+ Image.open(path),
139
+ caption=key.capitalize(),
140
+ use_column_width=True,
141
+ )
142
+ elif key == "unseen_index":
143
+ st.subheader(
144
+ "Cultural Index corrected by the unseen-species model"
145
+ )
146
+ print(path)
147
+ st.image(
148
+ Image.open(path),
149
+ caption=key.capitalize(),
150
+ use_column_width=True,
151
+ )
152
+ elif key == "unseen_index_capita":
153
+ st.subheader(
154
+ "Cultural Index per capita corrected by the unseen-species model"
155
+ )
156
+ st.image(
157
+ Image.open(path),
158
+ caption=key.capitalize(),
159
+ use_column_width=True,
160
+ )
161
+
162
+ else:
163
+ st.write(f"File for {key.capitalize()} does not exist.")
164
+
165
+ with col3:
166
+
167
+ try:
168
  st.image(
169
+ Image.open(f"data/map_figures/map_{selected_region}.png"),
 
170
  use_column_width=True,
171
+ width=1000,
172
  )
173
+ except:
174
+ pass
175
+
176
+ st.subheader("Analysis")
177
+ try:
178
+ region_description = get_region_description(
179
+ region_data, selected_region
180
  )
181
+ st.write(f"{region_description}")
182
+ except:
183
+ st.write("Analysis not ready yet")
184
+
185
+ st.subheader("Cultural Producers in Wikidata")
186
+ df = df_ind[df_ind["region_name"] == selected_region]
187
+ df = df.drop(["region_name", "decade"], axis=1)
188
+ df = df[
189
+ [
190
+ "individual_name",
191
+ "productive_year",
192
+ "score",
193
+ "individual_wikidata_id" "",
194
+ ]
195
+ ]
196
+ df = df.sort_values("score", ascending=False)
197
+ df = df.rename(columns={"score": "Number of Catalogs"})
198
+
199
+ min_date = region_list[selected_region]["time_range"][0]
200
+ max_date = region_list[selected_region]["time_range"][1]
201
+ df = df[df["productive_year"] >= min_date]
202
+ df = df[df["productive_year"] <= max_date]
203
+ df["productive_year"] = df["productive_year"].astype(int)
204
+ df = df.reset_index(drop=True)
205
+ st.dataframe(df)
206
+ st.write(f"Number of Cultural producers active before 1800: {len(df)}")
207
+
208
+ try:
209
+ st.subheader("Population")
210
  st.image(
211
  Image.open(path),
212
  caption=key.capitalize(),
213
  use_column_width=True,
214
  )
215
+ except:
216
+ pass
217
+
218
+
219
+ elif page == "Methodology":
220
+ # Add content for the Methodology section here
221
+ st.markdown("<h2>Methodology</h2>", unsafe_allow_html=True)
222
+ st.write("Here you can describe the methodology used in your project.")
 
 
 
 
 
 
 
 
 
 
 
data/immaterial_index/figures_trends_R/results/Western Europe.png CHANGED

Git LFS Details

  • SHA256: 3f4c1d647eded4521f7c1f2228af87c83d1bb04cda0b7269b8bfd4a926d7c192
  • Pointer size: 131 Bytes
  • Size of remote file: 935 kB

Git LFS Details

  • SHA256: bdd030994e63faa2b6ac9858956f5ecc201d19dfd66d81cbf52dc7e2986a54b0
  • Pointer size: 132 Bytes
  • Size of remote file: 1.29 MB
data/immaterial_index/figures_trends_R/results_per_capita/Western Europe.png ADDED

Git LFS Details

  • SHA256: afcde65294819ef109cf66bb3e01f94a0fb970bde24115680198be7652608831
  • Pointer size: 132 Bytes
  • Size of remote file: 1.29 MB
data/immaterial_index/figures_trends_R/test.png CHANGED

Git LFS Details

  • SHA256: 1834c76dc2aec677faa3f60941e95f25bc62aa8323a10f01e6c5137a39e5f293
  • Pointer size: 131 Bytes
  • Size of remote file: 756 kB

Git LFS Details

  • SHA256: 2b94064e288923bab8b40a8dd382436bfe0e174bb57d3bad188bf15f8c3a934f
  • Pointer size: 131 Bytes
  • Size of remote file: 756 kB
image/Japan.jpeg ADDED
regions.toml CHANGED
@@ -17,6 +17,7 @@ century and recovery from the 13th to 16th centuries Nakabayashi et al. (2020).
17
 
18
  In line with this study Nakabayashi et al. (2020), our results also suggest that the recovery of the economic development began in
19
  the 13th during the Kamakura shogunate, earlier than what was previously estimated.
 
20
  Our result also allows to have finer temporal estimation. For instance, we observe that the isolation of
21
  the country (the sakoku policy) starting in 1633 did not impact economic cultural production. At the other
22
  end of the period, we can see that cultural production was already very robust before the Meiji reforms
 
17
 
18
  In line with this study Nakabayashi et al. (2020), our results also suggest that the recovery of the economic development began in
19
  the 13th during the Kamakura shogunate, earlier than what was previously estimated.
20
+
21
  Our result also allows to have finer temporal estimation. For instance, we observe that the isolation of
22
  the country (the sakoku policy) starting in 1633 did not impact economic cultural production. At the other
23
  end of the period, we can see that cultural production was already very robust before the Meiji reforms