Code Monkey home page Code Monkey logo

csv-api's Introduction

Backend API Hiring Challenge

Introduction

Datapane is an API-driven product that provides client libraries / commandline applications that talk to an API server to handle and process datasets.

This challenge involves building a small API server and corresponding command-line client, both in Python, that allow uploading and processing CSV files, such as those included in the repo.

Task

For this task we'll be building a very simple Python 3-based REST API server and command-line client.

You may use any Python libraries and technologies of your choice, for instance FastAPI, etc, to build the API server.

API Server

The API server should have a single root endpoint, /dataset/, that allows list and CRUD operations over a dataset object via the following API / HTTP verbs:

  • GET /datasets/ - list the uploaded datasets
  • POST /datasets/ - creates a dataset. This endpoint takes a CSV file as input, and stores it somewhere/how on the server as a pandas dataframe. A reference id to this created object is returned by the endpoint.
  • GET /datasets/<id>/ - return the file name, and size of the dataset object
  • DELETE /datasets/<id>/ - delete the dataset object
  • GET /datasets/<id>/excel/ - export the dataset as an excel file
  • GET /datasets/<id>/stats/ - return the the stats generated by running df.describe() on the pandas dataframe as a json object
  • GET /datasets/<id>/plot/ - generate and return a PDF containing a list of histograms of all the numerical columns in the dataset

Client Library

The client app should be a fully standalone command-line python application, that is easily installable and runnable. The app should provide command-line arguments that correspond and support each of the API actions above - how you structure the command line arguments and what you call them is left up to yourselves.

  • list - list the uploaded datasets
  • clear - delete all the datasets
  • create name-of-dataset.csv - creates a dataset. This endpoint takes a CSV file as input, and stores it somewhere/how on the server as a pandas dataframe. A reference id to this created object is returned by the endpoint.
  • delete name-of-dataset.csv - delete the dataset object
  • info name-of-dataset.csv - return the file name, and size of the dataset object

Technologies

  • A Python 3 framework that supports generating JSON APIs (FastAPI)
  • Build systems, tools, and scripts of your choice, e.g. poetry, setup.py, docker, etc.
  • Any libraries you may find useful to help your task, we prioritise using existing libraries to accomplish tasks rather than building in-house

Requirements

  • Multi-user support and log-in is NOT required for this project
  • Instructions should be provided on how to build / bundle / start the system
  • You should aim to use the latest Python language features, ecosystem, tooling, and libraries where possible

Optional Requirements

  • As CSVs can be untrusted, you should consider running the CSV importing within a container / sandbox

Instructions

  • Start the server

    • cd name-of-server-dir
    • uvicorn server:app
  • Start the client

    • cd name-of-client-dir
    • python client.py
  • Docs

    • 'localhost:8000/docs' for the server

csv-api's People

Contributors

ocean2356 avatar mands avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.