Skip to content

utilitarianexe/wiki_poverty_list_bot

Repository files navigation

Automatically builds first table and image/map for https://en.wikipedia.org/wiki/List_of_countries_by_percentage_of_population_living_in_poverty based on most up to date world bank data from their api.

get started/install

1. install python 3

2. install pip for python 3
sudo apt-get install python3-pip

3. install the python libs
sudo pip3 install -r requrirements.txt

5. run it
This program is designed to be run with python3
navigate to the directory of this readme in the console
Then run 
python3 create_table.py
warning messages are printed to standard out
the table is output to a file named output_markup in the directory you ran from

6. Building the map. This will require installing pylab. A massive pain so I left it out of the main processs. On ubuntu I needed.
sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran libpng-dev libjpeg-dev libffi-dev libfreetype6-dev
Depending on your system set up this may very consideralbly. Check the error messages on the pip3 install

Then you will need to pip3 install 
numpy
scipy
pylab
cycler
python-dateutil
cairocffi
finally you will need basemap http://matplotlib.org/basemap/users/installing.html
Once this is complete you can run
python3 countries_map.py

It is likely at this point you will still hit some weird unicode errors. These can be fixed by changing return v.decode('utf-8')  to return v.decode('utf-8', 'ignore') in /usr/local/lib/python3.4/dist-packages/mpl_toolkits/basemap/shapefile.py (you may have this installed somewhere else or have a version without this issue)

countries_by_poverty_rate_world_bank_data.png will output to this directory. Use it to update https://commons.wikimedia.org/wiki/File:Countries_by_poverty_rate_world_bank_data.png if you can instead of totally reuploading. But don't worry if this does not work for some reason and you need to just totally redo it.


Notes:

1. This program is not set up to auto post the table. It just ouputs the full markup for the table for a user
to manually add to the page. That funtionality may come later. For now though it should be manually checked. I will be doing this personally for now. My wiki user name is Lonjers. My email is [email protected].

2. The program may take some time(5 min) to pull all the api data but it automatically caches so subsequent runs will be fast.

3. World Bank api is completely open at the moment don't do something stupid like delete the cache over and over and rerun this over and over. I don't want them to have to restrict their api.

4. Specific more recent estimates not from the world bank can be added in the reference_overwrite function. There is one in there for India currently. None of the other references made before this program were used were of good quality and more recent than the world bank data and so were removed. These references do not currently get added to the map that uses pure world bank data.

5. Access dates are updated to the time the program is run

6. More features to come

About

A wikipedia bot see README

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages