API Reference¶
This page documents the frontend-facing API contract used by lx-annotate.
The canonical frontend endpoint map is
frontend/src/types/api/endpoints.ts.
When adding, renaming, or removing frontend API calls, update that file first
and keep this document in sync.
Frontend Request Contract¶
lx-annotate exposes two API surfaces with different ownership. New code
should use the explicit mount names; the old names stay available as
compatibility aliases.
Canonical mount |
Compatibility alias |
Backing package |
Frontend usage |
|---|---|---|---|
|
|
|
Main application API used by |
|
|
|
Typed lookup, requirement, and report-template contracts sourced from |
Do not document dtypes-api/ routes as if they were endoreg_db routes. The
endpoints.ts contract below describes the main /endoreg-api/ surface. The
dtypes-api/ surface should be documented from lx_dtypes contracts,
especially LookupState and LookupStateDataDict, and called with
dtypesApi().
The frontend should not hard-code mount prefixes into each endpoint. It imports
endpoints and passes endpoint values through endoregApi() or the legacy
r() helper from
frontend/src/api/axiosInstance.ts:
import axiosInstance, { endoregApi } from '@/api/axiosInstance'
import { endpoints } from '@/types/api/endpoints'
const { data } = await axiosInstance.get(endoregApi(endpoints.anonymization.itemsOverview))
Important conventions:
Endpoint paths in
endpoints.tsare relative toendoregApi()or legacyr().endoregApi()prefixesVITE_ENDOREG_API_PREFIX, falling back toVITE_API_PREFIX, then/endoreg-api/.dtypesApi()prefixesVITE_DTYPES_API_PREFIX, defaulting to/dtypes-api/.dtypes-api/routes are not represented by theendpoints.tsmap unless a caller explicitly adds a separate typed contract for thelx_dtypesAPI.Keep trailing slashes exactly as defined in Django URLs.
Outgoing JSON payload keys are converted from
camelCasetosnake_case.Incoming JSON response keys are converted from
snake_casetocamelCase.FormDatapayloads are passed through without key conversion and without a manually setContent-Type.The CSRF token is read from the
csrftokencookie and sent asX-CSRFToken.Use
silentRequestConfig()for polling or optional status calls that should not show toast errors.
Use backend-native snake_case when documenting request and response payloads.
Frontend components will see camel-cased response fields after the Axios
interceptor runs.
Type Aliases¶
endpoints.ts defines two shared path parameter aliases:
Type |
Shape |
Use |
|---|---|---|
|
|
Numeric database IDs and string IDs accepted by route helpers. |
|
|
Upload job IDs and other UUID route parameters. |
Authentication¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
Bootstrap authentication and runtime context. |
|
|
|
Read current authentication context. |
|
|
|
Public backend home or health-style entrypoint. |
|
|
|
Start login flow when using backend login routes. |
|
|
|
Login callback route. |
|
|
|
Read frontend/runtime auth configuration. |
The active frontend auth flow may use Keycloak directly. A 401 response from
Axios triggers auth.login() through the Keycloak auth store.
Router And Core Domain Lists¶
These endpoints expose broad list/detail routes used by older router-level views and by shared stores.
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
List examinations. |
|
|
|
Read one examination. |
|
|
|
List findings. |
|
|
|
List classifications. |
|
|
|
List patient finding rows. |
|
|
|
List reports. |
Patients¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
List or create patients. |
|
|
|
Read, update, or delete a patient. |
|
|
|
Read pseudonym information for a patient. |
|
|
|
Check whether patient deletion is allowed. |
|
|
|
List centers. |
|
|
|
List gender values. |
|
|
|
List or create patient findings. |
|
|
|
Read, update, or delete a patient finding. |
|
|
|
Check whether a patient examination already exists. |
Examinations¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
List findings for an examination template. |
|
|
|
List classifications for a finding. |
|
|
|
List choices for a classification. |
|
|
|
Create a patient examination. |
|
|
|
Read or update a patient examination. |
|
|
|
Read or update examination draft data. |
|
|
|
List patient examinations. |
|
|
|
List or update classifications for a patient examination. |
|
|
|
List or update findings for a patient examination. |
Reports¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
List or create patient examination reports. |
|
|
|
Read, update, or delete a report. |
|
|
|
List reports for one patient examination. |
|
|
|
Persist report editor submission state. |
|
|
|
Generate a report artifact. |
|
|
|
Base segment/frame selector endpoint. |
|
|
|
Load segment/frame selector context. |
|
|
|
Load prior report context for assisted reporting. |
Frame Annotation¶
Frame annotation endpoints must preserve annotator scoping when a user restarts or overrides an annotation track. Submit the active annotator in task loading, skip, and write payloads when the UI is operating under an explicit annotator.
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
Fetch the next frame annotation task. |
|
|
|
Create or update frame annotations in bulk. |
|
|
|
Read or write frame box annotations. |
|
|
|
Skip an annotation task. |
Uploads¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
Upload media through the API upload flow. Use |
|
|
|
Poll an upload job by UUID. |
The upload flow persists source artifacts in protected storage. Failed uploads may be copied to quarantine by backend ingest handling; current quarantine support is read-only from the frontend.
Stats¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
Examination statistics. |
|
|
|
Video segment statistics. |
|
|
|
Alias for video segment statistics. |
|
|
|
Sensitive metadata list/stat source. |
|
|
|
General application statistics. |
Hub Export¶
Only anonymized processed media may be sent outbound. Raw media export is not permitted. Hub transfer behavior must stay within the active roadmap phase: mTLS for Phase 1 transport/authentication, envelope encryption for standalone artifacts in Phase 2, and KMS-backed key management in Phase 3.
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
List exportable and blocked media. |
|
|
|
Mark media for hub export. |
|
|
|
Remove media from the export queue. |
Runtime¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
Read a metadata-only overview of files in quarantine. |
The quarantine overview intentionally omits absolute filesystem paths. It is used to render read-only failed rows in the anonymization overview. At the time of writing there is no frontend release, restore, or requeue endpoint for quarantine files.
Anonymization Workflow¶
Do not conflate anonymization validation with segment annotation validation.
anonymizationStatus describes the anonymization pipeline. Segment annotation
completion is tracked separately on video-list data as
segmentAnnotationsValidated.
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
List media items and anonymization workflow state. |
|
|
|
List document type choices for validation. |
|
|
|
Load current validation metadata for a file. |
|
|
|
Start anonymization for a file. |
|
|
|
Poll anonymization status. |
|
|
|
Validate anonymization output. |
|
|
|
Read polling coordinator status. |
|
|
|
Clear stuck processing locks. Intended as an operational escape hatch. |
|
|
|
Check whether a raw source exists for the file. |
Common anonymization statuses:
Status |
Meaning |
|---|---|
|
Anonymization has not been started. |
|
Anonymization is running. |
|
Video frame extraction is running. |
|
Video segment prediction is running. |
|
Processed media exists and needs anonymization validation. |
|
Anonymization was accepted and processed media may be used downstream. |
|
Processing failed. |
Media Management¶
These endpoints are operational controls for stuck, failed, or unwanted media records. They operate on database media records, not synthetic quarantine rows.
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
Read media processing and cleanup status summary. |
|
|
|
Run cleanup by type, usually with |
|
|
|
Remove a media record and related upload job. |
|
|
|
Reset stuck processing state for a media record. |
Media: Videos¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
List videos. |
|
|
|
Read video details. |
|
|
|
Stream a video file. |
|
|
|
Re-import an existing video from its stored raw source. |
|
|
|
Export annotated video data. |
|
|
|
Load or submit video correction state. |
|
|
|
Read video metadata. |
|
|
|
Read FPS metadata. |
|
|
|
Apply a correction mask. |
|
|
|
Remove frames from processed output. |
|
|
|
List video labels. |
|
|
|
List video label sets. |
|
|
|
List available prediction models. |
Video re-import requires the raw source to still exist in managed storage. It does not release a file from quarantine.
Media: Video Segments¶
Prediction segments shown in the KI view are loaded through
source_kind=prediction and must correspond to LabelVideoSegment rows marked
with prediction metadata or source prediction.
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
Global segment collection route. |
|
|
|
Segment statistics. |
|
|
|
List or create segments for a video. |
|
|
|
Bulk mutate segments for a video. |
|
|
|
Read, update, or delete one segment. |
|
|
|
Import prediction segments. |
|
|
|
Replace existing prediction rows and rerun segment prediction. |
|
|
|
Validate one segment. |
|
|
|
Validate segments in bulk. Include |
|
|
|
Read segment validation state for a video. |
|
|
|
Dispatch outside-segment blackening after segment validation. |
|
|
|
Ensure frame-level annotations exist for a video. |
|
|
|
Ensure frame-level annotations for multiple videos. |
Operational queue notes:
videoSegmentsRerunPredictionsdispatchesendoreg_db.video_temporal_inferenceand should be monitored on theinferencequeue.videoSegmentsBlackenOutsidedispatchesendoreg_db.video_post_validation_rebuildand should be monitored on theframe_extractionqueue.
Media: Sensitive Metadata And Case Resolution¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
Read or update video sensitive metadata. |
|
|
|
Verify video sensitive metadata. |
|
|
|
Resolve or create video case linkage. |
|
|
|
Read or update PDF sensitive metadata. |
|
|
|
Verify PDF sensitive metadata. |
|
|
|
Resolve or create PDF case linkage. |
|
|
|
List sensitive metadata. |
|
|
|
List PDF sensitive metadata. |
Persisted JSON workflow and provenance payloads must be validated at the model boundary. Do not add loosely typed metadata mutations in frontend-only code.
Media: PDFs¶
Frontend key |
Path |
Typical method |
Purpose |
|---|---|---|---|
|
|
|
List PDFs. |
|
|
|
Read PDF details. |
|
|
|
Stream a PDF. |
|
|
|
Re-import an existing PDF from its stored raw source. |
Updating This Contract¶
When changing API routes:
Update
frontend/src/types/api/endpoints.ts.Update the relevant frontend API module or store.
Keep request payload keys documented in backend
snake_case.Add or update tests for the route behavior and the frontend caller.
Update this page with the frontend key, path, method, and purpose.
Avoid ad hoc URL strings in components. Prefer endpoint helpers so route changes stay searchable and type-checked.
Python Module Reference¶
This section documents the public Python modules exposed by lx-annotate.