From ec55edd0e1a4326fbef96641a67392c166619efe Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Sat, 6 Jun 2026 12:00:15 +0200 Subject: [PATCH] added append_row --- stand/adb.py | 5 +++++ stand/api.py | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) 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