Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
453 commits
Select commit Hold shift + click to select a range
5574b6f
fix import failures
maxhild Jan 23, 2026
93c67a6
start filewatcher command
maxhild Jan 23, 2026
c4d7ec1
Added secretspec documentation
maxhild Jan 23, 2026
8031e91
Fix for overview
maxhild Jan 23, 2026
11bdb8b
added streaming change
maxhild Jan 23, 2026
6811cfd
added streaming change
maxhild Jan 23, 2026
ec1b997
NGINX PROTECTED
maxhild Jan 23, 2026
2b7ce08
NGINX PROTECTED
maxhild Jan 23, 2026
9747c24
NGINX PROTECTED
maxhild Jan 23, 2026
0f4e868
NGINX PROTECTED
maxhild Jan 23, 2026
3056579
prefetch related on segments
maxhild Jan 25, 2026
f6bd169
prefetch related on segments -compiled
maxhild Jan 25, 2026
86eb436
lost video id recovered
maxhild Jan 25, 2026
004de40
Information source broke segment creation
maxhild Jan 25, 2026
9569505
State management tweak - Segments seperate from Anonymization
maxhild Jan 25, 2026
2c9d905
Annotation functional
maxhild Jan 25, 2026
a79a4e0
Annotation needed video id
maxhild Jan 25, 2026
3109fa4
Endoreg db export ready for job devenv shell export-frames
maxhild Jan 26, 2026
33ea2ab
overworked mutability
maxhild Jan 26, 2026
6e87cec
loading more often
maxhild Jan 26, 2026
a311e53
Annotation needed video id
maxhild Jan 27, 2026
725f6bc
Annotation change visibility
maxhild Jan 27, 2026
865d926
Cleanup of unused stores
maxhild Jan 27, 2026
5a8778d
Added shortcuts
maxhild Jan 27, 2026
535d415
export functionality now supports different sources and ICA
maxhild Jan 27, 2026
c7af634
export functionality now supports different sources and ICA
maxhild Jan 27, 2026
eeeb4db
preselecting labels in annotation on o
maxhild Jan 27, 2026
234fd57
export frame annotations
maxhild Jan 27, 2026
a5d5e98
preselecting labels in annotation on o
maxhild Jan 27, 2026
81a157b
env variable wired for output dir
maxhild Jan 27, 2026
507fbd5
alive export button
maxhild Jan 27, 2026
e52bb1f
feedback
maxhild Jan 27, 2026
6f9c42b
feedback
maxhild Jan 27, 2026
0eb42ea
fixed array manipulation by snake case conversion
maxhild Jan 27, 2026
85a9a98
ensure segment annotation
maxhild Jan 27, 2026
05c1c50
ensure video output
maxhild Jan 28, 2026
b147924
ensure video copy works
maxhild Jan 28, 2026
6ef157d
All segments preselected
maxhild Jan 28, 2026
5a75c37
Devenv activating always
maxhild Feb 4, 2026
636eb20
Devenv updates always
maxhild Feb 4, 2026
62378d1
Devenv no gpu check
maxhild Feb 4, 2026
e61000f
Devenv repo root
maxhild Feb 4, 2026
a9de0b3
Devenv repo root
maxhild Feb 4, 2026
7a5e79f
Devenv repo root
maxhild Feb 4, 2026
7faa23f
Devenv repo root
maxhild Feb 4, 2026
854034c
Hardened filewatcher start
maxhild Feb 4, 2026
29b9e8d
Hardened filewatcher start
maxhild Feb 4, 2026
2e7eba5
Hardened filewatcher start
maxhild Feb 4, 2026
eed6b52
Hardened filewatcher start
maxhild Feb 4, 2026
1562478
Hardened filewatcher start
maxhild Feb 4, 2026
9db7ba1
Using venv activation right in command to run server
maxhild Feb 4, 2026
e348fcd
Switching back to one line call
maxhild Feb 4, 2026
6d41913
New reporting mask, devenv optimizations
maxhild Feb 5, 2026
82ce0f8
Documentation update and Cleanup of old references
maxhild Feb 10, 2026
91bf9de
changed logo and sidebar behaivior
maxhild Feb 10, 2026
7cb74c9
sidebar
maxhild Feb 10, 2026
385981e
Logo display
maxhild Feb 10, 2026
01d2a58
Change of outside segments button
maxhild Feb 11, 2026
039c076
API ready for test
maxhild Feb 13, 2026
9f1907f
Revert "Change of outside segments button"
maxhild Feb 13, 2026
9f213f6
Default to false
maxhild Feb 13, 2026
1ffaeac
Revert "API ready for test"
maxhild Feb 13, 2026
65ef4fb
Reapply "Change of outside segments button"
maxhild Feb 13, 2026
b71f413
Reapply "API ready for test"
maxhild Feb 13, 2026
3ba07a8
Report API, better feedback
maxhild Feb 13, 2026
71edc13
Report API, better feedback
maxhild Feb 17, 2026
fb34f67
Removed faulty venv activation and direnv disallow
maxhild Feb 17, 2026
5f8b317
accept head devenv.nix
maxhild Feb 17, 2026
0ae69ff
New reporting infrastructure
maxhild Feb 26, 2026
d842ae5
tests and further reporting pages
maxhild Feb 27, 2026
4f31ad4
Document types required during anonymization for pdf, report text dis…
maxhild Mar 2, 2026
dac7328
Document types required during anonymization for pdf, report text dis…
maxhild Mar 2, 2026
c69a9ba
Merge pull request #74 from wg-lux/erc
maxhild Mar 2, 2026
b9fef7a
Less overhead on most serializer calls regarding segments
maxhild Mar 2, 2026
d0885a2
CSS quirks
maxhild Mar 2, 2026
c47001b
Documentation in Frontend
maxhild Mar 3, 2026
701fb42
Makefile corrections
maxhild Mar 3, 2026
45df60b
unique constraint sagety
maxhild Mar 3, 2026
8b2576f
label studio webhoolk
maxhild Mar 3, 2026
f86d84d
makfile fix
maxhild Mar 3, 2026
e990d4c
editorconfig
maxhild Mar 4, 2026
808693b
editorconfig
maxhild Mar 4, 2026
b090d9f
editorconfig
maxhild Mar 4, 2026
e161085
Make targets
maxhild Mar 4, 2026
69236bd
Make targets only build when changed
maxhild Mar 4, 2026
49111da
Run server in foreground
maxhild Mar 4, 2026
f2ef309
Label Studio CDN hosted
maxhild Mar 4, 2026
64dbd30
make cache in gitignot
maxhild Mar 4, 2026
4913a33
Requirement evaluation
maxhild Mar 5, 2026
ffc830f
New devenv, type safety across the tree
maxhild Mar 6, 2026
1201ed6
Update Vite build artifacts in static/dist
maxhild Mar 6, 2026
dd34339
Static folder cleanup
maxhild Mar 6, 2026
04a982d
FPS and label studio integration
maxhild Mar 9, 2026
d926496
Report streaming
maxhild Mar 9, 2026
b9ffa76
Added data and api
maxhild Mar 9, 2026
f9d5d8d
Report streaming
maxhild Mar 9, 2026
aecfef3
Examination, Intervention routes
maxhild Mar 10, 2026
75b3b5f
Examination, Intervention routes
maxhild Mar 10, 2026
62c5f87
important collectstatic fix
maxhild Mar 10, 2026
582399c
use one devenv in makefile
maxhild Mar 10, 2026
d021001
management.nix
maxhild Mar 10, 2026
d772774
management.nix
maxhild Mar 10, 2026
733832d
g
maxhild Mar 10, 2026
16c65e5
Vite rebuild
maxhild Mar 10, 2026
bdc06f7
management.nix
maxhild Mar 10, 2026
fc445c5
revised data models
maxhild Mar 10, 2026
92ce41c
Change vite path
maxhild Mar 10, 2026
1a6ecb2
Change vite path
maxhild Mar 10, 2026
a27f902
audit fix
maxhild Mar 10, 2026
ecad8cd
static base to match nginx
maxhild Mar 10, 2026
18b2b17
hardened keycloak loading
maxhild Mar 10, 2026
3ece958
hardened keycloak loading
maxhild Mar 10, 2026
09297cf
js update
maxhild Mar 10, 2026
4355e3e
anonymization workflow id
maxhild Mar 10, 2026
0a530d7
redaction pdf
maxhild Mar 11, 2026
6435c8c
dtypes non failing
maxhild Mar 11, 2026
b28b1a1
dtypes non failing
maxhild Mar 11, 2026
4052329
Bugfixes and tests
maxhild Mar 12, 2026
abdd66c
Merge file support branch, merge report masks into one
maxhild Mar 16, 2026
17b94d9
Merge file support branch, adjust endoreg-db
maxhild Mar 16, 2026
592d973
Validation of deployment and security settings
maxhild Mar 16, 2026
629007a
target active devenv venv on sync
maxhild Mar 17, 2026
3aaae00
Nix deployed Anonymizer
maxhild Mar 23, 2026
fdd17e6
Migration overrides and django integration with dtypes
maxhild Mar 25, 2026
eca3519
test setup for hub works
maxhild Mar 26, 2026
3ea350a
Added update to endoreg db and filewatcher
maxhild Mar 27, 2026
78c3c9b
overrides
maxhild Mar 27, 2026
f6009a5
overrides removed
maxhild Mar 27, 2026
5c1b2f0
Revert "overrides removed"
maxhild Mar 27, 2026
f3584df
overrides reapplied, made compatible with upstream squash
maxhild Mar 27, 2026
0e7b798
overrides reapplied, made compatible with upstream squash
maxhild Mar 27, 2026
6cbb3fe
Convert lx-terminology-editor from submodule to regular directory
maxhild Mar 27, 2026
7f9c4de
explicit remove ninja and add django ninja
maxhild Mar 27, 2026
22270d7
Dont set working dir to data dir
maxhild Mar 27, 2026
0d4a31d
Added pydantic-settings
maxhild Mar 27, 2026
e83a21d
New static file permissions
maxhild Mar 27, 2026
5255b9c
added german translation and lx data model api route
maxhild Mar 27, 2026
03c3482
0.0.1 - dead code removed
maxhild Mar 30, 2026
a6d0795
Application settings, encrypted streaming
maxhild Mar 30, 2026
fda21e8
encrypted directory setup
maxhild Apr 1, 2026
c92d14b
encrypted directory setup
maxhild Apr 1, 2026
03a7aeb
encrypted directory setup
maxhild Apr 1, 2026
626e4c0
encrypted directory setup
maxhild Apr 1, 2026
b9c54ea
encrypted directory setup
maxhild Apr 2, 2026
7a6de30
remove devenv env setup
maxhild Apr 2, 2026
abb8112
merge conflicting migrations
maxhild Apr 2, 2026
5b868dd
merge conflicting migrations
maxhild Apr 2, 2026
6323196
migrations fixed and xorg support
maxhild Apr 7, 2026
90e1532
repair plaintext copies
maxhild Apr 7, 2026
483439c
Activating encryption
maxhild Apr 7, 2026
7347f1a
Actual preservation of storage settings and env reading
maxhild Apr 8, 2026
b90f205
documenting watcher
maxhild Apr 8, 2026
d09d751
Center Key usage, hub export is ready for usage
maxhild Apr 9, 2026
c276cdd
0.1.1 - Simplification of Hub setup and Frame annotation
maxhild Apr 10, 2026
3d98dcd
0.9.4.5 - critical migration bug resolved idempotently in script
maxhild Apr 10, 2026
99574c6
0.1.2 - UX niceties, stream hopefully back
maxhild Apr 10, 2026
efee238
storage pressure addressing
maxhild Apr 13, 2026
3c32875
Atomic file operations
maxhild Apr 14, 2026
20a8390
filewatcher repeat safety
maxhild Apr 16, 2026
9098cdc
Further centralizing paths and file operations to shared helpers
maxhild Apr 21, 2026
baf339b
Frontend loaded pdf url for video
maxhild Apr 22, 2026
ddfb27b
V 0.2.8 Filewatcher issues with new cryptsetup hopefully resolved
maxhild Apr 22, 2026
4da4d40
V 0.3.1 longer timeout for videos and guard on video annotation so vi…
maxhild Apr 23, 2026
27aac05
V 0.3.2 - safe ffmpeg timeout, wiring through from the
maxhild Apr 23, 2026
4667e56
V 0.3.6 - Working state
maxhild Apr 28, 2026
443c26a
checks
Maddonix Apr 29, 2026
7da3d2c
checks updated
Maddonix Apr 29, 2026
ea46358
lx-annotate full application
maxhild Apr 29, 2026
fadee6a
Merge remote-tracking branch 'refs/remotes/origin/main'
maxhild Apr 29, 2026
6d51e59
lx-annotate full application
maxhild Apr 29, 2026
0d58387
encrypted streaming is now lazy and file field based
maxhild Apr 29, 2026
3a6b118
Add bounded filewatcher drain mode
maxhild Apr 30, 2026
08a4e61
0.4.0 - Various optimizations of frontend and filewatcher to make it …
maxhild Apr 30, 2026
0eacee9
Skip streamable artifacts during payload repair
maxhild Apr 30, 2026
ecfcc5f
Update generated documentation artifacts
maxhild Apr 30, 2026
aba8210
Pipeline and Frame Annotation debug
maxhild May 5, 2026
aa84228
Media integrity check to allow backfill
maxhild May 6, 2026
219d5a7
built docs assets
maxhild May 6, 2026
4b01526
Add annotation and validation workflow updates
maxhild May 7, 2026
5b6d9b6
Run pre-commit hooks through devenv
maxhild May 7, 2026
ebd2ef6
feat(ai): add dataset manifest settings page
maxhild May 8, 2026
1309362
feat(settings): export ai datasets by id
maxhild May 8, 2026
62e31a7
feat(training): add phi detector controls
maxhild May 8, 2026
a7c8455
chore(frontend): refresh generated store declarations
maxhild May 8, 2026
09396da
New explicit state models utilized in hub export
maxhild May 11, 2026
af19321
Filewatcher made threadsafe by importing signals first
maxhild May 11, 2026
a4a9f18
Add hub export k-anonymity summary
maxhild May 13, 2026
087f273
Show hub export k-anonymity metric
maxhild May 13, 2026
c7c6547
fix(hub-export): harden worker execution and privacy reporting
maxhild May 13, 2026
737fe4c
feat(ai-datasets): add dataset creation flow
maxhild May 13, 2026
5ca75cd
test(system): cover worker-thread imports
maxhild May 13, 2026
c4fe89f
fix(reporting): accept camelCase draft payloads
maxhild May 13, 2026
bcf736c
fix(annotation): normalize queue and segment payload state
maxhild May 13, 2026
8d02bfd
fix(anonymization): surface cleanup state and phi review links
maxhild May 13, 2026
c4c6348
feat(reporting): refresh the report editor workspace
maxhild May 13, 2026
a23dc54
docs: rebuild generated site artifacts
maxhild May 13, 2026
dbdbd49
Task safety in endoreg_db
maxhild May 13, 2026
b3ac831
Task safety in endoreg_db
maxhild May 13, 2026
4e30160
fix(stats): apply progress bar min height as style
maxhild May 18, 2026
e833986
chore(deps): bump endoreg-db to 0.9.9.6
maxhild May 18, 2026
ed3c8e1
feat(api): expose runtime quarantine overview
maxhild May 18, 2026
ab08d1d
feat(anonymization): show quarantined media in overview
maxhild May 18, 2026
8ecdbf0
feat(annotation): preserve dataset context for frame tasks
maxhild May 18, 2026
223bdfb
feat(video): track segment dataset and cleanup status
maxhild May 18, 2026
67605d9
feat(ai-datasets): attach annotations and scope training
maxhild May 18, 2026
5e5f6f2
feat(reporting): add report export page
maxhild May 18, 2026
c28e07e
docs(video): document segment job monitoring
maxhild May 18, 2026
200df58
chore(frontend): refresh generated declarations
maxhild May 18, 2026
a33a4fb
fix(reporting): type timeline href safely
maxhild May 18, 2026
dddb160
chore(frontend): refresh generated artifacts
maxhild May 18, 2026
bef3542
CUDA optimizations, new LX-Annotate with better jobs and monitoring b…
maxhild May 18, 2026
8592ded
chore(deploy): move deployment examples
maxhild May 18, 2026
abb2013
feat(api): add explicit endoreg and dtypes mounts
maxhild May 18, 2026
550a97c
docs(api): document frontend API contract
maxhild May 18, 2026
49f3426
style(app): improve sidebar toggle controls
maxhild May 18, 2026
68ac3ca
feat(stats): summarize annotation progress
maxhild May 18, 2026
0a410de
copy(anonymization): clarify import status labels
maxhild May 18, 2026
c6445e8
docs(frontend): clarify watcher import guide
maxhild May 18, 2026
e46bc2e
chore(deps): bump endoreg-db
maxhild May 18, 2026
bc349a0
copy(quarantine): localize quarantine reason
maxhild May 18, 2026
0d97ec8
chore(config): tidy secretspec sections
maxhild May 18, 2026
09c5bab
style(tests): apply ruff formatting
maxhild May 18, 2026
a0486fb
style(tests): format base api mount test
maxhild May 18, 2026
a36e31f
test(api): update frontend mount contract
maxhild May 18, 2026
59bc59b
test(frontend): update api helper and import label expectations
maxhild May 18, 2026
ed735b0
chore(frontend): refresh generated artifacts
maxhild May 18, 2026
864853a
Docs
maxhild May 18, 2026
1b22a63
Endoreg media operations now run using different workers
maxhild May 19, 2026
e04142d
feat(frontend): add anonymization metrics page
maxhild May 19, 2026
ad40fcd
feat(frontend): expose metrics in sidebar workflow
maxhild May 19, 2026
d28692c
feat(frontend): capture no-more-names confirmation
maxhild May 19, 2026
e17d106
style(frontend): tidy anonymization overview spacing
maxhild May 19, 2026
c78ecd8
chore(release): bump package metadata to 0.6.0
maxhild May 19, 2026
720cae7
migrations for endoreg db
maxhild May 20, 2026
748051d
nix package for lx-annotate
maxhild May 20, 2026
7feec46
migration made more compatible, stale test removed
maxhild May 29, 2026
061ce78
migration 13 made more compatible, stale test removed
maxhild May 29, 2026
3fee564
endoreg_db is strict pyright clean and uses dtypes contracts
maxhild Jun 12, 2026
f04e913
test extension, new migration of linked classifications to videos
maxhild Jun 30, 2026
809f8bf
test extension, new migration of linked classifications to videos
maxhild Jun 30, 2026
557d8ac
test extension, new migration of linked classifications to videos
maxhild Jun 30, 2026
46d525f
Stream with nginx back in env vars
maxhild Jun 30, 2026
25f4b4d
Version 0.9.20 - Large file operations ported to rust
maxhild Jul 1, 2026
59729e3
Version 0.9.20 - Large file operations ported to rust
maxhild Jul 1, 2026
b398555
raise default fps
Maddonix Jul 2, 2026
781824e
Raised the streamable migration limit
Maddonix Jul 2, 2026
6c35665
Merge remote-tracking branch 'refs/remotes/origin/main'
maxhild Jul 2, 2026
4f3c213
hls streaming
maxhild Jul 8, 2026
e4fb5ad
paper metrics
maxhild Jul 8, 2026
d414f19
Makefile added makemigrations to make package workflow
maxhild Jul 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Makefile]
indent_style = tab
17 changes: 2 additions & 15 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
if [ -n "${ENV_PATH:-}" ] && [ -f "${ENV_PATH}" ]; then
log_status "Sourcing environment from ENV_PATH: ${ENV_PATH}"
source_env "${ENV_PATH}"
else
# Default behavior: try parent, then current, if ENV_PATH is not set
if [ -f "../.env" ]; then
log_status "Sourcing environment from parent: ../.env"
source_env ../.env
fi
if [ -f ".env" ]; then # .env in the current directory (endoreg-db/.env)
log_status "Sourcing environment from current: ./.env"
source_env .env # This will override/add to what was sourced from ../.env
fi
fi

source_url "https://raw.githubusercontent.com/cachix/devenv/v1.6.1/devenv/direnvrc" "sha256-LzXLAtBt0TZW0vgIZnHwOuKzQ74cwVMVYLpfi5FmVT8="
# Original devenv direnvrc sourcing
eval "$(devenv direnvrc)"
use devenv
18 changes: 18 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
coverage:
status:
project:
default:
informational: true
target: 90%
threshold: 10%
patch:
default:
informational: true

comment:
layout: "diff, flags, files"
behavior: default
require_changes: true # if true: only post the comment if coverage changes
require_base: false # [true :: must have a base report to post]
require_head: true # [true :: must have a head report to post]
hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage]
210 changes: 210 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# Copilot Instructions for LX-Annotate

## Project Overview

LX-Annotate is a Vue 3 + Django medical video annotation platform with AI-powered analysis. It's a proxy API frontend that delegates backend operations to the `endoreg-db` submodule, designed for clinical endoscopy annotation and AI training data generation.

## Key Architecture Patterns

### 1. Modular Workspace Structure
- **Root Django App**: `lx_annotate/` - Proxy API and static file serving
- **Backend Logic**: `libs/endoreg-db/` - Core models, views, and business logic (git submodule)
- **Anonymization**: `libs/lx-anonymizer/` - Video anonymization and AI processing (git submodule)
- **Frontend**: `frontend/` - Vue 3 SPA with TypeScript and Vuetify

### 2. API Proxy Architecture
Django acts as a **proxy API** - all `/api/*` requests are routed to `endoreg-db`:
```python
# lx_annotate/urls.py
path("api/", include(("endoreg_db.urls", "endoreg_db"), namespace="endoreg_db"))
```
**Critical**: Implement new API endpoints in `libs/endoreg-db/endoreg_db/views/`, not in the root Django app.

### 3. Environment Management with Nix/DevEnv
Development environment is managed through `devenv.nix` with automatic dependency resolution:
- Use `direnv allow` for initial setup
- Use `uv sync` for Python dependencies (handled automatically)
- Frontend builds automatically to Django's `static/` folder

## Essential Development Workflows

### DevEnv Setup and Management
The project uses **Nix/DevEnv** for reproducible development environments with unified management commands:

#### Initial Setup
```bash
# One-time setup (handles everything automatically)
direnv allow # Root environment
cd frontend && direnv allow # Frontend has separate devenv.nix

# Automatic processes on shell enter:
# - Git submodule initialization
# - UV sync for Python dependencies
# - Virtual environment activation
# - Environment variable loading from .env
```

#### Unified Management Commands
```bash
# Environment management
manage setup # Complete environment setup
manage dev # Switch to development mode
manage prod # Switch to production mode
manage status # Show current configuration

# Container operations (Docker/Podman)
manage docker-dev-build # Build dev image
manage docker-dev-run # Run dev container
manage docker-prod-build # Build production image
manage docker-prod-run # Run production container
manage docker-logs [tier] # Tail logs (dev|prod)
manage docker-stop # Stop containers
manage docker-clean # Remove images and containers

# Deployment pipeline
manage deploy # Run migrations, load base data, collect static
```

