Skip to content

Repo dedicated to load tennis data and build an API REST around that

Notifications You must be signed in to change notification settings

adrianhrb/atp_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Atp tennis API REST 🎾

A dedicated to build a simple api around some tennis information.



Note

Original files are greater than the ones in the repo. Csv files have been reduced to test the project.

Starting 🚀

This section will help you to have a copy of the project in your local computer in case you want to work, change or test something

Installation and requirements 🔧

You can check requirements of the project on the requirements.txt file

Because the project will be done with Django-Python, we will need a Python Virtual Enviroment to install all dependencies. You can run in a terminal the following commands:

$ python -m venv .venv --prompt mysite
$ source .venv/bin/activate
$ pip install -r requirements.txt

If something goes wrong make sure you have Python installed or or else try to launch the command indicating the version of Python:

$ python3.X -m venv .venv --prompt mysite

Tip

In case of doubts you can see the documentation

Some functionalities will involve the use of sensitive information, so we will use a .env file for this purpose. This file must be out of version control so you will need to create one. In the project (mostly in the settings.py file) there will be calls to a config function of the prettyconf library, all these calls are the information that the .env file must contain.

On csv files, there are two field that we will not add to database, so we will use redis to link the csv ids with the database ones. We will need this to treat Stats.csv file for add winner and loser to a match as foreign keys.

To install redis you can run:

$ brew install redis

And then, to start running redis:

$ redis-server

Important

This commands may not work to you beacause I´m using Mac. In case of doubt you can see documentation

To streamline some repetitive processes on terminal we are using Justfile, a handy way to run and save commands. For example, in case of make the migrations and migrating changes of an app in django, instead of using python manage.py makemigrations app & python manage.py migrate we are using just mmigrate app

API endpoits 📩

All endpoints are Insensitive Case

Endpoints are build with __icontains method, so you can use urls whithout writting full names.

The API response is in JSON format. You have the following endpoints:

Players

  • /api/players -> Retrieve all players from database
  • /api/players/1(pk) -> Retrieve the player with pk/id 1
  • /api/players/nadal(name) -> Retrieve all players with name Nadal
  • /api/players/Ger(country) -> Retrieve all german players

Matches

  • /api/matches -> Retrieve all matches from database
  • /api/matches/1 -> Retrieve the match with pk/id 1
  • /api/matches/1/loser -> Retrieve the loser of match 1
  • /api/matches/1/winner -> Retrieve the winner of match 1

Data files 📑

Files with data:

Contribution 🖇️

Feel free to contribute to the project in any way you want <3. I will be happy to receive help from experienced people to correct mistakes and learn, as I said the project will be a help to continue taking my first steps with Django. 😊

⌨️ with ❤️ by Adrián ✌️

About

Repo dedicated to load tennis data and build an API REST around that

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages