diff --git a/stand/adb.py b/stand/adb.py index a8b6b4e..3af8500 100644 --- a/stand/adb.py +++ b/stand/adb.py @@ -34,6 +34,11 @@ class ArcticLibrary: self.set_data(symbol, df) + def append_row(self, symbol, index, entries): + df = pd.DataFrame(entries, index=[index]) + self.append_data(symbol, df) + + def get_data(self, symbol, index=None): if index is not None: index = encode_index(index) diff --git a/stand/api.py b/stand/api.py index badde71..15b4265 100644 --- a/stand/api.py +++ b/stand/api.py @@ -2,7 +2,6 @@ from datetime import datetime from http import HTTPStatus from typing import Any -import pandas as pd from fastapi import APIRouter, HTTPException, Response from state import grids, adb @@ -46,8 +45,7 @@ def append_run(beamline: Beamline, pgroup: PGroup, run: int, entries: dict[str, timestamp = datetime.fromisoformat(timestamp) if timestamp else datetime.now() entries = {"timestamp": timestamp, **entries} # setdefault would not force timestamp to be the first column - df = pd.DataFrame(entries, index=[run]) - lib.append_data(pgroup, df) + lib.append_row(pgroup, run, entries) entries = {"run": run, **entries} # setdefault would not force run to be the first column