示例#1
0
文件: views.py 项目: alexrpagan/doit
def detail_scoring(req, dbname, fid):
    db = DoitDB(dbname)
    attr_name = db.fieldname(fid)
    matches = db.indivscores(fid)
    return render(req, 'doit/pop_scores.html', {
            'matches': matches, 'attr_name': attr_name, 'fid': fid,
            'db': dbname, })
示例#2
0
def detail_summary(req, sid, dbname, fid):
	db = DoitDB(dbname)
	attr_name = db.fieldname(fid)
	meta = db.field_meta(fid)
	vals = db.fieldexamples(fid, 1000, distinct=False)
	histo = bucketize(vals)
	return render_to_response('doit/pop_summary.html', {'histo': histo, 'attr_name': attr_name, 'source': sid, 'fid': fid, 'metadata': meta,})
示例#3
0
文件: views.py 项目: alexrpagan/doit
def detail_shared(req, dbname, fid):
    db = DoitDB(dbname)
    attr_name = db.fieldname(fid)
    shared = []
    matches = db.field_candidates(fid)
    shared_value = False
    for match in matches[:4]:
        shared.append({
            'name': match['name'],
            'values': db.sharedvalues(fid, match['id'])
        })
    table = [[]]
    for match in shared:
        table[0].append(match['name'])
    for i in range(0, 10):
        table.append([])
        for match in shared:
            try:
                table[i + 1].append(match['values'][i])
                if match['values'][i] is not None:
                    shared_value = True
            except IndexError:
                table[i + 1].append(' ')
    return render(
        req, 'doit/pop_shared.html', {
            'shared': table,
            'attr_name': attr_name,
            'fid': fid,
            'db': dbname,
            'at_least_one': shared_value,
        })
示例#4
0
文件: views.py 项目: alexrpagan/doit
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
    })
示例#5
0
def detail_scoring(req, dbname, fid):
	db = DoitDB(dbname)
	attr_name = db.fieldname(fid)
	matches = db.indivscores(fid)
	return render_to_response('doit/pop_scores.html', {
            'matches': matches, 'attr_name': attr_name, 'fid': fid,
            'db': dbname,})
示例#6
0
def detail_summary(req, dbname, fid):
	db = DoitDB(dbname)
	attr_name = db.fieldname(fid)
	meta = db.field_meta(fid)
	vals = db.fieldexamples(fid, 1000, distinct=False)
	histo = bucketize(vals)
	return render_to_response('doit/pop_summary.html', {
            'histo': histo, 'attr_name': attr_name, 'source': '', 'fid': fid,
            'metadata': meta, 'db': dbname,})
示例#7
0
文件: views.py 项目: alexrpagan/doit
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, })
示例#8
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,})
示例#9
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,})
示例#10
0
def detail_shared(req, sid, dbname, fid):
	db = DoitDB(dbname)
	attr_name = db.fieldname(fid)
	shared = []
	matches = db.field_mappings(sid)[int(fid)]['matches']
	for match in matches:
	    shared.append({'name': match['name'],
                           'values': db.sharedvalues(fid, match['id'])})
	table = [[]]
	for match in shared:
	    table[0].append(match['name'])
	for i in range(0, 10):
	    table.append([])
	    for match in shared:
	        try:
		    table[i+1].append(match['values'][i])
		except IndexError:
		    table[i+1].append(' ')
	return render_to_response('doit/pop_shared.html', {'shared': table, 'attr_name': attr_name, 'fid': fid,})
示例#11
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,})
示例#12
0
文件: views.py 项目: alexrpagan/doit
def detail_shared(req, dbname, fid):
    db = DoitDB(dbname)
    attr_name = db.fieldname(fid)
    shared = []
    matches = db.field_candidates(fid)
    shared_value = False
    for match in matches[:4]:
        shared.append({'name': match['name'],
                           'values': db.sharedvalues(fid, match['id'])})
    table = [[]]
    for match in shared:
        table[0].append(match['name'])
    for i in range(0, 10):
        table.append([])
        for match in shared:
            try:
                table[i + 1].append(match['values'][i])
                if match['values'][i] is not None:
                        shared_value = True
            except IndexError:
                table[i + 1].append(' ')
    return render(req, 'doit/pop_shared.html', {
            'shared': table, 'attr_name': attr_name, 'fid': fid,
            'db': dbname, 'at_least_one': shared_value, })