The Era of Eras: Updating Pokelyzer for the Nest Switch-a-Roo
As you might have heard, nests have suddenly and dramatically switched around.
I know what you’re thinking: “what a great time to learn a good lesson about the power of dimensional models!” Exactly!
See, if you go hunting for nests using all the data from before the switch, you’ll find nests mixed with both kinds of Pokemon. What a mess.
Luckily, the schema we are using in Pokelyzer is designed to handle such situations. All we have to do is
- Stop our map server for a moment.
- Run this bit of SQL:
- Add this line below where you added
- Modify the bottom of the
customLog.pyto this (make sure it’s all indented 4 spaces/1 tab):
- Turn your server back on, this time just add an extra parameter,
--pokel-era "2", which identifies the current “era” as 2.
If somebody names these eras something special in the future, we can just create a new table like we did for the Pokemon Info table and join them to give them names. And if there’s a big change in the future, we can just follow the same procedure and switch the “2” to a “3”.
If you already have your data loaded into Tableau, you’ll need to go back to the Data Source tab, and drag the
spotted_pokemon table from the left over top of the
spotted_pokemon table in the tree diagram.
Then you can navigate back to your worksheets. If you’re using an extract, it may take a few mins to update.
Lastly, make sure that the
pokemon_go_era field is in the Dimensions panel and not the Measures panel. If it isn’t, drag it from one to the next.
After that, we’re back in action: you’ll now have a field you can use Tableau to choose whether you’re interested in data from era “1” or era “2” - just drag it into the Filters box, and right-click and choose “Show filter” to get quick access to it.
This Could Have Been Easier
The SQL to update this was really easy, but all this “insert a new line into a Python file” kind of sucks. When I started this project, this was just something I hacked together and I honestly didn’t expect the uptake it has received. I’ll be reaching out to the PokemonGo-Map team to hopefully get this integration built in to make this easier in the future.
Like this? Then tweet it! Oh, and follow me too.