Coder Social home page Coder Social logo

trends.earth-api's Introduction

GEF API

This project belongs to the GEF Project.

This repo implements the API of the GEF Environment. It implements the Scripts, Users and Executions management.

Check out the other parts of the GEF project:

  • The Command Line Interface. It allows to create and test custom scripts locally. It also can be used to publish the scripts to the GEF Environment GEF CLI
  • The GEF core platform GEF Environment
  • A web app to explore and manage the API entities GEF UI

Getting started

Requirements

You need to install Docker in your machine if you haven't already Docker

Technology

  • Docker is used in development and production environment
  • The API is coded in Python 3.6
  • It uses Flask to expose the API Endpoints and handle the HTTP requests
  • It also uses SQLAlchemy as ORM (PostgreSQL)
  • Celery is used to manage the background tasks (Redis)
  • In production mode, the API will be deployed using Gunicorn

Development

Setup

Follow the next steps to set up the development environment in your machine.

  1. Clone the repo and navigate to the folder
git clone https://github.com/Vizzuality/GEF-API
cd GEF-API
  1. Run the gefapi.sh shell script in development mode.
./gefapi.sh develop

If this is the first time you run it, it may take a few minutes.

Code structure

The API has been packed in a Python module (gefapi). It creates and exposes a WSGI application. The core functionality has been divided in three different layers or submodules (Routes, Services and Models).

There are also some generic submodules that manage the request validations, HTTP errors and the background tasks manager.

Entities Overview

Script

id: <UUID>
name: <String>
slug: <String>, unique
created_at: <Date>
user_id: <UUID>
status: <String>
logs: <- [ScriptLog]
executions: <- [Execution]

Execution

id: <UUID>
start_date: <Date>
end_date: <Date>
status: <String>
progress: <Integer>
params: <Dict>
results: <Dict>
logs: <- [ExecutionLog]
script_id: <- Script

User

id: <UUID>
created_at: <Date>
email: <String>, unique
password: <String>, encrypted
role: <String>
scripts: <- [Script]

API Endpoints

Script

GET: /api/v1/script
GET: /api/v1/script/<script>
POST: /api/v1/script
PATCH: /api/v1/script/<script>
DELETE: /api/v1/script/<script>
GET: /api/v1/script/<script>/log

Execution

GET: /api/v1/script/<script>/run
GET: /api/v1/execution
GET: /api/v1/execution/<execution>
PATCH: /api/v1/execution/<execution>
GET: /api/v1/execution/<execution>/log
POST: /api/v1/execution/<execution>/log

User

GET: /api/v1/user
GET: /api/v1/user/<user>
GET: /api/v1/user/me
POST: /api/v1/user
PATCH: /api/v1/user/<user>
DELETE: /api/v1/user/<user>
POST: /api/v1/user/<user>/recover-password

Auth

POST: /auth

trends.earth-api's People

Contributors

archelogos avatar rrequero avatar azvoleff avatar erick-otenyo avatar

Watchers

James Cloos avatar  avatar

Forkers

trellixvulnteam

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.