jbholden / cdcpool_google

0 stars 1 forks source link

New method for loading historical data + comments on latest submitted code #22

Closed jbholden closed 10 years ago

jbholden commented 10 years ago

A new way to load data into the database as been implemented. It allows finer grained control over loading and deleting data in the database.

The old way is still there (using /a/load), but hopefully this will be removed in the future.

Loading the database

The new method uses a python script that makes HTTP API calls to load the database. This requires the following python module

https://pypi.python.org/pypi/xlrd

The following is how to load the database in order for the tests to pass.

go to directory /scripts/fbpool
python --port 10090 --load year --year 2013
python --port 10090 --load year --year 2012

More details can be found here:
https://github.com/jbholden/cdcpool_google/blob/master/scripts/fbpool/README.md

Notes About the Implementation

directory /scripts/api A new HTTP API was created to allow reading, modifying, and deleting data.

directory /scripts/data This directory contains the historical excel files.

directory /scripts/excel A new python script was created for extracting the data from the excel files.

directory /scripts/fbpool This directory contains code to load, delete, and list data.

how load works

The new code offers the following advantages

directory tests/api

This directory contains code to test the new API. It is run from the command line using python. This code can be referenced for how to use the API.

directory pages/api

This directory contains the code to handle the HTTP API calls.

code/api.py

This file contains the code that implements the API. The code in pages/api uses this code to actually perform the API call

main.py

The code that maps URLs to the handlers has been modified to use a regular expression instead of the old way. This was done in order to capture string arguments for some of the API calls.

Future Improvements

jbholden commented 10 years ago

This issue is for information purposes only.