Commit efa5206c authored by Marc Duez's avatar Marc Duez
Browse files

vidjil_utils : anonymization function

parent 0f93cdf3
import math
from gluon import current
def format_size(n, unit='B'):
'''
......@@ -36,3 +37,15 @@ def format_size(n, unit='B'):
return fmt % size + ' ' + prefix + unit
def anon(patient_id, user_id):
db = current.db
auth=current.auth
last_name = db.patient[patient_id].last_name
first_name = db.patient[patient_id].first_name
if auth.has_permission("anon", "patient", patient_id, user_id):
return last_name + " " + first_name
else:
return last_name[:3] + " " + first_name[:3]
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