Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
geoelectoral-datos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
adsib
geoelectoral-datos
Commits
2ee7bb85
Commit
2ee7bb85
authored
Oct 17, 2014
by
Richard Rojas Mamani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resultados de municipios del 2009
parent
160caed0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2701 additions
and
16 deletions
+2701
-16
README.md
README.md
+8
-0
scripts/municipios_2009.sh
scripts/municipios_2009.sh
+12
-16
scripts/upgrade_0.10_hacia_0.11.sql
scripts/upgrade_0.10_hacia_0.11.sql
+2681
-0
No files found.
README.md
View file @
2ee7bb85
...
...
@@ -101,3 +101,11 @@ Para añadir los resultados uninominales, lanzar
./scripts/parsing_oep_uninominal.sh
psql -d geoelectoral -h localhost -U geoelectoral -W < /tmp/uni.sql
```
## Datos municipios 2009
Para añadir los resultados del 2009 para municipios ejecutar
```
psql -d geoelectoral -h localhost -U geoelectoral -W < scripts/upgrade_0.10_hacia_0.11.sql
```
scripts/municipios_2009.sh
View file @
2ee7bb85
...
...
@@ -46,7 +46,7 @@ EOF
# $6 fecha de la elección
function
resultados_muni
{
psql
-E
-U
$PGUSER
-q
-t
-o
/tmp/
$TABLA
.tmp.sql
-d
$BD_GEOELECTORAL
<<
EOF
SELECT
SELECT
DISTINCT
'(' ||
$1
|| ', ' || -- id_eleccion
(SELECT id_candidato FROM candidatos WHERE id_partido=
$2
AND id_eleccion=
$1
LIMIT 1) || ', ' || -- id_candidato
$2
|| ', ' || -- id_partido
...
...
@@ -55,7 +55,7 @@ psql -E -U $PGUSER -q -t -o /tmp/$TABLA.tmp.sql -d $BD_GEOELECTORAL << EOF
d.id_tipo_dpa || ', ' || -- id_tipo_dpa
$4
|| ', ' || -- id_tipo_resultado
"
$5
" || '),' -- resultado
FROM "
$TABLA
" m LEFT JOIN dpa d ON m.cod
igo
=d.codigo
FROM "
$TABLA
" m LEFT JOIN dpa d ON m.cod
seccion
=d.codigo
WHERE fecha_creacion_corte <= '
$6
' AND '
$6
' <= d.fecha_supresion_corte;
EOF
...
...
@@ -63,35 +63,31 @@ cat /tmp/$TABLA.tmp.sql >> /tmp/$TABLA.sql
rm
/tmp/
$TABLA
.tmp.sql
}
#
reseter
#
Datos para plurinominales 2009 con id_eleccion = 1
# MAS 25
resultados_muni 1
0
25 1 1
"mas"
"2009-12-06"
resultados_muni 1 25 1 1
"mas"
"2009-12-06"
# PPB-CN 27
resultados_muni 1
0 27 1 1
"ppb-cn
"
"2009-12-06"
resultados_muni 1
27 1 1
"convergenc
"
"2009-12-06"
# UN 16
resultados_muni 1
0
16 1 1
"un"
"2009-12-06"
resultados_muni 1 16 1 1
"un"
"2009-12-06"
# AS 18
resultados_muni 1
0 18 1 1
"as
"
"2009-12-06"
resultados_muni 1
18 1 1
"as_
"
"2009-12-06"
# MUSPA 3
resultados_muni 1
0
3 1 1
"muspa"
"2009-12-06"
resultados_muni 1 3 1 1
"muspa"
"2009-12-06"
# GENTE 2
resultados_muni 1
0
2 1 1
"gente"
"2009-12-06"
resultados_muni 1 2 1 1
"gente"
"2009-12-06"
# PULSO 4
resultados_muni 1
0
4 1 1
"pulso"
"2009-12-06"
resultados_muni 1 4 1 1
"pulso"
"2009-12-06"
# BSD 1
resultados_muni 10 1 1 1
"bsd"
"2009-12-06"
resultados_muni 1 1 1 1
"bsd"
"2009-12-06"
# Eliminación de la tabla temporal $TABLA
psql
-U
$PGUSER
-d
$BD_GEOELECTORAL
-c
"DROP TABLE IF EXISTS
$TABLA
;"
# Eliminando líneas blancas en el archivo y cambiando la última coma por ";"
sed
-i
'/^$/d'
/tmp/
$TABLA
.sql
sed
-i
'$s/,$/;/'
/tmp/
muni2009
.sql
sed
-i
'$s/,$/;/'
/tmp/
$TABLA
.sql
echo
echo
"*** Se generó un archivo /tmp/
$TABLA
.sql con las sentencias SQL. ***"
...
...
scripts/upgrade_0.10_hacia_0.11.sql
0 → 100644
View file @
2ee7bb85
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment