Challenge Overview
Challenge Objectives
-
Python Rest API development using Flask framework - refactor existing codebase
NOTE: The review/appeals timeline is shorter than usual - pay attention to the deadlines
Project Background
-
Our client has developed a specific method of calculating and visualizing various rock properties like Compressional velocity (Vc), Shear velocity (Vs), Young’s Modulus (E), Shear Modulus, Bulk Modulus (K), Poisson’s Ratio (PR), P-wave Modulus and Lambda.
-
All the calculations are currently in an Excel workbook - our goal is to create an API to process the data, i.e. move the calculations from Excel into the codebase.
-
In this challenge, we’ll refactor the api endpoints and remove all database related features
Technology Stack
-
Python 3
-
Flask
-
Flask-Restplus
Code access
The base code is available in the forums.
Individual requirements
-
Remove all database related features
Goal here is to make the calculations backend stateles, ie remove all the db related features - importing data, updates, searching, etc. Remove all the db models and all api endpoints except for one POST /calculation endpoint (that is the current POST /data endpoint) that takes the input parameters, calculates and returns both the inputs and outputs (keep same request response format). Update RestPlus models and test suite. -
Export endpoint
We still need to keep the export functionality, but instead of exporting the las file by data ID, the export feature should be added to the /calculation endpoint - it should read the "Accepts" header and return either json data (default), or the updated las file (accepts="text/las").
General requirements
-
Unit tests are required for all endpoints.
-
All endpoints should be annotated with Swagger annotations and swagger UI should be served by the API.
-
All endpoint routes should be prefixed with “API_NAME_”
-
All configuration parameters should be extracted to a common settings module. All environment variables have to be prefixed with “API_NAME_”
-
Please make sure your code is well-documented. Use the following style guides Google Python Style Guide, Python Style Guide, and Docstring Conventions. Code linter is required. Please make sure it is well-engineered but not over-engineered (YAGNI and KISS) solution. We're looking for well-structured and tested code. Well-structured code follows good design principles like the SOLID principles and well-tested code has comprehensive unit tests.
-
The code should be implemented using Python3 only.
-
Use matrix operations with numpy/pandas where possible