ConocimientoAbierto / policrowd

A website for crowd-sourcing structured politician data
https://beta.policrowd.org
GNU Affero General Public License v3.0
5 stars 0 forks source link

Importar CSV de Estructura Orgánica y Autoridades del PEN #11

Closed martinszy closed 8 years ago

martinszy commented 8 years ago

Fuente: http://datos.gob.ar/dataset/estructura-organica-pen/

godiard commented 8 years ago

Que buena data! Creo que está bueno importarlo, lo unico que me preocupa es que si nos ponemos a agregar tareas a algo que ya sabemos que estabamos jugados con el tiempo, vamos a terminar ahorcados.

martinszy commented 8 years ago

Esto lo hago yo, si necesito alguna ayuda concreta te creo otro issue, por si hace falta algún campo o modificación.

El mar., 8 de mar. de 2016 a la(s) 10:47, Gonzalo Odiard < notifications@github.com> escribió:

Que buena data! Creo que está bueno importarlo, lo unico que me preocupa es que si nos ponemos a agregar tareas a algo que ya sabemos que estabamos jugados con el tiempo, vamos a terminar ahorcados.

— Reply to this email directly or view it on GitHub https://github.com/ConocimientoAbierto/yournextrepresentative/issues/11#issuecomment-193791377 .

godiard commented 8 years ago

Ok. Lo que tenemos que acordar es como se va a subir, asi las vistas ya despliegan esta info.

martinszy commented 8 years ago

No está funcionando esta importación, por favor revisar.


$ ./manage.py candidates_import_argentina_politicians
Traceback (most recent call last):
  File "./manage.py", line 45, in <module>
    execute_from_command_line(sys.argv)
  File "/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/core/management/base.py", line 393, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
    output = self.handle(*args, **options)
  File "/home/poli/yournextrepresentative/candidates/management/commands/candidates_import_argentina_politicians.py", line 143, in handle
    self.prepareCaches()
  File "/home/poli/yournextrepresentative/candidates/management/commands/candidates_import_argentina_politicians.py", line 28, in prepareCaches
    self.prepareExecutivePowerCache()
  File "/home/poli/yournextrepresentative/candidates/management/commands/candidates_import_argentina_politicians.py", line 20, in prepareExecutivePowerCache
    self.executivePowerCache = Organization.objects.get(name='Poder Ejecutivo')
  File "/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/db/models/query.py", line 334, in get
    self.model._meta.object_name
popolo.models.DoesNotExist: Organization matching query does not exist.
godiard commented 8 years ago

Hay que agregar una organización "Poder Ejecutivo" y relacionarla con el area "Argentina". Lo ideal sería que candidates_import_argentina_politicians.py se fijara si ya existe y si no que lo agregue. Se nota que esta organización la agregó Cristian a mano. Si no podes hacer esto, le digo que haga la modificación en cuanto se reincorpore.

martinszy commented 8 years ago

Esto lo tendrían que hacer las migraciones o quizás el mismo script de management. Lo voy a revisar.

martinszy commented 8 years ago

Ok, modificando un par de líneas ahora corrió.

Pero tiró warnings.

$ ./manage.py candidates_import_argentina_politicians
Inserting Organizations...

/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:578: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if not self.blank and value in self.empty_values:

/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:535: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if value in self.empty_values:

/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:1474: RuntimeWarning: DateTimeField Organization.created_at received a naive datetime (2016-04-11 17:22:36) while time zone support is active.
  RuntimeWarning)

/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/db/models/base.py:1188: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if f.blank and raw_value in f.empty_values:

/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:1474: RuntimeWarning: DateTimeField Post.created_at received a naive datetime (2016-04-11 17:22:36) while time zone support is active.
  RuntimeWarning)

/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:1474: RuntimeWarning: DateTimeField Person.created_at received a naive datetime (2016-04-11 17:22:36) while time zone support is active.
  RuntimeWarning)

/home/poli/.virtualenvs/poli/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:1474: RuntimeWarning: DateTimeField Membership.created_at received a naive datetime (2016-04-11 17:22:36) while time zone support is active.
  RuntimeWarning)
martinszy commented 8 years ago

Funciona y está hecho.