Skip to content

API service for working with csv files and data visualization. Users have tokenized access to the api.

Notifications You must be signed in to change notification settings

Segfaul/data_includer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Data Includer

API service for working with csv files and data visualization. Users have tokenized access to the api.


Project Status

Completed ✓


Functionality

  • API for CRUD operations with dataset via DRF + Django ORM
  • Authorization and validation/error handling
  • Basic dataset operations via Django generic view classes and AJAX requests
  • Documentation and writing tests of the service's main API

Technologies and Frameworks

  • Python 3.10
  • Django 4.2.3
  • DRF 3.14.0
  • Pandas
  • PostgreSQL
  • Swagger, Docker

Installation

  1. Clone the repository to the local machine

    git clone https://github.com/Segfaul/data_includer.git
  2. Go to the repository directory

    cd data_includer
  3. Create and activate a virtual environment

    python -m venv env
    source env/bin/activate
  4. Set project dependencies

    pip install -r requirements.txt
  5. Move to the project directory

    cd data_includer
  6. Configure the configuration file .env

    nano .env
  7. Create database migrations and apply them

    python manage.py makemigrations
    python manage.py migrate
  8. Create a Django project superuser (admin)

    python manage.py createsuperuser
  9. Run the project on localhost in the background

    python manage.py runserver &
  10. Go to the site and enter the previously created data of the superuser (step 8)

    http://127.0.0.1:8000
  11. In the future you can deploy the project on a remote server

    python manage.py runserver 123.123.123.123:8000 &
  12. In case of a problem, the program will stop automatically or you can stop execution using

    ps aux | grep ".py"
    kill PID
  13. Also you can build a docker app and run the container

    docker build -t app .
    docker run -d app

API endpoints

  • [DELETE] /api/delete/{file_id}/?api_token=... - delete csv file on server related to user's api_token
  • [GET] /api/generate_token/ - generates api_token for an authorized user
  • [GET] /api/revoke_token/ - revokes api_token for an authorized user
  • [GET] /api/read/?api_token=... - read csv file using get request and pandas dataframe as a response
  • [GET] /api/list/?api_token=... - list of csv files on server related to user's api_token
  • [POST] /api/upload/?api_token=... - upload csv file on server related to user's api_token