Skip to content

Commit

Permalink
fix: more robust handling of InterVar result (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Jan 3, 2024
1 parent 86510e8 commit 25c825f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/app/api/internal/endpoints/remote.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Reverse proxies to external/remote services."""

import json

import httpx
from fastapi import APIRouter, BackgroundTasks, Request, Response
from fastapi.responses import JSONResponse, StreamingResponse
Expand Down Expand Up @@ -135,8 +137,13 @@ async def acmg(request: Request):
if backend_resp.status_code != 200:
return Response(status_code=backend_resp.status_code, content=backend_resp.content)

try:
backend_json = backend_resp.json()
except json.JSONDecodeError:
return Response(status_code=500, content="Invalid response from InterVar backend")

acmg_rating = default_acmg_rating()
for key, value in backend_resp.json().items():
for key, value in backend_json.items():
if key.lower() in acmg_rating:
acmg_rating[key.lower()] = value == 1
return JSONResponse(acmg_rating)
Expand Down

0 comments on commit 25c825f

Please sign in to comment.