wiki:Pakistan

Version 30 (modified by Fran Boon, 14 years ago) ( diff )

--

Pakistan

We have a site up to support the Floods Response in Pakistan.

Site:

A new SitRep module has been built to manage:

  • Flood Reports
  • Assessments from WFP
  • School Reports

These can be uploaded as files, but we really want volunteers using a Mechanical Turk process to input the data into the structured fields.

Data can be found here:

We're hoping that the XLS can be imported using our new Spreadsheet Importer, so the focus should initially be on the PDFs.

Data Entry tasks

  • Add Lat/Lon to some of the Districts (just those in Wikipedia have so far been added)
  • Add Rivers from uploaded Flood Report
  • Add Locstions from uploaded Flood Report
  • Add School District Reports
  • Enter School Reports within each District
  • Add Organisations from WFP Assessments
  • Add Union Councils from WFP Assessments
  • Add Villages from WFP Assessments
  • Add WFP Assessments' Data

Feature Requests

  • onvalidation to total male+female in the School Reports (=>Dominic)
  • .represent for irs_iimage.image as a thumbnail (like for gis_marker)
  • Move School Reports to CR as more related to that functionality?
  • Better .represent for name_l10n ("Language: name_l10n")
  • When adding a new Location, pass along the appropriate Level (L3 for Assessments, L1 for Schools) (=>Fran)
  • Reports
    • jqplot?
    • Map
      • KML XSLT (=>Dominic)
    • Would be good to write a custom PDF writer for this format of report so we can consider getting people to enter data into DB directly.
      • split column headers
  • PDF Importer?
  • Test the XForms controller with component resource to have OCRable forms to collect this info

Bugs

Adding a local name fails

This occurs on MySQL (sqlite fine) (=>Dominic)

Traceback (most recent call last):
  File "gluon/restricted.py", line 186, in restricted
    exec ccode in environment
  File "/home/web2py/applications/eden/controllers/gis.py", line 1673, in <module>
  File "gluon/globals.py", line 96, in <lambda>
    self._caller = lambda f: f()
  File "/home/web2py/applications/eden/controllers/gis.py", line 492, in location
    output = shn_rest_controller(module, resource)
  File "/home/web2py/applications/eden/models/01_crud.py", line 1892, in shn_rest_controller
    output = res.execute_request(req, **attr)
  File "applications/eden/modules/s3xrc.py", line 893, in execute_request
    output = handler(r, **attr)
  File "/home/web2py/applications/eden/models/01_crud.py", line 1159, in shn_list
    next=r.there())
  File "gluon/tools.py", line 2811, in create
    deletable=False,
  File "gluon/tools.py", line 2764, in update
    callback(onaccept,form,table._tablename)
  File "gluon/tools.py", line 48, in callback
    [action(form) for action in actions]
  File "/home/web2py/applications/eden/models/01_crud.py", line 1145, in <lambda>
    onaccept(form)
  File "/home/web2py/applications/eden/models/03_gis.py", line 503, in gis_location_onaccept
    name_dummy_element.onaccept(db, session.rcvars.gis_location, request)
  File "applications/eden/modules/widgets.py", line 217, in onaccept
    json_request = json_request )
  File "applications/eden/modules/widgets.py", line 321, in _process_json
    id  = json_table.insert(**json_record)
  File "gluon/sql.py", line 2003, in insert
    self._db._execute(query)
  File "gluon/sql.py", line 978, in <lambda>
    self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
  File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 166, in execute
    self.errorhandler(self, exc, value)
  File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line 35, in defaulterrorhandler
    raise errorclass, errorvalue
IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`sahana/gis_location_name`, CONSTRAINT `gis_location_name_ibfk_1`

Seems like the location_id isn't yet in the DB when the name_dummy_element.onaccept(db, session.rcvars.gis_location, request) attempts to update the link_table.

NB These files are fully in-sync with the ADPC branch which works:

  • modules/widgets.py: line 156 class JSON and class S3MultiSelectWidget
  • static/scripts/s3/s3.multiselect.widget.js
  • static/styles/s3/s3.multiselect.widget.css
  • This function also needed syncing: shn_split_multi_value() in modules/s3utils.py, but still no joy

This error occurs when looking at the gis_location table in Appadmin (Raw DB access) on a sqlite version with data there unless the .represent is commented out (models/03_gis.py +503):

Traceback (most recent call last):
  File "C:\Bin\web2py\gluon\restricted.py", line 186, in restricted
    exec ccode in environment
  File "C:\Bin\web2py\applications\eden/views\admin/appadmin.html", line 277, in <module>
  File "C:\Bin\web2py\gluon\sqlhtml.py", line 1175, in __init__
    r = field.represent(r)
  File "C:\Bin\web2py\applications\eden\modules\widgets.py", line 589, in represent
    row = db(link_table.id == id).select()
  File "C:\Bin\web2py\gluon\sql.py", line 2546, in __eq__
    return Query(self, '=', value)
  File "C:\Bin\web2py\gluon\sql.py", line 2988, in __init__
    right = sql_represent(right, left.type, left._db._dbname, left._db._db_codec)
  File "C:\Bin\web2py\gluon\sql.py", line 553, in sql_represent
    return str(int(obj))
ValueError: invalid literal for int() with base 10: 'name_l10n'
  • name_l10n field is empty
  • name_dummy field is a string that looks like a dict:
    • Punjab is: "{'name_l10n':'\xd9\xbe\xd9\x86\xd8\xac\xd8\xa7\xd8\xa8','language':'Urdu'}"
  • the gis_location_name table doesn't seem to be needed?

Related sites


Deployments

Note: See TracWiki for help on using the wiki.