#### Database Initialization (Required for First Run)
```bash
python manage.py migrate
python manage.py load_base_db_data
python manage.py create_multilabel_model_meta --model_path "./libs/endoreg-db/tests/assets/colo_segmentation_RegNetX800MF_6.ckpt"
```

#### Running Services
```bash
# Development mode
devenv up django # Start Django process
# OR unified approach:
manage dev && devenv up

# Production mode
manage prod && devenv up
```

### Testing
- Use `pytest` with Django settings: `DJANGO_SETTINGS_MODULE = lx_annotate.settings_dev`
- Test files in `tests/` and `libs/endoreg-db/tests/`
- Video/AI tests marked with `@pytest.mark.video` and `@pytest.mark.ai`

### File Import Workflow
Files are imported by placing them in:
- `data/raw_videos/` - for video processing
- `data/raw_pdfs/` - for PDF OCR and metadata extraction

## Project-Specific Conventions

### 1. API Endpoint Patterns
Modern endpoints follow **media framework** patterns:
```
POST /api/media/videos/{pk}/reimport/ # NOT /api/video/{id}/
GET /api/media/videos/{pk}/sensitive-metadata/
POST /api/media/pdfs/{pk}/reimport/
```

### 2. Async Task Architecture
Long-running operations use **Celery** for background processing:
```python
# Pattern: Return task_id immediately, poll for status
task = apply_mask_task.delay(video_id, config)
return Response({'task_id': task.id, 'status': 'pending'})

# Frontend polls: GET /api/task-status/{task_id}/
```

