/bloodstock_analysis

Companion code for post at https://sriramsami.com/bloodstocks

Primary LanguagePython

Blood Stock Analysis

This repository accompanies the analysis of Singapore's blood stock levels at https://sriramsami.com/bloodstocks.

Note: This is definitely not the most efficient way to analyze the data (one network call per commit).

Pre-requisites

  1. You'll need python 3+ and git
  2. Install python packages, either (a) conda env create -f environment.yml or (b) pip install pandas seaborn matplotlib PyGithub
  3. Clone this repository.

Downloading and analyzing the data

  1. Get a GitHub personal access token from https://github.com/settings/tokens/new. The token doesn't need any specific permissions.
  2. Run TOKEN=<your GitHub personal access token> python3 retrieve.py. This will download the data to the data/ subfolder. It'll take a few minutes. PRs are welcome to do this sanely (download the repo oneshot and extract the commits offline)
  3. When the data is downloaded, run python3 analyze.py. This should display the overall graph for blood stocks over time.