Giter Club home page Giter Club logo

apollo-xml-converter's Introduction

Apollo Back-End Engineering Challenge

This challenge is designed to evaluate several things:

  • How well you know Python
  • How effectively you can work with the Django framework
  • How well you understand different data serialization formats, which is important for working with the diverse APIs Apollo integrates with
  • How well you handle data validation and exception handling
  • Your ability to work with connected Django pages
  • Your ability to work with Django Rest Framework

It is intended to take 2-4 hours. After you submit your solution (either by emailing us a .tar or .zip file, or uploading to GitHub), we will schedule a call to talk through your solution and how it could be extended to accomplish further goals.

Setting Up

Install Python 3.7 or later if it is not already installed. Then, set up and enter a virtual environment and run pip install -r requirements.txt to install the dependencies. You should then be able to run the project from the exercise directory by running python manage.py runserver.

To verify that the server is running correctly, visit http:127.0.0.1:8000 in your browser.

Challenge Guidelines

This Django project consists of two parts:

  1. A very simple HTML page at /connected/.
  2. A stubbed out API endpoint at /api/converter/convert/

Your tasks are to:

  1. Add a file input to the HTML page and modify the view so that, when a file is submitted, convert it to JSON and return that to the user
  2. Add the same functionality to the API endpoint, returning the converted JSON as an application/json response.

To test your solution, you can run python manage.py test. This will execute 3 tests, which attempt to submit a file and check the response.

A good solution will not only pass the tests, but also work on any user-submitted XML file. Furthermore, a good solution should never return a 500 error and should show an error message to the user if they upload an invalid XML file.

JSON Conversion

For the purposes of this exercise, you may ignore any XML attributes. We are only interested in converting the XML node tags and any text values into JSON.

Leaf nodes should be converted into a JSON object with the node tag as the key and the node's text value as the value. For example, <Foo>Bar</Foo> should be converted to {"Foo": "Bar"}.

Non-leaf nodes should be converted into a JSON object with the node name as the key and an array of the node's children as the value. For example:

<Foo>
    <Bar>Baz</Bar>
</Foo>

should be converted to

{
    "Foo": [
        {"Bar": "Baz"}
    ]
}

The tests provide additional examples of more complex conversions.

apollo-xml-converter's People

Contributors

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