This python app takes a CSV export of the members/roles list of Holaspirit and transforms it into a Gephi-friendly CSV format. Requires Python >= 3
This app creates a one-mode network with bi-directional edges and people as nodes. A relation bewteen two nodes can either be
- same role
- same circle
First, the application creates two matrices:
- A matrix with weighted relations for same roles
- A matrix with weighted relations for same circles
These two matrices are then combined: Another empty matrix is created (all weights 0) and the values of the other two matrices are added.
The weight of the edges is determined as follows:
- 0: No relation, i.e. no edge present
- + 0.5: Same role, that is not Lead Link or Rep Link.
- + 1.0: Same role, both nodes are either Lead links or Rep Links or any combination (Lead and Rep Links tend to communicate more often through higher circles and are therefore of more influence)
- + 1.0: Same circle (People working together closely)
- + 1.5: Lead and Rep Link of same circle (Lead Link assigns roles within circle, Rep Link represents circle in upper circle)
- Alice and Bob are both Developers, but in different circles: 0.5
- Alice and Bob are both UX specialist and Developer, but in different circles: 0.5 * 2 roles = 1.0
- Alice is Developer, Bob is UX specialist, they are in the same circle: 1.0
- Alice and Bob are both Developers in the same circle: 1.0 (circle) + 0.5 (same roles) = 1.5
- Alice is Lead Link, Bob is Rep Link, they are in different circles: 1.0
- Alice is Lead Link, Bon is Rep Link, they are in the same circle: 1.0 (same circle) + 1.5 (Lead and Rep Link of same circle) = 2.5
- Alice and Bob are Lead and Rep Link of three different circles: 2.5 * 3 circles = 7.5
- Alice is Rep Link, Bob is UX specialist, they are in the same circle: From A to B: 1.5, from B to A: 1.0
This application does not add attributes for nodes or edges.
As per --help
:
usage: holaspirit-to-python.py [-h] [--anonymize] --source-file SOURCE_FILE
--target-file TARGET_RELATIONS
Convert an export of roles and circles of Holaspirit to Gephi CSV
optional arguments:
-h, --help show this help message and exit
--anonymize Determines if the names of people should be anonymized
required named arguments:
--source-file SOURCE_FILE
Source file: The Holaspirit CSV export
--target-file TARGET_RELATIONS
Target file for relations
The source file can be specified via --source-file
parameter. The file needs to be in CSV format, i.e. a direct export
from Holaspirit (which is .xlsx) converted to CSV.
The target file (i.e. the CSV being generated) can be specified via --target-file
parameter. This target file will
contain a matrix with values. Values > 0 mean that there's a weighted relation, values == 0 mean that there's
no relation.
In some use cases, it may be necessary to anonymize the data. If an anonymization is necessary, it can be achieved by
passing the --anonymize
flag. This will also create a file anonymize_map.csv
which contains the clear text names and
their respective anonymized tokens. A token will look like such: Person #123
whereas 123
is the index of
encountering.
To load an export from the file ../export.csv
and write it into ../network.csv
, anonymized, execute the following
command:
./holaspirit-to-gephi.py --source-file=../export.csv --target-file=../network.csv --anonymize
Creates a CSV file of names mapped to a list of rows.
usage: holaspirit-roles-gephi-attributes.py [-h] --source-file SOURCE_FILE
--target-file TARGET_ATTRIBUTES
Convert an export of roles and circles of Holaspirit to Gephi attributes CSV
optional arguments:
-h, --help show this help message and exit
required named arguments:
--source-file SOURCE_FILE
Source file: The Holaspirit CSV export
--target-file TARGET_ATTRIBUTES
Target file for attributes
Attaches further attributes (if ex partner and start date of person) to the attributes CSV file
created with holaspirit-roles-gephi-attributes.py
usage: attach-attributes.py [-h] --attributes-file ATTRS --expartners-file
EXPARTNERS --zebra-file ZEBRA
Attaches further attributes to a given attributes CSV
optional arguments:
-h, --help show this help message and exit
required named arguments:
--attributes-file ATTRS
Attributes, a given file with attributes for Gephi
--expartners-file EXPARTNERS
File containing a list of names that used to be
partners
--zebra-file ZEBRA File containing an export of Zebra
Anonymizes all attributes: Replaces names in an attributes CSV file with a given map of names to tokens.
usage: anonymize-attributes.py [-h] --attributes-file ATTRS --person-file
PERSONS
Anonymizes a given attributes CSV
optional arguments:
-h, --help show this help message and exit
required named arguments:
--attributes-file ATTRS
Attributes, a given file with attributes for Gephi
--person-file PERSONS
Personss, a list of persons and their anonymized
tokens
Executes all commands consectuively. The following files need to be present:
- data/raw/export.csv (Holaspirit export CSV)
- data/raw/expartners.csv (List of names that used to be partners)
- data/raw/startdates.csv (List of names and their startdates)
The following files will be created:
- data/gephi-ready/relations.csv
- data/gephi-ready/attributes.csv
The complete toolchain can be executed via ./toolchain.sh
This application serves educational purpose only and is developed by Nelson Abplanalp and Pascal Thormeier.
It is distributed under the MIT license.