Skip to content

Instantly share code, notes, and snippets.

@robertmogos
Last active June 23, 2021 09:10
Show Gist options
  • Save robertmogos/9d110e568ba7f391e21e6ed75ee18293 to your computer and use it in GitHub Desktop.
Save robertmogos/9d110e568ba7f391e21e6ed75ee18293 to your computer and use it in GitHub Desktop.

Technical test

The goal of this test is to evaluate your ability to architecture a small back-end service.
The service should expose a REST API endpoint and extract, transform and load a list of movies received via this endpoint in to Algolia.

Instructions

Expose a REST API endpoint

  • POST /1/load This should accept a body in the following format:
    {
      movieIDs: ["id1", "id2", ...]
    }
    

Retrieve the details of each movie

For each movieID, you will need to enrich it by retrieving all the details from themoviedb.org. You can use the API Key provided with the assignment or sign up for your own.

Transform each object

For each movie that you retrieve from themoviedb, transform (rename keys, combine, etc) it into the following format:

{
    "tmdbID": id,
    "title": "title",
    "description": "description",
    "genres": ["genres1", "genres2",... ],
    "imdbID": "imdb_id",
    "popularity": score,
    "backdropPath": {
        "w300": "https://image.tmdb.org/t/p//t/p/w300/dkokENeY5Ka30BFgWAqk14mbnGs.jpg",
        "w780": "https://image.tmdb.org/t/p//t/p/w780/dkokENeY5Ka30BFgWAqk14mbnGs.jpg",
        "w1280": "https://image.tmdb.org/t/p//t/p/w1280/dkokENeY5Ka30BFgWAqk14mbnGs.jpg",
        "original: "https://image.tmdb.org/t/p/t/p/original/dkokENeY5Ka30BFgWAqk14mbnGs.jpg"
    },
    "posterPath": {
        "w154": "https://image.tmdb.org/t/p//t/p/w154/dkokENeY5Ka30BFgWAqk14mbnGs.jpg",
        "w185": "https://image.tmdb.org/t/p//t/p/w185/dkokENeY5Ka30BFgWAqk14mbnGs.jpg",
        "w500": "https://image.tmdb.org/t/p//t/p/w500/dkokENeY5Ka30BFgWAqk14mbnGs.jpg",
        "w780": "https://image.tmdb.org/t/p//t/p/w780/dkokENeY5Ka30BFgWAqk14mbnGs.jpg",
        "original: "https://image.tmdb.org/t/p/t/p/original/dkokENeY5Ka30BFgWAqk14mbnGs.jpg"
    },    
}
  • tmdbID is the equivalent of id
  • description is the equivalent of overview
  • genres refers to the same key but instead of having an array of (id, genre) we only keep the string genre
  • backdropPath and posterPath: instead of providing only the path, we compute a list of available assets using https://image.tmdb.org/t/p//t/p/ + size + backdrop_path|poster_path
    • sizes for backdropPath : ["w300", "w780", "w1280", "original"]
    • sizes for posterPath : ["w154", "w185", "w500", "w780", "original"]

Index into Algolia

Once transformed, push the new items into an Algolia index.
Review our Quick Start Tutorials for more on how to get started in your preferred language.

Guidelines

  • You can use third party libraries if you know how to re-implement the features they're providing.
  • Language: Python, JavaScript, Java, Ruby, Go
  • Try not to spend more than 5 hours on the assignment
  • We know you will have plenty of ideas. If you are not able to fit all of them in your assignment, list them in the comments / README.

Evaluation Criteria

  • Please push your code to a GitHub repository or send us an archive.
  • Feel free to include a README with instructions on how to get your code up and running as well as whatever information you deem appropriate for us to understand your assignment or thought process.

We'll evaluate:

  • the complexity & scalability of your solution
  • the quality & structure of your code

Good luck!

Appendix

GET https://api.themoviedb.org/3/movie/813258?api_key=API_KEY

{
    "adult": false,
    "backdrop_path": "/qqkpwhiB1BQcSvegL10uHKMzKKl.jpg",
    "belongs_to_collection": null,
    "budget": 0,
    "genres": [
        {
            "id": 16,
            "name": "Animation"
        },
        {
            "id": 35,
            "name": "Comedy"
        },
        {
            "id": 14,
            "name": "Fantasy"
        }
    ],
    "homepage": "",
    "id": 813258,
    "imdb_id": "tt14423802",
    "original_language": "en",
    "original_title": "Monster Pets: A Hotel Transylvania Short",
    "overview": "Drac tries out some new monster pets to help occupy Tinkles for playtime.",
    "popularity": 643.77,
    "poster_path": "/dkokENeY5Ka30BFgWAqk14mbnGs.jpg",
    "production_companies": [
        {
            "id": 5,
            "logo_path": "/71BqEFAF4V3qjjMPCpLuyJFB9A.png",
            "name": "Columbia Pictures",
            "origin_country": "US"
        },
        {
            "id": 2251,
            "logo_path": "/6l16UFSkZ1oPpyBYaILgffFZlTc.png",
            "name": "Sony Pictures Animation",
            "origin_country": "US"
        }
    ],
    "production_countries": [
        {
            "iso_3166_1": "US",
            "name": "United States of America"
        }
    ],
    "release_date": "2021-04-02",
    "revenue": 0,
    "runtime": 6,
    "spoken_languages": [
        {
            "english_name": "English",
            "iso_639_1": "en",
            "name": "English"
        }
    ],
    "status": "Released",
    "tagline": "",
    "title": "Monster Pets: A Hotel Transylvania Short",
    "video": false,
    "vote_average": 7.5,
    "vote_count": 161
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment