|
|
|
@@ -17,6 +17,7 @@ from tempfile import NamedTemporaryFile |
|
|
|
from typing import Callable |
|
|
|
import base64 |
|
|
|
from datetime import datetime, timedelta |
|
|
|
import csv |
|
|
|
|
|
|
|
from api_utils import api_utils, coerce_methods |
|
|
|
from collections import OrderedDict |
|
|
|
@@ -191,6 +192,31 @@ async def get_documentation(): |
|
|
|
return get_swagger_ui_html(openapi_url="/openapi.json", title="docs") |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/ble-ai/infer", tags=["BLE-AI"]) |
|
|
|
async def get_ble_ai_infer(): |
|
|
|
path = config_env.BLE_AI_INFER_CSV |
|
|
|
if not os.path.isfile(path): |
|
|
|
raise HTTPException(status_code=404, detail="CSV not found") |
|
|
|
|
|
|
|
items = [] |
|
|
|
with open(path, newline="") as f: |
|
|
|
reader = csv.DictReader(f, delimiter=";") |
|
|
|
for row in reader: |
|
|
|
try: |
|
|
|
items.append( |
|
|
|
{ |
|
|
|
"mac": row.get("mac"), |
|
|
|
"z": int(row["z"]) if row.get("z") not in (None, "") else None, |
|
|
|
"x": int(row["x"]) if row.get("x") not in (None, "") else None, |
|
|
|
"y": int(row["y"]) if row.get("y") not in (None, "") else None, |
|
|
|
} |
|
|
|
) |
|
|
|
except (KeyError, ValueError): |
|
|
|
continue |
|
|
|
|
|
|
|
return {"items": items, "count": len(items)} |
|
|
|
|
|
|
|
|
|
|
|
@app.post("/majortel/call/", tags=["Majortel"]) |
|
|
|
async def route_call(active_user=Depends(manager),callerNumber=None, calledNumber=None): |
|
|
|
try: |
|
|
|
|