

def index():
    " Module's Home Page "
    try:
        module_name = settings.modules[module].name_nice
    except:
        module_name = T('Disaster Victim Identification')
    btable = s3db.dvi_body
    itable = s3db.dvi_identification
    query = (btable.deleted == False)
    left = itable.on((itable.pe_id == btable.pe_id))
    body_count = btable.id.count()
    rows = db(query).select(body_count, itable.status, left=left, groupby=itable.status)
    numbers = {
        None: 0,
    }
    for row in rows:
        numbers[row[itable.status]] = row[body_count]
    total = sum(numbers.values())
    dvi_id_status = dict(s3db.dvi_id_status)
    dvi_id_status[None] = T('unidentified')
    statistics = []
    for status in dvi_id_status:
        count = (numbers.get(status) or 0)
        statistics.append((str(dvi_id_status[status]), count))
    response.title = module_name
    return dict(module_name=module_name, total=total, status=json.dumps(statistics))

dataset/ETHPy150Open sahana/eden/controllers/dvi.py index/original