Skip to content

Commit b9af8e7

Browse files
Merge branch 'master' of github.com:Transparency-Information-Language/python-tilt
2 parents 0ba8119 + 50b5c60 commit b9af8e7

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# python-tilt | Transparency Information Language and Toolkit
2+
3+
## What is the Transparency Information Language and Toolkit?
4+
With this proposed schema for transparency information with regards to data privacy, an essential step towards a sophisticated ecosystem shall be made by introducing a transparency enhancing toolkit based on a formal language model describing transparency information in the context of multi-service environments and latest legal requirements (EU General Data Protection Regulation). The desired results of the work should be suitable as ready-to-use privacy engineering solutions for developers and serve as a starting point for further research in this area. Eventually, data subjects should (be able to) understand what happens to data relating to them by using the interfaces of the toolkit.
5+
6+
## What is python-tilt?
7+
*tilt* is a Python based language binding for the _Transparency Information Language and Toolkit_.
8+
9+
## Installation
10+
Install the python client library using pip. See the [project page](https://pypi.org/project/tilt/).
11+
12+
13+
```console
14+
foo@bar:~$ pip3 install tilt
15+
Collecting tilt
16+
Using cached tilt-0.0.1-py3-none-any.whl (22 kB)
17+
Installing collected packages: tilt
18+
Successfully installed tilt-0.0.1
19+
```
20+
21+
## Basic usage
22+
23+
```info
24+
See here for an [interactive playground]().
25+
```
26+
27+
1) Import the transparency information language binding/library.
28+
2) Create your first object, e.g. a Data Protection Officer with their contact details.
29+
3) Continue creating your objects, i.e. a Controller and its Representative.
30+
4) ... (add all other fields, not shown in here) ...
31+
32+
33+
```python
34+
from tilt import tilt
35+
36+
dpo = tilt.DataProtectionOfficer(name='Max Ninjaturtle', address='21 Jump Street', country='DE', email='jane@mycompany.com', phone='0142 43333')
37+
print(dpo.to_dict())
38+
# {'address': '21 Jump Street', 'country': 'DE', 'email': 'jane@mycompany.com', 'name': 'Max Ninjaturtle', 'phone': '0142 43333'}
39+
40+
41+
r = tilt.ControllerRepresentative(name='Maxi Müller', email='maxi@mail.com', phone=None)
42+
c = tilt.Controller(name='MyCompany', address='Straße des 17. Juni', country='DE', division='Main', representative=r)
43+
print(c.to_dict())
44+
# {'address': 'Straße des 17. Juni', 'country': 'DE', 'division': 'Main', 'name': 'MyCompany', 'representative': {'email': 'maxi@mail.com', 'name': 'Maxi Müller', 'phone': None}}
45+
```
46+
47+
## Import existing documents
48+
In order to import exisiting tilt documents (we call them instances), you can use your favorite HTTP client or load from your local disk. Then you can use the native python objects and do any manipulations as you like.[](http://)
49+
50+
51+
```python
52+
import json
53+
import requests
54+
55+
file = requests.get('https://raw.githubusercontent.com/Transparency-Information-Language/schema/master/tilt.json')
56+
instance = tilt.tilt_from_dict(json.loads(file.content))
57+
58+
print(instance.controller.to_dict())
59+
# {'address': 'Wolfsburger Ring 2, 38440 Berlin', 'country': 'DE', 'division': 'Product line e-mobility', 'name': 'Green Company AG', 'representative': {'email': 'contact@greencompany.de', 'name': 'Jane Super', 'phone': '0049 151 1234 5678'}}
60+
61+
for element in list(instance.data_disclosed):
62+
for recipient in element.recipients:
63+
print(recipient.category)
64+
# Marketing content provider
65+
# Responsible Statistical Institutes
66+
67+
68+
instance.controller.name = 'Yellow Company Ltd.'
69+
print(instance.controller.to_dict())
70+
# {'address': 'Wolfsburger Ring 2, 38440 Berlin', 'country': 'DE', 'division': 'Product line e-mobility', 'name': 'Yellow Company Ltd.', 'representative': {'email': 'contact@greencompany.de', 'name': 'Jane Super', 'phone': '0049 151 1234 5678'}}
71+
```
72+
73+
## Create new documents from scratch
74+
In the example below we are using standard libraries (e.g. sha256 or datetime) in order to create formatted strings. All objects have `from_dict()` and `to_dict()` functions which help you to build or export them.
75+
76+
77+
```python
78+
from hashlib import sha256
79+
from datetime import datetime
80+
81+
result = {}
82+
result["_hash"] = sha256('<insert hashable content here>'.encode('utf-8')).hexdigest()
83+
result["_id"] = '<your-id-01>'
84+
result["created"] = '2020-10-02T22:08:12.510696'
85+
result["language"] = 'en'
86+
result["modified"] = datetime.now().isoformat()
87+
result["name"] = 'Green Compancy SE'
88+
result["status"] = 'active'
89+
result["url"] = 'https://greencompany.implementation.cloud'
90+
result["version"] = 42
91+
92+
meta = tilt.Meta.from_dict(result)
93+
94+
print(meta)
95+
# <tilt.tilt.Meta object at 0x7fef287928d0>
96+
97+
print(meta.to_dict())
98+
# {'_hash': 'bd8f3c314b73d85175c8ccf15b4b8d26348beca96c9df39ba98fa5dda3f60fcc', '_id': '<your-id-01>', 'created': '2020-10-02T22:08:12.510696', 'language': 'en', 'modified': '2020-07-27T15:14:35.689606', 'name': 'Green Compancy SE', 'status': 'active', 'url': 'https://greencompany.implementation.cloud', 'version': 42}
99+
```
100+
101+
102+
103+
## Author
104+
Elias Grünewald
105+
106+
## License
107+
GNU General Public License, Version 3

0 commit comments

Comments
 (0)