$ git clone <this repo>
$ cd birth-names
$ mkvirtualenv birth-names
$ pip install -r requirements.txt
For local use, you can spin up a database in Postgres.app. Then, using the example provided in .env.sample
as a template, save your access credentials in a new file named .env
.
Afterward, don't forget to:
$ source .env
$ python3 download.py
The result should be two folders, data/us
and data/uk
. Each should contain many files with annual birth records for the respective country plus one summary file of total births with a name like us_births_by_year.csv
(or uk_…
).
$ python3 database.py
The result should be three new empty tables in your database: year
, birth_record
, and name
.
$ python3 process.py
Creates a data model for birth records and initializes a database schema using Peewee ORM. Loops through all U.S. and U.K. data files in /data/
and loads the records into a PostgreSQL database. This could take as long as a half hour to complete.
$ streamlit run analysis.py
Starts a local Streamlit server and opens a browser tab with an interactive time series chart rendered using Plotly Express. It should look like this: