Git Product home page Git Product logo

adopter-statistics-server's Introduction

Adopter Statistics

This is a Flask server that is build to collect, store and administrate statistics reports and error events from opencast instances (adopters). In future opencast versions the admin will be asked to register the instance and allow sending error reports and monthly statistics reports.

Installation Guide

  • Clone Repository:
git clone https://github.com/opencast/adopter-statistics-server.git
cd adopter-statistics-server
  • Create virtual enviroment:
python3 -m venv venv

// on Windows:
py -3 -m venv venv
  • Activate the environment:
. venv/bin/activate

// on Windows:
venv\Scripts\activate
  • Install requirements:
// NOTE: within the virtual environment 'pip' should automatically be version 3.x - use pip3 if it isn't
pip install -r requirements.txt
  • Configure TODOs in config.py (if you want to run it in production)
  • Run app:
// ignore following line if running in production
export FLASK_ENV=development

flask run
// if you run into ModuleNotFound-Error try using
venv/bin/flask run

User model / security:

To ensure security there is a role based user model implemented. Before handling the first request this app will create the database, create the roles "readonly" and "superuser" and will create the default superuser defined in config.py (default: Email: "admin", "Password": "admin"). This default admin should be configured with a strong password or be deleted after another superuser was created.

To access the admin page you need to create an account. The created user will not have any permissions. A superuser needs to edit and add a role to your user profile.

Roles:

  • readonly: Can see Adopter, Error Event and Statistics Report tables
  • superuser: readonly + can edit and delete entries and read/edit/delete users

Api

Authentication

Use BasicAuth for authentication.

Adopter

Method Endpoint Description Auth Query param
POST /api/1.0/adopter Create Adopter [everybody]
GET /api/1.0/adopter Query all Adopters [readonly/superuser] __limit & __offset
GET /api/1.0/adopter/<adopter_key> Query adopter by adopter_key [everybody]
PUT /api/1.0/adopter/<adopter_key> Edit adopter [everybody]

Example:

{
	"adopter_key": "C2B1262C424F905466FBCF2ACA1148CF",
	"organisation_name": "Example University",
	"department_name": "Mathematics and Computer Science",
	"gender": null,
	"first_name": null,
	"last_name": null,
	"mail": null,
	"country": "GER",
	"postal_code": "12345",
	"city": "Exampletown",
	"street": "Main Street",
	"street_no": "1A",
	"address_additional": null,
	"contact_me": false,
	"allows_statistics": true,
	"allows_error_reports": true,
	"allows_tech_data": true
}

Statistics Report

Method Endpoint Description Auth Query param
POST /api/1.0/statistics_report Create statistics report (adopter_key needed) [everybody]
GET /api/1.0/statistics_report Query all statistic reports [readonly/superuser] __limit & __offset
GET /api/1.0/statistics_report/<id> Query statistic report by id [readonly/superuser]
GET /api/1.0/adopter/<adopter_key>/statistics_report Query statistics reports from adopter [everybody] __limit & __offset

Example:

{
	"from_date": "2019-01-01",
	"to_date": "2019-01-31",
	"opencast_version": "6.0.0",
	"adopter_key": "C2B1262C424F905466FBCF2ACA1148CF"
}

Error Event

Method Endpoint Description Auth Query param
POST /api/1.0/error_event Create error event (adopter_key needed) [everybody]
GET /api/1.0/error_event Query all error events [readonly/superuser] __limit & __offset
GET /api/1.0/error_event/<id> Query error event by id [readonly/superuser]
GET /api/1.0/adopter/<adopter_key>/error_event Query error events from adopter [everybody] __limit & __offset

Example:

{
	"timestamp": "2019-02-24T12:34:56+0100",
	"adopter_key": "C2B1262C424F905466FBCF2ACA1148CF",
	"error_type": "Runtime Exception",
	"data": "{'some': 'json_data'}",
	"opencast_version": "6.0.0"
}

adopter-statistics-server's People

Contributors

edmundodelgusto avatar lkiesow avatar renovate-bot avatar

Watchers

 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.