### 3. Vue 3 + Composition API Patterns
Components use `<script setup>` syntax with Pinia stores:
```typescript
// Store pattern
const anonymizationStore = useAnonymizationStore()
await anonymizationStore.reimportVideo(videoId)

// Composables in src/composables/
const { generatePseudonym } = usePseudonym()
```

### 4. Settings Management
- **Development**: `lx_annotate.settings_dev` (default via `manage.py`)
- **Production**: `lx_annotate.settings_prod`
- Environment detection via `DJANGO_ENV` variable
- Configuration centralized in `app_config.nix`

## Critical Integration Points

### 1. Frontend ↔ Django
- Vue app compiles to `lx_annotate/static/`
- Django serves SPA via catch-all route: `re_path(r"^(?!api/|admin/|media/).*$", ...)`
- API calls go to `/api/*` (proxied to endoreg-db)

### 2. Django ↔ endoreg-db
- All business logic lives in `libs/endoreg-db/`
- Models: `endoreg_db.models.*`
- Views: `endoreg_db.views.*` (media, patient, video, etc.)
- URL routing in `endoreg_db.urls.*`

### 3. AI/Video Processing
- Video anonymization via `lx-anonymizer`
- CUDA support configured in `devenv.nix`
- Frame-by-frame processing with progress tracking
- Metadata extraction and sensitive data detection

## Common Gotchas

1. **Don't add views to root Django app** - use `libs/endoreg-db/endoreg_db/views/`
2. **Frontend changes require rebuild** - `npm run build` or restart devenv
3. **Database changes need migration** - in `libs/endoreg-db/`, not root
4. **Environment isolation** - frontend and backend have separate `devenv.nix` files
5. **Submodule updates** - changes in `libs/` directories affect git submodules

## Deployment and Infrastructure

### Kubernetes Setup
Production deployment uses Kubernetes with the following components:

#### Core Manifests (`k8s/`)
- **`deployment.tmpl.yaml`** - Main application deployment with health checks
- **`service.yaml`** - ClusterIP service exposing port 80 → 8117
- **`ingress.tmpl.yaml`** - Nginx ingress with Let's Encrypt TLS
- **`namespace.yaml`** - Dedicated `lx-annotate` namespace
- **`pvc.yaml`** - Persistent volume claims for data storage

#### Deployment Configuration
```yaml
# Key settings in deployment.tmpl.yaml
ports:
- containerPort: 8117 # Django app port
env:
- DJANGO_SETTINGS_MODULE: lx_annotate.settings.settings_prod # Production settings
readinessProbe:
path: / # Health check endpoint
securityContext:
fsGroup: 10001 # File system permissions
```

#### Ingress and TLS
- **Ingress Class**: nginx
- **TLS**: Automated via cert-manager/Let's Encrypt
- **Host**: Template variable `${HOST}` for environment-specific domains

#### Container Strategy
- **Development**: `container/Dockerfile.dev` with development extras
- **Production**: `container/Dockerfile.prod` (optimized, no dev deps)
- **Base**: Python 3.12-slim with UV package manager
- **Dependencies**: Copied from `libs/` workspace for UV sources

### Environment Management
- **Settings**: Environment-aware via `DJANGO_ENV` variable
- **Configuration**: Centralized in `app_config.nix`
- **Secrets**: Kubernetes secrets and configmaps
- **Storage**: Persistent volumes for video/PDF data

## Key Files for Understanding
- `lx_annotate/urls.py` - API proxy routing
- `frontend/src/router/index.ts` - SPA routing
- `devenv/management.nix` - Unified development commands
- `libs/endoreg-db/endoreg_db/views/media/` - Modern API endpoints
- `frontend/src/stores/anonymizationStore.ts` - Core application state
- `k8s/deployment.tmpl.yaml` - Production Kubernetes deployment
- `devenv.nix` - Development environment configuration
- `app_config.nix` - Centralized application configuration
29 changes: 29 additions & 0 deletions .github/workflows/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
stages:
- build
- deploy

build_package:
stage: build
image: python:3.11-slim
script:
- pip install build
- python -m build
artifacts:
paths:
- dist/

deploy_to_test_pypi:
stage: deploy
image: python:3.11-slim
environment:
name: test-release
dependencies:
- build_package
id_tokens:
TESTPYPI_ID_TOKEN:
aud: testpypi
script:
- pip install twine
- python -m twine upload -r testpypi dist/* --verbose
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/' # Triggers only on semantic version tags (e.g., v0.1.0)
Loading
Loading