A world stats interface that allows you to learn about different countries and play games.
docker-compose up
This command will build the docker images, start the db and web containers, and seed the database.
The first time the containers are built, the database is completely empty. A script will automatically detect if the tables are empty and seed them with the world statistics. If the tables already exist and are populated this initialization step will be skipped.
Database Information
- PostgreSQL
- View sample queries and outputs here
Once the container has been build and the database populate navigate to http://localhost:5001/
to interact with the web app.
This factbook has the unique feature of supporting a timeseries data from multiple years. To update the database with new data, first insert this new data into the appropriate CSV file in the raw_data
folder, make sure to follow the existing format. Then, with the web app up and running, simply open a terminal and run the command:
docker-compose exec web python manage.py update
Starting the app locally:
- Ensure the workign dir is the frontend ;
cd frontend
- Install dependencies ;
yarn
- Start the frontend ;
yarn dev
Library Documentation Links
(once the project is up and running within its container)
Access the WEB service using:
docker-compose exec web sh
Access the DB service using:
docker-compose exec db sh
Interacting with the PostgreSQL Database:
Once the project is up and running within its container, run the following command to access the PostgreSQL CLI.
docker-compose exec db psql --username=user --dbname=world_factbook
To view tables in the database, use
\dt
Run the following SQL command to check if the data inside the population table was loaded successfully.
TABLE population;