Skip to content
Snippets Groups Projects
Commit c4c4855d authored by Cain, Payton David's avatar Cain, Payton David
Browse files

response NaNs as null

parent 66f1bf34
No related branches found
No related tags found
3 merge requests!166Merge branch master into production,!158Merge branch 'master' into 'production',!148Scale value error
from os import name
import json
from fastapi import APIRouter, Depends, HTTPException
from starlette.responses import Response
from ... import TimeseriesFactory
from ...algorithm import DbDtAlgorithm
from ...residual import (
calculate,
......@@ -44,6 +44,9 @@ def get_dbdt(
)
def calculate_residual(reading: Reading, adjust_reference: bool = True):
try:
return calculate(reading=reading, adjust_reference=adjust_reference)
calculated = calculate(
reading=reading, adjust_reference=adjust_reference
).json()
return json.loads(calculated.replace("NaN", "null"))
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
from typing import Optional
from .Measurement import Measurement
from pydantic import BaseModel
......@@ -14,4 +13,4 @@ class Diagnostics(BaseModel):
"""
inclination: float
meridian: float
meridian: Optional[float] = None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment