Pokemon Database

Progress Report by Cosimo Leone

UML Diagram

Schema

  • Pokemon Table 
  • Types Table
  • Moves Table
  • Pokemon Trainer (Twitter User)
  • Critical Effects (Move to Pokemon relation)

Pokedex

Collection of Pokemon

{  
   "resource_uri":"/api/v1/pokedex/1/",
   "pokemon":[
        {  
            "name":"wartortle",
            "resource_uri":"api/v1/pokemon/8/"
        },
        {  
            "name":"blastoise",
            "resource_uri":"api/v1/pokemon/9/"
        },
        {  
            "name":"caterpie",
            "resource_uri":"api/v1/pokemon/10/"
        },
        {  
            "name":"metapod",
            "resource_uri":"api/v1/pokemon/11/"
        },
        {  
            "name":"butterfree",
            "resource_uri":"api/v1/pokemon/12/"
        },
        ...]
}

PokeMoves

All available Moves

{  
     "name":"Ice-punch",
     "category":"",
     "pp":15,
     "description":
        "Inflicts regular damage."
        "Has a 10% chance to freeze the target.",
     "power":75,
     "created":"2013-11-03T15:06:09.503161",
     "modified":"2013-12-24T15:24:29.687639",
     "resource_uri":"/api/v1/move/8/",
     "id":8,
     "accuracy":100
}

Data Sources

  • Bulbapedia (http://bulbapedia.bulbagarden.net)
  • Poke API (http://pokeapi.co)
  • PokemonDB (http://pokemondb.net)
  • Twitter

Bulbapedia

PokeAPI

POKEMONDB

Scripts

Python Libraries Used

  • Pykemon (PokeAPI)
  • Requests
  • json
  • tweepy
  • BeautifulSoup
  • re (regex)
  • MySQLdb
  • urllib


from __future__ import print_function
import os
import requests
import json
from pprint import pprint

if not os.path.exists("data/pokedex.json"):
	f = open("data/pokedex.json", "w")
	pokedex = requests.get("http://pokeapi.co/api/v1/pokedex/1/")
	pokejson = pokedex.json()
	with f as output_file:
		json.dump(pokejson, output_file)
	print("Called the API")
else:
	print("Reading from file")
	with open("data/pokedex.json") as data_file:
		jdata = json.load(data_file)
		pprint(jdata['pokemon'][0])
	print("... and many more")

Next Steps:

  • Insert JSON data into DB
  • Represent critical effects
  • Restructure moves / pokemon / types relationship
  • Randomize Pokemon Interactions
Made with Slides.com