Skip to content

Examples for implementing pseudonymization patterns in Django for data privacy and compliance.

License

Notifications You must be signed in to change notification settings

cuttlesoft/django-pseudonymization-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Pseudonymization Example

This example Django app demonstrates two approaches to pseudonymizing personal data with masking functions.

  • Example 1 employs getter and setter methods to interface with the pseudonymized model fields.
  • Example 2 creates a custom Field class to handle value masking/unmasking automatically.

...

For a more detailed explanation, check out the blog post on Cuttlesoft.com.

Clone

git clone https://github.com/cuttlesoft/django-pseudonymization-example.git
cd django-pseudonymization-example

Checkout Example Branches

Example 1, branch: properties

git checkout properties

Example 2, branch: fields

git checkout fields

Dependencies

This example uses Django 2.0, which supports Python 3.4, 3.5, and 3.6. To properly run this example you'll need:

  1. Python 3.4 or greater
  2. PostgreSQL
  3. pipenv

Install dependencies with pipenv

$ pipenv install
Creating a virtualenv for this project…
...
Virtualenv location: /Users/user/.venvs/django-pseudonymization-example-ztyUS4al
Installing dependencies from Pipfile.lock (5d8b51)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 3/3 — 00:00:09
To activate this project's virtualenv, run the following:
 $ pipenv shell

Activate virtual environment with pipenv

$ pipenv shell
Spawning environment shell (/bin/zsh). Use 'exit' to leave.
(django-pseudonymization-example-ztyUS4al) $

Initialize the Application

createdb django_pseudonymization_example
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser

Start the Application

$ python manage.py runserver

Performing system checks...

System check identified no issues (0 silenced).
June 25, 2018 - 21:16:11
Django version 2.0.6, using settings 'app.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Disclaimer

Our mask/unmask functions are intended for this example only, to enable demonstration of the application's handling of masking and unmasking. They do not sufficiently protect the data, as it is reasonably likely that someone accessing the data would be able to simply reverse the shifted characters, re-identifying users without any additional information present.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct.

License

This project is licensed under the MIT License - see the LICENSE file for details

Wanna Cuttle?

About

Examples for implementing pseudonymization patterns in Django for data privacy and compliance.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages