mirror of
https://github.com/kuhyx/ARAI.git
synced 2026-07-04 10:03:44 +02:00
Update
This commit is contained in:
parent
97cde5040c
commit
4d942c0f21
@ -1,5 +1,9 @@
|
||||
from flask import Flask, request, jsonify
|
||||
from flask_cors import CORS, cross_origin
|
||||
import pathlib
|
||||
import sys
|
||||
import pandas as pd
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
cors = CORS(app)
|
||||
@ -11,7 +15,9 @@ def recommended_mediators():
|
||||
data = request.get_json()
|
||||
|
||||
input = data.get('request_data', {})
|
||||
# print(input.get("location"))
|
||||
|
||||
tmp = os.system('python3 ..\statystyki\load_data.py -t 1 -k 25000 -b True')
|
||||
print(tmp)
|
||||
|
||||
top_5 = {
|
||||
"response_type": "recommended_mediators",
|
||||
@ -39,11 +45,10 @@ def recommended_mediators():
|
||||
"ai_rating": 90,
|
||||
"user_rating": 99,
|
||||
"number_of_opinions": 5
|
||||
}]]
|
||||
}], tmp]
|
||||
}
|
||||
|
||||
|
||||
return jsonify(top_5)
|
||||
return jsonify(tmp)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
@ -20,7 +20,7 @@ def calc_stats(typ=TYP,KWOTA=KWOTA,BIEGLY = BIEGLY):
|
||||
koszt_bieglego= 1789.42
|
||||
koszt = 0
|
||||
if KWOTA < 100000 and typ != '4':
|
||||
df = pd.read_excel('dane.xlsx',sheet_name='rejon')
|
||||
df = pd.read_excel('..\statystyki\dane.xlsx',sheet_name='rejon')
|
||||
mask = df['RODZAJ'] == int(typ)
|
||||
liczba_miesiecy = df[mask]['mean']
|
||||
procent = (1 - df[mask]['procent do 12 miesięcy']) * 100
|
||||
@ -64,7 +64,7 @@ def calc_stats(typ=TYP,KWOTA=KWOTA,BIEGLY = BIEGLY):
|
||||
print(f"Średni czas trwania rozprawy typu {mapka[typ]} wynosi {round(liczba_miesiecy,0).to_string(index=False)} miesięcy, a {procent.to_string(index=False)}% spraw trwa dłuzej niz rok, jej minimalny koszt wyniesie {koszt}")
|
||||
|
||||
elif KWOTA > 100000:
|
||||
df = pd.read_excel('dane.xlsx',sheet_name='okreg')
|
||||
df = pd.read_excel('..\statystyki\dane.xlsx',sheet_name='okreg')
|
||||
mask = df['RODZAJ'] == int(typ)
|
||||
liczba_miesiecy = df[mask]['mean']
|
||||
procent = (1 - df[mask]['procent do 12 miesięcy']) * 100
|
||||
@ -87,6 +87,9 @@ def calc_stats(typ=TYP,KWOTA=KWOTA,BIEGLY = BIEGLY):
|
||||
else:
|
||||
koszt = koszt_sadu + koszt_adwokata
|
||||
|
||||
print(f"Średni czas trwania rozprawy typu {mapka[TYP]} wynosi {round(liczba_miesiecy,0).to_string(index=False)} miesięcy, a {procent.to_string(index=False)}% spraw trwa krócej niz rok, a jej minimalny koszt wynosi {koszt}")
|
||||
return_string = f"Średni czas trwania rozprawy typu {mapka[TYP]} wynosi {round(liczba_miesiecy,0).to_string(index=False)} miesięcy, a {procent.to_string(index=False)}% spraw trwa krócej niz rok, a jej minimalny koszt wynosi {koszt}"
|
||||
print(return_string)
|
||||
|
||||
return return_string
|
||||
|
||||
calc_stats()
|
||||
Loading…
Reference in New Issue
Block a user