Revision 115d3a63
Added by Jérôme Schneider about 11 years ago
anonimize.py | ||
---|---|---|
10 | 10 |
django.core.management.setup_environ(calebasse.settings) |
11 | 11 |
|
12 | 12 |
import random |
13 |
from calebasse.actes.models import Act |
|
14 |
from calebasse.agenda.models import Event |
|
15 |
from calebasse.dossiers.models import PatientRecord |
|
13 | 16 |
from calebasse.personnes.models import People |
14 | 17 |
|
15 | 18 |
last = [] |
... | ... | |
17 | 20 |
random.seed() |
18 | 21 |
l = -1 |
19 | 22 |
for p in People.objects.all(): |
20 |
last.append(p.last_name) |
|
21 |
first.append(p.first_name) |
|
23 |
if p.last_name: |
|
24 |
last.append(p.last_name) |
|
25 |
if p.first_name: |
|
26 |
first.append(p.first_name) |
|
22 | 27 |
l += 1 |
23 | 28 |
for p in People.objects.all(): |
24 | 29 |
i = random.randint(0, l) |
25 | 30 |
p.last_name = last[i] |
31 |
if (p.last_name) > 5: |
|
32 |
p.last_name = p.last_name[:-2] + 'zz' |
|
26 | 33 |
i = random.randint(0, l) |
27 | 34 |
p.first_name = first[i] |
28 | 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 |
|
Also available in: Unified diff
anonimize: improve anonymisation