# django-geohashing

A Django application for calculating geohashes and exposing them 
via RESTful interface. Requires Django 1.8.x+ (takes advantage of
updated argument parsing for custom management commands, see: 
[Django 1.8 Release Notes][1] for more information).

## Installation

Install with pip:

```bash
pip install django-geohashing
```

## Quick Start

1. Add "geohashing" to your INSTALLED_APPS:

    ```python
    INSTALLED_APPS = (
       ...
       'geohashing',
    )
    ```

2. Create the geohashing tables by resyncing your models:

    ```bash
    python manage.py migrate
    ```

3. Populate the table using the `get_historical_djia` management command:

    ```bash
    python manage.py get_historical_djia
    ```

    The `get_historical_djia` command takes two optional parameters:
    `--start` and `--end`. These parameters accept date strings of the format
    `YYYY-MM-DD`. They may be used to limit the set of results from
    which to database is populated (so for instance to only retrieve and process 
    only the 30 most recent DJIA openings instead of every opening since 1928).

## TODO

This project is still in an extremely early alpha stage. Tasks that still need 
to be tackled:

- Create endpoint for retrieving geohash data
- Update the importer to:

    - Handle the creation of new Day objects and the update of existing Day 
      objects seperately so that we can use `bulk_create` to improve 
      performance.
    - Extrapolate data points beyond the maximum date when enough information
      is available to do so.
    - Add a `get_current_djia` management command to be used for retrieving
      today's opening value. Occasionally the various sources for the opening 
      value are initially inconsistent with one another. The management command 
      should handle this gracefully by waiting for consensus.
    - Add a seperate management command to be used for retrieving the current
      date. Sometimes one of the data sources for this will be temporarily 
      inconsistent with the others. The management command should handle this 
      automatically and only save the date once a consensus has been reached.

- Add unit tests and docs
- Run Flake8 against the codebase and fix any glaring PEP-8 violations
- Set up Continuous Integration...integration

[1]: https://docs.djangoproject.com/en/1.8/releases/1.8/#extending-management-command-arguments-through-command-option-list