Spaces:
Running
Running
drguilhermeapolinario
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ from streamlit_extras.stylable_container import stylable_container
|
|
16 |
from streamlit_folium import folium_static
|
17 |
from streamlit_option_menu import option_menu
|
18 |
|
19 |
-
from data_cleaning import criar_dataframe, iniciar, limpa_rci1, limpa_rci2, separa_grupos, renomear_escola, limpar_dfs
|
20 |
|
21 |
st.set_page_config(
|
22 |
page_title="Dashboard UBS Flamengo",
|
@@ -25,28 +25,6 @@ st.set_page_config(
|
|
25 |
initial_sidebar_state="expanded",
|
26 |
)
|
27 |
|
28 |
-
def processar_arquivo(file):
|
29 |
-
"""
|
30 |
-
A function that processes the uploaded file by writing it to a temporary CSV file,
|
31 |
-
then performs various data cleaning operations on the CSV data to create and return dataframes.
|
32 |
-
Returns:
|
33 |
-
- dataframes: the processed dataframes generated from the uploaded file
|
34 |
-
"""
|
35 |
-
csv_st = iniciar(file)
|
36 |
-
clean_txt = limpa_rci1(csv_st)
|
37 |
-
grupos_encontrados = separa_grupos(clean_txt)
|
38 |
-
dataframes = criar_dataframe(grupos_encontrados)
|
39 |
-
|
40 |
-
# Renomear descrições do DataFrame de escolaridade
|
41 |
-
dataframes["Escola"] = renomear_escola(dataframes["Escola"])
|
42 |
-
|
43 |
-
# Aplicar limpeza final nos DataFrames
|
44 |
-
clean_final = r"(\sativ\w+)|(\sde\scid.+o)|(iciê.+ia)|((?<=rans)gên.+o|omem|ulher|ário|Homoss.+\(|\))|(\d{10}\s-\s)"
|
45 |
-
substituicao = ""
|
46 |
-
dataframes = limpar_dfs(dataframes, clean_final, substituicao)
|
47 |
-
|
48 |
-
return dataframes
|
49 |
-
|
50 |
# Inicializar variáveis dos DataFrames como None
|
51 |
DF_DATA = None
|
52 |
DF_HEAD = None
|
@@ -180,8 +158,7 @@ with c2:
|
|
180 |
overflow: hidden;
|
181 |
position: relative;
|
182 |
object-fit: cover;
|
183 |
-
mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
|
184 |
-
-webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0)); /* For Safari */
|
185 |
}
|
186 |
""",
|
187 |
):
|
|
|
16 |
from streamlit_folium import folium_static
|
17 |
from streamlit_option_menu import option_menu
|
18 |
|
19 |
+
from data_cleaning import criar_dataframe, iniciar, limpa_rci1, limpa_rci2, separa_grupos, renomear_escola, limpar_dfs, processar_arquivo
|
20 |
|
21 |
st.set_page_config(
|
22 |
page_title="Dashboard UBS Flamengo",
|
|
|
25 |
initial_sidebar_state="expanded",
|
26 |
)
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# Inicializar variáveis dos DataFrames como None
|
29 |
DF_DATA = None
|
30 |
DF_HEAD = None
|
|
|
158 |
overflow: hidden;
|
159 |
position: relative;
|
160 |
object-fit: cover;
|
161 |
+
mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0)); /* For Safari */
|
|
|
162 |
}
|
163 |
""",
|
164 |
):
|