|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Functions | |
| list[str] | _parse_components (str|None components) |
| str | _time_source (str value) |
| api_runs () | |
| api_set_description (str run_id, str text=Body(..., embed=True, max_length=4000)) | |
| api_summary (str run_id) | |
| api_components (str run_id) | |
| api_index (str run_id) | |
| api_config (str run_id) | |
| api_series (str run_id, str components=Query(...), float|None start=None, float|None end=None, int max_points=4000, str time_source="sensor") | |
| api_download (str run_id, str|None components=None, float|None start=None, float|None end=None, str time_source="sensor") | |
| api_run_video (str run_id) | |
| api_video_file (str recording, str stream) | |
| lifespan (FastAPI app) | |
| str | _sentence (str text) |
| str | _one_problem (dict err) |
| str | validation_sentence (list errors) |
| JSONResponse | _validation_as_sentence (Request request, RequestValidationError exc) |
| JSONResponse | _unhandled_as_sentence (Request request, Exception exc) |
| root () | |
| health () | |
Variables | |
| app = FastAPI(title="Elodin Past-Run Viewer") | |
| allow_origins | |
| allow_methods | |
| allow_headers | |
| str | VIDEO_CACHE_CONTROL = "private, max-age=86400" |
| str | _dist = Path(__file__).resolve().parent.parent / "frontend" / "dist" |
| name | |
| project_root = Path(__file__).resolve().parents[1] | |
| dict | _optional_routers = {} |
| router_module = __import__(f'backend.routers.{router_name}', fromlist=[router_name]) | |
| allow_credentials | |
FastAPI app: browse past Elodin runs, list sensors, plot, and export CSV. Run (dev): uvicorn backend.main:app --reload --port 8000 Prod-ish: build the frontend to frontend/dist and this process serves it too.
FastAPI application for Pintle Engine Design.
Run with:
cd /home/adnan/EngineDesign
uvicorn backend.main:app --reload --port 8000
|
protected |
Definition at line 80 of file main.py.
Referenced by validation_sentence().
|
protected |
Definition at line 30 of file main.py.
Referenced by api_download(), and api_series().
|
protected |
|
protected |
Which clock the x-axis is. Defaults to the sensor clock; see series.py.
Definition at line 36 of file main.py.
Referenced by api_download(), and api_series().
|
protected |
|
protected |
Definition at line 99 of file main.py.
References validation_sentence().
| backend.main.api_components | ( | str | run_id | ) |
| backend.main.api_config | ( | str | run_id | ) |
| backend.main.api_download | ( | str | run_id, |
| str | None | components = None, | ||
| float | None | start = None, | ||
| float | None | end = None, | ||
| str | time_source = "sensor" ) |
CSV export. - With `components` (a plot selection): a **wide** CSV — one column per channel aligned on a shared time grid. Bounded by the selection, ideal for analysis of a few channels. - Without `components` (whole run): a **long/tidy** CSV (`time,component, value`) over every primary channel. Streams at constant memory; a wide whole-run frame would blow up to millions of rows × hundreds of columns.
Definition at line 157 of file main.py.
References _parse_components(), and _time_source().
| backend.main.api_index | ( | str | run_id | ) |
Export the run to parquet and build its index — the expensive step, run only when asked for. Synchronous: tens of seconds on a multi-GB run, and the caller shows a busy state for the duration. Concurrent callers share one export (export_cache holds a per-run lock), so a double click costs nothing extra.
| backend.main.api_run_video | ( | str | run_id | ) |
The video clips that overlap this run, on the epoch-seconds axis the plot uses. Matched against the run's whole extent on either clock, so switching the plot to DB write time never hides a clip. Needs the index (that is where the extent lives); an un-indexed run has no plot to put video on anyway. `available` is false when no recordings folder is mounted: the page then shows no video panel at all.
| backend.main.api_series | ( | str | run_id, |
| str | components = Query(...), | ||
| float | None | start = None, | ||
| float | None | end = None, | ||
| int | max_points = 4000, | ||
| str | time_source = "sensor" ) |
Definition at line 133 of file main.py.
References _parse_components(), _time_source(), max, and min.
| backend.main.api_set_description | ( | str | run_id, |
| str | text = Body(..., embed=True, max_length=4000) ) |
| backend.main.api_summary | ( | str | run_id | ) |
| backend.main.api_video_file | ( | str | recording, |
| str | stream ) |
| backend.main.health | ( | ) |
| backend.main.lifespan | ( | FastAPI | app | ) |
| str backend.main.validation_sentence | ( | list | errors | ) |
FastAPI's request-validation list ([{loc, msg, type}, ...]) as the one plain sentence every
error response carries (``{"detail": "<sentence>"}``). Every problem, each named by its field,
joined with '; ' -- as feed-twin's backend/errors.validation_sentence does. A sentence that
names only the first leaves the person fixing one field per round trip.
Definition at line 87 of file main.py.
References _one_problem(), and _sentence().
Referenced by _validation_as_sentence().
|
protected |
| backend.main.project_root = Path(__file__).resolve().parents[1] |
| backend.main.router_module = __import__(f'backend.routers.{router_name}', fromlist=[router_name]) |