program to store and update pokemons using SQL and Flask

Overview

Pokemon

SQL and Flask Pokemons api in python.

Technologies

  • flask
  • pymysql

Description

PokeCorp is a company that tracks pokemon and their trainers around the world.

Until this day, they've been storing all their data together, in the attached JSON file that looks like this:

, "name": , "type": , "height": , "weight": , "ownedBy": [ {name: , town: }, ... ] }, ...] ">
[{ 
    "id": 
         
          , 
    "name": 
          
           , 
    "type": 
           
            , 
    "height": 
            
             , 
    "weight": 
             
              , "ownedBy": [ {name: 
              
               , town: 
               
                }, ... ] }, ...] 
               
              
             
            
           
          
         

The file has 151 pokemon in it. Each pokemon has some data, as well as an ownedBy field.

The ownedBy field is an array of objects, where each object represents a trainer that owns this pokemon - note that this array might be empty.

In this project we were required to migrate all of the data to an SQL database, create the tables using plain SQL, and then do all the INSERTs in python using the pymysql package.

Once we were done, we wrote functions for the following queries:

  • heaviest_ pokemon(): returns the heaviest pokemon (the one with the biggest weight property).
  • find_by_type(type): receives a pokemon type, and returns all of the pokemon names with that type.
  • find_owners(pokemon __name): receives the name of a pokemon, and returns the names of all the trainers that own it, or an empty array if no one owns it.
  • find_roster(trainer_name): receives the name of a trainer, and returns the names of all the pokemon he or she owns.
  • finds_most_owned(): finds the most owned pokemon, meaning the pokemon that has the highest number of owners.

At the next stage, we were required to implement a server with api to the pokemons database. The api:

  • /pokemons/ GET: returns all the pokemons of a given owner.
  • /trainers/ GET: returns all the trainers of a given pokemon.
  • /pokemons POST: adds a new pokemon with the following information: id, name, height, weight, types (all of them).
  • /pokemons/get_by_type/ GET: returns all pokemons with the specific type.
  • /pokemons/ DELETE: deletes pokemon.
  • /pokemons/ DELETE: deletes all pokemons of trainer.
  • /pokemons/types/ PUT: updates pokemon types.
  • /evolve PUT: evolves specific pokemon of specific trainer.

Evolution

  1. Get the info of a specific pokemon.

  2. From the pokemon general info, get the species url.

  3. Get the info of the species, by making a request to the species url .

  4. From the species info get the evolution chain url.

  5. Get the info of the evolution chain, by making a request to the evolution chain url.

  6. From the evolution chain info get the chain item.

  7. Scan the chain item to find what is the next form of your pokemon.

  8. You should end up with the name of the evolved pokemon.

  9. Update the DB accordingly.

Original database

Pokémon Data

Owner
Sara Hindy Salfer
Sara Hindy Salfer
simple password manager.

simple password manager.

1 Nov 18, 2021
This is the improvised version of Dobot Magician which can be implemented for Dobot M1

pydobotM1 This is the edited driver for Dobot M1 version of the original pydobot library intended for use with the Dobot Magician. Here's what you nee

Shaik Abdullah 2 Jul 11, 2022
A multi purpose password managing and generating tool called Kyper.

Kyper A multi purpose password managing and generating tool called Kyper. Setup The setup for Kyper is fairly simple only involving the command python

Jan Dorian Poczekaj 1 Feb 05, 2022
Your self-hosted bookmark archive. Free and open source.

Your self-hosted bookmark archive. Free and open source. Contents About LinkAce Support Setup Contribution About LinkAce LinkAce is a self-hosted arch

Kevin Woblick 1.7k Jan 03, 2023
Simple web application, which has a single endpoint, dedicated to annotation parsing and convertion.

Simple web application, which has a single endpoint, dedicated to annotation parsing and conversion.

Pavel Paranin 1 Nov 01, 2021
PyDateWaiter helps waiting special day & calculating remain days till that day with Python code.

PyDateWaiter (v.Beta) PyDateWaiter helps waiting special day(aniversary) & calculating remain days till that day with Python code. Made by wallga gith

wallga 1 Jan 14, 2022
OpenTable Reservation Maker For Python

OpenTable-Reservation-Maker The code that corresponds with this blog post on writing a script to make reservations for me on opentable Getting started

JonLuca De Caro 36 Nov 10, 2022
A dashboard for your code. A build system.

NOTICE: THIS REPO IS NO LONGER UPDATED Changes Changes is a build coordinator and reporting solution written in Python. The project is primarily built

Dropbox 763 Sep 09, 2022
Python language from the beginning.

Python For Beginners Python Programming Language ♦️ Python is a very powerful and user friendly programming language. ❄️ ♦️ There are some basic sytax

Randula Yashasmith Mawaththa 6 Sep 18, 2022
Intelligent Employer Profiling Platform.

Intelligent Employer Profiling Platform Setup Instructions Generating Model Data Ensure that Python 3.9+ and pip is installed. Install project depende

Harvey Donnelly 2 Jan 09, 2022
A simple BrainF**k compiler written in Python

bf-comp A simple BrainF**k compiler written in Python. What else were you looking for?

1 Jan 09, 2022
This application is made solely for entertainment purposes

Timepass This application is made solely for entertainment purposes helps you find things to do when you're bored ! tells jokes guaranteed to bring on

Omkar Pramod Hankare 2 Nov 24, 2021
Removes all archived super productivity tasks. Just run the python script.

delete-archived-sp-tasks.py Removes all archived super productivity tasks. Just run the python script. This is helpful to do a cleanup every 3-6 month

Ben Herbst 1 Jan 09, 2022
dynamically create __slots__ objects with less code

slots_factory Factory functions and decorators for creating slot objects Slots are a python construct that allows users to create an object that doesn

Michael Green 2 Sep 07, 2021
My collection of mini-projects in various languages

Mini-Projects My collection of mini-projects in various languages About: This repository consists of a number of small projects. Most of these "mini-p

Siddhant Attavar 1 Jul 11, 2022
Rotating cube with hand

I am still working on this project :)) To-Do(Present): = It needs an algorithm to fine tune my hand's coordinates for rotation of our cube (initial o

Jay Desale 2 Dec 26, 2021
Alfred 4 Workflow to search through your maintained/watched/starred GitHub repositories.

Alfred 4 Workflow to search through your maintained/watched/starred GitHub repositories. Setup This workflow requires a number of Python modules. Thes

Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 1 Oct 14, 2022
Aim of the project is to reduce phishing victims. 😇

Sites: For more details visit our Blog. How to use 😀 : You just have to paste the url in the ENTER THE SUSPECTED URL section and SELECT THE RESEMBELI

0 May 19, 2022
Magenta: Music and Art Generation with Machine Intelligence

Magenta is a research project exploring the role of machine learning in the process of creating art and music. Primarily this involves developing new

Magenta 18.1k Jan 05, 2023
An open source server for Super Mario Bros. 35

SMB35 A custom server for Super Mario Bros. 35 This server is highly experimental. Do not expect it to work without flaws.

Yannik Marchand 162 Dec 07, 2022