lib is not part of state
This commit is contained in:
+2
-2
@@ -4,7 +4,7 @@ from typing import Any
|
||||
import pandas as pd
|
||||
from fastapi import APIRouter
|
||||
|
||||
from state import grids, lib
|
||||
from state import grids, adb
|
||||
from utils.annotations import PGroup
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ def append(pgroup: PGroup, row: dict[str, Any]):
|
||||
now = datetime.now()
|
||||
|
||||
df = pd.DataFrame(row, index=[now])
|
||||
lib.append(pgroup, df)
|
||||
adb.get("stand").append(pgroup, df)
|
||||
|
||||
now = str(now) # nicegui converts datetime to str
|
||||
row = {"index": now, **row} # setdefault would not force index to be the first column
|
||||
|
||||
@@ -7,7 +7,6 @@ from utils.registry import Registry
|
||||
|
||||
|
||||
adb = ArcticDB("lmdb://adb")
|
||||
lib = adb.get("stand")
|
||||
|
||||
|
||||
config = Config(
|
||||
|
||||
+5
-4
@@ -1,12 +1,12 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
import arcticdb as adb
|
||||
import arcticdb
|
||||
import pandas as pd
|
||||
from nicegui import APIRouter, app, ui
|
||||
|
||||
from aggridx import aggridx
|
||||
from state import grids, lib
|
||||
from state import grids, adb
|
||||
from utils.annotations import PGroup
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ def table_show(pgroup):
|
||||
# btn = ui.button(icon="sym_o_left_panel_open", on_click=cb).props("flat dense")
|
||||
|
||||
try:
|
||||
df = lib.read(pgroup).data
|
||||
except adb.exceptions.NoSuchVersionException:
|
||||
df = adb.get("stand").read(pgroup).data
|
||||
except arcticdb.exceptions.NoSuchVersionException:
|
||||
df = pd.DataFrame()
|
||||
|
||||
df = df.reset_index()
|
||||
@@ -85,6 +85,7 @@ def update_adb(evt):
|
||||
new_val = evt.args["newValue"]
|
||||
|
||||
index = datetime.fromisoformat(row_id) # nicegui converts datetime to str
|
||||
lib = adb.get("stand")
|
||||
df = lib.read(pgroup, date_range=[index]).data
|
||||
df.at[index, col_id] = new_val
|
||||
lib.update(pgroup, df)
|
||||
|
||||
Reference in New Issue
Block a user