API Reference
Complete API documentation auto-generated from code.
Routers
Main Router
Main API router aggregating all sub-routers.
This module serves as the entry point for all API endpoints, combining routers for history, test management, sensor operations, and graphique data visualization.
History Router
archive_history(name)
async
Archive a test history (move to archived storage).
Source code in src/routers/history.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
delete_history(name)
async
Permanently delete a test history.
Source code in src/routers/history.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
download_history(name)
async
Download a test history as a ZIP file containing metadata, raw log, and CSV.
Source code in src/routers/history.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
get_description(name)
async
Get the description.md content for a test history. Returns the markdown content as plain text.
Source code in src/routers/history.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
get_history_metadata(name)
async
Get metadata for a specific test history.
Source code in src/routers/history.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
get_treatment(name)
async
Get the treatment.json content for a test history. Returns the JSON content as a dictionary.
Source code in src/routers/history.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
get_treatment_image(name)
async
Get the treatment image for a test history. Returns the image as a PNG stream.
Source code in src/routers/history.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
list_histories()
async
List all available test histories (sorted by date, newest first).
Source code in src/routers/history.py
13 14 15 16 17 18 19 20 | |
update_description(name, payload)
async
Update the description.md content for a test history.
Request body:
```json
{
"content": "# My Test Description
This is a markdown file." } ```
Source code in src/routers/history.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
update_history_metadata(name, metadata)
async
Update metadata for a test history.
Source code in src/routers/history.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
Test Router
add_file_to_current_test(file, filename)
async
Add a file to the current test.
The file is saved in the current test directory and will be part of the test record. Available after POST /info has been called.
Request body:
{
"file": "<base64-encoded file content>",
"filename": "example.txt"
}
Source code in src/routers/test.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
delete_file_from_current_test(filename)
async
Delete a file from the current test.
Removes the specified file from the test directory and the tracked file list. Available after POST /info has been called.
Source code in src/routers/test.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
finalize_test()
async
Finalize a stopped test and move it to history.
Changes state from STOPPED to NOTHING. Test data is now part of the historical record and cannot be modified.
Requires that the test has been stopped via PUT /stop first.
Source code in src/routers/test.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
get_current_test_description()
async
Get the description of the current test (PREPARED or RUNNING state).
Available after POST /info has been called. Returns the markdown content of description.md
Source code in src/routers/test.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
get_current_test_info()
async
Return the metadata of the current prepared/test in memory.
Returns 409 if no test metadata was prepared via POST /info.
Source code in src/routers/test.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
get_file_from_current_test(filename)
async
Retrieve a file from the current test.
Returns the content of the specified file that was added to the current test. Available after POST /info has been called.
Response body:
{
"file": "<base64-encoded file content>"
}
Source code in src/routers/test.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
get_test_state()
async
Get the current state of the test system.
Returns one of four possible states: - NOTHING: No test is running, no test is stopped, AND no test metadata has been prepared. Ready to start fresh. - PREPARED: No test is currently running AND no test stopped, BUT test metadata has been set. Ready to call PUT /start to begin the test. - RUNNING: A test is currently executing and recording data. Data is being collected; call PUT /stop to end recording. - STOPPED: A test has stopped recording BUT not yet finalized. Review the data, then call PUT /finalize to move to history.
Source code in src/routers/test.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
list_current_test_files()
async
List the files that have been added to the current test.
Returns a list of filenames that have been uploaded via POST /files for the current test. Available after POST /info has been called.
Source code in src/routers/test.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
set_test_info(metadata)
async
Set test metadata to prepare for a test run.
This endpoint stores the test information without starting data collection. After calling this, the test will be in PREPARED state. Then call PUT /start to begin the actual test.
Source code in src/routers/test.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
start_test()
async
Start the prepared test and begin recording data.
Requires that metadata has been set via POST /info first. Changes state from PREPARED to RUNNING.
Source code in src/routers/test.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
stop_test()
async
Stop the currently running test and end data recording.
Changes state from RUNNING to STOPPED. Test data is preserved in memory and on disk but not yet moved to history. Call PUT /finalize to move the test to history.
Source code in src/routers/test.py
94 95 96 97 98 99 100 101 102 103 104 | |
update_current_test_description(payload)
async
Update the description of the current test (PREPARED or RUNNING state).
Available after POST /info has been called.
Modifies the description.md file in real-time.
Request body:
```json
{
"content": "# Updated Description
New markdown content..." } ```
Source code in src/routers/test.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
Sensor Router
get_sensor_data(sensor_id)
async
Get the latest data point from a sensor (calibrated/processed value). Time is relative to test start if a test is running, otherwise 0.
Source code in src/routers/sensor.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
get_sensor_data_history(sensor_id, window=30)
async
Get historical data points from a sensor (calibrated/processed values). Window is expressed in seconds and must be one of: 30, 60, 120, 300, 600. Returns a fixed number of points (based on 30s sampling) evenly spaced across the window.
Source code in src/routers/sensor.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
get_sensor_raw_data(sensor_id)
async
Get the latest raw (uncalibrated) data point from a sensor. Time is relative to test start if a test is running, otherwise 0.
Source code in src/routers/sensor.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
get_sensor_zero_offset(sensor_id)
async
Get the current zero offset applied to raw readings for a sensor. The offset represents how much raw values are shifted to compute calibrated values.
Source code in src/routers/sensor.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
get_sensors_all()
async
Get the latest data points from all sensors, including raw values, calibrated values, and zero offsets.
Source code in src/routers/sensor.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
zero_sensor(sensor_id)
async
Zero a sensor by recording its current value. Future readings from this sensor will be adjusted by subtracting this value.
Source code in src/routers/sensor.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
Graphique Router
get_graphique(sensor_id=Path(..., description='Sensor name: DISP_1 or ARC'))
async
Get the current test graphique as PNG image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor_id
|
str
|
Either 'DISP_1' or 'ARC' for X-axis sensor |
Path(..., description='Sensor name: DISP_1 or ARC')
|
Y-axis: FORCE Points are added in real-time as data is processed.
Source code in src/routers/graphique.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
get_graphique_base64(sensor_id=Path(..., description='Sensor name: DISP_1 or ARC'))
async
Get the current test graphique as base64-encoded PNG.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor_id
|
str
|
Either 'DISP_1' or 'ARC' for X-axis sensor |
Path(..., description='Sensor name: DISP_1 or ARC')
|
Useful for embedding in frontend applications. Returns: {"data": "data:image/png;base64,..."}
Source code in src/routers/graphique.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
Response Schemas
API Response Schemas.
This module defines Pydantic models for all API responses, including health checks, data points, test status, and historical data structures.
HealthOK
Bases: BaseModel
Basic health check response.
Attributes:
| Name | Type | Description |
|---|---|---|
status |
str
|
Health status as string (e.g., 'ok', 'healthy'). |
Source code in src/schemas.py
14 15 16 17 18 19 20 | |
AppHealthOK
Bases: BaseModel
Application-level health check response.
Attributes:
| Name | Type | Description |
|---|---|---|
status |
str
|
Health status as string. |
app |
str
|
Application name or version. |
Source code in src/schemas.py
23 24 25 26 27 28 29 30 31 | |
Point
Bases: BaseModel
Single data point with timestamp.
Attributes:
| Name | Type | Description |
|---|---|---|
time |
float
|
Timestamp in seconds. |
value |
float
|
Numeric value of the measurement. |
Source code in src/schemas.py
34 35 36 37 38 39 40 41 42 | |
OffsetResponse
Bases: BaseModel
Sensor offset calibration response.
Attributes:
| Name | Type | Description |
|---|---|---|
offset |
float
|
Offset value for sensor calibration. |
Source code in src/schemas.py
44 45 46 47 48 49 50 | |
DictPoint
Bases: BaseModel
Complete sensor data with raw, processed, and offset values.
Attributes:
| Name | Type | Description |
|---|---|---|
raw |
dict[str, Point]
|
Dictionary of raw sensor measurements by sensor ID. |
data |
dict[str, Point]
|
Dictionary of processed sensor measurements by sensor ID. |
zeros |
dict[str, OffsetResponse]
|
Dictionary of sensor offset calibrations by sensor ID. |
Source code in src/schemas.py
52 53 54 55 56 57 58 59 60 61 62 | |
PointsList
Bases: BaseModel
List of data points.
Attributes:
| Name | Type | Description |
|---|---|---|
list |
List[Point]
|
Collection of Point objects. |
Source code in src/schemas.py
64 65 66 67 68 69 70 | |
HistoryList
Bases: BaseModel
List of historical data identifiers.
Attributes:
| Name | Type | Description |
|---|---|---|
list |
List[str]
|
Collection of history file or record identifiers. |
Source code in src/schemas.py
73 74 75 76 77 78 79 | |
EmptyResponse
Bases: BaseModel
Empty response model for endpoints with no return data.
Source code in src/schemas.py
82 83 84 | |
FieldsResponse
Bases: BaseModel
Response containing field metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
fields |
Union[List[Any], TestMetaData]
|
Either a list of field definitions or TestMetaData object. |
Source code in src/schemas.py
87 88 89 90 91 92 93 | |
MessageResponse
Bases: BaseModel
Generic message response.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
str
|
Response message text. |
Source code in src/schemas.py
96 97 98 99 100 101 102 | |
TestStatusResponse
Bases: BaseModel
Test execution status response.
Attributes:
| Name | Type | Description |
|---|---|---|
status |
TestState
|
Current state of the test (e.g., running, completed, failed). |
Source code in src/schemas.py
105 106 107 108 109 110 111 | |