Project

General

Profile

Download (950 Bytes) Statistics
| Branch: | Tag: | Revision:

calebasse / anonimize.py @ 115d3a63

1
#!/usr/bin/env python
2

    
3
"""
4
 Shuffle nom et prenom
5
"""
6

    
7
import django.core.management
8
import calebasse.settings
9

    
10
django.core.management.setup_environ(calebasse.settings)
11

    
12
import random
13
from calebasse.actes.models import Act
14
from calebasse.agenda.models import Event
15
from calebasse.dossiers.models import PatientRecord
16
from calebasse.personnes.models import People
17

    
18
last = []
19
first = []
20
random.seed()
21
l = -1
22
for p in People.objects.all():
23
    if p.last_name:
24
        last.append(p.last_name)
25
    if p.first_name:
26
        first.append(p.first_name)
27
    l += 1
28
for p in People.objects.all():
29
    i = random.randint(0, l)
30
    p.last_name = last[i]
31
    if (p.last_name) > 5:
32
        p.last_name = p.last_name[:-2] + 'zz'
33
    i = random.randint(0, l)
34
    p.first_name = first[i]
35
    p.save()
36

    
37
PatientRecord.objects.all().update(social_security_id="3999999999999", comment="")
38
Event.objects.all().update(description="")
39
Act.objects.all().update(comment="")
40

    
(9-9/16)