README.md 1.99 KB
Newer Older
Maximilian Dolling's avatar
Maximilian Dolling committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Astronaut Analysis

The script analyzes publicly available astronauts data from [Wikidata](https://www.wikidata.org/wiki/Wikidata:Main_Page).
It generates a set of plots focusing on aspects such as time humans spent in space, the gender distribution as well as the age distribution.

## Install

The script comes with a predefined Python environment, which is managed by [pipenv](https://github.com/pypa/pipenv).
The environment handles all dependencies.

> The script has been successfully tested on 5.7.8-arch1-1 with Python 3.8.3

Please clone this repository and install the [dependencies](requirements.txt) as follows:

```bash
git clone ...
cd astronaut-analysis
pip install -r requirements.txt
```

## Usage

You can run the script as follows:

```bash
26
python src/astronaut_analysis.py
Maximilian Dolling's avatar
Maximilian Dolling committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
```

The script processes the [astronauts data set]( data/astronauts.json) and stores the plots in the directory `results`.
The directory will be created by the script.
Existing result plots will be overwritten.

### Astronaut Data

The data set has been generated from the following SPARQL query [[1]] (retrieval date: 2018-10-25).

You can replace the data set as follows:
- Run the SPARQL query
- Download the resulting data formatted as JSON
- Replace the file `data/astronauts.json`

[1]: https://query.wikidata.org/#%23Birthplaces%20of%20astronauts%0ASELECT%20DISTINCT%20%3Fastronaut%20%3FastronautLabel%20%3Fbirthdate%20%3FbirthplaceLabel%20%3Fsex_or_genderLabel%20%3Ftime_in_space%20%3Fdate_of_death%20WHERE%20%7B%0A%20%20%3Fastronaut%20%3Fx1%20wd%3AQ11631.%0A%20%20%3Fastronaut%20wdt%3AP569%20%3Fbirthdate.%0A%20%20%3Fastronaut%20wdt%3AP19%20%3Fbirthplace.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fastronaut%20wdt%3AP21%20%3Fsex_or_gender.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fastronaut%20wdt%3AP2873%20%3Ftime_in_space.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fastronaut%20wdt%3AP570%20%3Fdate_of_death.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Ftime_in_space%29