Giter Site home page Giter Site logo

alpha74 / profitmoviesapi Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 68 KB

API to get maximum movies which an actor can sign without date conflicts using Flask and C++

Python 56.12% C++ 43.88%
actors movies-api conflict-resolution algorithms backtracking-search data-structures coding coding-interviews python-scripts json

profitmoviesapi's Introduction

Profit Movies API

alpha74

Project created for implementing the task which is here

Tech Used:

  • Python
  • Flask framework for API handling
  • C++ in movie_selector/choose_movies.cpp used in computation.

Run

Step1

  • Build the file movie_selector/choose_movies.cpp.
  • Place the executable file in dir movie_selector.
  • Update path to this file in utils.py as var MOVIE_SELECTOR.

Step2

  • Create a virtual environment from requirements.txt.
  • Run python mainhandler.py.
  • By default, the server runs on localhost:5000, if no errors are encountered.

APIs

  • /

    • Method : GET
    • Used to check if server is running.
  • /api/get_profit_movies

    • Method : POST
    • Returns data of chosen profitable movies.

Sample Payload in JSON

  • Payload for /api/get_profit_movies
{
	"schedule" : [
		{
			"movie_name" : "Bala",
			"start_date" : "8 Jan",
			"end_date" : "28 Jan"
		},
		{
			"movie_name" : "Rock",
			"start_date" : "20 Jan",
			"end_date" : "30 Jan"
		},
		{
		    "movie_name": "Brave",
		    "start_date": "2 Feb",
		    "end_date": "14 Feb"
		},
		{
		    "movie_name": "Race",
		    "start_date": "15 Feb",
		    "end_date": "28 Feb"
		}
	]
}

Sample output in JSON

  • Output for /api/get_profit_movies.
  • Returns Success when computation is completed with no internal errors.
  • Returns Failure when some internal error occurs.

Success output

{
    "status": "Success",
    "result": [
        {
            "movie_name": "Rock",
            "start_date": "20 Jan",
            "end_date": "30 Jan"
        },
        {
            "movie_name": "Brave",
            "start_date": "2 Feb",
            "end_date": "14 Feb"
        },
        {
            "movie_name": "Race",
            "start_date": "15 Feb",
            "end_date": "28 Feb"
        }
    ]
}

Failure output

{
    "status": "Failed"
}

Dependencies:

  • APIs are tested using Postman v7.25.0.
  • Python scripts call movie_selector/choose_movies.exe (executable file generated after build in Step1) internally to generate results.
  • Communication between python scripts and cpp executable is done using file I/O.
  • Input and Output file names in python scripts and cpp programs should be same.
  • Executable paths if changed, should be updated in python scripts.

PRs

  • PRs accepted on master

profitmoviesapi's People

Contributors

alpha74 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.