Code Monkey home page Code Monkey logo

experiment-server's People

Contributors

antero71 avatar darktan avatar ffagerho avatar satukark avatar wakr avatar

Watchers

 avatar  avatar  avatar

experiment-server's Issues

API refactoring

More simple and clear API. API should be able to give some guidelines on how data is arranged in the application.

Refactor UI

At least following issues

  • configure application
  • front-end speed up

Application UUID

Application gets UUID, and can be identified by it. Clients can use UUID to specify their application.

/applications/{appid}/experiments/{expid}/metadata returns 500

Swagger API version 2.0.1 returns 500 with correct values to the address in the topic. For some reason the error message contains the data which was requested. Swagger is fun.

{
  "title": "Internal Server Error",
  "code": "500 Internal Server Error",
  "message": "The server has either erred or is incapable of performing the requested operation.\n\n\nResponse body should be empty: {\"data\": {\"endDatetime\": \"2017-11-10 14:11:09\", \"application_id\": 1, \"totalDataitems\": 0, \"experimentgroups\": [{\"configurations\": [{\"key\": \"highScore\", \"value\": true, \"id\": 1, \"experimentgroup_id\": 1}], \"clients\": 0, \"experiment_id\": 1, \"id\": 1, \"name\": \"High score ON\"}, {\"configurations\": [{\"key\": \"highScore\", \"value\": false, \"id\": 2, \"experimentgroup_id\": 2}], \"clients\": 0, \"experiment_id\": 1, \"id\": 2, \"name\": \"High score OFF\"}], \"status\": \"running\", \"startDatetime\": \"2016-11-10 14:11:09\", \"name\": \"High score\", \"id\": 1}}\n\n"
}

AttributeError: 'Request' object has no attribute 'swagger_data'

2016-11-16T13:57:46.813518+00:00 app[web.1]:     app_id = self.request.swagger_data['appid']
2016-11-16T13:57:46.813524+00:00 app[web.1]: AttributeError: 'Request' object has no attribute 'swagger_data'

Does anyone know what's going on?

This works

    @view_config(route_name='configurationkeys_for_app', request_method="GET")
    def configurationkeys_GET(self):
        """ List all configurationkeys with GET method """
        app_id = self.request.swagger_data['id']
        if Application.get(app_id) is None:
            print_log(datetime.datetime.now(), 'GET', '/applications/%s/configurationkeys'\
                % app_id, 'Get configurationkeys', 'Failed')
            return self.createResponse(None, 400)
        app_conf_keys = ConfigurationKey.query().join(Application).filter(Application.id == app_id)
        return list(map(lambda _: _.as_dict(), app_conf_keys))

And this doesn't

    @view_config(route_name='configurationkey', request_method="GET")
    def configurationkeys_GET_one(self):
        """ Find and return one configurationkey by id with GET method """
        app_id = self.request.swagger_data['appid']
        confkey_id = self.request.swagger_data['ckid']
        confkey = get_conf_key_by_appid_and_ckid(app_id, confkey_id)
        if confkey is None:
            print_log(datetime.datetime.now(), 'GET',\
                '/applications/%s/configurationkeys/' % app_id
                + str(confkey_id), 'Get one configurationkey', 'Failed')
            return self.createResponse(None, 400)
        return confkey.as_dict()

Added routes are:

    config.add_route('configurationkeys_for_app', '/applications/{id}/configurationkeys')
    config.add_route('configurationkey', '/applications/{appid}/configurationkeys/{ckid}')

Clients' API refactoring

Client only sends post requests to

  • /configurations
  • Requires Application UUID
  • If such Client does not exist, one will be created
  • Client recives configurations from backend
  • /events
  • Client sends research data to this address

Delete db.py

In comments: "WARNING: This is a deprecated class and should be removed ASAP"

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.