Commit 9574d4ce authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team
Browse files anon_birth, anonymize birth date

parent b4e54e1c
......@@ -64,7 +64,21 @@ def age_years_months(birth, months_below_year=4):
age += ' %dm' % months
return age
def anon_birth(patient_id, user_id):
'''Anonymize birth date. Only the 'anon' access see the full birth date.'''
db = current.db
birth = db.patient[patient_id].birth
age = age_years_months(birth)
if auth.has_permission("anon", "patient", patient_id, user_id):
return "%s (%s)" % (birth, age)
return age
def anon(patient_id, user_id):
'''Anonymize patient name. Only the 'anon' access see the full patient name.'''
db = current.db
Supports Markdown
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