Commit 44df59ca authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team

patient index: There is no more the need to have a “custom” anonymization for the patient list.

It uses anon_names too, now, which is efficient enough.
parent 6bd40868
......@@ -290,16 +290,12 @@ def index():
result = {}
for i, row in enumerate(query) :
try:
ln = unicode(row.last_name, 'utf-8')
except UnicodeDecodeError:
ln = row.last_name
result[row.id] = {
"id" :int(row.id),
"last_name" : row.last_name,
"first_name" : row.first_name,
"has_permission" : False,
"name" : ln[:3],
"anon_allowed": False,
"birth" : row.birth,
"info" : row.info,
"creator" : row.creator,
......@@ -370,19 +366,18 @@ def index():
for i, row in enumerate(query4) :
if row.patient.id in keys :
result[row.patient.id]['group_list'].append(row.auth_group.role.replace('user_','u'))
query5 = db(
(db.auth_permission.name == "anon") &
(db.auth_permission.name == "anon") &
(db.auth_permission.table_name == "patient") &
(db.patient.id == db.auth_permission.record_id ) &
(auth.user_group() == db.auth_permission.group_id )
).select(
db.patient.id, db.patient.last_name, db.patient.first_name
db.patient.id
)
for i, row in enumerate(query5) :
if row.id in keys :
result[row.id]['name'] = row.last_name + " " + row.first_name
result[row.id]['anon_allowed'] = True
for key, row in result.iteritems():
row['most_used_conf'] = max(set(row['conf_id_list']), key=row['conf_id_list'].count)
......
......@@ -41,8 +41,7 @@
{{for row in query :}}
<tr class="pointer" onclick="db.call('patient/info', {'id' :'{{=row['id']}}' , 'config_id' : {{=row['most_used_conf']}} } )" >
<td>
{{ if isAdmin: }} ({{=row['id']}}) {{ pass }}
{{=vidjil_utils.anon_names(row['id'], row['first_name'], row['last_name'])}}
{{=vidjil_utils.anon_names(row['id'], row['first_name'], row['last_name'], row['anon_allowed'])}}
</td>
<td> {{=row['birth'] }} </td>
<td> {{=row['info'] }} </td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment