File size: 1,328 Bytes
75c6e74
 
 
 
 
 
 
 
a832d75
75c6e74
a832d75
 
 
 
 
75c6e74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

# app_04.py
import os
import dash
from load_process import load_files
from layout_01 import criar_layout
from callbacks import registrar_callbacks
from flask_caching import Cache
from load_process import load_bairros, load_coleta, load_descartes

print("📦 Carregando dados geoespaciais...")
gdf_bairros = load_bairros()
gdf_coleta = load_coleta()
gdf_descartes = load_descartes()
print("✅ Dados carregados")


# Leitura dos dados
#gdf_m,df_plot,list_feature,feat_options=load_files() #original
gdf_m,df_plot,list_feature,feat_options,gdf_p =load_files(ponto_descarte=True)

descriptions_map = {
    opt['value']: opt['description']
    for opt in feat_options
    if opt.get('description') is not None
}

# APP
app = dash.Dash(__name__)
server = app.server  #to render deploy

# Inicialização do CACHE
cache = Cache(server, config={
    'CACHE_TYPE': 'SimpleCache',
    'CACHE_DEFAULT_TIMEOUT': 300  # segundos
})

# Configurar layout
app.layout = criar_layout(feat_options)

# Registrar callbacks
registrar_callbacks(app, df_plot, gdf_m,descriptions_map,gdf_p,cache)

# if __name__ == '__main__':
#     app.run(debug=True, host='0.0.0.0', port=8050)



# Execução local (ignorado por Gunicorn)
if __name__ == '__main__':
    port = int(os.environ.get("PORT", 8050))
    app.run(debug=False, host='0.0.0.0', port=port)