Giter Site home page Giter Site logo

onlyphantom / revconnexion Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 539 KB

RevConnextion is a RESTful API application built on top of Connexion and can be used as a standalone post-workshop survey system

License: Apache License 2.0

Python 28.16% HTML 23.80% CSS 6.38% JavaScript 41.66%
connexion rest-api restful-api workshop openapi swagger

revconnexion's Introduction

RevConnexion

Project Description

RevConnextion is a RESTful API application built on top of Connexion and can be used as a standalone post-workshop survey system. It is part of the Pedagogy Framework, which at this point consist of:

Both of these apps can be used together, as they share the same database schema and common elements of system design.

The Pedagogy Framework

The Pedagogy Framework is an undertaking to transform the way education professionals conduct high-stakes, high-performance education courses (for brevity, we call them "workshops"). A quick survey of the current landscape in workshop design and execution will point to workshops falling into one of 3 categories. Some overlapse may occur, but broadly speaking, workshops design will inherit one of the following system:

  1. System-less: Workshops conducted in an ad-hoc fashion, typically by hobbyist and involving heavy use of guest speakers. A Google Form or paper form is handed out to survey the general satisfaction of the course at the end.
  2. Professionals: Workshops conducted by folks whom main business is education. Use of guest speakers are still common, but may feature permanent, full-time instructors. Surveys are collected on a per-workshop basis.
  3. Institutional: Workshops conducted by education enterprises, where success is measured on a per-workshop level as well as on an institutional level. Typically feature a roster of permanent instructors. Surveys are persisted permanently to serve as a yardstick against which performance standards are set.

Each system brings with it an extra level of rigor, and shift the emphasis toward long-term performance gains in the classroom.

In Algoritma, we develop intensive short courses and bootcamp-length courses. The tools we developed brings a high degree of automation to various functions of effective workshop design:

  • Survey creation and collection
  • Performance measurement
  • Instructor analytics
  • Organizational analytics
  • Text and sentiment analysis
  • Automated reporting
  • Persistent data storage

The tools are suited for anyone conducting workshops and educational courses but especially effective for system (3).

About Connexion

Swagger/OpenAPI First framework for Python on top of Flask with automatic endpoint validation & OAuth2 support. Connexion is a framework that automagically handles HTTP requests based on OpenAPI Specification (formerly known as Swagger Spec) of your API described in YAML format

Getting Started

Prerequisites

Python 3.6, Connexion and Flask

Python 3.6 is required because of the f-strings (formatted string literals, PEP 498). The more widespread .format() can be used as the drop-in replacement, in which case Python 3.4+ will be fully compatible.

A built-in sqlite database is provided for demo purposes.

Setting up: Installation of Packages

Method 1: Install from requirements.txt

Activate your virtual environment, then:

pip install -r requirements.txt

Method 2: Manual Installation

Manually install Flask and Connexion:

pip install flask
pip install connexion

Running the app

Starting the app is as simple as:

python3 app.py

Fire up a browser and point to http://0.0.0.0:5000/ for the single-page application (SPA) UI.

Navigate to http://0.0.0.0:5000/api/ui and you'll be greeted with the Swagger UI screen:

Using the app

  • A GET HTTP method on /reviews is implemented, as shown in the Swagger UI. Clicking on Try it out! will show the CURL as well as the Request URL methods. In your terminal, copy and paste the curl command or use the HTTP method. Try and use the length and offset query parameters. The GET method on http://0.0.0.0:5000/api/reviews?length=4&offset=1 returns:
[
  {
    "assistants_score": 5,
    "comments": "Fantastic materials and a lot of depth",
    "difficulty": 4,
    "id": 99,
    "knowledge": 5,
    "objectives": 5,
    "satisfaction_score": 4,
    "timeliness": 3,
    "venue_score": 4,
    "workshop_id": 15
  },
  {
    "assistants_score": 5,
    "comments": "start at 19:00",
    "difficulty": 4,
    "id": 98,
    "knowledge": 5,
    "objectives": 4,
    "satisfaction_score": 4,
    "timeliness": 3,
    "venue_score": 4,
    "workshop_id": 15
  },
  {
    "assistants_score": 4,
    "comments": "i'm not a fast typer",
    "difficulty": 3,
    "id": 97,
    "knowledge": 4,
    "objectives": 4,
    "satisfaction_score": 4,
    "timeliness": 3,
    "venue_score": 4,
    "workshop_id": 15
  }
]
{
  "assistants_score": 5,
  "comments": "Love the attention to details.",
  "difficulty": 4,
  "id": 101,
  "knowledge": 5,
  "objectives": 5,
  "satisfaction_score": 4,
  "timeliness": 4,
  "venue_score": 4,
  "workshop_id": 115
}
  • Try the POST method for /reviews on Swagger UI.

  • Notice that entering a review with an id value that already exist will return a 406 error (implemented in reviews.py) and an invalid JSON (try missing out the comma, or any schema error) will raise a failed validation error and abort.

  • Use the DELETE method. Confirm that review id 101 currently exist on http://0.0.0.0:5000/api/reviews/101. Set the value for id to 101 in the DELETE method and verify that the review no longer exist. Use the GET method to get all reviews and viola! The review deleted is nowhere to be found.

  • Follow the 6-step process on the homepage (http://0.0.0.0:5000/) to see the SPA (single page application) in action.

Learning References

  1. Learn by tweaking things and see the changes. Start renaming the operationId in swagger.yml and then the corresponding function name. Next, look into the GET parameters and change the query from a path-based one to a query-based (or vice-versa). Refer to the official documentation for the parameters.

  2. Doug Farrell's article on Real Python is a great tutorial.

  3. Meet up! Stay in touch with me or my team at Algoritma and look out for upcoming events - join us in our community meetups or workshops where we discuss all things Python and R.

revconnexion's People

Contributors

onlyphantom avatar

Stargazers

 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.