Giter Site home page Giter Site logo

providers-api-demo's Introduction

Providers API

This is a Flask Rest API that manages providers data. It allows users to filter providers by various attributes and skills.

Solution to the Assignment

LIVE APP: https://providers-api-demo-elifry.vercel.app/docs

Features

  • Load providers data from a json file
  • Filter providers by any attribute
  • Filter providers by any active
  • Favor providers with fewer matches
  • Favor providers with higher rating
  • Return providers data as json responses

Setup and Install

To run this project, you need to have Python 3 and pip installed on your system.

  • Clone this repository
  • Navigate to the project directory
  • Install the required packages using the command pip install -r requirements.txt or just use VSCode to install the packages by selecting the python interpreter and selecting the virtual environment
  • Run the app using the command flask run
  • The app will run on http://localhost:5000 by default
  • You can use any tool like Postman or curl to send requests to the app
  • Alternatively, you can use the Swagger UI to send requests to the app. To do this, run the app and navigate to http://localhost:5000/docs

Usage

The app has one route:

  • /providers

You can add traits separated by commas, with "|" as options within that trait. Note that spaces in requests are replaced with "+".

Here are some examples of requests and responses:

  • To get all the providers, send a GET request to /providers
  • To get all 50 year old providers, send a GET request to /providers?traits=age:50
  • To get all female providers between the ages 25 and 35, /providers?traits=sex:female,age:25-35
  • To get the providers who have "Code Refactoring" in their primary skills and "Reusability" as a secondary skill, send a GET request to /providers?traits=primary_skills:Code+Refactoring,secondary_skill:Reusability
    • Note that secondary_skill is a typo in the assignment.
  • To get the providers who are from China and have "Assamese" as their language, send a GET request to /providers?traits=country:China,language:Assamese
  • Active providers: /providers?active=true
  • Inactive providers: /providers?active=false

And of course you can combine all of these filters.

All results will first be filtered by rating, then by how many times they have been returned, so that providers which have been returned fewer times get put towards the front of the list.

providers-api-demo's People

Contributors

elifry avatar

Watchers

 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.