A webhook listener and database schema for doing geospatial analysis and advanced analytics on Pokemon Go data.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
dimension_table_csvs
language_patches
patches
.gitignore
DateTimeDimensionGenerator.ipynb
LICENSE.md
README.md
app.js
config.js
package.json
pokelyze_sql.sql
pokemon_go_db_backup.tar
time_dim.csv
windowsBatch.bat

README.md

Pokelyzer

A webhook listener and database schema for doing geospatial analysis and advanced analytics on Pokemon Go data.

Tableau Screenshot of Spawn Points

Explanation

These blog posts help to explain what Pokelyzer is, and what it can be used for.

The Database Schema

The schema itself follows the approach of dimensional modelling to keep it fast and flexible. The entire schema currently looks like this:

Schema image

It looks like a lot, but it isn't. spotted_pokemon is where all your data goes. The date_dimension and time_dimension tables let you slice and filter by dates and times, and the pokemon_info table lets you do the same with Pokemon information. _meta keeps track of changes to the schema itself. date_dimension, time_dimension, pokemon_info and _meta all connect to the spotted_pokemon table.

The Webhook Listener

The webhook listener is a node application that listens for POSTS to port 9876 by default, for JSON messages that look like this:

{
  "type": "pokemon",
  "message": {
    "encounter_id": "17290083747243295117",
    "spawnpoint_id": "4ca42277a41",
    "pokemon_id": "41",
    "latitude": "45.9586350970765",
    "longitude": "-66.6595416124465",
    "disappear_time": "1469421912",
    "last_modified_time": "1469421858380",
    "time_until_hidden_ms": "54456"
  }
}

Where timestamps are in UNIX time. If you are manually submitting data to this endpoint, pass in an additional parameter ENC_ENC=f (set ENC_ENC=f on Windows) to ensure that it does not try to decode the encounter_id, which it has to for the PokemonGo-Map data source.

Installation

See the wiki page for installation instructions.

Upgrading

If you already have the database running, ensure all of the patches below since your installation date have been applied. I wish there were better version control for databases, but this is the best solution I have for now. If you know of a better one, let me know.

To use the webhook listener, I recommend doing a fresh installation of PokemonGo-Map using the instructions prodvided in the wiki . Just rename your current directory to something else and do the install. No data will be lost from Pokelyzer since that's stored separately from the PokemonGo-Map database.

Patches

Before you try to do recent tutorials or install new versions of the webhook listener, please install all patches since your installation date.

All patches can be found in the Patches wiki page.