Skip to content

Commit

Permalink
Merge pull request #40 from reflejar/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mpvaldez authored Dec 7, 2023
2 parents f7dcd93 + 689de1c commit 8971f06
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 25 deletions.
4 changes: 2 additions & 2 deletions assets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
}

.cell-table tbody tr td {
white-space: pre-line;
white-space: pre-line!important;
min-width: 100%;
width: 150px;
width: 150px!important;
text-align: center!important;
font-family: Arial, Helvetica, sans-serif;
}
Expand Down
2 changes: 1 addition & 1 deletion assets/dashExtensions_default.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ window.dashExtensions = Object.assign({}, window.dashExtensions, {
style.weight = 1;
style.dashArray = false;
} else {
for (let i = 0; i < classes.length; ++i) {
for (let i = 0; i <= classes.length; ++i) {
if (value >= classes[i]) {
style.fillColor = colorscale[i];
style.weight = 1;
Expand Down
7 changes: 6 additions & 1 deletion assets/sticky.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ window.dash_props = Object.assign({}, window.dash_props, {
return
}
if (feature.properties.popup) {
layer.bindPopup(feature.properties.popup)
layer.bindPopup(feature.properties.popup);
}
if (feature.properties.tooltip) {
// here you can change all leaflet tooltip options
Expand All @@ -14,6 +14,11 @@ window.dash_props = Object.assign({}, window.dash_props, {
layer.closeTooltip();
});
}
layer.on('popupclose', function(e) {
if (layer._map.dragging._enabled === undefined) {
layer._map.setView(layer._map.options.center)
}
});
}
}
});
2 changes: 1 addition & 1 deletion dash_tools_reflejar/mapas.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
style.weight = 1;
style.dashArray = false;
} else {
for (let i = 0; i < classes.length; ++i) {
for (let i = 0; i <= classes.length; ++i) {
if (value >= classes[i]) {
style.fillColor = colorscale[i];
style.weight = 1;
Expand Down
23 changes: 15 additions & 8 deletions pages/jurisprudencia/componentes/filtros.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,49 @@
options=DATA['filtros']['voces-tematicas'],
searchable = True,
placeholder = 'Voces temáticas',
className="mt-1"
className="mt-1",
optionHeight=50,
maxHeight=300
)
],
md=6, lg=3, xs=12
md=12, lg=6
),
dbc.Col([
dcc.Dropdown(
id="select-provincia",
options=DATA['filtros']['provincia'],
searchable = True,
placeholder = 'Provincia',
className="mt-1"
className="mt-1",
maxHeight=300
)
],
md=6, lg=3, xs=12
md=12, lg=6
),
dbc.Col([
dcc.Dropdown(
id="select-tipo-fallo",
options=DATA['filtros']['tipo-fallo'],
searchable = True,
placeholder = 'Tipo de fallo',
className="mt-1"
className="mt-1",
optionHeight=50,
maxHeight=300
)
],
md=6, lg=3, xs=12
md=12, lg=6
),
dbc.Col([
dcc.Dropdown(
id="select-organismo",
options=DATA['filtros']['organismo'],
searchable = True,
placeholder = 'Organismo',
className="mt-1"
className="mt-1",
optionHeight=100,
maxHeight=300
)
],
md=6, lg=3, xs=12
md=12, lg=6
),
])
2 changes: 1 addition & 1 deletion pages/ranking_ambiental/componentes/solapas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Solapas = dbc.Row(dbc.Col([
dbc.Tabs(id="tabs-ranking", active_tab='escuelas', children=[
dbc.Tab(label='ESCUELAS', tab_id='escuelas', label_style={'background-color':ROJO, 'border-radius': '40px', 'color': '#000', 'margin-top': "7px"},active_label_style={'border': '4px solid white'}),
dbc.Tab(label='TRANSPARENCIAS', tab_id='transparencia', label_style={'background-color':LILA, 'border-radius': '40px', 'color': '#000', 'margin-top': "7px"},active_label_style={'border': '4px solid white'}),
dbc.Tab(label='TRANSPARENCIA', tab_id='transparencia', label_style={'background-color':LILA, 'border-radius': '40px', 'color': '#000', 'margin-top': "7px"},active_label_style={'border': '4px solid white'}),
dbc.Tab(label='AGUA', tab_id='agua', label_style={'background-color':VERDE_AGUA, 'border-radius': '40px', 'color': '#000', 'margin-top': "7px"},active_label_style={'border': '4px solid white'}),
dbc.Tab(label='POBLACIONES', tab_id='poblaciones', label_style={'background-color':LIMA, 'border-radius': '40px', 'color': '#000', 'margin-top': "7px"},active_label_style={'border': '4px solid white'}),
dbc.Tab(label='APIARIOS', tab_id='apiarios', label_style={'background-color':NARANJA, 'border-radius': '40px', 'color': '#000', 'margin-top': "7px"},active_label_style={'border': '4px solid white'}),
Expand Down
17 changes: 6 additions & 11 deletions pages/ranking_ambiental/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
pba["Municipios_nombre_original"]=pba["Municipios"]
gba["Municipios_nombre_original"]=gba["Municipios"]

etiquetas["Municipios"]=etiquetas["Municipios"].str.normalize('NFD').str.encode('ascii', errors='ignore').str.decode('utf-8')
pba["Municipios"]=pba["Municipios"].str.normalize('NFD').str.encode('ascii', errors='ignore').str.decode('utf-8')
gba["Municipios"]=gba["Municipios"].str.normalize('NFD').str.encode('ascii', errors='ignore').str.decode('utf-8')
etiquetas["Municipios"]=etiquetas["Municipios"].str.normalize('NFD').str.encode('ascii', errors='ignore').str.decode('utf-8').str.strip()
pba["Municipios"]=pba["Municipios"].str.normalize('NFD').str.encode('ascii', errors='ignore').str.decode('utf-8').str.strip()
gba["Municipios"]=gba["Municipios"].str.normalize('NFD').str.encode('ascii', errors='ignore').str.decode('utf-8').str.strip()


etiquetas["Municipios"]=etiquetas["Municipios"].str.replace(" - Pigue","")
Expand Down Expand Up @@ -81,21 +81,15 @@ def preparar_base(base):
elif 'LINK' in base.columns:
base = base.rename(columns={'LOCALIDAD':'Municipios','LINK': 'Link','ORDENANZA': 'Ordenanza', 'FECHA': 'Fecha' , 'Puntaje - agroeco NORMALIZADO': 'Puntaje'})

base["Municipios"] = base["Municipios"].str.normalize('NFD').str.encode('ascii', errors='ignore').str.decode('utf-8').str.strip()
base["Ordenanza"] = base["Ordenanza"].fillna("Sin Ordenanza")

base["Link"] = base["Link"].fillna("")
base['Ordenanza'] = base[['Ordenanza','Link' ]].apply(crear_link, axis=1)


base["Fecha"] = base["Fecha"].fillna("\-")
base["Fecha"] = base["Fecha"].fillna("\-").apply(lambda x: x[-4:] if len(x)>=4 else x)

# # Reemplazar valores nulos en columnas de tipo objeto con 'NO'
# columna_especifica = "Obligatoriedad de notificación"
# base[columna_especifica] = base[columna_especifica].fillna('NO')

# # Reemplazar valores nulos en la columna específica con '-'
# columna_especifica = 'Puntaje'
# base[columna_especifica] = base[columna_especifica].fillna(0)
base["Puntaje"]=base["Puntaje"].fillna(0).apply(lambda x: round(float(x.replace(',', '.')), 2) if isinstance(x, str) else round(x, 2))
# Identificar las columnas que no son numéricas
non_numeric_columns = base.select_dtypes(exclude=['number']).columns
Expand All @@ -108,6 +102,7 @@ def preparar_base(base):
# base["Puntaje"]=base["Puntaje"].fillna(0).apply(lambda x: round(math.sqrt(x), 2) )

base["Fecha"]=base["Fecha"].apply(lambda x: x if x!="\-" else "")
base = base.rename(columns={"Fecha": "Año"})
del base["Link"]
return base

Expand Down

0 comments on commit 8971f06

Please sign in to comment.