Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: more robust handling of InterVar result #362

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading