Ejemplo n.º 1
0
def createRondo(project_id):
    json = request.get_json()
    json.pop('project_id', None)
    json.pop('_project_id', None)
    _id = json.get("_id")
    if _id:
        rondo = Rondo.get(project_id=project_id, id=_id)
        rondo.update(**json)
    else:
        rondo = Rondo(project_id=project_id, **json)
        rondo.save()
    return jsn(rondo._json)
Ejemplo n.º 2
0
    def adjust_headers(*args, **kwargs):
        if request.method == 'OPTIONS':
            response = jsn({'message': 'options'})
        else:
            response = f(*args, **kwargs)
        if app.config['CORS']:
            response.headers["Access-Control-Allow-Origin"] = '*'
            response.headers[
                "Access-Control-Allow-Headers"] = "Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, \
                Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Origin"

            response.headers[
                "Access-Control-Allow-Methods"] = 'GET,HEAD,OPTIONS,POST,PUT'
            response.headers["Access-Control-Allow-Credentials"] = "true"
            response.headers['X-Application-Context'] = 'application'
        return response
Ejemplo n.º 3
0
def flowfile(project_id, rondo_id):
    """
    endpoint used for nifi processor. It accepts patient json,
    and returns modified json as the flow file.
    """
    json = request.get_json()
    json.pop('project_id', None)
    json.pop('_project_id', None)
    patient = Patient.create(_project_id=project_id, **json)
    rondo = Rondo.get(project_id=project_id, id=rondo_id)
    if rondo.random:
        rondo.allocate_random_cohort(patient, force=True)
        if patient.cohort:
            json["cohort"] = patient.cohort
        if patient.pair_id:
            json["pair_id"] = patient.pair_id
    else:
        rondo.match_patient(patient)
        if patient.cohort:
            json['cohort'] = patient.cohort
    return jsn(json)
Ejemplo n.º 4
0
def getSchema(project_id):
    response = omop.get_schema(project_id)
    if 'tables' in response:
        return jsn({"tables": response['tables']})
    else:
        return jsn(response)
Ejemplo n.º 5
0
def getRondo(project_id, config_id):
    rondo = Rondo.get(project_id=project_id, id=config_id, json=True)
    return jsn(rondo)
Ejemplo n.º 6
0
def all(project_id):
    rondo = Rondo.all(project_id=project_id, json=True)
    return jsn(rondo)
Ejemplo n.º 7
0
def index():
    return jsn({'message': 'Hello World!, welcome to Rondo'})
Ejemplo n.º 8
0
def test():
    return jsn({'message': 'Hello World!, welcome to Rondo test'})