mirror of
https://github.com/kuhyx/ARAI.git
synced 2026-07-04 15:43:12 +02:00
Update code with data samples
This commit is contained in:
parent
bb590d1a8f
commit
c4d363c333
@ -3,23 +3,9 @@ from flask import Flask, jsonify, request
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route("/", methods=['POST'])
|
@app.route("/", methods=['POST'])
|
||||||
def statistics_output():
|
|
||||||
data = request.get_json()
|
|
||||||
cost_of_trial = data.get('response_data', {}).get('cost_of_trial')
|
|
||||||
time_of_trial = data.get('response_data', {}).get('time_of_trial')
|
|
||||||
|
|
||||||
response = {
|
|
||||||
"response_type": "statics_output",
|
|
||||||
"response_data": {
|
|
||||||
"cost_of_trial": cost_of_trial, # cena w PLN (integer)
|
|
||||||
"time_of_trial": time_of_trial # czas w formacie UTC (unix time stamp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
def recommended_mediators():
|
def recommended_mediators():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
|
|
||||||
request_type = data.get('request_type', {}).get('request_type')
|
request_type = data.get('request_type', {}).get('request_type')
|
||||||
request_data = data.get('request_data', {}).get('experts_called')
|
request_data = data.get('request_data', {}).get('experts_called')
|
||||||
generic_input = data.get('generic_input', {}).get('generic_input')
|
generic_input = data.get('generic_input', {}).get('generic_input')
|
||||||
@ -28,24 +14,36 @@ def recommended_mediators():
|
|||||||
experts_called = data.get('experts_called', {}).get('experts_called')
|
experts_called = data.get('experts_called', {}).get('experts_called')
|
||||||
witnesses_called = data.get('witnesses_called', {}).get('witnesses_called')
|
witnesses_called = data.get('witnesses_called', {}).get('witnesses_called')
|
||||||
|
|
||||||
top_5 = {}
|
top_5 = {
|
||||||
list_of_mediators = []
|
|
||||||
|
|
||||||
for i in range(5):
|
|
||||||
mediator = {}
|
|
||||||
top_5.add(mediator)
|
|
||||||
|
|
||||||
response = {
|
|
||||||
"response_type": "recommended_mediators",
|
"response_type": "recommended_mediators",
|
||||||
"response_data": {
|
"response_data": [{
|
||||||
"name": name,
|
"cost_of_trial": 5000,
|
||||||
"specialization": specialization,
|
"time_of_trial": 70
|
||||||
|
}, [{
|
||||||
|
"name": "Mateusz Szpyruk",
|
||||||
|
"specialization": "Prawo podatkowe",
|
||||||
"localization": localization,
|
"localization": localization,
|
||||||
"score": score,
|
"ai_rating": 99,
|
||||||
"number_of_opinions": number_of_opinions
|
"user_rating": 99,
|
||||||
}
|
"number_of_opinions": 5
|
||||||
|
}, {
|
||||||
|
"name": "Jan Kowalski",
|
||||||
|
"specialization": "Prawo pracy",
|
||||||
|
"localization": localization,
|
||||||
|
"ai_rating": 90,
|
||||||
|
"user_rating": 99,
|
||||||
|
"number_of_opinions": 5
|
||||||
|
}, {
|
||||||
|
"name": "Jan Kowalski",
|
||||||
|
"specialization": "Prawo pracy",
|
||||||
|
"localization": localization,
|
||||||
|
"ai_rating": 90,
|
||||||
|
"user_rating": 99,
|
||||||
|
"number_of_opinions": 5
|
||||||
|
}]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return jsonify(top_5)
|
return jsonify(top_5)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user