Commit 7ffa62e3 authored by Maximilian Dolling's avatar Maximilian Dolling
Browse files

initial commit

parents
Pipeline #11916 failed with stage
in 49 seconds
# Ignore plots
*.png
# Ignore IDE files
.idea/
# Python
venv/
\ No newline at end of file
image: python:3
stages:
- test
before_script:
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
test:pylint:
stage: test
script:
- pipenv run pylint --rcfile test/linting/pylintrc src/*.py
only:
changes:
- "**/*.py"
- "test/linting/pylintrc"
- ".gitlab-ci.yml"
test:unittest:
stage: test
script:
- pipenv run python -m unittest discover test/unittest
only:
changes:
- "**/*.py"
- ".gitlab-ci.yml"
# 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
python src/astronaut-analysis.py
```
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
[
{
"astronaut": "http://www.wikidata.org/entity/Q1371840",
"astronautLabel": "Richard A. Searfoss",
"birthdate": "1956-06-05T00:00:00Z",
"birthplaceLabel": "Mount Clemens",
"sex_or_genderLabel": "male",
"time_in_space": "56358",
"date_of_death": "2018-09-29T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q4994273",
"astronautLabel": "Tatyana Kuznetsova",
"birthdate": "1941-07-14T00:00:00Z",
"birthplaceLabel": "Nizhny Novgorod",
"sex_or_genderLabel": "female",
"time_in_space": "0",
"date_of_death": "2018-08-28T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q557058",
"astronautLabel": "Donald H. Peterson",
"birthdate": "1933-10-22T00:00:00Z",
"birthplaceLabel": "Winona",
"sex_or_genderLabel": "male",
"time_in_space": "7223",
"date_of_death": "2018-05-27T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q310924",
"astronautLabel": "Alan Bean",
"birthdate": "1932-03-15T00:00:00Z",
"birthplaceLabel": "Wheeler",
"sex_or_genderLabel": "male",
"time_in_space": "100305",
"date_of_death": "2018-05-26T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q449577",
"astronautLabel": "Vladimir Lyakhov",
"birthdate": "1941-07-20T00:00:00Z",
"birthplaceLabel": "Antratsyt",
"sex_or_genderLabel": "male",
"time_in_space": "479987",
"date_of_death": "2018-04-19T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q52106890",
"astronautLabel": "Joseph M. Prahl",
"birthdate": "1943-03-30T00:00:00Z",
"birthplaceLabel": "Beverly",
"sex_or_genderLabel": "male",
"date_of_death": "2018-04-19T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q382150",
"astronautLabel": "Leonid Kadeniuk",
"birthdate": "1951-01-28T00:00:00Z",
"birthplaceLabel": "Klischkiwzi",
"sex_or_genderLabel": "male",
"date_of_death": "2018-01-31T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q107667",
"astronautLabel": "John Young",
"birthdate": "1930-09-24T00:00:00Z",
"birthplaceLabel": "San Francisco",
"sex_or_genderLabel": "male",
"time_in_space": "50139",
"date_of_death": "2018-01-05T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q433608",
"astronautLabel": "Bruce McCandless II",
"birthdate": "1937-06-08T00:00:00Z",
"birthplaceLabel": "Boston",
"sex_or_genderLabel": "male",
"time_in_space": "18751",
"date_of_death": "2017-12-21T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q502963",
"astronautLabel": "Richard F. Gordon",
"birthdate": "1929-10-05T00:00:00Z",
"birthplaceLabel": "Seattle",
"sex_or_genderLabel": "male",
"time_in_space": "18953",
"date_of_death": "2017-11-06T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q536632",
"astronautLabel": "Paul J. Weitz",
"birthdate": "1932-07-25T00:00:00Z",
"birthplaceLabel": "Erie",
"sex_or_genderLabel": "male",
"time_in_space": "47593",
"date_of_death": "2017-10-22T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q348205",
"astronautLabel": "Viktor Gorbatko",
"birthdate": "1934-12-03T00:00:00Z",
"birthplaceLabel": "Krasnodar Krai",
"sex_or_genderLabel": "male",
"time_in_space": "43967",
"date_of_death": "2017-05-17T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q348205",
"astronautLabel": "Viktor Gorbatko",
"birthdate": "1934-12-03T00:00:00Z",
"birthplaceLabel": "Ventsy",
"sex_or_genderLabel": "male",
"time_in_space": "43967",
"date_of_death": "2017-05-17T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q434555",
"astronautLabel": "Georgy Grechko",
"birthdate": "1931-05-25T00:00:00Z",
"birthplaceLabel": "Saint Petersburg",
"sex_or_genderLabel": "male",
"time_in_space": "194192",
"date_of_death": "2017-04-08T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q158486",
"astronautLabel": "Eugene Cernan",
"birthdate": "1934-03-14T00:00:00Z",
"birthplaceLabel": "Bellwood",
"sex_or_genderLabel": "male",
"time_in_space": "33975",
"date_of_death": "2017-01-16T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q280301",
"astronautLabel": "Igor Volk",
"birthdate": "1937-04-12T00:00:00Z",
"birthplaceLabel": "Zmiiv",
"sex_or_genderLabel": "male",
"time_in_space": "16994",
"date_of_death": "2017-01-03T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q14948501",
"astronautLabel": "Ricardo Peralta y Fabi",
"birthdate": "1950-08-15T00:00:00Z",
"birthplaceLabel": "Mexico City",
"sex_or_genderLabel": "male",
"date_of_death": "2017-01-01T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q505439",
"astronautLabel": "Piers Sellers",
"birthdate": "1955-04-11T00:00:00Z",
"birthplaceLabel": "Crowborough",
"sex_or_genderLabel": "male",
"time_in_space": "50942",
"date_of_death": "2016-12-23T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q182642",
"astronautLabel": "John Glenn",
"birthdate": "1921-07-18T00:00:00Z",
"birthplaceLabel": "Cambridge",
"sex_or_genderLabel": "male",
"time_in_space": "13414",
"date_of_death": "2016-12-08T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q3499300",
"astronautLabel": "Duane Graveline",
"birthdate": "1931-03-02T00:00:00Z",
"birthplaceLabel": "Newport",
"sex_or_genderLabel": "male",
"date_of_death": "2016-09-05T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q717654",
"astronautLabel": "Donald E. Williams",
"birthdate": "1942-02-13T00:00:00Z",
"birthplaceLabel": "Lafayette",
"sex_or_genderLabel": "male",
"time_in_space": "17254",
"date_of_death": "2016-02-23T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q295873",
"astronautLabel": "Edgar Mitchell",
"birthdate": "1930-09-17T00:00:00Z",
"birthplaceLabel": "Pula",
"sex_or_genderLabel": "male",
"time_in_space": "12961",
"date_of_death": "2016-02-04T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q6969146",
"astronautLabel": "Nathan J. Lindsay",
"birthdate": "1936-01-01T00:00:00Z",
"birthplaceLabel": "Monroe",
"sex_or_genderLabel": "male",
"date_of_death": "2015-05-25T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q8070504",
"astronautLabel": "Zhanna Yorkina",
"birthdate": "1939-05-06T00:00:00Z",
"birthplaceLabel": "Soltsy",
"sex_or_genderLabel": "female",
"date_of_death": "2015-05-15T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q3270358",
"astronautLabel": "Curt Michel",
"birthdate": "1934-06-05T00:00:00Z",
"birthplaceLabel": "La Crosse",
"sex_or_genderLabel": "male",
"date_of_death": "2015-02-23T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q465748",
"astronautLabel": "Aleksei Gubarev",
"birthdate": "1931-03-29T00:00:00Z",
"birthplaceLabel": "Q4134456",
"sex_or_genderLabel": "male",
"time_in_space": "53976",
"date_of_death": "2015-02-21T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q281604",
"astronautLabel": "Boris Morukov",
"birthdate": "1950-10-01T00:00:00Z",
"birthplaceLabel": "Moscow",
"sex_or_genderLabel": "male",
"time_in_space": "16992",
"date_of_death": "2015-01-01T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q465724",
"astronautLabel": "Anatoly Berezovoy",
"birthdate": "1942-04-11T00:00:00Z",
"birthplaceLabel": "Enem",
"sex_or_genderLabel": "male",
"time_in_space": "304384",
"date_of_death": "2014-09-20T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q16523336",
"astronautLabel": "Timothy Kristian Charles Mace",
"birthdate": "1955-11-20T00:00:00Z",
"birthplaceLabel": "Catterick",
"sex_or_genderLabel": "male",
"date_of_death": "2014-09-14T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q720361",
"astronautLabel": "Steven R. Nagel",
"birthdate": "1946-10-27T00:00:00Z",
"birthplaceLabel": "Canton",
"sex_or_genderLabel": "male",
"time_in_space": "43294",
"date_of_death": "2014-08-21T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q460161",
"astronautLabel": "Henry Hartsfield",
"birthdate": "1933-11-21T00:00:00Z",
"birthplaceLabel": "Birmingham",
"sex_or_genderLabel": "male",
"time_in_space": "28970",
"date_of_death": "2014-07-17T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q944386",
"astronautLabel": "Wubbo Ockels",
"birthdate": "1946-03-28T00:00:00Z",
"birthplaceLabel": "Almelo",
"sex_or_genderLabel": "male",
"time_in_space": "10124",
"date_of_death": "2014-05-18T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q1395516",
"astronautLabel": "Bill Dana",
"birthdate": "1930-11-03T00:00:00Z",
"birthplaceLabel": "Pasadena",
"sex_or_genderLabel": "male",
"date_of_death": "2014-05-06T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q460440",
"astronautLabel": "William R. Pogue",
"birthdate": "1930-01-23T00:00:00Z",
"birthplaceLabel": "Okemah",
"sex_or_genderLabel": "male",
"time_in_space": "121035",
"date_of_death": "2014-03-03T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q432752",
"astronautLabel": "Valeri Kubasov",
"birthdate": "1935-01-07T00:00:00Z",
"birthplaceLabel": "Vyazniki",
"sex_or_genderLabel": "male",
"time_in_space": "26997",
"date_of_death": "2014-02-19T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q426836",
"astronautLabel": "Dale Gardner",
"birthdate": "1948-11-08T00:00:00Z",
"birthplaceLabel": "Fairmont",
"sex_or_genderLabel": "male",
"time_in_space": "20212",
"date_of_death": "2014-02-19T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q362819",
"astronautLabel": "Aleksandr Serebrov",
"birthdate": "1944-02-15T00:00:00Z",
"birthplaceLabel": "Moscow",
"sex_or_genderLabel": "male",
"time_in_space": "537052",
"date_of_death": "2013-11-12T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q905516",
"astronautLabel": "Dmitri Zaikin",
"birthdate": "1932-04-29T00:00:00Z",
"birthplaceLabel": "Rostov Oblast",
"sex_or_genderLabel": "male",
"date_of_death": "2013-10-21T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q335503",
"astronautLabel": "Scott Carpenter",
"birthdate": "1925-05-01T00:00:00Z",
"birthplaceLabel": "Boulder",
"sex_or_genderLabel": "male",
"time_in_space": "296",
"date_of_death": "2013-10-10T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q519268",
"astronautLabel": "C. Gordon Fullerton",
"birthdate": "1936-10-11T00:00:00Z",
"birthplaceLabel": "Rochester",
"sex_or_genderLabel": "male",
"time_in_space": "22970",
"date_of_death": "2013-08-21T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q986620",
"astronautLabel": "Anthony Llewellyn",
"birthdate": "1933-04-22T00:00:00Z",
"birthplaceLabel": "Cardiff",
"sex_or_genderLabel": "male",
"date_of_death": "2013-07-02T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q822726",
"astronautLabel": "Dumitru Dediu",
"birthdate": "1942-05-12T00:00:00Z",
"birthplaceLabel": "Galați",
"sex_or_genderLabel": "male",
"date_of_death": "2013-07-01T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q1401203",
"astronautLabel": "Q1401203",
"birthdate": "1930-06-08T00:00:00Z",
"birthplaceLabel": "Donetsk Oblast",
"sex_or_genderLabel": "male",
"date_of_death": "2012-11-10T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q1615",
"astronautLabel": "Neil Armstrong",
"birthdate": "1930-08-05T00:00:00Z",
"birthplaceLabel": "Wapakoneta",
"sex_or_genderLabel": "male",
"time_in_space": "12372.5",
"date_of_death": "2012-08-25T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q49285",
"astronautLabel": "Sally Ride",
"birthdate": "1951-05-26T00:00:00Z",
"birthplaceLabel": "Los Angeles",
"sex_or_genderLabel": "female",
"time_in_space": "20626",
"date_of_death": "2012-07-23T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q362220",
"astronautLabel": "Alan G. Poindexter",
"birthdate": "1961-11-05T00:00:00Z",
"birthplaceLabel": "Pasadena",
"sex_or_genderLabel": "male",
"time_in_space": "40149",
"date_of_death": "2012-07-01T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q17593757",
"astronautLabel": "Alexander Jabloncev",
"birthdate": "1955-04-03T00:00:00Z",
"birthplaceLabel": "Warsaw",
"sex_or_genderLabel": "male",
"time_in_space": "0",
"date_of_death": "2012-05-09T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q52923",
"astronautLabel": "Janice E. Voss",
"birthdate": "1956-10-08T00:00:00Z",
"birthplaceLabel": "South Bend",
"sex_or_genderLabel": "female",
"time_in_space": "70789",
"date_of_death": "2012-02-06T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q360038",
"astronautLabel": "Valery Rozhdestvensky",
"birthdate": "1939-02-13T00:00:00Z",
"birthplaceLabel": "Saint Petersburg",
"sex_or_genderLabel": "male",
"time_in_space": "2886",
"date_of_death": "2011-08-31T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q986622",
"astronautLabel": "Brian O'Leary",
"birthdate": "1940-01-27T00:00:00Z",
"birthplaceLabel": "Boston",
"sex_or_genderLabel": "male",
"date_of_death": "2011-07-28T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q501697",
"astronautLabel": "John M. Lounge",
"birthdate": "1946-06-28T00:00:00Z",
"birthplaceLabel": "Denver",
"sex_or_genderLabel": "male",
"time_in_space": "28943",
"date_of_death": "2011-03-01T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q376165",
"astronautLabel": "William B. Lenoir",
"birthdate": "1939-03-14T00:00:00Z",
"birthplaceLabel": "Miami",
"sex_or_genderLabel": "male",
"time_in_space": "7334",
"date_of_death": "2010-08-26T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q360060",
"astronautLabel": "Leonid Kizim",
"birthdate": "1941-08-05T00:00:00Z",
"birthplaceLabel": "Lyman",
"sex_or_genderLabel": "male",
"time_in_space": "539636",
"date_of_death": "2010-06-14T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q1129526",
"astronautLabel": "Lew Worobjow",
"birthdate": "1931-02-24T00:00:00Z",
"birthplaceLabel": "Borovichi",
"sex_or_genderLabel": "male",
"date_of_death": "2010-05-12T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q252726",
"astronautLabel": "Vitaly Sevastyanov",
"birthdate": "1935-07-08T00:00:00Z",
"birthplaceLabel": "Krasnouralsk",
"sex_or_genderLabel": "male",
"time_in_space": "116178",
"date_of_death": "2010-04-05T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q2620784",
"astronautLabel": "Robert Michael White",
"birthdate": "1924-07-06T00:00:00Z",
"birthplaceLabel": "New York City",
"sex_or_genderLabel": "male",
"date_of_death": "2010-03-17T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q320068",
"astronautLabel": "Konstantin Feoktistov",
"birthdate": "1926-02-07T00:00:00Z",
"birthplaceLabel": "Voronezh",
"sex_or_genderLabel": "male",
"time_in_space": "1457",
"date_of_death": "2009-11-21T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q2315605",
"astronautLabel": "Fernando Caldeiro",
"birthdate": "1958-06-12T00:00:00Z",
"birthplaceLabel": "Buenos Aires",
"sex_or_genderLabel": "male",
"date_of_death": "2009-10-03T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q118490",
"astronautLabel": "Pavel Popovich",
"birthdate": "1930-10-05T00:00:00Z",
"birthplaceLabel": "Uzyn",
"sex_or_genderLabel": "male",
"time_in_space": "26907",
"date_of_death": "2009-09-29T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q14948500",
"astronautLabel": "Robert Jackson Wood",
"birthdate": "1957-06-26T00:00:00Z",
"birthplaceLabel": "Fitchburg",
"sex_or_genderLabel": "male",
"date_of_death": "2009-02-19T00:00:00Z"
},
{
"astronaut": "http://www.wikidata.org/entity/Q465461",
"astronautLabel": "Yury Glazkov",
"birthdate": "1939-10-02T00:00:00Z",
"birthplaceLabel": "Moscow",
"sex_or_genderLabel": "male",
"time_in_space": "25525",
"date_of_death": "2008-12-09T00:00:00Z"