Ejemplo n.º 1
0
def detail_examples(req, dbname, fid):
    db = DoitDB(dbname)
    attr_name = db.fieldname(fid)
    egs = [{'name': attr_name, 'values': db.fieldexamples(fid, 10)}]
    matches = db.field_candidates(fid)[:5]
    for match in matches:
        egs.append({
            'name': match['name'],
            'values': db.globalfieldexamples(match['id'], 10)
        })
    transpose = [[]]
    for eg in egs:
        transpose[0].append(eg['name'])
    for i in range(0, 10):
        transpose.append([])
        for eg in egs:
            try:
                transpose[i + 1].append(eg['values'][i])
            except IndexError:
                transpose[i + 1].append(' ')
    return render(req, 'doit/pop_egs.html', {
        'examples': transpose,
        'attr_name': attr_name,
        'fid': fid,
        'db': dbname
    })
Ejemplo n.º 2
0
def detail_distro(req,  dbname, fid):
    db = DoitDB(dbname)
    attr_name = db.fieldname(fid)
    vals = db.fieldexamples(fid, 1000, distinct=False)
    histos = [bucketize(vals)]
    histos[0]['name'] = attr_name
    matches = db.field_candidates(fid)[:4]
    for match in matches:
        histo = bucketize(db.globalfieldexamples(int(match['id']), n=1000, distinct=False))
        histo['name'] = match['name']
        histos.append(histo)
    return render(req, 'doit/pop_distro.html', {
            'histos': histos, 'attr_name': attr_name, 'fid': fid,
            'db': dbname, })
Ejemplo n.º 3
0
def detail_distro(req,  dbname, fid):
	db = DoitDB(dbname)
	attr_name = db.fieldname(fid)
	vals = db.fieldexamples(fid, 1000, distinct=False)
	histos = [bucketize(vals)]
	histos[0]['name'] = attr_name
	matches = db.field_candidates(fid)[:4]
	for match in matches:
		histo = bucketize(db.globalfieldexamples(int(match['id']), n=1000, distinct=False))
		histo['name'] = match['name']
		histos.append(histo)
	return render_to_response('doit/pop_distro.html', {
            'histos': histos, 'attr_name': attr_name, 'fid': fid,
            'db': dbname,})
Ejemplo n.º 4
0
def detail_distro(req,  dbname, sid, fid):
	db = DoitDB(dbname)
	attr_name = db.fieldname(fid)
	vals = db.fieldexamples(fid, 1000, distinct=False)

	histos = [bucketize(vals)]
	histos[0]['name'] = attr_name

	matches = sorted(db.field_mappings(sid)[int(fid)]['matches'], key=itemgetter('score'), reverse=True)[:4]

	for match in matches:
		histo = bucketize(db.globalfieldexamples(int(match['id']), n=1000, distinct=False))
		histo['name'] = match['name']
		histos.append(histo)

	return render_to_response('doit/pop_distro.html', {'histos': histos, 'attr_name': attr_name, 'fid': fid,})
Ejemplo n.º 5
0
def detail_examples(req, sid, dbname, fid):
	db = DoitDB(dbname)
	attr_name = db.fieldname(fid)
	egs = [{'name': attr_name, 'values': db.fieldexamples(fid, 10)}]
	matches = db.field_mappings(sid)[int(fid)]['matches'][:5]
	for match in matches:
		egs.append({'name': match['name'], 'values': db.globalfieldexamples(match['id'], 10)})

	transpose = [[]]
	for eg in egs:
		transpose[0].append(eg['name'])
	for i in range(0, 10):
		transpose.append([])
		for eg in egs:
			try:
				transpose[i+1].append(eg['values'][i])
			except IndexError:
				transpose[i+1].append(' ')

	return render_to_response('doit/pop_egs.html', {'examples': transpose, 'attr_name': attr_name, 'fid': fid,})