renamed: row -> entries
This commit is contained in:
+3
-3
@@ -27,16 +27,16 @@ def clear_pgroup(beamline: Beamline, pgroup: PGroup):
|
||||
|
||||
|
||||
@router.post("/pgroups/{pgroup}/runs/{run}")
|
||||
def append_run(beamline: Beamline, pgroup: PGroup, run: int, row: dict[str, Any]):
|
||||
def append_run(beamline: Beamline, pgroup: PGroup, run: int, entries: dict[str, Any]):
|
||||
lib = adb.get(beamline)
|
||||
|
||||
run_exists = lib.has_index(pgroup, run)
|
||||
if run_exists:
|
||||
raise HTTPException(HTTPStatus.CONFLICT, f"run {run} exists already in {beamline}/{pgroup}")
|
||||
|
||||
timestamp = row.pop("timestamp", None)
|
||||
timestamp = entries.pop("timestamp", None)
|
||||
timestamp = datetime.fromisoformat(timestamp) if timestamp else datetime.now()
|
||||
row = {"timestamp": timestamp, **row} # setdefault would not force timestamp to be the first column
|
||||
row = {"timestamp": timestamp, **entries} # setdefault would not force timestamp to be the first column
|
||||
|
||||
df = pd.DataFrame(row, index=[run])
|
||||
lib.append_data(pgroup, df)
|
||||
|
||||
Reference in New Issue
Block a user